From ecf10702553df171f5f51ef2cb8875f28655799a Mon Sep 17 00:00:00 2001 From: bdon Date: Thu, 22 Aug 2024 16:18:45 +0000 Subject: [PATCH] deploy: 6c9867bb099ba49a281b39e52aba2e0c32e35a22 --- .nojekyll | 0 assets/index-DPyuBmJF.css | 1 + assets/index-DpUF8vPi.js | 581 ++++++++++++++++++++++++++++++++++++++ index.html | 14 + 4 files changed, 596 insertions(+) create mode 100644 .nojekyll create mode 100644 assets/index-DPyuBmJF.css create mode 100644 assets/index-DpUF8vPi.js create mode 100644 index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/assets/index-DPyuBmJF.css b/assets/index-DPyuBmJF.css new file mode 100644 index 0000000..7cb9880 --- /dev/null +++ b/assets/index-DPyuBmJF.css @@ -0,0 +1 @@ +:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}#root{margin:0 auto;width:100%}.container{display:flex}.controls{width:25%;padding:1rem}#map{height:100vh;width:75%}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' 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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%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.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%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}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%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 (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%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")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/assets/index-DpUF8vPi.js b/assets/index-DpUF8vPi.js new file mode 100644 index 0000000..2e2ee38 --- /dev/null +++ b/assets/index-DpUF8vPi.js @@ -0,0 +1,581 @@ +(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))n(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&n(m)}).observe(document,{childList:!0,subtree:!0});function a(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function n(c){if(c.ep)return;c.ep=!0;const f=a(c);fetch(c.href,f)}})();const Dv=(x,s)=>x===s,Vm={equals:Dv};let jg=Gg;const qs=1,su=2,Ug={owned:null,cleanups:null,context:null,owner:null};var cr=null;let Wd=null,Lv=null,yi=null,Ji=null,ls=null,bu=0;function Bv(x,s){const a=yi,n=cr,c=x.length===0,f=s===void 0?n:s,m=c?Ug:{owned:null,cleanups:null,context:f?f.context:null,owner:f},h=c?x:()=>x(()=>wu(()=>Cu(m)));cr=m,yi=null;try{return Rh(h,!0)}finally{yi=a,cr=n}}function Nm(x,s){s=s?Object.assign({},Vm,s):Vm;const a={value:x,observers:null,observerSlots:null,comparator:s.equals||void 0},n=c=>(typeof c=="function"&&(c=c(a.value)),$g(a,c));return[Rv.bind(a),n]}function Ph(x,s,a){const n=Zg(x,s,!1,qs);Iu(n)}function qg(x,s,a){jg=Nv;const n=Zg(x,s,!1,qs);n.user=!0,ls?ls.push(n):Iu(n)}function wu(x){if(yi===null)return x();const s=yi;yi=null;try{return x()}finally{yi=s}}function Fv(x){qg(()=>wu(x))}function Rv(){if(this.sources&&this.state)if(this.state===qs)Iu(this);else{const x=Ji;Ji=null,Rh(()=>au(this),!1),Ji=x}if(yi){const x=this.observers?this.observers.length:0;yi.sources?(yi.sources.push(this),yi.sourceSlots.push(x)):(yi.sources=[this],yi.sourceSlots=[x]),this.observers?(this.observers.push(yi),this.observerSlots.push(yi.sources.length-1)):(this.observers=[yi],this.observerSlots=[yi.sources.length-1])}return this.value}function $g(x,s,a){let n=x.value;return(!x.comparator||!x.comparator(n,s))&&(x.value=s,x.observers&&x.observers.length&&Rh(()=>{for(let c=0;c1e6)throw Ji=[],new Error},!1)),s}function Iu(x){if(!x.fn)return;Cu(x);const s=bu;Ov(x,x.value,s)}function Ov(x,s,a){let n;const c=cr,f=yi;yi=cr=x;try{n=x.fn(s)}catch(m){return x.pure&&(x.state=qs,x.owned&&x.owned.forEach(Cu),x.owned=null),x.updatedAt=a+1,Wg(m)}finally{yi=f,cr=c}(!x.updatedAt||x.updatedAt<=a)&&(x.updatedAt!=null&&"observers"in x?$g(x,n):x.value=n,x.updatedAt=a)}function Zg(x,s,a,n=qs,c){const f={fn:x,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:s,owner:cr,context:cr?cr.context:null,pure:a};return cr===null||cr!==Ug&&(cr.owned?cr.owned.push(f):cr.owned=[f]),f}function ou(x){if(x.state===0)return;if(x.state===su)return au(x);if(x.suspense&&wu(x.suspense.inFallback))return x.suspense.effects.push(x);const s=[x];for(;(x=x.owner)&&(!x.updatedAt||x.updatedAt=0;a--)if(x=s[a],x.state===qs)Iu(x);else if(x.state===su){const n=Ji;Ji=null,Rh(()=>au(x,s[0]),!1),Ji=n}}function Rh(x,s){if(Ji)return x();let a=!1;s||(Ji=[]),ls?a=!0:ls=[],bu++;try{const n=x();return Vv(a),n}catch(n){a||(ls=null),Ji=null,Wg(n)}}function Vv(x){if(Ji&&(Gg(Ji),Ji=null),x)return;const s=ls;ls=null,s.length&&Rh(()=>jg(s),!1)}function Gg(x){for(let s=0;s=0;s--)Cu(x.owned[s]);x.owned=null}if(x.cleanups){for(s=x.cleanups.length-1;s>=0;s--)x.cleanups[s]();x.cleanups=null}x.state=0}function jv(x){return x instanceof Error?x:new Error(typeof x=="string"?x:"Unknown error",{cause:x})}function Wg(x,s=cr){throw jv(x)}let Uv=!1;function qv(x,s){return wu(()=>x(s||{}))}function $v(x,s,a){let n=a.length,c=s.length,f=n,m=0,h=0,M=s[c-1].nextSibling,L=null;for(;mV-h){const vt=s[m];for(;h{c=f,s===document?x():Wv(s,x(),s.firstChild?null:void 0,a)},n.owner),()=>{c(),s.textContent=""}}function Gv(x,s,a){let n;const c=()=>{const m=document.createElement("template");return m.innerHTML=x,m.content.firstChild},f=()=>(n||(n=c())).cloneNode(!0);return f.cloneNode=f,f}function Xv(x,s=window.document){const a=s[jm]||(s[jm]=new Set);for(let n=0,c=x.length;nlu(x,s(),c,a),n)}function Hv(x){const s=`$$${x.type}`;let a=x.composedPath&&x.composedPath()[0]||x.target;for(x.target!==a&&Object.defineProperty(x,"target",{configurable:!0,value:a}),Object.defineProperty(x,"currentTarget",{configurable:!0,get(){return a||document}});a;){const n=a[s];if(n&&!a.disabled){const c=a[`${s}Data`];if(c!==void 0?n.call(a,c,x):n.call(a,x),x.cancelBubble)return}a=a._$host||a.parentNode||a.host}}function lu(x,s,a,n,c){for(;typeof a=="function";)a=a();if(s===a)return a;const f=typeof s,m=n!==void 0;if(x=m&&a[0]&&a[0].parentNode||x,f==="string"||f==="number"){if(f==="number"&&(s=s.toString(),s===a))return a;if(m){let h=a[0];h&&h.nodeType===3?h.data!==s&&(h.data=s):h=document.createTextNode(s),a=Va(x,a,n,h)}else a!==""&&typeof a=="string"?a=x.firstChild.data=s:a=x.textContent=s}else if(s==null||f==="boolean")a=Va(x,a,n);else{if(f==="function")return Ph(()=>{let h=s();for(;typeof h=="function";)h=h();a=lu(x,h,a,n)}),()=>a;if(Array.isArray(s)){const h=[],M=a&&Array.isArray(a);if(cp(h,s,a,c))return Ph(()=>a=lu(x,h,a,n,!0)),()=>a;if(h.length===0){if(a=Va(x,a,n),m)return a}else M?a.length===0?Um(x,h,n):$v(x,a,h):(a&&Va(x),Um(x,h));a=h}else if(s.nodeType){if(Array.isArray(a)){if(m)return a=Va(x,a,n,s);Va(x,a,null,s)}else a==null||a===""||!x.firstChild?x.appendChild(s):x.replaceChild(s,x.firstChild);a=s}}return a}function cp(x,s,a,n){let c=!1;for(let f=0,m=s.length;f=0;m--){const h=s[m];if(c!==h){const M=h.parentNode===x;!f&&!m?M?x.replaceChild(c,h):x.insertBefore(c,a):M&&h.remove()}else f=!0}}else x.insertBefore(c,a);return[c]}var Kv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jv(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var Hg={exports:{}};/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.6.0/LICENSE.txt + */(function(x,s){(function(a,n){x.exports=n()})(Kv,function(){var a={},n={};function c(m,h,M){if(n[m]=M,m==="index"){var L="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",V={};return n.shared(V),n.index(a,V),typeof window<"u"&&a.setWorkerUrl(window.URL.createObjectURL(new Blob([L],{type:"text/javascript"}))),a}}c("shared",["exports"],function(m){function h(i,e,r,l){return new(r||(r=Promise))(function(p,g){function v(P){try{I(l.next(P))}catch(T){g(T)}}function b(P){try{I(l.throw(P))}catch(T){g(T)}}function I(P){var T;P.done?p(P.value):(T=P.value,T instanceof r?T:new r(function(A){A(T)})).then(v,b)}I((l=l.apply(i,e||[])).next())})}function M(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var L=V;function V(i,e){this.x=i,this.y=e}V.prototype={clone:function(){return new V(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),l=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=l,this},_rotateAround:function(i,e){var r=Math.cos(i),l=Math.sin(i),p=e.y+l*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-l*(this.y-e.y),this.y=p,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},V.convert=function(i){return i instanceof V?i:Array.isArray(i)?new V(i[0],i[1]):i};var B=M(L),U=ut;function ut(i,e,r,l){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(l-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=l}ut.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,l=0;l<8;l++){var p=this.sampleCurveX(r)-i;if(Math.abs(p)p?v=r:b=r,r=.5*(b-v)+v;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var vt=M(U);let Tt,Vt;function jt(){return Tt==null&&(Tt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Tt}function se(){if(Vt==null&&(Vt=!1,jt())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let l=0;l<5*5;l++){const p=4*l;e.fillStyle=`rgb(${p},${p+1},${p+2})`,e.fillRect(l%5,Math.floor(l/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let l=0;l<5*5*4;l++)if(l%4!=3&&r[l]!==l){Vt=!0;break}}}return Vt||!1}function Yt(i,e,r,l){const p=new vt(i,e,r,l);return g=>p.solve(g)}const oe=Yt(.25,.1,.25,1);function ce(i,e,r){return Math.min(r,Math.max(e,i))}function xe(i,e,r){const l=r-e,p=((i-e)%l+l)%l+e;return p===e?r:p}function ye(i,...e){for(const r of e)for(const l in r)i[l]=r[l];return i}let Qe=1;function ii(i,e,r){const l={};for(const p in i)l[p]=e.call(this,i[p],p,i);return l}function pi(i,e,r){const l={};for(const p in i)e.call(this,i[p],p,i)&&(l[p]=i[p]);return l}function le(i){return Array.isArray(i)?i.map(le):typeof i=="object"&&i?ii(i,le):i}const vi={};function qe(i){vi[i]||(typeof console<"u"&&console.warn(i),vi[i]=!0)}function ri(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function xi(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let rn=null;function ji(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const gn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Nn(i,e,r,l,p){return h(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const g=new VideoFrame(i,{timestamp:0});try{const v=g==null?void 0:g.format;if(!v||!v.startsWith("BGR")&&!v.startsWith("RGB"))throw new Error(`Unrecognized format ${v}`);const b=v.startsWith("BGR"),I=new Uint8ClampedArray(l*p*4);if(yield g.copyTo(I,function(P,T,A,D,O){const j=4*Math.max(-T,0),q=(Math.max(0,A)-A)*D*4+j,H=4*D,tt=Math.max(0,T),ct=Math.max(0,A);return{rect:{x:tt,y:ct,width:Math.min(P.width,T+D)-tt,height:Math.min(P.height,A+O)-ct},layout:[{offset:q,stride:H}]}}(i,e,r,l,p)),b)for(let P=0;Pxi(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,jn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const l=Ur(i.url);if(l)return l(i,e);if(xi(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:ds},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(wr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(l,p){return h(this,void 0,void 0,function*(){const g=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,cache:l.cache,referrer:wr(),signal:p.signal});l.type!=="json"||g.headers.has("Accept")||g.headers.set("Accept","application/json");const v=yield fetch(g);if(!v.ok){const P=yield v.blob();throw new Yi(v.status,v.statusText,l.url,P)}let b;b=l.type==="arrayBuffer"||l.type==="image"?v.arrayBuffer():l.type==="json"?v.json():v.text();const I=yield b;if(p.signal.aborted)throw us();return{data:I,cacheControl:v.headers.get("Cache-Control"),expires:v.headers.get("Expires")}})}(i,e);if(xi(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:ds},e)}var r;return function(l,p){return new Promise((g,v)=>{var b;const I=new XMLHttpRequest;I.open(l.method||"GET",l.url,!0),l.type!=="arrayBuffer"&&l.type!=="image"||(I.responseType="arraybuffer");for(const P in l.headers)I.setRequestHeader(P,l.headers[P]);l.type==="json"&&(I.responseType="text",!((b=l.headers)===null||b===void 0)&&b.Accept||I.setRequestHeader("Accept","application/json")),I.withCredentials=l.credentials==="include",I.onerror=()=>{v(new Error(I.statusText))},I.onload=()=>{if(!p.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let P=I.response;if(l.type==="json")try{P=JSON.parse(I.response)}catch(T){return void v(T)}g({data:P,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const P=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});v(new Yi(I.status,I.statusText,l.url,P))}},p.signal.addEventListener("abort",()=>{I.abort(),v(us())}),I.send(l.body)})}(i,e)};function Un(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Zs(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function sn(i,e,r){if(r&&r[i]){const l=r[i].indexOf(e);l!==-1&&r[i].splice(l,1)}}class _n{constructor(e,r={}){ye(this,r),this.type=e}}class vn extends _n{constructor(e,r={}){super("error",ye({error:e},r))}}class ps{on(e,r){return this._listeners=this._listeners||{},Zs(e,r,this._listeners),this}off(e,r){return sn(e,r,this._listeners),sn(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Zs(e,r,this._oneTimeListeners),this):new Promise(l=>this.once(e,l))}fire(e,r){typeof e=="string"&&(e=new _n(e,r||{}));const l=e.type;if(this.listens(l)){e.target=this;const p=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(const b of p)b.call(this,e);const g=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(const b of g)sn(l,b,this._oneTimeListeners),b.call(this,e);const v=this._eventedParent;v&&(ye(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),v.fire(e))}else e instanceof vn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var ft={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const qn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Gs(i,e){const r={};for(const l in i)l!=="ref"&&(r[l]=i[l]);return qn.forEach(l=>{l in e&&(r[l]=e[l])}),r}function be(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const $=[bn,At,he,Kt,qi,an,Ir,R(ee),wn,Gr,Y];function K(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!K(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of $)if(!K(r,e))return null}}return`Expected ${F(i)} but found ${F(e)} instead.`}function nt(i,e){return e.some(r=>r.kind===i.kind)}function st(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function lt(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const et=.96422,yt=.82521,bt=4/29,pt=6/29,Mt=3*pt*pt,Xt=pt*pt*pt,Wt=Math.PI/180,re=180/Math.PI;function _e(i){return(i%=360)<0&&(i+=360),i}function ie([i,e,r,l]){let p,g;const v=We((.2225045*(i=ke(i))+.7168786*(e=ke(e))+.0606169*(r=ke(r)))/1);i===e&&e===r?p=g=v:(p=We((.4360747*i+.3850649*e+.1430804*r)/et),g=We((.0139322*i+.0971045*e+.7141733*r)/yt));const b=116*v-16;return[b<0?0:b,500*(p-v),200*(v-g),l]}function ke(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function We(i){return i>Xt?Math.pow(i,1/3):i/Mt+bt}function ai([i,e,r,l]){let p=(i+16)/116,g=isNaN(e)?p:p+e/500,v=isNaN(r)?p:p-r/200;return p=1*Ie(p),g=et*Ie(g),v=yt*Ie(v),[ue(3.1338561*g-1.6168667*p-.4906146*v),ue(-.9787684*g+1.9161415*p+.033454*v),ue(.0719453*g-.2289914*p+1.4052427*v),l]}function ue(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ie(i){return i>pt?i*i*i:Mt*(i-bt)}function $e(i){return parseInt(i.padEnd(2,i),16)/255}function ui(i,e){return Ii(e?i/100:i,0,1)}function Ii(i,e,r){return Math.min(Math.max(e,i),r)}function Ci(i){return!i.some(Number.isNaN)}const Ks={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Ce{constructor(e,r,l,p=1,g=!0){this.r=e,this.g=r,this.b=l,this.a=p,g||(this.r*=p,this.g*=p,this.b*=p,p||this.overwriteGetter("rgb",[e,r,l,p]))}static parse(e){if(e instanceof Ce)return e;if(typeof e!="string")return;const r=function(l){if((l=l.toLowerCase().trim())==="transparent")return[0,0,0,0];const p=Ks[l];if(p){const[v,b,I]=p;return[v/255,b/255,I/255,1]}if(l.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(l)){const v=l.length<6?1:2;let b=1;return[$e(l.slice(b,b+=v)),$e(l.slice(b,b+=v)),$e(l.slice(b,b+=v)),$e(l.slice(b,b+v)||"ff")]}if(l.startsWith("rgb")){const v=l.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[b,I,P,T,A,D,O,j,q,H,tt,ct]=v,rt=[T||" ",O||" ",H].join("");if(rt===" "||rt===" /"||rt===",,"||rt===",,,"){const at=[P,D,q].join(""),mt=at==="%%%"?100:at===""?255:0;if(mt){const wt=[Ii(+I/mt,0,1),Ii(+A/mt,0,1),Ii(+j/mt,0,1),tt?ui(+tt,ct):1];if(Ci(wt))return wt}}return}}const g=l.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(g){const[v,b,I,P,T,A,D,O,j]=g,q=[I||" ",T||" ",D].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const H=[+b,Ii(+P,0,100),Ii(+A,0,100),O?ui(+O,j):1];if(Ci(H))return function([tt,ct,rt,at]){function mt(wt){const Lt=(wt+tt/30)%12,Ht=ct*Math.min(rt,1-rt);return rt-Ht*Math.max(-1,Math.min(Lt-3,9-Lt,1))}return tt=_e(tt),ct/=100,rt/=100,[mt(0),mt(8),mt(4),at]}(H)}}}(e);return r?new Ce(...r,!1):void 0}get rgb(){const{r:e,g:r,b:l,a:p}=this,g=p||1/0;return this.overwriteGetter("rgb",[e/g,r/g,l/g,p])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,l,p,g]=ie(e),v=Math.sqrt(l*l+p*p);return[Math.round(1e4*v)?_e(Math.atan2(p,l)*re):NaN,v,r,g]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ie(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,l,p]=this.rgb;return`rgba(${[e,r,l].map(g=>Math.round(255*g)).join(",")},${p})`}}Ce.black=new Ce(0,0,0,1),Ce.white=new Ce(1,1,1,1),Ce.transparent=new Ce(0,0,0,0),Ce.red=new Ce(1,0,0,1);class hl{constructor(e,r,l){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=l,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class cl{constructor(e,r,l,p,g){this.text=e,this.image=r,this.scale=l,this.fontStack=p,this.textColor=g}}class Qi{constructor(e){this.sections=e}static fromString(e){return new Qi([new cl(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Qi?e:Qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class tr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tr)return e;if(typeof e=="number")return new tr([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new tr(e)}}toString(){return JSON.stringify(this.values)}}const Bu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class er{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof er)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[i,e,r,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[i,e,r,l]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Js(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Ce||i instanceof hl||i instanceof Qi||i instanceof tr||i instanceof er||i instanceof Si)return!0;if(Array.isArray(i)){for(const e of i)if(!Js(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Js(i[e]))return!1;return!0}return!1}function li(i){if(i===null)return bn;if(typeof i=="string")return he;if(typeof i=="boolean")return Kt;if(typeof i=="number")return At;if(i instanceof Ce)return qi;if(i instanceof hl)return Zr;if(i instanceof Qi)return an;if(i instanceof tr)return wn;if(i instanceof er)return Y;if(i instanceof Si)return Gr;if(Array.isArray(i)){const e=i.length;let r;for(const l of i){const p=li(l);if(r){if(r===p)continue;r=ee;break}r=p}return R(r||ee,e)}return Ir}function ln(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Ce||i instanceof Qi||i instanceof tr||i instanceof er||i instanceof Si?i.toString():JSON.stringify(i)}class $n{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Js(e[1]))return r.error("invalid value");const l=e[1];let p=li(l);const g=r.expectedType;return p.kind!=="array"||p.N!==0||!g||g.kind!=="array"||typeof g.N=="number"&&g.N!==0||(p=g),new $n(p,l)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ni{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Xo={string:he,number:At,boolean:Kt,object:Ir};class pr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let l,p=1;const g=e[0];if(g==="array"){let b,I;if(e.length>2){const P=e[1];if(typeof P!="string"||!(P in Xo)||P==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);b=Xo[P],p++}else b=ee;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);I=e[2],p++}l=R(b,I)}else{if(!Xo[g])throw new Error(`Types doesn't contain name = ${g}`);l=Xo[g]}const v=[];for(;pe.outputDefined())}}const Ys={"to-boolean":Kt,"to-color":qi,"to-number":At,"to-string":he};class In{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const l=e[0];if(!Ys[l])throw new Error(`Can't parse ${l} as it is not part of the known types`);if((l==="to-boolean"||l==="to-string")&&e.length!==2)return r.error("Expected one argument.");const p=Ys[l],g=[];for(let v=1;v4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Go(r[0],r[1],r[2],r[3]),!l))return new Ce(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ni(l||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const l of this.args){r=l.evaluate(e);const p=tr.parse(r);if(p)return p}throw new ni(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const l of this.args){r=l.evaluate(e);const p=er.parse(r);if(p)return p}throw new ni(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const l of this.args){if(r=l.evaluate(e),r===null)return 0;const p=Number(r);if(!isNaN(p))return p}throw new ni(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Qi.fromString(ln(this.args[0].evaluate(e)));case"resolvedImage":return Si.fromString(ln(this.args[0].evaluate(e)));default:return ln(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ul=["Unknown","Point","LineString","Polygon"];class Qs{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ul[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=Ce.parse(e)),r}}class Cn{constructor(e,r,l=[],p,g=new $r,v=[]){this.registry=e,this.path=l,this.key=l.map(b=>`[${b}]`).join(""),this.scope=g,this.errors=v,this.expectedType=p,this._isConstant=r}parse(e,r,l,p,g={}){return r?this.concat(r,l,p)._parse(e,g):this._parse(e,g)}_parse(e,r){function l(p,g,v){return v==="assert"?new pr(g,[p]):v==="coerce"?new In(g,[p]):p}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const p=e[0];if(typeof p!="string")return this.error(`Expression name must be a string, but found ${typeof p} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const g=this.registry[p];if(g){let v=g.parse(e,this);if(!v)return null;if(this.expectedType){const b=this.expectedType,I=v.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||I.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string")if(b.kind!=="padding"||I.kind!=="value"&&I.kind!=="number"&&I.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||I.kind!=="value"&&I.kind!=="array"){if(this.checkSubtype(b,I))return null}else v=l(v,b,r.typeAnnotation||"coerce");else v=l(v,b,r.typeAnnotation||"coerce");else v=l(v,b,r.typeAnnotation||"coerce");else v=l(v,b,r.typeAnnotation||"assert")}if(!(v instanceof $n)&&v.type.kind!=="resolvedImage"&&this._isConstant(v)){const b=new Qs;try{v=new $n(v.type,v.evaluate(b))}catch(I){return this.error(I.message),null}}return v}return this.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,l){const p=typeof e=="number"?this.path.concat(e):this.path,g=l?this.scope.concat(l):this.scope;return new Cn(this.registry,this._isConstant,p,r||null,g,this.errors)}error(e,...r){const l=`${this.key}${r.map(p=>`[${p}]`).join("")}`;this.errors.push(new Fi(l,e))}checkSubtype(e,r){const l=K(e,r);return l&&this.error(l),l}}class we{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const l=[];for(let g=1;g=l.length)throw new ni(`Array index out of bounds: ${r} > ${l.length-1}.`);if(r!==Math.floor(r))throw new ni(`Array index must be an integer, but found ${r} instead.`);return l[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class to{constructor(e,r){this.type=Kt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const l=r.parse(e[1],1,ee),p=r.parse(e[2],2,ee);return l&&p?nt(l.type,[Kt,he,At,bn,ee])?new to(l,p):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(l.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),l=this.haystack.evaluate(e);if(!l)return!1;if(!st(r,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${F(li(r))} instead.`);if(!st(l,["string","array"]))throw new ni(`Expected second argument to be of type array or string, but found ${F(li(l))} instead.`);return l.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ho{constructor(e,r,l){this.type=At,this.needle=e,this.haystack=r,this.fromIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const l=r.parse(e[1],1,ee),p=r.parse(e[2],2,ee);if(!l||!p)return null;if(!nt(l.type,[Kt,he,At,bn,ee]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(l.type)} instead`);if(e.length===4){const g=r.parse(e[3],3,At);return g?new Ho(l,p,g):null}return new Ho(l,p)}evaluate(e){const r=this.needle.evaluate(e),l=this.haystack.evaluate(e);if(!st(r,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${F(li(r))} instead.`);let p;if(this.fromIndex&&(p=this.fromIndex.evaluate(e)),st(l,["string"])){const g=l.indexOf(r,p);return g===-1?-1:[...l.slice(0,g)].length}if(st(l,["array"]))return l.indexOf(r,p);throw new ni(`Expected second argument to be of type array or string, but found ${F(li(l))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ko{constructor(e,r,l,p,g,v){this.inputType=e,this.type=r,this.input=l,this.cases=p,this.outputs=g,this.otherwise=v}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let l,p;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);const g={},v=[];for(let P=2;PNumber.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof j=="number"&&Math.floor(j)!==j)return D.error("Numeric branch labels must be integer values.");if(l){if(D.checkSubtype(l,li(j)))return null}else l=li(j);if(g[String(j)]!==void 0)return D.error("Branch labels must be unique.");g[String(j)]=v.length}const O=r.parse(A,P,p);if(!O)return null;p=p||O.type,v.push(O)}const b=r.parse(e[1],1,ee);if(!b)return null;const I=r.parse(e[e.length-1],e.length-1,p);return I?b.type.kind!=="value"&&r.concat(1).checkSubtype(l,b.type)?null:new Ko(l,p,b,g,v,I):null}evaluate(e){const r=this.input.evaluate(e);return(li(r)===this.inputType&&this.outputs[this.cases[r]]||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()}}class Jo{constructor(e,r,l){this.type=e,this.branches=r,this.otherwise=l}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const p=[];for(let v=1;vr.outputDefined())&&this.otherwise.outputDefined()}}class Yo{constructor(e,r,l,p){this.type=e,this.input=r,this.beginIndex=l,this.endIndex=p}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const l=r.parse(e[1],1,ee),p=r.parse(e[2],2,At);if(!l||!p)return null;if(!nt(l.type,[R(ee),he,ee]))return r.error(`Expected first argument to be of type array or string, but found ${F(l.type)} instead`);if(e.length===4){const g=r.parse(e[3],3,At);return g?new Yo(l.type,l,p,g):null}return new Yo(l.type,l,p)}evaluate(e){const r=this.input.evaluate(e),l=this.beginIndex.evaluate(e);let p;if(this.endIndex&&(p=this.endIndex.evaluate(e)),st(r,["string"]))return[...r].slice(l,p).join("");if(st(r,["array"]))return r.slice(l,p);throw new ni(`Expected first argument to be of type array or string, but found ${F(li(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function eo(i,e){const r=i.length-1;let l,p,g=0,v=r,b=0;for(;g<=v;)if(b=Math.floor((g+v)/2),l=i[b],p=i[b+1],l<=e){if(b===r||ee))throw new ni("Input is not a number.");v=b-1}return 0}class ms{constructor(e,r,l){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[p,g]of l)this.labels.push(p),this.outputs.push(g)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const l=r.parse(e[1],1,At);if(!l)return null;const p=[];let g=null;r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=1;v=b)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',P);const A=r.parse(I,T,g);if(!A)return null;g=g||A.type,p.push([b,A])}return new ms(g,l,p)}evaluate(e){const r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(e);const p=this.input.evaluate(e);if(p<=r[0])return l[0].evaluate(e);const g=r.length;return p>=r[g-1]?l[g-1].evaluate(e):l[eo(r,p)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Fu(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ru=Wh;function Wh(i,e,r,l){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(l-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=l}Wh.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,l=0;l<8;l++){var p=this.sampleCurveX(r)-i;if(Math.abs(p)p?v=r:b=r,r=.5*(b-v)+v;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Ou=Fu(Ru);function Sn(i,e,r){return i+r*(e-i)}function io(i,e,r){return i.map((l,p)=>Sn(l,e[p],r))}const ir={number:Sn,color:function(i,e,r,l="rgb"){switch(l){case"rgb":{const[p,g,v,b]=io(i.rgb,e.rgb,r);return new Ce(p,g,v,b,!1)}case"hcl":{const[p,g,v,b]=i.hcl,[I,P,T,A]=e.hcl;let D,O;if(isNaN(p)||isNaN(I))isNaN(p)?isNaN(I)?D=NaN:(D=I,v!==1&&v!==0||(O=P)):(D=p,T!==1&&T!==0||(O=g));else{let ct=I-p;I>p&&ct>180?ct-=360:I180&&(ct+=360),D=p+r*ct}const[j,q,H,tt]=function([ct,rt,at,mt]){return ct=isNaN(ct)?0:ct*Wt,ai([at,Math.cos(ct)*rt,Math.sin(ct)*rt,mt])}([D,O??Sn(g,P,r),Sn(v,T,r),Sn(b,A,r)]);return new Ce(j,q,H,tt,!1)}case"lab":{const[p,g,v,b]=ai(io(i.lab,e.lab,r));return new Ce(p,g,v,b,!1)}}},array:io,padding:function(i,e,r){return new tr(io(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const l=i.values,p=e.values;if(l.length!==p.length)throw new ni(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const g=[];for(let v=0;vtypeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);p={name:"cubic-bezier",controlPoints:P}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(g=r.parse(g,2,At),!g)return null;const b=[];let I=null;l==="interpolate-hcl"||l==="interpolate-lab"?I=qi:r.expectedType&&r.expectedType.kind!=="value"&&(I=r.expectedType);for(let P=0;P=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);const j=r.parse(A,O,I);if(!j)return null;I=I||j.type,b.push([T,j])}return lt(I,At)||lt(I,qi)||lt(I,wn)||lt(I,Y)||lt(I,R(At))?new rr(I,l,p,g,b):r.error(`Type ${F(I)} is not interpolatable.`)}evaluate(e){const r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(e);const p=this.input.evaluate(e);if(p<=r[0])return l[0].evaluate(e);const g=r.length;if(p>=r[g-1])return l[g-1].evaluate(e);const v=eo(r,p),b=rr.interpolationFactor(this.interpolation,p,r[v],r[v+1]),I=l[v].evaluate(e),P=l[v+1].evaluate(e);switch(this.operator){case"interpolate":return ir[this.type.kind](I,P,b);case"interpolate-hcl":return ir.color(I,P,b,"hcl");case"interpolate-lab":return ir.color(I,P,b,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ro(i,e,r,l){const p=l-r,g=i-r;return p===0?0:e===1?g/p:(Math.pow(e,g)-1)/(Math.pow(e,p)-1)}class Qo{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let l=null;const p=r.expectedType;p&&p.kind!=="value"&&(l=p);const g=[];for(const b of e.slice(1)){const I=r.parse(b,1+g.length,l,void 0,{typeAnnotation:"omit"});if(!I)return null;l=l||I.type,g.push(I)}if(!l)throw new Error("No output type");const v=p&&g.some(b=>K(p,b.type));return new Qo(v?ee:l,g)}evaluate(e){let r,l=null,p=0;for(const g of this.args)if(p++,l=g.evaluate(e),l&&l instanceof Si&&!l.available&&(r||(r=l.name),l=null,p===this.args.length&&(l=r)),l!==null)break;return l}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function Hh(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Kh(i,e,r,l){return l.compare(e,r)===0}function Zn(i,e,r){const l=i!=="=="&&i!=="!=";return class Kg{constructor(g,v,b){this.type=Kt,this.lhs=g,this.rhs=v,this.collator=b,this.hasUntypedArgument=g.type.kind==="value"||v.type.kind==="value"}static parse(g,v){if(g.length!==3&&g.length!==4)return v.error("Expected two or three arguments.");const b=g[0];let I=v.parse(g[1],1,ee);if(!I)return null;if(!Hh(b,I.type))return v.concat(1).error(`"${b}" comparisons are not supported for type '${F(I.type)}'.`);let P=v.parse(g[2],2,ee);if(!P)return null;if(!Hh(b,P.type))return v.concat(2).error(`"${b}" comparisons are not supported for type '${F(P.type)}'.`);if(I.type.kind!==P.type.kind&&I.type.kind!=="value"&&P.type.kind!=="value")return v.error(`Cannot compare types '${F(I.type)}' and '${F(P.type)}'.`);l&&(I.type.kind==="value"&&P.type.kind!=="value"?I=new pr(P.type,[I]):I.type.kind!=="value"&&P.type.kind==="value"&&(P=new pr(I.type,[P])));let T=null;if(g.length===4){if(I.type.kind!=="string"&&P.type.kind!=="string"&&I.type.kind!=="value"&&P.type.kind!=="value")return v.error("Cannot use collator to compare non-string types.");if(T=v.parse(g[3],3,Zr),!T)return null}return new Kg(I,P,T)}evaluate(g){const v=this.lhs.evaluate(g),b=this.rhs.evaluate(g);if(l&&this.hasUntypedArgument){const I=li(v),P=li(b);if(I.kind!==P.kind||I.kind!=="string"&&I.kind!=="number")throw new ni(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${I.kind}, ${P.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){const I=li(v),P=li(b);if(I.kind!=="string"||P.kind!=="string")return e(g,v,b)}return this.collator?r(g,v,b,this.collator.evaluate(g)):e(g,v,b)}eachChild(g){g(this.lhs),g(this.rhs),this.collator&&g(this.collator)}outputDefined(){return!0}}}const Jh=Zn("==",function(i,e,r){return e===r},Kh),Vu=Zn("!=",function(i,e,r){return e!==r},function(i,e,r,l){return!Kh(0,e,r,l)}),Nu=Zn("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,l){return l.compare(e,r)>0}),Qh=Zn("<=",function(i,e,r){return e<=r},function(i,e,r,l){return l.compare(e,r)<=0}),ju=Zn(">=",function(i,e,r){return e>=r},function(i,e,r,l){return l.compare(e,r)>=0});class ta{constructor(e,r,l){this.type=Zr,this.locale=l,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const l=e[1];if(typeof l!="object"||Array.isArray(l))return r.error("Collator options argument must be an object.");const p=r.parse(l["case-sensitive"]!==void 0&&l["case-sensitive"],1,Kt);if(!p)return null;const g=r.parse(l["diacritic-sensitive"]!==void 0&&l["diacritic-sensitive"],1,Kt);if(!g)return null;let v=null;return l.locale&&(v=r.parse(l.locale,1,he),!v)?null:new ta(p,g,v)}evaluate(e){return new hl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class pl{constructor(e,r,l,p,g){this.type=he,this.number=e,this.locale=r,this.currency=l,this.minFractionDigits=p,this.maxFractionDigits=g}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const l=r.parse(e[1],1,At);if(!l)return null;const p=e[2];if(typeof p!="object"||Array.isArray(p))return r.error("NumberFormat options argument must be an object.");let g=null;if(p.locale&&(g=r.parse(p.locale,1,he),!g))return null;let v=null;if(p.currency&&(v=r.parse(p.currency,1,he),!v))return null;let b=null;if(p["min-fraction-digits"]&&(b=r.parse(p["min-fraction-digits"],1,At),!b))return null;let I=null;return p["max-fraction-digits"]&&(I=r.parse(p["max-fraction-digits"],1,At),!I)?null:new pl(l,g,v,b,I)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ea{constructor(e){this.type=an,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const l=e[1];if(!Array.isArray(l)&&typeof l=="object")return r.error("First argument must be an image or text section.");const p=[];let g=!1;for(let v=1;v<=e.length-1;++v){const b=e[v];if(g&&typeof b=="object"&&!Array.isArray(b)){g=!1;let I=null;if(b["font-scale"]&&(I=r.parse(b["font-scale"],1,At),!I))return null;let P=null;if(b["text-font"]&&(P=r.parse(b["text-font"],1,R(he)),!P))return null;let T=null;if(b["text-color"]&&(T=r.parse(b["text-color"],1,qi),!T))return null;const A=p[p.length-1];A.scale=I,A.font=P,A.textColor=T}else{const I=r.parse(e[v],1,ee);if(!I)return null;const P=I.type.kind;if(P!=="string"&&P!=="value"&&P!=="null"&&P!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");g=!0,p.push({content:I,scale:null,font:null,textColor:null})}}return new ea(p)}evaluate(e){return new Qi(this.sections.map(r=>{const l=r.content.evaluate(e);return li(l)===Gr?new cl("",l,null,null,null):new cl(ln(l),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class fl{constructor(e){this.type=Gr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const l=r.parse(e[1],1,he);return l?new fl(l):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),l=Si.fromString(r);return l&&e.availableImages&&(l.available=e.availableImages.indexOf(r)>-1),l}eachChild(e){e(this.input)}outputDefined(){return!1}}class ml{constructor(e){this.type=At,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const l=r.parse(e[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${F(l.type)} instead.`):new ml(l):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ni(`Expected value to be of type string or array, but found ${F(li(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Xr=8192;function gl(i,e){const r=(180+i[0])/360,l=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,p=Math.pow(2,e.z);return[Math.round(r*p*Xr),Math.round(l*p*Xr)]}function gs(i,e){const r=Math.pow(2,e.z);return[(p=(i[0]/Xr+e.x)/r,360*p-180),(l=(i[1]/Xr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90)];var l,p}function ge(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function no(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Uu(i,e,r){const l=i[0]-e[0],p=i[1]-e[1],g=i[0]-r[0],v=i[1]-r[1];return l*v-g*p==0&&l*g<=0&&p*v<=0}function ia(i,e,r,l){return(p=[l[0]-r[0],l[1]-r[1]])[0]*(g=[e[0]-i[0],e[1]-i[1]])[1]-p[1]*g[0]!=0&&!(!ec(i,e,r,l)||!ec(r,l,i,e));var p,g}function qu(i,e,r){for(const l of r)for(let p=0;p(p=i)[1]!=(v=b[I+1])[1]>p[1]&&p[0]<(v[0]-g[0])*(p[1]-g[1])/(v[1]-g[1])+g[0]&&(l=!l)}var p,g,v;return l}function $u(i,e){for(const r of e)if(ys(i,r))return!0;return!1}function tc(i,e){for(const r of i)if(!ys(r,e))return!1;for(let r=0;r0&&b<0||v<0&&b>0}function yl(i,e,r){const l=[];for(let p=0;pr[2]){const p=.5*l;let g=i[0]-r[0]>p?-l:r[0]-i[0]>p?l:0;g===0&&(g=i[0]-r[2]>p?-l:r[2]-i[0]>p?l:0),i[0]+=g}ge(e,i)}function nc(i,e,r,l){const p=Math.pow(2,l.z)*Xr,g=[l.x*Xr,l.y*Xr],v=[];for(const b of i)for(const I of b){const P=[I.x+g[0],I.y+g[1]];rc(P,e,r,p),v.push(P)}return v}function sc(i,e,r,l){const p=Math.pow(2,l.z)*Xr,g=[l.x*Xr,l.y*Xr],v=[];for(const I of i){const P=[];for(const T of I){const A=[T.x+g[0],T.y+g[1]];ge(e,A),P.push(A)}v.push(P)}if(e[2]-e[0]<=p/2){(b=e)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const I of v)for(const P of I)rc(P,e,r,p)}var b;return v}class Gn{constructor(e,r){this.type=Kt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Js(e[1])){const l=e[1];if(l.type==="FeatureCollection"){const p=[];for(const g of l.features){const{type:v,coordinates:b}=g.geometry;v==="Polygon"&&p.push(b),v==="MultiPolygon"&&p.push(...b)}if(p.length)return new Gn(l,{type:"MultiPolygon",coordinates:p})}else if(l.type==="Feature"){const p=l.geometry.type;if(p==="Polygon"||p==="MultiPolygon")return new Gn(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new Gn(l,l)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,l){const p=[1/0,1/0,-1/0,-1/0],g=[1/0,1/0,-1/0,-1/0],v=r.canonicalID();if(l.type==="Polygon"){const b=yl(l.coordinates,g,v),I=nc(r.geometry(),p,g,v);if(!no(p,g))return!1;for(const P of I)if(!ys(P,b))return!1}if(l.type==="MultiPolygon"){const b=ic(l.coordinates,g,v),I=nc(r.geometry(),p,g,v);if(!no(p,g))return!1;for(const P of I)if(!$u(P,b))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,l){const p=[1/0,1/0,-1/0,-1/0],g=[1/0,1/0,-1/0,-1/0],v=r.canonicalID();if(l.type==="Polygon"){const b=yl(l.coordinates,g,v),I=sc(r.geometry(),p,g,v);if(!no(p,g))return!1;for(const P of I)if(!tc(P,b))return!1}if(l.type==="MultiPolygon"){const b=ic(l.coordinates,g,v),I=sc(r.geometry(),p,g,v);if(!no(p,g))return!1;for(const P of I)if(!Zu(P,b))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let oc=class{constructor(i=[],e=(r,l)=>rl?1:0){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:r}=this,l=e[i];for(;i>0;){const p=i-1>>1,g=e[p];if(r(l,g)>=0)break;e[i]=g,i=p}e[i]=l}_down(i){const{data:e,compare:r}=this,l=this.length>>1,p=e[i];for(;i=0)break;e[i]=e[g],i=g}e[i]=p}};function Gu(i,e,r,l,p){ac(i,e,r,l||i.length-1,p||Xu)}function ac(i,e,r,l,p){for(;l>r;){if(l-r>600){var g=l-r+1,v=e-r+1,b=Math.log(g),I=.5*Math.exp(2*b/3),P=.5*Math.sqrt(b*I*(g-I)/g)*(v-g/2<0?-1:1);ac(i,e,Math.max(r,Math.floor(e-v*I/g+P)),Math.min(l,Math.floor(e+(g-v)*I/g+P)),p)}var T=i[e],A=r,D=l;for(so(i,r,e),p(i[l],T)>0&&so(i,r,l);A0;)D--}p(i[r],T)===0?so(i,r,D):so(i,++D,l),D<=e&&(r=D+1),e<=D&&(l=D-1)}}function so(i,e,r){var l=i[e];i[e]=i[r],i[r]=l}function Xu(i,e){return ie?1:0}function ra(i,e){if(i.length<=1)return[i];const r=[];let l,p;for(const g of i){const v=Hu(g);v!==0&&(g.area=Math.abs(v),p===void 0&&(p=v<0),p===v<0?(l&&r.push(l),l=[g]):l.push(g))}if(l&&r.push(l),e>1)for(let g=0;g1?(P=e[I+1][0],T=e[I+1][1]):O>0&&(P+=A/this.kx*O,T+=D/this.ky*O)),A=this.wrap(r[0]-P)*this.kx,D=(r[1]-T)*this.ky;const j=A*A+D*D;j180;)e-=360;return e}}function uc(i,e){return e[0]-i[0]}function na(i){return i[1]-i[0]+1}function hn(i,e){return i[1]>=i[0]&&i[1]i[1])return[null,null];const r=na(i);if(e){if(r===2)return[i,null];const p=Math.floor(r/2);return[[i[0],i[0]+p],[i[0]+p,i[1]]]}if(r===1)return[i,null];const l=Math.floor(r/2)-1;return[[i[0],i[0]+l],[i[0]+l+1,i[1]]]}function oo(i,e){if(!hn(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let l=e[0];l<=e[1];++l)ge(r,i[l]);return r}function xl(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const l of r)ge(e,l);return e}function dc(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function bl(i,e,r){if(!dc(i)||!dc(e))return NaN;let l=0,p=0;return i[2]e[2]&&(l=i[0]-e[2]),i[1]>e[3]&&(p=i[1]-e[3]),i[3]=l)return l;if(no(p,g)){if(De(i,e))return 0}else if(De(e,i))return 0;let v=1/0;for(const b of i)for(let I=0,P=b.length,T=P-1;I0;){const I=v.pop();if(I[0]>=g)continue;const P=I[1],T=e?50:100;if(na(P)<=T){if(!hn(P,i.length))return NaN;if(e){const A=Ze(i,P,r,l);if(isNaN(A)||A===0)return A;g=Math.min(g,A)}else for(let A=P[0];A<=P[1];++A){const D=wl(i[A],r,l);if(g=Math.min(g,D),g===0)return 0}}else{const A=vl(P,e);Il(v,g,l,i,b,A[0]),Il(v,g,l,i,b,A[1])}}return g}function aa(i,e,r,l,p,g=1/0){let v=Math.min(g,p.distance(i[0],r[0]));if(v===0)return v;const b=new oc([[0,[0,i.length-1],[0,r.length-1]]],uc);for(;b.length>0;){const I=b.pop();if(I[0]>=v)continue;const P=I[1],T=I[2],A=e?50:100,D=l?50:100;if(na(P)<=A&&na(T)<=D){if(!hn(P,i.length)&&hn(T,r.length))return NaN;let O;if(e&&l)O=Ku(i,P,r,T,p),v=Math.min(v,O);else if(e&&!l){const j=i.slice(P[0],P[1]+1);for(let q=T[0];q<=T[1];++q)if(O=Xn(r[q],j,p),v=Math.min(v,O),v===0)return v}else if(!e&&l){const j=r.slice(T[0],T[1]+1);for(let q=P[0];q<=P[1];++q)if(O=Xn(i[q],j,p),v=Math.min(v,O),v===0)return v}else O=pe(i,P,r,T,p),v=Math.min(v,O)}else{const O=vl(P,e),j=vl(T,l);ao(b,v,p,i,r,O[0],j[0]),ao(b,v,p,i,r,O[0],j[1]),ao(b,v,p,i,r,O[1],j[0]),ao(b,v,p,i,r,O[1],j[1])}}return v}function Cl(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Wn{constructor(e,r){this.type=At,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Js(e[1])){const l=e[1];if(l.type==="FeatureCollection")return new Wn(l,l.features.map(p=>Cl(p.geometry)).flat());if(l.type==="Feature")return new Wn(l,Cl(l.geometry));if("type"in l&&"coordinates"in l)return new Wn(l,Cl(l))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,l){const p=r.geometry(),g=p.flat().map(I=>gs([I.x,I.y],r.canonical));if(p.length===0)return NaN;const v=new _l(g[0][1]);let b=1/0;for(const I of l){switch(I.type){case"Point":b=Math.min(b,aa(g,!1,[I.coordinates],!1,v,b));break;case"LineString":b=Math.min(b,aa(g,!1,I.coordinates,!0,v,b));break;case"Polygon":b=Math.min(b,oa(g,!1,I.coordinates,v,b))}if(b===0)return b}return b}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,l){const p=r.geometry(),g=p.flat().map(I=>gs([I.x,I.y],r.canonical));if(p.length===0)return NaN;const v=new _l(g[0][1]);let b=1/0;for(const I of l){switch(I.type){case"Point":b=Math.min(b,aa(g,!0,[I.coordinates],!1,v,b));break;case"LineString":b=Math.min(b,aa(g,!0,I.coordinates,!0,v,b));break;case"Polygon":b=Math.min(b,oa(g,!0,I.coordinates,v,b))}if(b===0)return b}return b}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,l){const p=r.geometry();if(p.length===0||p[0].length===0)return NaN;const g=ra(p,0).map(I=>I.map(P=>P.map(T=>gs([T.x,T.y],r.canonical)))),v=new _l(g[0][0][0][1]);let b=1/0;for(const I of l)for(const P of g){switch(I.type){case"Point":b=Math.min(b,oa([I.coordinates],!1,P,v,b));break;case"LineString":b=Math.min(b,oa(I.coordinates,!0,P,v,b));break;case"Polygon":b=Math.min(b,sa(P,I.coordinates,v,b))}if(b===0)return b}return b}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Hn={"==":Jh,"!=":Vu,">":Yh,"<":Nu,">=":ju,"<=":Qh,array:pr,at:dl,boolean:pr,case:Jo,coalesce:Qo,collator:ta,format:ea,image:fl,in:to,"index-of":Ho,interpolate:rr,"interpolate-hcl":rr,"interpolate-lab":rr,length:ml,let:we,literal:$n,match:Ko,number:pr,"number-format":pl,object:pr,slice:Yo,step:ms,string:pr,"to-boolean":In,"to-color":In,"to-number":In,"to-string":In,var:Wo,within:Gn,distance:Wn};class nr{constructor(e,r,l,p){this.name=e,this.type=r,this._evaluate=l,this.args=p}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const l=e[0],p=nr.definitions[l];if(!p)return r.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0);const g=Array.isArray(p)?p[0]:p.type,v=Array.isArray(p)?[[p[1],p[2]]]:p.overloads,b=v.filter(([P])=>!Array.isArray(P)||P.length===e.length-1);let I=null;for(const[P,T]of b){I=new Cn(r.registry,la,r.path,null,r.scope);const A=[];let D=!1;for(let O=1;O{return D=A,Array.isArray(D)?`(${D.map(F).join(", ")})`:`(${F(D.type)}...)`;var D}).join(" | "),T=[];for(let A=1;A{r=e?r&&la(l):r&&l instanceof $n}),!!r&&ha(i)&&ca(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ha(i){if(i instanceof nr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Gn||i instanceof Wn)return!1;let e=!0;return i.eachChild(r=>{e&&!ha(r)&&(e=!1)}),e}function ho(i){if(i instanceof nr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!ho(r)&&(e=!1)}),e}function ca(i,e){if(i instanceof nr&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(l=>{r&&!ca(l,e)&&(r=!1)}),r}function pc(i){return{result:"success",value:i}}function _s(i){return{result:"error",value:i}}function vs(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ml(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ua(i){return!!i.expression&&i.expression.interpolated}function me(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function da(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function fc(i){return i}function El(i,e){const r=e.type==="color",l=i.stops&&typeof i.stops[0][0]=="object",p=l||!(l||i.property!==void 0),g=i.type||(ua(e)?"exponential":"interval");if(r||e.type==="padding"){const T=r?Ce.parse:tr.parse;(i=qr({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],T(A[1])])),i.default=T(i.default?i.default:e.default)}if(i.colorSpace&&(v=i.colorSpace)!=="rgb"&&v!=="hcl"&&v!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var v;let b,I,P;if(g==="exponential")b=uo;else if(g==="interval")b=pa;else if(g==="categorical"){b=Tl,I=Object.create(null);for(const T of i.stops)I[T[0]]=T[1];P=typeof i.stops[0][0]}else{if(g!=="identity")throw new Error(`Unknown function type "${g}"`);b=mc}if(l){const T={},A=[];for(let j=0;jj[0]),evaluate:({zoom:j},q)=>uo({stops:D,base:i.base},e,j).evaluate(j,q)}}if(p){const T=g==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:T,interpolationFactor:rr.interpolationFactor.bind(void 0,T),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>b(i,e,A,I,P)}}return{kind:"source",evaluate(T,A){const D=A&&A.properties?A.properties[i.property]:void 0;return D===void 0?co(i.default,e.default):b(i,e,D,I,P)}}}function co(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Tl(i,e,r,l,p){return co(typeof r===p?l[r]:void 0,i.default,e.default)}function pa(i,e,r){if(me(r)!=="number")return co(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const p=eo(i.stops.map(g=>g[0]),r);return i.stops[p][1]}function uo(i,e,r){const l=i.base!==void 0?i.base:1;if(me(r)!=="number")return co(i.default,e.default);const p=i.stops.length;if(p===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[p-1][0])return i.stops[p-1][1];const g=eo(i.stops.map(T=>T[0]),r),v=function(T,A,D,O){const j=O-D,q=T-D;return j===0?0:A===1?q/j:(Math.pow(A,q)-1)/(Math.pow(A,j)-1)}(r,l,i.stops[g][0],i.stops[g+1][0]),b=i.stops[g][1],I=i.stops[g+1][1],P=ir[e.type]||fc;return typeof b.evaluate=="function"?{evaluate(...T){const A=b.evaluate.apply(void 0,T),D=I.evaluate.apply(void 0,T);if(A!==void 0&&D!==void 0)return P(A,D,v,i.colorSpace)}}:P(b,I,v,i.colorSpace)}function mc(i,e,r){switch(e.type){case"color":r=Ce.parse(r);break;case"formatted":r=Qi.fromString(r.toString());break;case"resolvedImage":r=Si.fromString(r.toString());break;case"padding":r=tr.parse(r);break;default:me(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return co(r,i.default,e.default)}nr.register(Hn,{error:[{kind:"error"},[he],(i,[e])=>{throw new ni(e.evaluate(i))}],typeof:[he,[ee],(i,[e])=>F(li(e.evaluate(i)))],"to-rgba":[R(At,4),[qi],(i,[e])=>{const[r,l,p,g]=e.evaluate(i).rgb;return[255*r,255*l,255*p,g]}],rgb:[qi,[At,At,At],Sl],rgba:[qi,[At,At,At,At],Sl],has:{type:Kt,overloads:[[[he],(i,[e])=>Pl(e.evaluate(i),i.properties())],[[he,Ir],(i,[e,r])=>Pl(e.evaluate(i),r.evaluate(i))]]},get:{type:ee,overloads:[[[he],(i,[e])=>lo(e.evaluate(i),i.properties())],[[he,Ir],(i,[e,r])=>lo(e.evaluate(i),r.evaluate(i))]]},"feature-state":[ee,[he],(i,[e])=>lo(e.evaluate(i),i.featureState||{})],properties:[Ir,[],i=>i.properties()],"geometry-type":[he,[],i=>i.geometryType()],id:[ee,[],i=>i.id()],zoom:[At,[],i=>i.globals.zoom],"heatmap-density":[At,[],i=>i.globals.heatmapDensity||0],"line-progress":[At,[],i=>i.globals.lineProgress||0],accumulated:[ee,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[At,Kn(At),(i,e)=>{let r=0;for(const l of e)r+=l.evaluate(i);return r}],"*":[At,Kn(At),(i,e)=>{let r=1;for(const l of e)r*=l.evaluate(i);return r}],"-":{type:At,overloads:[[[At,At],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[At],(i,[e])=>-e.evaluate(i)]]},"/":[At,[At,At],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[At,[At,At],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[At,[],()=>Math.LN2],pi:[At,[],()=>Math.PI],e:[At,[],()=>Math.E],"^":[At,[At,At],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[At,[At],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[At,[At],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[At,[At],(i,[e])=>Math.log(e.evaluate(i))],log2:[At,[At],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[At,[At],(i,[e])=>Math.sin(e.evaluate(i))],cos:[At,[At],(i,[e])=>Math.cos(e.evaluate(i))],tan:[At,[At],(i,[e])=>Math.tan(e.evaluate(i))],asin:[At,[At],(i,[e])=>Math.asin(e.evaluate(i))],acos:[At,[At],(i,[e])=>Math.acos(e.evaluate(i))],atan:[At,[At],(i,[e])=>Math.atan(e.evaluate(i))],min:[At,Kn(At),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[At,Kn(At),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[At,[At],(i,[e])=>Math.abs(e.evaluate(i))],round:[At,[At],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[At,[At],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[At,[At],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Kt,[he,ee],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Kt,[ee],(i,[e])=>i.id()===e.value],"filter-type-==":[Kt,[he],(i,[e])=>i.geometryType()===e.value],"filter-<":[Kt,[he,ee],(i,[e,r])=>{const l=i.properties()[e.value],p=r.value;return typeof l==typeof p&&l{const r=i.id(),l=e.value;return typeof r==typeof l&&r":[Kt,[he,ee],(i,[e,r])=>{const l=i.properties()[e.value],p=r.value;return typeof l==typeof p&&l>p}],"filter-id->":[Kt,[ee],(i,[e])=>{const r=i.id(),l=e.value;return typeof r==typeof l&&r>l}],"filter-<=":[Kt,[he,ee],(i,[e,r])=>{const l=i.properties()[e.value],p=r.value;return typeof l==typeof p&&l<=p}],"filter-id-<=":[Kt,[ee],(i,[e])=>{const r=i.id(),l=e.value;return typeof r==typeof l&&r<=l}],"filter->=":[Kt,[he,ee],(i,[e,r])=>{const l=i.properties()[e.value],p=r.value;return typeof l==typeof p&&l>=p}],"filter-id->=":[Kt,[ee],(i,[e])=>{const r=i.id(),l=e.value;return typeof r==typeof l&&r>=l}],"filter-has":[Kt,[ee],(i,[e])=>e.value in i.properties()],"filter-has-id":[Kt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Kt,[R(he)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Kt,[R(ee)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Kt,[he,R(ee)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Kt,[he,R(ee)],(i,[e,r])=>function(l,p,g,v){for(;g<=v;){const b=g+v>>1;if(p[b]===l)return!0;p[b]>l?v=b-1:g=b+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Kt,overloads:[[[Kt,Kt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kn(Kt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Kt,overloads:[[[Kt,Kt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kn(Kt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Kt,[Kt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Kt,[he],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[he,[he],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[he,[he],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[he,Kn(ee),(i,e)=>e.map(r=>ln(r.evaluate(i))).join("")],"resolved-locale":[he,[Zr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class po{constructor(e,r){var l;this.expression=e,this._warningHistory={},this._evaluator=new Qs,this._defaultValue=r?(l=r).type==="color"&&da(l.default)?new Ce(0,0,0,0):l.type==="color"?Ce.parse(l.default)||null:l.type==="padding"?tr.parse(l.default)||null:l.type==="variableAnchorOffsetCollection"?er.parse(l.default)||null:l.default===void 0?null:l.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,l,p,g,v){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=l,this._evaluator.canonical=p,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=v,this.expression.evaluate(this._evaluator)}evaluate(e,r,l,p,g,v){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=l||null,this._evaluator.canonical=p,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=v||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new ni(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function fo(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Hn}function mo(i,e){const r=new Cn(Hn,la,[],e?function(p){const g={color:qi,string:he,number:At,enum:he,boolean:Kt,formatted:an,padding:wn,resolvedImage:Gr,variableAnchorOffsetCollection:Y};return p.type==="array"?R(g[p.value]||ee,p.length):g[p.type]}(e):void 0),l=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?pc(new po(l,e)):_s(r.errors)}class xs{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!ho(r.expression)}evaluateWithoutErrorHandling(e,r,l,p,g,v){return this._styleExpression.evaluateWithoutErrorHandling(e,r,l,p,g,v)}evaluate(e,r,l,p,g,v){return this._styleExpression.evaluate(e,r,l,p,g,v)}}class Al{constructor(e,r,l,p){this.kind=e,this.zoomStops=l,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!ho(r.expression),this.interpolationType=p}evaluateWithoutErrorHandling(e,r,l,p,g,v){return this._styleExpression.evaluateWithoutErrorHandling(e,r,l,p,g,v)}evaluate(e,r,l,p,g,v){return this._styleExpression.evaluate(e,r,l,p,g,v)}interpolationFactor(e,r,l){return this.interpolationType?rr.interpolationFactor(this.interpolationType,e,r,l):0}}function gc(i,e){const r=mo(i,e);if(r.result==="error")return r;const l=r.value.expression,p=ha(l);if(!p&&!vs(e))return _s([new Fi("","data expressions not supported")]);const g=ca(l,["zoom"]);if(!g&&!Ml(e))return _s([new Fi("","zoom expressions not supported")]);const v=ma(l);return v||g?v instanceof Fi?_s([v]):v instanceof rr&&!ua(e)?_s([new Fi("",'"interpolate" expressions cannot be used with this property')]):pc(v?new Al(p?"camera":"composite",r.value,v.labels,v instanceof rr?v.interpolation:void 0):new xs(p?"constant":"source",r.value)):_s([new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class fa{constructor(e,r){this._parameters=e,this._specification=r,qr(this,El(this._parameters,this._specification))}static deserialize(e){return new fa(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ma(i){let e=null;if(i instanceof we)e=ma(i.result);else if(i instanceof Qo){for(const r of i.args)if(e=ma(r),e)break}else(i instanceof ms||i instanceof rr)&&i.input instanceof nr&&i.input.name==="zoom"&&(e=i);return e instanceof Fi||i.eachChild(r=>{const l=ma(r);l instanceof Fi?e=l:!e&&l?e=new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&l&&e!==l&&(e=new Fi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function zl(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!zl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ga={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function bs(i){if(i==null)return{filter:()=>!0,needGeometry:!1};zl(i)||(i=go(i));const e=mo(i,ga);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,l,p)=>e.value.evaluate(r,l,{},p),needGeometry:ws(i)}}function sr(i,e){return ie?1:0}function ws(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?kl(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(go))):e==="all"?["all"].concat(i.slice(1).map(go)):e==="none"?["all"].concat(i.slice(1).map(go).map(yo)):e==="in"?yc(i[1],i.slice(2)):e==="!in"?yo(yc(i[1],i.slice(2))):e==="has"?Is(i[1]):e!=="!has"||yo(Is(i[1]));var r}function kl(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function yc(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(sr)]]:["filter-in-small",i,["literal",e]]}}function Is(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function yo(i){return["!",i]}function _o(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let p="[";for(const g of i)p+=`${_o(g)},`;return`${p}]`}const r=Object.keys(i).sort();let l="{";for(let p=0;pl.maximum?[new Pt(e,r,`${r} is greater than the maximum value ${l.maximum}`)]:[]}function va(i){const e=i.valueSpec,r=ti(i.value.type);let l,p,g,v={};const b=r!=="categorical"&&i.value.property===void 0,I=!b,P=me(i.value.stops)==="array"&&me(i.value.stops[0])==="array"&&me(i.value.stops[0][0])==="object",T=fr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new Pt(O.key,O.value,'identity function may not have a "stops" property')];let j=[];const q=O.value;return j=j.concat(vo({key:O.key,value:q,valueSpec:O.valueSpec,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:A})),me(q)==="array"&&q.length===0&&j.push(new Pt(O.key,q,"array must have at least one stop")),j},default:function(O){return O.validateSpec({key:O.key,value:O.value,valueSpec:e,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&b&&T.push(new Pt(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Pt(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!ua(i.valueSpec)&&T.push(new Pt(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(I&&!vs(i.valueSpec)?T.push(new Pt(i.key,i.value,"property functions not supported")):b&&!Ml(i.valueSpec)&&T.push(new Pt(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!P||i.value.property!==void 0||T.push(new Pt(i.key,i.value,'"property" property is required')),T;function A(O){let j=[];const q=O.value,H=O.key;if(me(q)!=="array")return[new Pt(H,q,`array expected, ${me(q)} found`)];if(q.length!==2)return[new Pt(H,q,`array length 2 expected, length ${q.length} found`)];if(P){if(me(q[0])!=="object")return[new Pt(H,q,`object expected, ${me(q[0])} found`)];if(q[0].zoom===void 0)return[new Pt(H,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new Pt(H,q,"object stop key must have value")];if(g&&g>ti(q[0].zoom))return[new Pt(H,q[0].zoom,"stop zoom values must appear in ascending order")];ti(q[0].zoom)!==g&&(g=ti(q[0].zoom),p=void 0,v={}),j=j.concat(fr({key:`${H}[0]`,value:q[0],valueSpec:{zoom:{}},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:_a,value:D}}))}else j=j.concat(D({key:`${H}[0]`,value:q[0],valueSpec:{},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec},q));return fo(Cr(q[1]))?j.concat([new Pt(`${H}[1]`,q[1],"expressions are not allowed in function stops.")]):j.concat(O.validateSpec({key:`${H}[1]`,value:q[1],valueSpec:e,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec}))}function D(O,j){const q=me(O.value),H=ti(O.value),tt=O.value!==null?O.value:j;if(l){if(q!==l)return[new Pt(O.key,tt,`${q} stop domain type must match previous stop domain type ${l}`)]}else l=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new Pt(O.key,tt,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&r!=="categorical"){let ct=`number expected, ${q} found`;return vs(e)&&r===void 0&&(ct+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Pt(O.key,tt,ct)]}return r!=="categorical"||q!=="number"||isFinite(H)&&Math.floor(H)===H?r!=="categorical"&&q==="number"&&p!==void 0&&Hnew Pt(`${i.key}${l.key}`,i.value,l.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Pt(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!ho(r))return[new Pt(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!ho(r))return[new Pt(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ca(r,["zoom","feature-state"]))return[new Pt(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ha(r))return[new Pt(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cs(i){const e=i.key,r=i.value,l=i.valueSpec,p=[];return Array.isArray(l.values)?l.values.indexOf(ti(r))===-1&&p.push(new Pt(e,r,`expected one of [${l.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(l.values).indexOf(ti(r))===-1&&p.push(new Pt(e,r,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(r)} found`)),p}function Dl(i){return zl(Cr(i.value))?Jn(qr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xa(i)}function xa(i){const e=i.value,r=i.key;if(me(e)!=="array")return[new Pt(r,e,`array expected, ${me(e)} found`)];const l=i.styleSpec;let p,g=[];if(e.length<1)return[new Pt(r,e,"filter array must have at least 1 element")];switch(g=g.concat(Cs({key:`${r}[0]`,value:e[0],valueSpec:l.filter_operator,style:i.style,styleSpec:i.styleSpec})),ti(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ti(e[1])==="$type"&&g.push(new Pt(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&g.push(new Pt(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(p=me(e[1]),p!=="string"&&g.push(new Pt(`${r}[1]`,e[1],`string expected, ${p} found`)));for(let v=2;v{P in r&&e.push(new Pt(l,r[P],`"${P}" is prohibited for ref layers`))}),p.layers.forEach(P=>{ti(P.id)===b&&(I=P)}),I?I.ref?e.push(new Pt(l,r.ref,"ref cannot reference another ref layer")):v=ti(I.type):e.push(new Pt(l,r.ref,`ref layer "${b}" not found`))}else if(v!=="background")if(r.source){const I=p.sources&&p.sources[r.source],P=I&&ti(I.type);I?P==="vector"&&v==="raster"?e.push(new Pt(l,r.source,`layer "${r.id}" requires a raster source`)):P!=="raster-dem"&&v==="hillshade"?e.push(new Pt(l,r.source,`layer "${r.id}" requires a raster-dem source`)):P==="raster"&&v!=="raster"?e.push(new Pt(l,r.source,`layer "${r.id}" requires a vector source`)):P!=="vector"||r["source-layer"]?P==="raster-dem"&&v!=="hillshade"?e.push(new Pt(l,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):v!=="line"||!r.paint||!r.paint["line-gradient"]||P==="geojson"&&I.lineMetrics||e.push(new Pt(l,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Pt(l,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Pt(l,r.source,`source "${r.source}" not found`))}else e.push(new Pt(l,r,'missing required property "source"'));return e=e.concat(fr({key:l,value:r,valueSpec:g.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${l}.type`,value:r.type,valueSpec:g.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Dl,layout:I=>fr({layer:r,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":P=>Bl(qr({layerType:v},P))}}),paint:I=>fr({layer:r,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":P=>Ll(qr({layerType:v},P))}})}})),e}function Pn(i){const e=i.value,r=i.key,l=me(e);return l!=="string"?[new Pt(r,e,`string expected, ${l} found`)]:[]}const ba={promoteId:function({key:i,value:e}){if(me(e)==="string")return Pn({key:i,value:e});{const r=[];for(const l in e)r.push(...Pn({key:`${i}.${l}`,value:e[l]}));return r}}};function Rl(i){const e=i.value,r=i.key,l=i.styleSpec,p=i.style,g=i.validateSpec;if(!e.type)return[new Pt(r,e,'"type" is required')];const v=ti(e.type);let b;switch(v){case"vector":case"raster":return b=fr({key:r,value:e,valueSpec:l[`source_${v.replace("-","_")}`],style:i.style,styleSpec:l,objectElementValidators:ba,validateSpec:g}),b;case"raster-dem":return b=function(I){var P;const T=(P=I.sourceName)!==null&&P!==void 0?P:"",A=I.value,D=I.styleSpec,O=D.source_raster_dem,j=I.style;let q=[];const H=me(A);if(A===void 0)return q;if(H!=="object")return q.push(new Pt("source_raster_dem",A,`object expected, ${H} found`)),q;const tt=ti(A.encoding)==="custom",ct=["redFactor","greenFactor","blueFactor","baseShift"],rt=I.value.encoding?`"${I.value.encoding}"`:"Default";for(const at in A)!tt&&ct.includes(at)?q.push(new Pt(at,A[at],`In "${T}": "${at}" is only valid when "encoding" is set to "custom". ${rt} encoding found`)):O[at]?q=q.concat(I.validateSpec({key:at,value:A[at],valueSpec:O[at],validateSpec:I.validateSpec,style:j,styleSpec:D})):q.push(new Pt(at,A[at],`unknown property "${at}"`));return q}({sourceName:r,value:e,style:i.style,styleSpec:l,validateSpec:g}),b;case"geojson":if(b=fr({key:r,value:e,valueSpec:l.source_geojson,style:p,styleSpec:l,validateSpec:g,objectElementValidators:ba}),e.cluster)for(const I in e.clusterProperties){const[P,T]=e.clusterProperties[I],A=typeof P=="string"?[P,["accumulated"],["get",I]]:P;b.push(...Jn({key:`${r}.${I}.map`,value:T,validateSpec:g,expressionContext:"cluster-map"})),b.push(...Jn({key:`${r}.${I}.reduce`,value:A,validateSpec:g,expressionContext:"cluster-reduce"}))}return b;case"video":return fr({key:r,value:e,valueSpec:l.source_video,style:p,validateSpec:g,styleSpec:l});case"image":return fr({key:r,value:e,valueSpec:l.source_image,style:p,validateSpec:g,styleSpec:l});case"canvas":return[new Pt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Cs({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:p,validateSpec:g,styleSpec:l})}}function _c(i){const e=i.value,r=i.styleSpec,l=r.light,p=i.style;let g=[];const v=me(e);if(e===void 0)return g;if(v!=="object")return g=g.concat([new Pt("light",e,`object expected, ${v} found`)]),g;for(const b in e){const I=b.match(/^(.*)-transition$/);g=g.concat(I&&l[I[1]]&&l[I[1]].transition?i.validateSpec({key:b,value:e[b],valueSpec:r.transition,validateSpec:i.validateSpec,style:p,styleSpec:r}):l[b]?i.validateSpec({key:b,value:e[b],valueSpec:l[b],validateSpec:i.validateSpec,style:p,styleSpec:r}):[new Pt(b,e[b],`unknown property "${b}"`)])}return g}function Ol(i){const e=i.value,r=i.styleSpec,l=r.sky,p=i.style,g=me(e);if(e===void 0)return[];if(g!=="object")return[new Pt("sky",e,`object expected, ${g} found`)];let v=[];for(const b in e)v=v.concat(l[b]?i.validateSpec({key:b,value:e[b],valueSpec:l[b],style:p,styleSpec:r}):[new Pt(b,e[b],`unknown property "${b}"`)]);return v}function vc(i){const e=i.value,r=i.styleSpec,l=r.terrain,p=i.style;let g=[];const v=me(e);if(e===void 0)return g;if(v!=="object")return g=g.concat([new Pt("terrain",e,`object expected, ${v} found`)]),g;for(const b in e)g=g.concat(l[b]?i.validateSpec({key:b,value:e[b],valueSpec:l[b],validateSpec:i.validateSpec,style:p,styleSpec:r}):[new Pt(b,e[b],`unknown property "${b}"`)]);return g}function Vl(i){let e=[];const r=i.value,l=i.key;if(Array.isArray(r)){const p=[],g=[];for(const v in r)r[v].id&&p.includes(r[v].id)&&e.push(new Pt(l,r,`all the sprites' ids must be unique, but ${r[v].id} is duplicated`)),p.push(r[v].id),r[v].url&&g.includes(r[v].url)&&e.push(new Pt(l,r,`all the sprites' URLs must be unique, but ${r[v].url} is duplicated`)),g.push(r[v].url),e=e.concat(fr({key:`${l}[${v}]`,value:r[v],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Pn({key:l,value:r})}const Nl={"*":()=>[],array:vo,boolean:function(i){const e=i.value,r=i.key,l=me(e);return l!=="boolean"?[new Pt(r,e,`boolean expected, ${l} found`)]:[]},number:_a,color:function(i){const e=i.key,r=i.value,l=me(r);return l!=="string"?[new Pt(e,r,`color expected, ${l} found`)]:Ce.parse(String(r))?[]:[new Pt(e,r,`color expected, "${r}" found`)]},constants:ya,enum:Cs,filter:Dl,function:va,layer:Fl,object:fr,source:Rl,light:_c,sky:Ol,terrain:vc,projection:function(i){const e=i.value,r=i.styleSpec,l=r.projection,p=i.style,g=me(e);if(e===void 0)return[];if(g!=="object")return[new Pt("projection",e,`object expected, ${g} found`)];let v=[];for(const b in e)v=v.concat(l[b]?i.validateSpec({key:b,value:e[b],valueSpec:l[b],style:p,styleSpec:r}):[new Pt(b,e[b],`unknown property "${b}"`)]);return v},string:Pn,formatted:function(i){return Pn(i).length===0?[]:Jn(i)},resolvedImage:function(i){return Pn(i).length===0?[]:Jn(i)},padding:function(i){const e=i.key,r=i.value;if(me(r)==="array"){if(r.length<1||r.length>4)return[new Pt(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const l={type:"number"};let p=[];for(let g=0;g[]}})),i.constants&&(r=r.concat(ya({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ss}))),jl(r)}function Pr(i){return function(e){return i({...e,validateSpec:Ss})}}function jl(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Mr(i){return function(...e){return jl(i.apply(this,e))}}Sr.source=Mr(Pr(Rl)),Sr.sprite=Mr(Pr(Vl)),Sr.glyphs=Mr(Pr(xc)),Sr.light=Mr(Pr(_c)),Sr.sky=Mr(Pr(Ol)),Sr.terrain=Mr(Pr(vc)),Sr.layer=Mr(Pr(Fl)),Sr.filter=Mr(Pr(Dl)),Sr.paintProperty=Mr(Pr(Ll)),Sr.layoutProperty=Mr(Pr(Bl));const Yn=Sr,wa=Yn.light,Yu=Yn.sky,Ul=Yn.paintProperty,Qu=Yn.layoutProperty;function bc(i,e){let r=!1;if(e&&e.length)for(const l of e)i.fire(new vn(new Error(l.message))),r=!0;return r}class Ps{constructor(e,r,l){const p=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const v=new Int32Array(this.arrayBuffer);e=v[0],this.d=(r=v[1])+2*(l=v[2]);for(let I=0;I=A[j+0]&&p>=A[j+1])?(b[O]=!0,v.push(T[O])):b[O]=!1}}}}_forEachCell(e,r,l,p,g,v,b,I){const P=this._convertToCellCoord(e),T=this._convertToCellCoord(r),A=this._convertToCellCoord(l),D=this._convertToCellCoord(p);for(let O=P;O<=A;O++)for(let j=T;j<=D;j++){const q=this.d*j+O;if((!I||I(this._convertFromCellCoord(O),this._convertFromCellCoord(j),this._convertFromCellCoord(O+1),this._convertFromCellCoord(j+1)))&&g.call(this,e,r,l,p,q,v,b,I))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let l=0;for(let v=0;v=0)continue;const v=i[g];p[g]=Wr[r].shallow.indexOf(g)>=0?v:bo(v,e)}i instanceof Error&&(p.message=i.message)}if(p.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(p.$name=r),p}function wo(i){if(Ic(i))return i;if(Array.isArray(i))return i.map(wo);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=ql(i)||"Object";if(!Wr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Wr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const l=Object.create(r.prototype);for(const p of Object.keys(i)){if(p==="$name")continue;const g=i[p];l[p]=Wr[e].shallow.indexOf(p)>=0?g:wo(g)}return l}class Qn{constructor(){this.first=!0}update(e,r){const l=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function $l(i){for(const e of i)if(cn(e.charCodeAt(0)))return!0;return!1}function td(i){for(const e of i)if(!ed(e.charCodeAt(0)))return!1;return!0}function Zl(i){const e=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}const Cc=Zl(["Arab","Dupl","Mong","Ougr","Syrc"]);function ed(i){return!Cc.test(String.fromCodePoint(i))}const Sc=Zl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function cn(i){return!(i!==746&&i!==747&&(i<4352||!(fe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||fe["CJK Compatibility"](i)||fe["CJK Strokes"](i)||!(!fe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||fe["Enclosed CJK Letters and Months"](i)||fe["Ideographic Description Characters"](i)||fe.Kanbun(i)||fe.Katakana(i)&&i!==12540||!(!fe["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!fe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||fe["Vertical Forms"](i)||fe["Yijing Hexagram Symbols"](i)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(i))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(i))||Sc.test(String.fromCodePoint(i)))))}function Gl(i){return!(cn(i)||function(e){return!!(fe["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||fe["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||fe["Letterlike Symbols"](e)||fe["Number Forms"](e)||fe["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||fe["Control Pictures"](e)&&e!==9251||fe["Optical Character Recognition"](e)||fe["Enclosed Alphanumerics"](e)||fe["Geometric Shapes"](e)||fe["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||fe["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||fe["CJK Symbols and Punctuation"](e)||fe.Katakana(e)||fe["Private Use Area"](e)||fe["CJK Compatibility Forms"](e)||fe["Small Form Variants"](e)||fe["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}const Xl=Zl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Wl(i){return Xl.test(String.fromCodePoint(i))}function Hl(i,e){return!(!e&&Wl(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||fe.Khmer(i))}function id(i){for(const e of i)if(Wl(e.charCodeAt(0)))return!0;return!1}const Hr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Me{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Qn,this.transition={})}isSupportedScript(e){return function(r,l){for(const p of r)if(!Hl(p.charCodeAt(0),l))return!1;return!0}(e,Hr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),l=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*r}}}class Ia{constructor(e,r){this.property=e,this.value=r,this.expression=function(l,p){if(da(l))return new fa(l,p);if(fo(l)){const g=gc(l,p);if(g.result==="error")throw new Error(g.value.map(v=>`${v.key}: ${v.message}`).join(", "));return g.value}{let g=l;return p.type==="color"&&typeof l=="string"?g=Ce.parse(l):p.type!=="padding"||typeof l!="number"&&!Array.isArray(l)?p.type==="variableAnchorOffsetCollection"&&Array.isArray(l)&&(g=er.parse(l)):g=tr.parse(l),{kind:"constant",evaluate:()=>g}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,l){return this.property.possiblyEvaluate(this,e,r,l)}}class Ca{constructor(e){this.property=e,this.value=new Ia(e,void 0)}transitioned(e,r){return new Pc(this.property,this.value,r,ye({},e.transition,this.transition),e.now)}untransitioned(){return new Pc(this.property,this.value,null,{},0)}}class Ms{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return le(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ca(this._values[e].property)),this._values[e].value=new Ia(this._values[e].property,r===null?void 0:le(r))}getTransition(e){return le(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ca(this._values[e].property)),this._values[e].transition=le(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const l=this.getValue(r);l!==void 0&&(e[r]=l);const p=this.getTransition(r);p!==void 0&&(e[`${r}-transition`]=p)}return e}transitioned(e,r){const l=new Mc(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].transitioned(e,r._values[p]);return l}untransitioned(){const e=new Mc(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Pc{constructor(e,r,l,p,g){this.property=e,this.value=r,this.begin=g+p.delay||0,this.end=this.begin+p.duration||0,e.specification.transition&&(p.delay||p.duration)&&(this.prior=l)}possiblyEvaluate(e,r,l){const p=e.now||0,g=this.value.possiblyEvaluate(e,r,l),v=this.prior;if(v){if(p>this.end)return this.prior=null,g;if(this.value.isDataDriven())return this.prior=null,g;if(p=1)return 1;const P=I*I,T=P*I;return 4*(I<.5?T:3*(I-P)+T-.75)}(b))}}return g}}class Mc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,l){const p=new y(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].possiblyEvaluate(e,r,l);return p}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ec{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return le(this._values[e].value)}setValue(e,r){this._values[e]=new Ia(this._values[e].property,r===null?void 0:le(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const l=this.getValue(r);l!==void 0&&(e[r]=l)}return e}possiblyEvaluate(e,r,l){const p=new y(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].possiblyEvaluate(e,r,l);return p}}class Kr{constructor(e,r,l){this.property=e,this.value=r,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,l,p){return this.property.evaluate(this.value,this.parameters,e,r,l,p)}}class y{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,l){const p=ir[this.specification.type];return p?p(e,r,l):e}}class o{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,l,p){return new Kr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},l,p)}:e.expression,r)}interpolate(e,r,l){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Kr(this,{kind:"constant",value:void 0},e.parameters);const p=ir[this.specification.type];if(p){const g=p(e.value.value,r.value.value,l);return new Kr(this,{kind:"constant",value:g},e.parameters)}return e}evaluate(e,r,l,p,g,v){return e.kind==="constant"?e.value:e.evaluate(r,l,p,g,v)}}class u extends o{possiblyEvaluate(e,r,l,p){if(e.value===void 0)return new Kr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const g=e.expression.evaluate(r,null,{},l,p),v=e.property.specification.type==="resolvedImage"&&typeof g!="string"?g.name:g,b=this._calculate(v,v,v,r);return new Kr(this,{kind:"constant",value:b},r)}if(e.expression.kind==="camera"){const g=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Kr(this,{kind:"constant",value:g},r)}return new Kr(this,e.expression,r)}evaluate(e,r,l,p,g,v){if(e.kind==="source"){const b=e.evaluate(r,l,p,g,v);return this._calculate(b,b,b,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},l,p),e.evaluate({zoom:Math.floor(r.zoom)},l,p),e.evaluate({zoom:Math.floor(r.zoom)+1},l,p),r):e.value}_calculate(e,r,l,p){return p.zoom>p.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:l,to:r}}interpolate(e){return e}}class d{constructor(e){this.specification=e}possiblyEvaluate(e,r,l,p){if(e.value!==void 0){if(e.expression.kind==="constant"){const g=e.expression.evaluate(r,null,{},l,p);return this._calculate(g,g,g,r)}return this._calculate(e.expression.evaluate(new Me(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Me(Math.floor(r.zoom),r)),e.expression.evaluate(new Me(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,l,p){return p.zoom>p.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:l,to:r}}interpolate(e){return e}}class _{constructor(e){this.specification=e}possiblyEvaluate(e,r,l,p){return!!e.expression.evaluate(r,null,{},l,p)}interpolate(){return!1}}class w{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const l=e[r];l.specification.overridable&&this.overridableProperties.push(r);const p=this.defaultPropertyValues[r]=new Ia(l,void 0),g=this.defaultTransitionablePropertyValues[r]=new Ca(l);this.defaultTransitioningPropertyValues[r]=g.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=p.possiblyEvaluate({})}}}Rt("DataDrivenProperty",o),Rt("DataConstantProperty",t),Rt("CrossFadedDataDrivenProperty",u),Rt("CrossFadedProperty",d),Rt("ColorRampProperty",_);const C="-transition";class S extends ps{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Ec(r.layout)),r.paint)){this._transitionablePaint=new Ms(r.paint);for(const l in e.paint)this.setPaintProperty(l,e.paint[l],{validate:!1});for(const l in e.layout)this.setLayoutProperty(l,e.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new y(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,l={}){r!=null&&this._validate(Qu,`layers.${this.id}.layout.${e}`,e,r,l)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(C)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,l={}){if(r!=null&&this._validate(Ul,`layers.${this.id}.paint.${e}`,e,r,l))return!1;if(e.endsWith(C))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const p=this._transitionablePaint._values[e],g=p.property.specification["property-type"]==="cross-faded-data-driven",v=p.value.isDataDriven(),b=p.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const I=this._transitionablePaint._values[e].value;return I.isDataDriven()||v||g||this._handleOverridablePaintPropertyUpdate(e,b,I)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,l){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),pi(e,(r,l)=>!(r===void 0||l==="layout"&&!Object.keys(r).length||l==="paint"&&!Object.keys(r).length))}_validate(e,r,l,p,g={}){return(!g||g.validate!==!1)&&bc(this,e.call(Yn,{key:r,layerType:this.type,objectKey:l,value:p,styleSpec:ft,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Kr&&vs(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const E={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class k{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class z{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(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 r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function N(i,e=1){let r=0,l=0;return{members:i.map(p=>{const g=E[p.type].BYTES_PER_ELEMENT,v=r=Z(r,Math.max(e,g)),b=p.components||1;return l=Math.max(l,g),r+=g*b,{name:p.name,type:p.type,components:b,offset:v}}),size:Z(r,Math.max(l,e)),alignment:e}}function Z(i,e){return Math.ceil(i/e)*e}class G extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,r)}emplace(e,r,l){const p=2*e;return this.int16[p+0]=r,this.int16[p+1]=l,e}}G.prototype.bytesPerElement=4,Rt("StructArrayLayout2i4",G);class J extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,l)}emplace(e,r,l,p){const g=3*e;return this.int16[g+0]=r,this.int16[g+1]=l,this.int16[g+2]=p,e}}J.prototype.bytesPerElement=6,Rt("StructArrayLayout3i6",J);class X extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p){const g=this.length;return this.resize(g+1),this.emplace(g,e,r,l,p)}emplace(e,r,l,p,g){const v=4*e;return this.int16[v+0]=r,this.int16[v+1]=l,this.int16[v+2]=p,this.int16[v+3]=g,e}}X.prototype.bytesPerElement=8,Rt("StructArrayLayout4i8",X);class Q extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,l,p,g,v)}emplace(e,r,l,p,g,v,b){const I=6*e;return this.int16[I+0]=r,this.int16[I+1]=l,this.int16[I+2]=p,this.int16[I+3]=g,this.int16[I+4]=v,this.int16[I+5]=b,e}}Q.prototype.bytesPerElement=12,Rt("StructArrayLayout2i4i12",Q);class it extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,l,p,g,v)}emplace(e,r,l,p,g,v,b){const I=4*e,P=8*e;return this.int16[I+0]=r,this.int16[I+1]=l,this.uint8[P+4]=p,this.uint8[P+5]=g,this.uint8[P+6]=v,this.uint8[P+7]=b,e}}it.prototype.bytesPerElement=8,Rt("StructArrayLayout2i4ub8",it);class W extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,r)}emplace(e,r,l){const p=2*e;return this.float32[p+0]=r,this.float32[p+1]=l,e}}W.prototype.bytesPerElement=8,Rt("StructArrayLayout2f8",W);class ot extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v,b,I,P,T){const A=this.length;return this.resize(A+1),this.emplace(A,e,r,l,p,g,v,b,I,P,T)}emplace(e,r,l,p,g,v,b,I,P,T,A){const D=10*e;return this.uint16[D+0]=r,this.uint16[D+1]=l,this.uint16[D+2]=p,this.uint16[D+3]=g,this.uint16[D+4]=v,this.uint16[D+5]=b,this.uint16[D+6]=I,this.uint16[D+7]=P,this.uint16[D+8]=T,this.uint16[D+9]=A,e}}ot.prototype.bytesPerElement=20,Rt("StructArrayLayout10ui20",ot);class ht extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v,b,I,P,T,A,D){const O=this.length;return this.resize(O+1),this.emplace(O,e,r,l,p,g,v,b,I,P,T,A,D)}emplace(e,r,l,p,g,v,b,I,P,T,A,D,O){const j=12*e;return this.int16[j+0]=r,this.int16[j+1]=l,this.int16[j+2]=p,this.int16[j+3]=g,this.uint16[j+4]=v,this.uint16[j+5]=b,this.uint16[j+6]=I,this.uint16[j+7]=P,this.int16[j+8]=T,this.int16[j+9]=A,this.int16[j+10]=D,this.int16[j+11]=O,e}}ht.prototype.bytesPerElement=24,Rt("StructArrayLayout4i4ui4i24",ht);class dt extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,l)}emplace(e,r,l,p){const g=3*e;return this.float32[g+0]=r,this.float32[g+1]=l,this.float32[g+2]=p,e}}dt.prototype.bytesPerElement=12,Rt("StructArrayLayout3f12",dt);class xt extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}xt.prototype.bytesPerElement=4,Rt("StructArrayLayout1ul4",xt);class It extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v,b,I,P){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,l,p,g,v,b,I,P)}emplace(e,r,l,p,g,v,b,I,P,T){const A=10*e,D=5*e;return this.int16[A+0]=r,this.int16[A+1]=l,this.int16[A+2]=p,this.int16[A+3]=g,this.int16[A+4]=v,this.int16[A+5]=b,this.uint32[D+3]=I,this.uint16[A+8]=P,this.uint16[A+9]=T,e}}It.prototype.bytesPerElement=20,Rt("StructArrayLayout6i1ul2ui20",It);class Bt extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,l,p,g,v)}emplace(e,r,l,p,g,v,b){const I=6*e;return this.int16[I+0]=r,this.int16[I+1]=l,this.int16[I+2]=p,this.int16[I+3]=g,this.int16[I+4]=v,this.int16[I+5]=b,e}}Bt.prototype.bytesPerElement=12,Rt("StructArrayLayout2i2i2i12",Bt);class Ft extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,r,l,p,g)}emplace(e,r,l,p,g,v){const b=4*e,I=8*e;return this.float32[b+0]=r,this.float32[b+1]=l,this.float32[b+2]=p,this.int16[I+6]=g,this.int16[I+7]=v,e}}Ft.prototype.bytesPerElement=16,Rt("StructArrayLayout2f1f2i16",Ft);class Ct extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,l,p,g,v)}emplace(e,r,l,p,g,v,b){const I=16*e,P=4*e,T=8*e;return this.uint8[I+0]=r,this.uint8[I+1]=l,this.float32[P+1]=p,this.float32[P+2]=g,this.int16[T+6]=v,this.int16[T+7]=b,e}}Ct.prototype.bytesPerElement=16,Rt("StructArrayLayout2ub2f2i16",Ct);class St extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,l)}emplace(e,r,l,p){const g=3*e;return this.uint16[g+0]=r,this.uint16[g+1]=l,this.uint16[g+2]=p,e}}St.prototype.bytesPerElement=6,Rt("StructArrayLayout3ui6",St);class Ut extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt){const ct=this.length;return this.resize(ct+1),this.emplace(ct,e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt)}emplace(e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt,ct){const rt=24*e,at=12*e,mt=48*e;return this.int16[rt+0]=r,this.int16[rt+1]=l,this.uint16[rt+2]=p,this.uint16[rt+3]=g,this.uint32[at+2]=v,this.uint32[at+3]=b,this.uint32[at+4]=I,this.uint16[rt+10]=P,this.uint16[rt+11]=T,this.uint16[rt+12]=A,this.float32[at+7]=D,this.float32[at+8]=O,this.uint8[mt+36]=j,this.uint8[mt+37]=q,this.uint8[mt+38]=H,this.uint32[at+10]=tt,this.int16[rt+22]=ct,e}}Ut.prototype.bytesPerElement=48,Rt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ut);class te extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt,ct,rt,at,mt,wt,Lt,Ht,Dt,zt,$t,Nt){const Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt,ct,rt,at,mt,wt,Lt,Ht,Dt,zt,$t,Nt)}emplace(e,r,l,p,g,v,b,I,P,T,A,D,O,j,q,H,tt,ct,rt,at,mt,wt,Lt,Ht,Dt,zt,$t,Nt,Ot){const _t=32*e,Zt=16*e;return this.int16[_t+0]=r,this.int16[_t+1]=l,this.int16[_t+2]=p,this.int16[_t+3]=g,this.int16[_t+4]=v,this.int16[_t+5]=b,this.int16[_t+6]=I,this.int16[_t+7]=P,this.uint16[_t+8]=T,this.uint16[_t+9]=A,this.uint16[_t+10]=D,this.uint16[_t+11]=O,this.uint16[_t+12]=j,this.uint16[_t+13]=q,this.uint16[_t+14]=H,this.uint16[_t+15]=tt,this.uint16[_t+16]=ct,this.uint16[_t+17]=rt,this.uint16[_t+18]=at,this.uint16[_t+19]=mt,this.uint16[_t+20]=wt,this.uint16[_t+21]=Lt,this.uint16[_t+22]=Ht,this.uint32[Zt+12]=Dt,this.float32[Zt+13]=zt,this.float32[Zt+14]=$t,this.uint16[_t+30]=Nt,this.uint16[_t+31]=Ot,e}}te.prototype.bytesPerElement=64,Rt("StructArrayLayout8i15ui1ul2f2ui64",te);class Et extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}Et.prototype.bytesPerElement=4,Rt("StructArrayLayout1f4",Et);class kt extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,l)}emplace(e,r,l,p){const g=3*e;return this.uint16[6*e+0]=r,this.float32[g+1]=l,this.float32[g+2]=p,e}}kt.prototype.bytesPerElement=12,Rt("StructArrayLayout1ui2f12",kt);class Jt extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,l)}emplace(e,r,l,p){const g=4*e;return this.uint32[2*e+0]=r,this.uint16[g+2]=l,this.uint16[g+3]=p,e}}Jt.prototype.bytesPerElement=8,Rt("StructArrayLayout1ul2ui8",Jt);class Le extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const l=this.length;return this.resize(l+1),this.emplace(l,e,r)}emplace(e,r,l){const p=2*e;return this.uint16[p+0]=r,this.uint16[p+1]=l,e}}Le.prototype.bytesPerElement=4,Rt("StructArrayLayout2ui4",Le);class ae extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}ae.prototype.bytesPerElement=2,Rt("StructArrayLayout1ui2",ae);class de extends z{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,l,p){const g=this.length;return this.resize(g+1),this.emplace(g,e,r,l,p)}emplace(e,r,l,p,g){const v=4*e;return this.float32[v+0]=r,this.float32[v+1]=l,this.float32[v+2]=p,this.float32[v+3]=g,e}}de.prototype.bytesPerElement=16,Rt("StructArrayLayout4f16",de);class Ve extends k{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}}Ve.prototype.size=20;class Pi extends It{get(e){return new Ve(this,e)}}Rt("CollisionBoxArray",Pi);class Er extends k{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Er.prototype.size=48;class Ne extends Ut{get(e){return new Er(this,e)}}Rt("PlacedSymbolArray",Ne);class $i extends k{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}$i.prototype.size=64;class Ri extends te{get(e){return new $i(this,e)}}Rt("SymbolInstanceArray",Ri);class Mi extends Et{getoffsetX(e){return this.float32[1*e+0]}}Rt("GlyphOffsetArray",Mi);class Ei extends J{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Rt("SymbolLineVertexArray",Ei);class Tr extends k{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Tr.prototype.size=12;class ts extends kt{get(e){return new Tr(this,e)}}Rt("TextAnchorOffsetArray",ts);class Io extends k{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]}}Io.prototype.size=8;class es extends Jt{get(e){return new Io(this,e)}}Rt("FeatureIndexArray",es);class Mn extends G{}class Sa extends G{}class Kl extends G{}class mr extends Q{}class Ar extends it{}class En extends W{}class zr extends ot{}class Oi extends ht{}class Ti extends dt{}class or extends xt{}class Ke extends Bt{}class Es extends Ct{}class Tn extends St{}class Co extends Le{}const rd=N([{name:"a_pos",components:2,type:"Int16"}],4),{members:nd}=rd;class bi{constructor(e=[]){this.segments=e}prepareSegment(e,r,l,p){let g=this.segments[this.segments.length-1];return e>bi.MAX_VERTEX_ARRAY_LENGTH&&qe(`Max vertices per segment is ${bi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!g||g.vertexLength+e>bi.MAX_VERTEX_ARRAY_LENGTH||g.sortKey!==p)&&(g={vertexOffset:r.length,primitiveOffset:l.length,vertexLength:0,primitiveLength:0},p!==void 0&&(g.sortKey=p),this.segments.push(g)),g}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,l,p){return new bi([{vertexOffset:e,primitiveOffset:r,vertexLength:l,primitiveLength:p,vaos:{},sortKey:0}])}}function An(i,e){return 256*(i=ce(Math.floor(i),0,255))+ce(Math.floor(e),0,255)}bi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Rt("SegmentVector",bi);const So=N([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Po={exports:{}},Jl={exports:{}};Jl.exports=function(i,e){var r,l,p,g,v,b,I,P;for(l=i.length-(r=3&i.length),p=e,v=3432918353,b=461845907,P=0;P>>16)*v&65535)<<16)&4294967295)<<15|I>>>17))*b+(((I>>>16)*b&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(I=0,r){case 3:I^=(255&i.charCodeAt(P+2))<<16;case 2:I^=(255&i.charCodeAt(P+1))<<8;case 1:p^=I=(65535&(I=(I=(65535&(I^=255&i.charCodeAt(P)))*v+(((I>>>16)*v&65535)<<16)&4294967295)<<15|I>>>17))*b+(((I>>>16)*b&65535)<<16)&4294967295}return p^=i.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0};var Yl=Jl.exports,Ql={exports:{}};Ql.exports=function(i,e){for(var r,l=i.length,p=e^l,g=0;l>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(g)|(255&i.charCodeAt(++g))<<8|(255&i.charCodeAt(++g))<<16|(255&i.charCodeAt(++g))<<24))+((1540483477*(r>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),l-=4,++g;switch(l){case 3:p^=(255&i.charCodeAt(g+2))<<16;case 2:p^=(255&i.charCodeAt(g+1))<<8;case 1:p=1540483477*(65535&(p^=255&i.charCodeAt(g)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0};var Pa=Yl,Ny=Ql.exports;Po.exports=Pa,Po.exports.murmur3=Pa,Po.exports.murmur2=Ny;var sd=M(Po.exports);class Tc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,l,p){this.ids.push(tf(e)),this.positions.push(r,l,p)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=tf(e);let l=0,p=this.ids.length-1;for(;l>1;this.ids[v]>=r?p=v:l=v+1}const g=[];for(;this.ids[l]===r;)g.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return g}static serialize(e,r){const l=new Float64Array(e.ids),p=new Uint32Array(e.positions);return od(l,p,0,l.length-1),r&&r.push(l.buffer,p.buffer),{ids:l,positions:p}}static deserialize(e){const r=new Tc;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function tf(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:sd(String(i))}function od(i,e,r,l){for(;r>1];let g=r-1,v=l+1;for(;;){do g++;while(i[g]p);if(g>=v)break;Ac(i,g,v),Ac(e,3*g,3*v),Ac(e,3*g+1,3*v+1),Ac(e,3*g+2,3*v+2)}v-r`u_${p}`),this.type=l}setUniform(e,r,l){e.set(l.constantOr(this.value))}getBinding(e,r,l){return this.type==="color"?new rf(e,r):new zc(e,r)}}class Ma{constructor(e,r){this.uniformNames=r.map(l=>`u_${l}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,l,p){const g=p==="u_pattern_to"?this.patternTo:p==="u_pattern_from"?this.patternFrom:p==="u_pixel_ratio_to"?this.pixelRatioTo:p==="u_pixel_ratio_from"?this.pixelRatioFrom:null;g&&e.set(g)}getBinding(e,r,l){return l.substr(0,9)==="u_pattern"?new ef(e,r):new zc(e,r)}}class is{constructor(e,r,l,p){this.expression=e,this.type=l,this.maxValue=0,this.paintVertexAttributes=r.map(g=>({name:`a_${g}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,l,p,g){const v=this.paintVertexArray.length,b=this.expression.evaluate(new Me(0),r,{},p,[],g);this.paintVertexArray.resize(e),this._setPaintValue(v,e,b)}updatePaintArray(e,r,l,p){const g=this.expression.evaluate({zoom:0},l,p);this._setPaintValue(e,r,g)}_setPaintValue(e,r,l){if(this.type==="color"){const p=ad(l);for(let g=e;g`u_${b}_t`),this.type=l,this.useIntegerZoom=p,this.zoom=g,this.maxValue=0,this.paintVertexAttributes=r.map(b=>({name:`a_${b}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new v}populatePaintArray(e,r,l,p,g){const v=this.expression.evaluate(new Me(this.zoom),r,{},p,[],g),b=this.expression.evaluate(new Me(this.zoom+1),r,{},p,[],g),I=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(I,e,v,b)}updatePaintArray(e,r,l,p){const g=this.expression.evaluate({zoom:this.zoom},l,p),v=this.expression.evaluate({zoom:this.zoom+1},l,p);this._setPaintValue(e,r,g,v)}_setPaintValue(e,r,l,p){if(this.type==="color"){const g=ad(l),v=ad(p);for(let b=e;b`#define HAS_UNIFORM_${p}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const l=this.binders[r];if(l instanceof is||l instanceof un)for(let p=0;p!0){this.programConfigurations={};for(const p of e)this.programConfigurations[p.id]=new nf(p,r,l);this.needsUpload=!1,this._featureMap=new Tc,this._bufferOffset=0}populatePaintArrays(e,r,l,p,g,v){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(e,r,p,g,v);r.id!==void 0&&this._featureMap.add(r.id,l,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,l,p){for(const g of l)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,r,g,p)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Uy(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function sf(i,e,r){const l={color:{source:W,composite:de},number:{source:Et,composite:W}},p=function(g){return{"line-pattern":{source:zr,composite:zr},"fill-pattern":{source:zr,composite:zr},"fill-extrusion-pattern":{source:zr,composite:zr}}[g]}(i);return p&&p[r]||l[e][r]}Rt("ConstantBinder",th),Rt("CrossFadedConstantBinder",Ma),Rt("SourceExpressionBinder",is),Rt("CrossFadedCompositeBinder",Ts),Rt("CompositeExpressionBinder",un),Rt("ProgramConfiguration",nf,{omit:["_buffers"]}),Rt("ProgramConfigurationSet",Eo);const hi=8192,ld=Math.pow(2,14)-1,of=-ld-1;function To(i){const e=hi/i.extent,r=i.loadGeometry();for(let l=0;lv.x+1||Iv.y+1)&&qe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ao(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?To(i):[]}}function kc(i,e,r,l,p){i.emplaceBack(2*e+(l+1)/2,2*r+(p+1)/2)}class hd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Sa,this.indexArray=new Tn,this.segments=new bi,this.programConfigurations=new Eo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,l){const p=this.layers[0],g=[];let v=null,b=!1;p.type==="circle"&&(v=p.layout.get("circle-sort-key"),b=!v.isConstant());for(const{feature:I,id:P,index:T,sourceLayerIndex:A}of e){const D=this.layers[0]._featureFilter.needGeometry,O=Ao(I,D);if(!this.layers[0]._featureFilter.filter(new Me(this.zoom),O,l))continue;const j=b?v.evaluate(O,{},l):void 0,q={id:P,properties:I.properties,type:I.type,sourceLayerIndex:A,index:T,geometry:D?O.geometry:To(I),patterns:{},sortKey:j};g.push(q)}b&&g.sort((I,P)=>I.sortKey-P.sortKey);for(const I of g){const{geometry:P,index:T,sourceLayerIndex:A}=I,D=e[T].feature;this.addFeature(I,P,T,l),r.featureIndex.insert(D,P,T,A,this.index)}}update(e,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,l,p){for(const g of r)for(const v of g){const b=v.x,I=v.y;if(b<0||b>=hi||I<0||I>=hi)continue;const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=P.vertexLength;kc(this.layoutVertexArray,b,I,-1,-1),kc(this.layoutVertexArray,b,I,1,-1),kc(this.layoutVertexArray,b,I,1,1),kc(this.layoutVertexArray,b,I,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,l,{},p)}}function af(i,e){for(let r=0;r1){if(cd(i,e))return!0;for(let l=0;l1?r:r.sub(e)._mult(p)._add(e))}function cf(i,e){let r,l,p,g=!1;for(let v=0;ve.y!=p.y>e.y&&e.x<(p.x-l.x)*(e.y-l.y)/(p.y-l.y)+l.x&&(g=!g)}return g}function Ea(i,e){let r=!1;for(let l=0,p=i.length-1;le.y!=v.y>e.y&&e.x<(v.x-g.x)*(e.y-g.y)/(v.y-g.y)+g.x&&(r=!r)}return r}function Gy(i,e,r){const l=r[0],p=r[2];if(i.xp.x&&e.x>p.x||i.yp.y&&e.y>p.y)return!1;const g=ri(i,e,r[0]);return g!==ri(i,e,r[1])||g!==ri(i,e,r[2])||g!==ri(i,e,r[3])}function eh(i,e,r){const l=e.paint.get(i).value;return l.kind==="constant"?l.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Dc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Lc(i,e,r,l,p){if(!e[0]&&!e[1])return i;const g=B.convert(e)._mult(p);r==="viewport"&&g._rotate(-l);const v=[];for(let b=0;bff(H,q))}(P,I),O=A?T*b:T;for(const j of p)for(const q of j){const H=A?q:ff(q,I);let tt=O;const ct=Bc([],[q.x,q.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?tt*=ct[3]/v.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(tt*=v.cameraToCenterDistance/ct[3]),qy(D,H,tt))return!0}return!1}}function ff(i,e){const r=Bc([],[i.x,i.y,0,1],e);return new B(r[0]/r[3],r[1]/r[3])}class mf extends hd{}let gf;Rt("HeatmapBucket",mf,{omit:["layers"]});var Ky={get paint(){return gf=gf||new w({"heatmap-radius":new o(ft.paint_heatmap["heatmap-radius"]),"heatmap-weight":new o(ft.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new t(ft.paint_heatmap["heatmap-intensity"]),"heatmap-color":new _(ft.paint_heatmap["heatmap-color"]),"heatmap-opacity":new t(ft.paint_heatmap["heatmap-opacity"])})}};function pd(i,{width:e,height:r},l,p){if(p){if(p instanceof Uint8ClampedArray)p=new Uint8Array(p.buffer);else if(p.length!==e*r*l)throw new RangeError(`mismatched image size. expected: ${p.length} but got: ${e*r*l}`)}else p=new Uint8Array(e*r*l);return i.width=e,i.height=r,i.data=p,i}function yf(i,{width:e,height:r},l){if(e===i.width&&r===i.height)return;const p=pd({},{width:e,height:r},l);fd(i,p,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},l),i.width=e,i.height=r,i.data=p.data}function fd(i,e,r,l,p,g){if(p.width===0||p.height===0)return e;if(p.width>i.width||p.height>i.height||r.x>i.width-p.width||r.y>i.height-p.height)throw new RangeError("out of range source coordinates for image copy");if(p.width>e.width||p.height>e.height||l.x>e.width-p.width||l.y>e.height-p.height)throw new RangeError("out of range destination coordinates for image copy");const v=i.data,b=e.data;if(v===b)throw new Error("srcData equals dstData, so image is already copied");for(let I=0;I{e[i.evaluationKey]=I;const P=i.expression.evaluate(e);p.data[v+b+0]=Math.floor(255*P.r/P.a),p.data[v+b+1]=Math.floor(255*P.g/P.a),p.data[v+b+2]=Math.floor(255*P.b/P.a),p.data[v+b+3]=Math.floor(255*P.a)};if(i.clips)for(let v=0,b=0;v80*r){b=1/0,I=1/0;let T=-1/0,A=-1/0;for(let D=r;DT&&(T=O),j>A&&(A=j)}P=Math.max(T-b,A-I),P=P!==0?32767/P:0}return nh(g,v,r,b,I,P,0),v}function bf(i,e,r,l,p){let g;if(p===function(v,b,I,P){let T=0;for(let A=b,D=I-P;A0)for(let v=e;v=e;v-=l)g=Cf(v/l|0,i[v],i[v+1],g);return g&&Fc(g,g.next)&&(oh(g),g=g.next),g}function zo(i,e){if(!i)return i;e||(e=i);let r,l=i;do if(r=!1,l.steiner||!Fc(l,l.next)&&si(l.prev,l,l.next)!==0)l=l.next;else{if(oh(l),l=e=l.prev,l===l.next)break;r=!0}while(r||l!==e);return e}function nh(i,e,r,l,p,g,v){if(!i)return;!v&&g&&function(I,P,T,A){let D=I;do D.z===0&&(D.z=md(D.x,D.y,P,T,A)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==I);D.prevZ.nextZ=null,D.prevZ=null,function(O){let j,q=1;do{let H,tt=O;O=null;let ct=null;for(j=0;tt;){j++;let rt=tt,at=0;for(let wt=0;wt0||mt>0&&rt;)at!==0&&(mt===0||!rt||tt.z<=rt.z)?(H=tt,tt=tt.nextZ,at--):(H=rt,rt=rt.nextZ,mt--),ct?ct.nextZ=H:O=H,H.prevZ=ct,ct=H;tt=rt}ct.nextZ=null,q*=2}while(j>1)}(D)}(i,l,p,g);let b=i;for(;i.prev!==i.next;){const I=i.prev,P=i.next;if(g?r_(i,l,p,g):i_(i))e.push(I.i,i.i,P.i),oh(i),i=P.next,b=P.next;else if((i=P)===b){v?v===1?nh(i=n_(zo(i),e),e,r,l,p,g,2):v===2&&s_(i,e,r,l,p,g):nh(zo(i),e,r,l,p,g,1);break}}}function i_(i){const e=i.prev,r=i,l=i.next;if(si(e,r,l)>=0)return!1;const p=e.x,g=r.x,v=l.x,b=e.y,I=r.y,P=l.y,T=pg?p>v?p:v:g>v?g:v,O=b>I?b>P?b:P:I>P?I:P;let j=l.next;for(;j!==e;){if(j.x>=T&&j.x<=D&&j.y>=A&&j.y<=O&&Aa(p,b,g,I,v,P,j.x,j.y)&&si(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function r_(i,e,r,l){const p=i.prev,g=i,v=i.next;if(si(p,g,v)>=0)return!1;const b=p.x,I=g.x,P=v.x,T=p.y,A=g.y,D=v.y,O=bI?b>P?b:P:I>P?I:P,H=T>A?T>D?T:D:A>D?A:D,tt=md(O,j,e,r,l),ct=md(q,H,e,r,l);let rt=i.prevZ,at=i.nextZ;for(;rt&&rt.z>=tt&&at&&at.z<=ct;){if(rt.x>=O&&rt.x<=q&&rt.y>=j&&rt.y<=H&&rt!==p&&rt!==v&&Aa(b,T,I,A,P,D,rt.x,rt.y)&&si(rt.prev,rt,rt.next)>=0||(rt=rt.prevZ,at.x>=O&&at.x<=q&&at.y>=j&&at.y<=H&&at!==p&&at!==v&&Aa(b,T,I,A,P,D,at.x,at.y)&&si(at.prev,at,at.next)>=0))return!1;at=at.nextZ}for(;rt&&rt.z>=tt;){if(rt.x>=O&&rt.x<=q&&rt.y>=j&&rt.y<=H&&rt!==p&&rt!==v&&Aa(b,T,I,A,P,D,rt.x,rt.y)&&si(rt.prev,rt,rt.next)>=0)return!1;rt=rt.prevZ}for(;at&&at.z<=ct;){if(at.x>=O&&at.x<=q&&at.y>=j&&at.y<=H&&at!==p&&at!==v&&Aa(b,T,I,A,P,D,at.x,at.y)&&si(at.prev,at,at.next)>=0)return!1;at=at.nextZ}return!0}function n_(i,e){let r=i;do{const l=r.prev,p=r.next.next;!Fc(l,p)&&wf(l,r,r.next,p)&&sh(l,p)&&sh(p,l)&&(e.push(l.i,r.i,p.i),oh(r),oh(r.next),r=i=p),r=r.next}while(r!==i);return zo(r)}function s_(i,e,r,l,p,g){let v=i;do{let b=v.next.next;for(;b!==v.prev;){if(v.i!==b.i&&c_(v,b)){let I=If(v,b);return v=zo(v,v.next),I=zo(I,I.next),nh(v,e,r,l,p,g,0),void nh(I,e,r,l,p,g,0)}b=b.next}v=v.next}while(v!==i)}function o_(i,e){return i.x-e.x}function a_(i,e){const r=function(p,g){let v=g;const b=p.x,I=p.y;let P,T=-1/0;do{if(I<=v.y&&I>=v.next.y&&v.next.y!==v.y){const q=v.x+(I-v.y)*(v.next.x-v.x)/(v.next.y-v.y);if(q<=b&&q>T&&(T=q,P=v.x=v.x&&v.x>=D&&b!==v.x&&Aa(IP.x||v.x===P.x&&l_(P,v)))&&(P=v,j=q)}v=v.next}while(v!==A);return P}(i,e);if(!r)return e;const l=If(r,i);return zo(l,l.next),zo(r,r.next)}function l_(i,e){return si(i.prev,i,e.prev)<0&&si(e.next,i,i.next)<0}function md(i,e,r,l,p){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*p|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-l)*p|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function h_(i){let e=i,r=i;do(e.x=(i-v)*(g-b)&&(i-v)*(l-b)>=(r-v)*(e-b)&&(r-v)*(g-b)>=(p-v)*(l-b)}function c_(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,l){let p=r;do{if(p.i!==r.i&&p.next.i!==r.i&&p.i!==l.i&&p.next.i!==l.i&&wf(p,p.next,r,l))return!0;p=p.next}while(p!==r);return!1}(i,e)&&(sh(i,e)&&sh(e,i)&&function(r,l){let p=r,g=!1;const v=(r.x+l.x)/2,b=(r.y+l.y)/2;do p.y>b!=p.next.y>b&&p.next.y!==p.y&&v<(p.next.x-p.x)*(b-p.y)/(p.next.y-p.y)+p.x&&(g=!g),p=p.next;while(p!==r);return g}(i,e)&&(si(i.prev,i,e.prev)||si(i,e.prev,e))||Fc(i,e)&&si(i.prev,i,i.next)>0&&si(e.prev,e,e.next)>0)}function si(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Fc(i,e){return i.x===e.x&&i.y===e.y}function wf(i,e,r,l){const p=Oc(si(i,e,r)),g=Oc(si(i,e,l)),v=Oc(si(r,l,i)),b=Oc(si(r,l,e));return p!==g&&v!==b||!(p!==0||!Rc(i,r,e))||!(g!==0||!Rc(i,l,e))||!(v!==0||!Rc(r,i,l))||!(b!==0||!Rc(r,e,l))}function Rc(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Oc(i){return i>0?1:i<0?-1:0}function sh(i,e){return si(i.prev,i,i.next)<0?si(i,e,i.next)>=0&&si(i,i.prev,e)>=0:si(i,e,i.prev)<0||si(i,i.next,e)<0}function If(i,e){const r=gd(i.i,i.x,i.y),l=gd(e.i,e.x,e.y),p=i.next,g=e.prev;return i.next=e,e.prev=i,r.next=p,p.prev=r,l.next=r,r.prev=l,g.next=l,l.prev=g,l}function Cf(i,e,r,l){const p=gd(i,e,r);return l?(p.next=l.next,p.prev=l,l.next.prev=p,l.next=p):(p.prev=p,p.next=p),p}function oh(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function gd(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function yd(i,e,r){const l=r.patternDependencies;let p=!1;for(const g of e){const v=g.paint.get(`${i}-pattern`);v.isConstant()||(p=!0);const b=v.constantOr(null);b&&(p=!0,l[b.to]=!0,l[b.from]=!0)}return p}function _d(i,e,r,l,p){const g=p.patternDependencies;for(const v of e){const b=v.paint.get(`${i}-pattern`).value;if(b.kind!=="constant"){let I=b.evaluate({zoom:l-1},r,{},p.availableImages),P=b.evaluate({zoom:l},r,{},p.availableImages),T=b.evaluate({zoom:l+1},r,{},p.availableImages);I=I&&I.name?I.name:I,P=P&&P.name?P.name:P,T=T&&T.name?T.name:T,g[I]=!0,g[P]=!0,g[T]=!0,r.patterns[v.id]={min:I,mid:P,max:T}}}return r}class vd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Kl,this.indexArray=new Tn,this.indexArray2=new Co,this.programConfigurations=new Eo(e.layers,e.zoom),this.segments=new bi,this.segments2=new bi,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,l){this.hasPattern=yd("fill",this.layers,r);const p=this.layers[0].layout.get("fill-sort-key"),g=!p.isConstant(),v=[];for(const{feature:b,id:I,index:P,sourceLayerIndex:T}of e){const A=this.layers[0]._featureFilter.needGeometry,D=Ao(b,A);if(!this.layers[0]._featureFilter.filter(new Me(this.zoom),D,l))continue;const O=g?p.evaluate(D,{},l,r.availableImages):void 0,j={id:I,properties:b.properties,type:b.type,sourceLayerIndex:T,index:P,geometry:A?D.geometry:To(b),patterns:{},sortKey:O};v.push(j)}g&&v.sort((b,I)=>b.sortKey-I.sortKey);for(const b of v){const{geometry:I,index:P,sourceLayerIndex:T}=b;if(this.hasPattern){const A=_d("fill",this.layers,b,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(b,I,P,l,{});r.featureIndex.insert(e[P].feature,I,P,T,this.index)}}update(e,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,l)}addFeatures(e,r,l){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,e_),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,l,p,g){for(const v of ra(r,500)){let b=0;for(const O of v)b+=O.length;const I=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),P=I.vertexLength,T=[],A=[];for(const O of v){if(O.length===0)continue;O!==v[0]&&A.push(T.length/2);const j=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),q=j.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(q+O.length-1,q),T.push(O[0].x),T.push(O[0].y);for(let H=1;H>3}if(p--,l===1||l===2)g+=i.readSVarint(),v+=i.readSVarint(),l===1&&(e&&b.push(e),e=[]),e.push(new g_(g,v));else{if(l!==7)throw new Error("unknown command "+l);e&&e.push(e[0].clone())}}return e&&b.push(e),b},za.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,l=0,p=0,g=0,v=1/0,b=-1/0,I=1/0,P=-1/0;i.pos>3}if(l--,r===1||r===2)(p+=i.readSVarint())b&&(b=p),(g+=i.readSVarint())P&&(P=g);else if(r!==7)throw new Error("unknown command "+r)}return[v,I,b,P]},za.prototype.toGeoJSON=function(i,e,r){var l,p,g=this.extent*Math.pow(2,r),v=this.extent*i,b=this.extent*e,I=this.loadGeometry(),P=za.types[this.type];function T(O){for(var j=0;j>3;p=v===1?l.readString():v===2?l.readFloat():v===3?l.readDouble():v===4?l.readVarint64():v===5?l.readVarint():v===6?l.readSVarint():v===7?l.readBoolean():null}return p}(r))}Tf.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new v_(this._pbf,e,this.extent,this._keys,this._values)};var b_=Ef;function w_(i,e,r){if(i===3){var l=new b_(r,r.readVarint()+r.pos);l.length&&(e[l.name]=l)}}As.VectorTile=function(i,e){this.layers=i.readFields(w_,{},e)},As.VectorTileFeature=Mf,As.VectorTileLayer=Ef;const I_=As.VectorTileFeature.types,xd=Math.pow(2,13);function ah(i,e,r,l,p,g,v,b){i.emplaceBack(e,r,2*Math.floor(l*xd)+v,p*xd*2,g*xd*2,Math.round(b))}class bd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new mr,this.centroidVertexArray=new Mn,this.indexArray=new Tn,this.programConfigurations=new Eo(e.layers,e.zoom),this.segments=new bi,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,l){this.features=[],this.hasPattern=yd("fill-extrusion",this.layers,r);for(const{feature:p,id:g,index:v,sourceLayerIndex:b}of e){const I=this.layers[0]._featureFilter.needGeometry,P=Ao(p,I);if(!this.layers[0]._featureFilter.filter(new Me(this.zoom),P,l))continue;const T={id:g,sourceLayerIndex:b,index:v,geometry:I?P.geometry:To(p),properties:p.properties,type:p.type,patterns:{}};this.hasPattern?this.features.push(_d("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,v,l,{}),r.featureIndex.insert(p,T.geometry,v,b,this.index,!0)}}addFeatures(e,r,l){for(const p of this.features){const{geometry:g}=p;this.addFeature(p,g,p.index,r,l)}}update(e,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,m_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,f_.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,l,p,g){for(const v of ra(r,500)){const b={x:0,y:0,vertexCount:0};let I=0;for(const j of v)I+=j.length;let P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const j of v){if(j.length===0||S_(j))continue;let q=0;for(let H=0;H=1){const ct=j[H-1];if(!C_(tt,ct)){P.vertexLength+4>bi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const rt=tt.sub(ct)._perp()._unit(),at=ct.dist(tt);q+at>32768&&(q=0),ah(this.layoutVertexArray,tt.x,tt.y,rt.x,rt.y,0,0,q),ah(this.layoutVertexArray,tt.x,tt.y,rt.x,rt.y,0,1,q),b.x+=2*tt.x,b.y+=2*tt.y,b.vertexCount+=2,q+=at,ah(this.layoutVertexArray,ct.x,ct.y,rt.x,rt.y,0,0,q),ah(this.layoutVertexArray,ct.x,ct.y,rt.x,rt.y,0,1,q),b.x+=2*ct.x,b.y+=2*ct.y,b.vertexCount+=2;const mt=P.vertexLength;this.indexArray.emplaceBack(mt,mt+2,mt+1),this.indexArray.emplaceBack(mt+1,mt+2,mt+3),P.vertexLength+=4,P.primitiveLength+=2}}}}if(P.vertexLength+I>bi.MAX_VERTEX_ARRAY_LENGTH&&(P=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray)),I_[e.type]!=="Polygon")continue;const T=[],A=[],D=P.vertexLength;for(const j of v)if(j.length!==0){j!==v[0]&&A.push(T.length/2);for(let q=0;qhi)||i.y===e.y&&(i.y<0||i.y>hi)}function S_(i){return i.every(e=>e.x<0)||i.every(e=>e.x>hi)||i.every(e=>e.y<0)||i.every(e=>e.y>hi)}let Af;Rt("FillExtrusionBucket",bd,{omit:["layers","features"]});var P_={get paint(){return Af=Af||new w({"fill-extrusion-opacity":new t(ft["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new o(ft["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new t(ft["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new t(ft["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new u(ft["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new o(ft["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new o(ft["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new t(ft["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class M_ extends S{constructor(e){super(e,P_)}createBucket(e){return new bd(e)}queryRadius(){return Dc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,l,p,g,v,b,I){const P=Lc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),v.angle,b),T=this.paint.get("fill-extrusion-height").evaluate(r,l),A=this.paint.get("fill-extrusion-base").evaluate(r,l),D=function(j,q,H,tt){const ct=[];for(const rt of j){const at=[rt.x,rt.y,0,1];Bc(at,at,q),ct.push(new B(at[0]/at[3],at[1]/at[3]))}return ct}(P,I),O=function(j,q,H,tt){const ct=[],rt=[],at=tt[8]*q,mt=tt[9]*q,wt=tt[10]*q,Lt=tt[11]*q,Ht=tt[8]*H,Dt=tt[9]*H,zt=tt[10]*H,$t=tt[11]*H;for(const Nt of j){const Ot=[],_t=[];for(const Zt of Nt){const qt=Zt.x,Qt=Zt.y,ze=tt[0]*qt+tt[4]*Qt+tt[12],Te=tt[1]*qt+tt[5]*Qt+tt[13],fi=tt[2]*qt+tt[6]*Qt+tt[14],Jr=tt[3]*qt+tt[7]*Qt+tt[15],zi=fi+wt,mi=Jr+Lt,Gi=ze+Ht,Xi=Te+Dt,Wi=fi+zt,ei=Jr+$t,gi=new B((ze+at)/mi,(Te+mt)/mi);gi.z=zi/mi,Ot.push(gi);const Vi=new B(Gi/ei,Xi/ei);Vi.z=Wi/ei,_t.push(Vi)}ct.push(Ot),rt.push(_t)}return[ct,rt]}(p,A,T,I);return function(j,q,H){let tt=1/0;lf(H,q)&&(tt=zf(H,q[0]));for(let ct=0;ctr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ar,this.layoutVertexArray2=new En,this.indexArray=new Tn,this.programConfigurations=new Eo(e.layers,e.zoom),this.segments=new bi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,l){this.hasPattern=yd("line",this.layers,r);const p=this.layers[0].layout.get("line-sort-key"),g=!p.isConstant(),v=[];for(const{feature:b,id:I,index:P,sourceLayerIndex:T}of e){const A=this.layers[0]._featureFilter.needGeometry,D=Ao(b,A);if(!this.layers[0]._featureFilter.filter(new Me(this.zoom),D,l))continue;const O=g?p.evaluate(D,{},l):void 0,j={id:I,properties:b.properties,type:b.type,sourceLayerIndex:T,index:P,geometry:A?D.geometry:To(b),patterns:{},sortKey:O};v.push(j)}g&&v.sort((b,I)=>b.sortKey-I.sortKey);for(const b of v){const{geometry:I,index:P,sourceLayerIndex:T}=b;if(this.hasPattern){const A=_d("line",this.layers,b,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(b,I,P,l,{});r.featureIndex.insert(e[P].feature,I,P,T,this.index)}}update(e,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,l)}addFeatures(e,r,l){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,z_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,T_),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,l,p,g){const v=this.layers[0].layout,b=v.get("line-join").evaluate(e,{}),I=v.get("line-cap"),P=v.get("line-miter-limit"),T=v.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const A of r)this.addLine(A,e,b,I,P,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,l,g,p)}addLine(e,r,l,p,g,v){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let tt=0;tt=2&&e[I-1].equals(e[I-2]);)I--;let P=0;for(;P0;if(Lt&&tt>P){const $t=D.dist(O);if($t>2*T){const Nt=D.sub(D.sub(O)._mult(T/$t)._round());this.updateDistance(O,Nt),this.addCurrentVertex(Nt,q,0,0,A),O=Nt}}const Dt=O&&j;let zt=Dt?l:b?"butt":p;if(Dt&&zt==="round"&&(mtg&&(zt="bevel"),zt==="bevel"&&(mt>2&&(zt="flipbevel"),mt100)ct=H.mult(-1);else{const $t=mt*q.add(H).mag()/q.sub(H).mag();ct._perp()._mult($t*(Ht?-1:1))}this.addCurrentVertex(D,ct,0,0,A),this.addCurrentVertex(D,ct.mult(-1),0,0,A)}else if(zt==="bevel"||zt==="fakeround"){const $t=-Math.sqrt(mt*mt-1),Nt=Ht?$t:0,Ot=Ht?0:$t;if(O&&this.addCurrentVertex(D,q,Nt,Ot,A),zt==="fakeround"){const _t=Math.round(180*wt/Math.PI/20);for(let Zt=1;Zt<_t;Zt++){let qt=Zt/_t;if(qt!==.5){const ze=qt-.5;qt+=qt*ze*(qt-1)*((1.0904+rt*(rt*(3.55645-1.43519*rt)-3.2452))*ze*ze+(.848013+rt*(.215638*rt-1.06021)))}const Qt=H.sub(q)._mult(qt)._add(q)._unit()._mult(Ht?-1:1);this.addHalfVertex(D,Qt.x,Qt.y,!1,Ht,0,A)}}j&&this.addCurrentVertex(D,H,-Nt,-Ot,A)}else if(zt==="butt")this.addCurrentVertex(D,ct,0,0,A);else if(zt==="square"){const $t=O?1:-1;this.addCurrentVertex(D,ct,$t,$t,A)}else zt==="round"&&(O&&(this.addCurrentVertex(D,q,0,0,A),this.addCurrentVertex(D,q,1,1,A,!0)),j&&(this.addCurrentVertex(D,H,-1,-1,A,!0),this.addCurrentVertex(D,H,0,0,A)));if(Lt&&tt2*T){const Nt=D.add(j.sub(D)._mult(T/$t)._round());this.updateDistance(D,Nt),this.addCurrentVertex(Nt,H,0,0,A),D=Nt}}}}addCurrentVertex(e,r,l,p,g,v=!1){const b=r.y*p-r.x,I=-r.y-r.x*p;this.addHalfVertex(e,r.x+r.y*l,r.y-r.x*l,v,!1,l,g),this.addHalfVertex(e,b,I,v,!0,-p,g),this.distance>kf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,l,p,g,v))}addHalfVertex({x:e,y:r},l,p,g,v,b,I){const P=.5*(this.lineClips?this.scaledDistance*(kf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(g?1:0),(r<<1)+(v?1:0),Math.round(63*l)+128,Math.round(63*p)+128,1+(b===0?0:b<0?-1:1)|(63&P)<<2,P>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=I.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),I.primitiveLength++),v?this.e2=T:this.e1=T}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Df,Lf;Rt("LineBucket",wd,{omit:["layers","patternFeatures"]});var Bf={get paint(){return Lf=Lf||new w({"line-opacity":new o(ft.paint_line["line-opacity"]),"line-color":new o(ft.paint_line["line-color"]),"line-translate":new t(ft.paint_line["line-translate"]),"line-translate-anchor":new t(ft.paint_line["line-translate-anchor"]),"line-width":new o(ft.paint_line["line-width"]),"line-gap-width":new o(ft.paint_line["line-gap-width"]),"line-offset":new o(ft.paint_line["line-offset"]),"line-blur":new o(ft.paint_line["line-blur"]),"line-dasharray":new d(ft.paint_line["line-dasharray"]),"line-pattern":new u(ft.paint_line["line-pattern"]),"line-gradient":new _(ft.paint_line["line-gradient"])})},get layout(){return Df=Df||new w({"line-cap":new t(ft.layout_line["line-cap"]),"line-join":new o(ft.layout_line["line-join"]),"line-miter-limit":new t(ft.layout_line["line-miter-limit"]),"line-round-limit":new t(ft.layout_line["line-round-limit"]),"line-sort-key":new o(ft.layout_line["line-sort-key"])})}};class L_ extends o{possiblyEvaluate(e,r){return r=new Me(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,l,p){return r=ye({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,l,p)}}let Vc;class B_ extends S{constructor(e){super(e,Bf),this.gradientVersion=0,Vc||(Vc=new L_(Bf.paint.properties["line-width"].specification),Vc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(l){return l._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof ms,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Vc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new wd(e)}queryRadius(e){const r=e,l=Ff(eh("line-width",this,r),eh("line-gap-width",this,r)),p=eh("line-offset",this,r);return l/2+Math.abs(p)+Dc(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,l,p,g,v,b){const I=Lc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),v.angle,b),P=b/2*Ff(this.paint.get("line-width").evaluate(r,l),this.paint.get("line-gap-width").evaluate(r,l)),T=this.paint.get("line-offset").evaluate(r,l);return T&&(p=function(A,D){const O=[];for(let j=0;j=3){for(let H=0;H0?e+2*i:i}const F_=N([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),R_=N([{name:"a_projected_pos",components:3,type:"Float32"}],4);N([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const O_=N([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);N([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Rf=N([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),V_=N([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function N_(i,e,r){return i.sections.forEach(l=>{l.text=function(p,g,v){const b=g.layout.get("text-transform").evaluate(v,{});return b==="uppercase"?p=p.toLocaleUpperCase():b==="lowercase"&&(p=p.toLocaleLowerCase()),Hr.applyArabicShaping&&(p=Hr.applyArabicShaping(p)),p}(l.text,e,r)}),i}N([{name:"triangle",components:3,type:"Uint16"}]),N([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),N([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),N([{type:"Float32",name:"offsetX"}]),N([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),N([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const hh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var di=24,Of=Ee,Vf=function(i,e,r,l,p){var g,v,b=8*p-l-1,I=(1<>1,T=-7,A=p-1,D=-1,O=i[e+A];for(A+=D,g=O&(1<<-T)-1,O>>=-T,T+=b;T>0;g=256*g+i[e+A],A+=D,T-=8);for(v=g&(1<<-T)-1,g>>=-T,T+=l;T>0;v=256*v+i[e+A],A+=D,T-=8);if(g===0)g=1-P;else{if(g===I)return v?NaN:1/0*(O?-1:1);v+=Math.pow(2,l),g-=P}return(O?-1:1)*v*Math.pow(2,g-l)},Nf=function(i,e,r,l,p,g){var v,b,I,P=8*g-p-1,T=(1<>1,D=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=0,j=1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(b=isNaN(e)?1:0,v=T):(v=Math.floor(Math.log(e)/Math.LN2),e*(I=Math.pow(2,-v))<1&&(v--,I*=2),(e+=v+A>=1?D/I:D*Math.pow(2,1-A))*I>=2&&(v++,I/=2),v+A>=T?(b=0,v=T):v+A>=1?(b=(e*I-1)*Math.pow(2,p),v+=A):(b=e*Math.pow(2,A-1)*Math.pow(2,p),v=0));p>=8;i[r+O]=255&b,O+=j,b/=256,p-=8);for(v=v<0;i[r+O]=255&v,O+=j,v/=256,P-=8);i[r+O-j]|=128*q};function Ee(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Ee.Varint=0,Ee.Fixed64=1,Ee.Bytes=2,Ee.Fixed32=5;var Id=4294967296,jf=1/Id,Uf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function rs(i){return i.type===Ee.Bytes?i.readVarint()+i.pos:i.pos+1}function ka(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function qf(i,e,r){var l=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(l);for(var p=r.pos-1;p>=i;p--)r.buf[p+l]=r.buf[p]}function j_(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function $f(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Ee.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,g=this.pos;this.type=7&l,i(p,e,this),this.pos===g&&this.skip(l)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Nc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=$f(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Nc(this.buf,this.pos)+Nc(this.buf,this.pos+4)*Id;return this.pos+=8,i},readSFixed64:function(){var i=Nc(this.buf,this.pos)+$f(this.buf,this.pos+4)*Id;return this.pos+=8,i},readFloat:function(){var i=Vf(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Vf(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,l=this.buf;return e=127&(r=l[this.pos++]),r<128?e:(e|=(127&(r=l[this.pos++]))<<7,r<128?e:(e|=(127&(r=l[this.pos++]))<<14,r<128?e:(e|=(127&(r=l[this.pos++]))<<21,r<128?e:function(p,g,v){var b,I,P=v.buf;if(b=(112&(I=P[v.pos++]))>>4,I<128||(b|=(127&(I=P[v.pos++]))<<3,I<128)||(b|=(127&(I=P[v.pos++]))<<10,I<128)||(b|=(127&(I=P[v.pos++]))<<17,I<128)||(b|=(127&(I=P[v.pos++]))<<24,I<128)||(b|=(1&(I=P[v.pos++]))<<31,I<128))return ka(p,b,g);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=l[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Uf?function(r,l,p){return Uf.decode(r.subarray(l,p))}(this.buf,e,i):function(r,l,p){for(var g="",v=l;v239?4:T>223?3:T>191?2:1;if(v+D>p)break;D===1?T<128&&(A=T):D===2?(192&(b=r[v+1]))==128&&(A=(31&T)<<6|63&b)<=127&&(A=null):D===3?(I=r[v+2],(192&(b=r[v+1]))==128&&(192&I)==128&&((A=(15&T)<<12|(63&b)<<6|63&I)<=2047||A>=55296&&A<=57343)&&(A=null)):D===4&&(I=r[v+2],P=r[v+3],(192&(b=r[v+1]))==128&&(192&I)==128&&(192&P)==128&&((A=(15&T)<<18|(63&b)<<12|(63&I)<<6|63&P)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,D=1):A>65535&&(A-=65536,g+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),g+=String.fromCharCode(A),v+=D}return g}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Ee.Bytes)return i.push(this.readVarint(e));var r=rs(this);for(i=i||[];this.pos127;);else if(e===Ee.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ee.Fixed32)this.pos+=4;else{if(e!==Ee.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var l,p;if(e>=0?(l=e%4294967296|0,p=e/4294967296|0):(p=~(-e/4294967296),4294967295^(l=~(-e%4294967296))?l=l+1|0:(l=0,p=p+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(g,v,b){b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,b.buf[b.pos]=127&(g>>>=7)}(l,0,r),function(g,v){var b=(7&g)<<4;v.buf[v.pos++]|=b|((g>>>=3)?128:0),g&&(v.buf[v.pos++]=127&g|((g>>>=7)?128:0),g&&(v.buf[v.pos++]=127&g|((g>>>=7)?128:0),g&&(v.buf[v.pos++]=127&g|((g>>>=7)?128:0),g&&(v.buf[v.pos++]=127&g|((g>>>=7)?128:0),g&&(v.buf[v.pos++]=127&g)))))}(p,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(l,p,g){for(var v,b,I=0;I55295&&v<57344){if(!b){v>56319||I+1===p.length?(l[g++]=239,l[g++]=191,l[g++]=189):b=v;continue}if(v<56320){l[g++]=239,l[g++]=191,l[g++]=189,b=v;continue}v=b-55296<<10|v-56320|65536,b=null}else b&&(l[g++]=239,l[g++]=191,l[g++]=189,b=null);v<128?l[g++]=v:(v<2048?l[g++]=v>>6|192:(v<65536?l[g++]=v>>12|224:(l[g++]=v>>18|240,l[g++]=v>>12&63|128),l[g++]=v>>6&63|128),l[g++]=63&v|128)}return g}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&qf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Nf(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Nf(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&qf(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeMessage:function(i,e,r){this.writeTag(i,Ee.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,j_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,U_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Z_,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,q_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,$_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,G_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,X_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,W_,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,H_,e)},writeBytesField:function(i,e){this.writeTag(i,Ee.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Ee.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Ee.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Ee.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Ee.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Ee.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Ee.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Ee.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Ee.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Ee.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Cd=M(Of);const Sd=3;function K_(i,e,r){i===1&&r.readMessage(J_,e)}function J_(i,e,r){if(i===3){const{id:l,bitmap:p,width:g,height:v,left:b,top:I,advance:P}=r.readMessage(Y_,{});e.push({id:l,bitmap:new rh({width:g+2*Sd,height:v+2*Sd},p),metrics:{width:g,height:v,left:b,top:I,advance:P}})}}function Y_(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Zf=Sd;function Gf(i){let e=0,r=0;for(const v of i)e+=v.w*v.h,r=Math.max(r,v.w);i.sort((v,b)=>b.h-v.h);const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let p=0,g=0;for(const v of i)for(let b=l.length-1;b>=0;b--){const I=l[b];if(!(v.w>I.w||v.h>I.h)){if(v.x=I.x,v.y=I.y,g=Math.max(g,v.y+v.h),p=Math.max(p,v.x+v.w),v.w===I.w&&v.h===I.h){const P=l.pop();b=0&&l>=e&&Uc[this.text.charCodeAt(l)];l--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const l=new La;return l.text=this.text.substring(e,r),l.sectionIndex=this.sectionIndex.slice(e,r),l.sections=this.sections,l}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(uh.forText(e.scale,e.fontStack||r));const l=this.sections.length-1;for(let p=0;p=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jc(i,e,r,l,p,g,v,b,I,P,T,A,D,O,j){const q=La.fromFeature(i,p);let H;A===m.ah.vertical&&q.verticalizePunctuation();const{processBidirectionalText:tt,processStyledBidirectionalText:ct}=Hr;if(tt&&q.sections.length===1){H=[];const mt=tt(q.toString(),Md(q,P,g,e,l,O));for(const wt of mt){const Lt=new La;Lt.text=wt,Lt.sections=q.sections;for(let Ht=0;Ht0&&ns>Di&&(Di=ns)}else{const Br=Lt[ve.fontStack],wi=Br&&Br[je];if(wi&&wi.rect)Oa=wi.rect,Je=wi.metrics;else{const ns=wt[ve.fontStack],yh=ns&&ns[je];if(!yh)continue;Je=yh.metrics}gr=(gi-ve.scale)*di}Yr?(mt.verticalizable=!0,Hi.push({glyph:je,imageName:kn,x:Qt,y:ze+gr,vertical:Yr,scale:ve.scale,fontStack:ve.fontStack,sectionIndex:Be,metrics:Je,rect:Oa}),Qt+=Dn*ve.scale+_t):(Hi.push({glyph:je,imageName:kn,x:Qt,y:ze+gr,vertical:Yr,scale:ve.scale,fontStack:ve.fontStack,sectionIndex:Be,metrics:Je,rect:Oa}),Qt+=Je.advance*ve.scale+_t)}Hi.length!==0&&(Te=Math.max(Qt-_t,Te),iv(Hi,0,Hi.length-1,Jr,Di)),Qt=0;const Lr=zt*gi+Di;ki.lineOffset=Math.max(Di,Vi),ze+=Lr,fi=Math.max(Lr,fi),++zi}var mi;const Gi=ze-ch,{horizontalAlign:Xi,verticalAlign:Wi}=Ed($t);(function(ei,gi,Vi,ki,Hi,Di,Lr,lr,ve){const Be=(gi-Vi)*Hi;let je=0;je=Di!==Lr?-lr*ki-ch:(-ki*ve+.5)*Lr;for(const gr of ei)for(const Je of gr.positionedGlyphs)Je.x+=Be,Je.y+=je})(mt.positionedLines,Jr,Xi,Wi,Te,fi,zt,Gi,Dt.length),mt.top+=-Wi*Gi,mt.bottom=mt.top+Gi,mt.left+=-Xi*Te,mt.right=mt.left+Te}(at,e,r,l,H,v,b,I,A,P,D,j),!function(mt){for(const wt of mt)if(wt.positionedGlyphs.length!==0)return!1;return!0}(rt)&&at}const Uc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Q_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},tv={40:!0};function Wf(i,e,r,l,p,g){if(e.imageName){const v=l[e.imageName];return v?v.displaySize[0]*e.scale*di/g+p:0}{const v=r[e.fontStack],b=v&&v[i];return b?b.metrics.advance*e.scale+p:0}}function Hf(i,e,r,l){const p=Math.pow(i-e,2);return l?i=0;let P=0;for(let A=0;AP){const T=Math.ceil(g/P);p*=T/v,v=T}return{x1:l,y1:p,x2:l+g,y2:p+v}}function Qf(i,e,r,l,p,g){const v=i.image;let b;if(v.content){const H=v.content,tt=v.pixelRatio||1;b=[H[0]/tt,H[1]/tt,v.displaySize[0]-H[2]/tt,v.displaySize[1]-H[3]/tt]}const I=e.left*g,P=e.right*g;let T,A,D,O;r==="width"||r==="both"?(O=p[0]+I-l[3],A=p[0]+P+l[1]):(O=p[0]+(I+P-v.displaySize[0])/2,A=O+v.displaySize[0]);const j=e.top*g,q=e.bottom*g;return r==="height"||r==="both"?(T=p[1]+j-l[0],D=p[1]+q+l[2]):(T=p[1]+(j+q-v.displaySize[1])/2,D=T+v.displaySize[1]),{image:v,top:T,right:A,bottom:D,left:O,collisionPadding:b}}const dh=255,zn=128,ks=dh*zn;function tm(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Me(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:p}=r;let g=0;for(;gv.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=dd([]),this.placementViewportMatrix=dd([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=tm(this.zoom,r["text-size"]),this.iconSizeData=tm(this.zoom,r["icon-size"]);const l=this.layers[0].layout,p=l.get("symbol-sort-key"),g=l.get("symbol-z-order");this.canOverlap=Td(l,"text-overlap","text-allow-overlap")!=="never"||Td(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=g!=="viewport-y"&&!p.isConstant(),this.sortFeaturesByY=(g==="viewport-y"||g==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.get("text-writing-mode").map(v=>m.ah[v])),this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id),this.sourceID=e.sourceID}createArrays(){this.text=new zd(new Eo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new zd(new Eo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Mi,this.lineVertexArray=new Ei,this.symbolInstances=new Ri,this.textAnchorOffsets=new ts}calculateGlyphDependencies(e,r,l,p,g){for(let v=0;v0)&&(v.value.kind!=="constant"||v.value.value.length>0),T=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,A=g.get("symbol-sort-key");if(this.features=[],!P&&!T)return;const D=r.iconDependencies,O=r.glyphDependencies,j=r.availableImages,q=new Me(this.zoom);for(const{feature:H,id:tt,index:ct,sourceLayerIndex:rt}of e){const at=p._featureFilter.needGeometry,mt=Ao(H,at);if(!p._featureFilter.filter(q,mt,l))continue;let wt,Lt;if(at||(mt.geometry=To(H)),P){const Dt=p.getValueAndResolveTokens("text-field",mt,l,j),zt=Qi.factory(Dt),$t=this.hasRTLText=this.hasRTLText||ov(zt);(!$t||Hr.getRTLTextPluginStatus()==="unavailable"||$t&&Hr.isParsed())&&(wt=N_(zt,p,mt))}if(T){const Dt=p.getValueAndResolveTokens("icon-image",mt,l,j);Lt=Dt instanceof Si?Dt:Si.fromString(Dt)}if(!wt&&!Lt)continue;const Ht=this.sortFeaturesByKey?A.evaluate(mt,{},l):void 0;if(this.features.push({id:tt,text:wt,icon:Lt,index:ct,sourceLayerIndex:rt,geometry:mt.geometry,properties:H.properties,type:nv[H.type],sortKey:Ht}),Lt&&(D[Lt.name]=!0),wt){const Dt=v.evaluate(mt,{},l).join(","),zt=g.get("text-rotation-alignment")!=="viewport"&&g.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(m.ah.vertical)>=0;for(const $t of wt.sections)if($t.image)D[$t.image.name]=!0;else{const Nt=$l(wt.toString()),Ot=$t.fontStack||Dt,_t=O[Ot]=O[Ot]||{};this.calculateGlyphDependencies($t.text,_t,zt,this.allowVerticalPlacement,Nt)}}}g.get("symbol-placement")==="line"&&(this.features=function(H){const tt={},ct={},rt=[];let at=0;function mt(Dt){rt.push(H[Dt]),at++}function wt(Dt,zt,$t){const Nt=ct[Dt];return delete ct[Dt],ct[zt]=Nt,rt[Nt].geometry[0].pop(),rt[Nt].geometry[0]=rt[Nt].geometry[0].concat($t[0]),Nt}function Lt(Dt,zt,$t){const Nt=tt[zt];return delete tt[zt],tt[Dt]=Nt,rt[Nt].geometry[0].shift(),rt[Nt].geometry[0]=$t[0].concat(rt[Nt].geometry[0]),Nt}function Ht(Dt,zt,$t){const Nt=$t?zt[0][zt[0].length-1]:zt[0][0];return`${Dt}:${Nt.x}:${Nt.y}`}for(let Dt=0;DtDt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((H,tt)=>H.sortKey-tt.sortKey)}update(e,r,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,l),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,l))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const l=this.lineVertexArray.length;if(e.segment!==void 0){let p=e.dist(r[e.segment+1]),g=e.dist(r[e.segment]);const v={};for(let b=e.segment+1;b=0;b--)v[b]={x:r[b].x,y:r[b].y,tileUnitDistanceFromAnchor:g},b>0&&(g+=r[b-1].dist(r[b]));for(let b=0;b0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const l=e.placedSymbolArray.get(r),p=l.vertexStartIndex+4*l.numGlyphs;for(let g=l.vertexStartIndex;gp[b]-p[I]||g[I]-g[b]),v}addToSortKeyRanges(e,r){const l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===r?l.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const l=this.symbolInstances.get(r);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((p,g,v)=>{p>=0&&v.indexOf(p)===g&&this.addIndicesForPlacedSymbol(this.text,p)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let em,im;Rt("SymbolBucket",Ba,{omit:["layers","collisionBoxArray","features","compareText"]}),Ba.MAX_GLYPHS=65535,Ba.addDynamicAttributes=Ad;var Dd={get paint(){return im=im||new w({"icon-opacity":new o(ft.paint_symbol["icon-opacity"]),"icon-color":new o(ft.paint_symbol["icon-color"]),"icon-halo-color":new o(ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new o(ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new o(ft.paint_symbol["icon-halo-blur"]),"icon-translate":new t(ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new t(ft.paint_symbol["icon-translate-anchor"]),"text-opacity":new o(ft.paint_symbol["text-opacity"]),"text-color":new o(ft.paint_symbol["text-color"],{runtimeType:qi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new o(ft.paint_symbol["text-halo-color"]),"text-halo-width":new o(ft.paint_symbol["text-halo-width"]),"text-halo-blur":new o(ft.paint_symbol["text-halo-blur"]),"text-translate":new t(ft.paint_symbol["text-translate"]),"text-translate-anchor":new t(ft.paint_symbol["text-translate-anchor"])})},get layout(){return em=em||new w({"symbol-placement":new t(ft.layout_symbol["symbol-placement"]),"symbol-spacing":new t(ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new t(ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new o(ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new t(ft.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new t(ft.layout_symbol["icon-allow-overlap"]),"icon-overlap":new t(ft.layout_symbol["icon-overlap"]),"icon-ignore-placement":new t(ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new t(ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new t(ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new o(ft.layout_symbol["icon-size"]),"icon-text-fit":new t(ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new t(ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new o(ft.layout_symbol["icon-image"]),"icon-rotate":new o(ft.layout_symbol["icon-rotate"]),"icon-padding":new o(ft.layout_symbol["icon-padding"]),"icon-keep-upright":new t(ft.layout_symbol["icon-keep-upright"]),"icon-offset":new o(ft.layout_symbol["icon-offset"]),"icon-anchor":new o(ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new t(ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new t(ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new t(ft.layout_symbol["text-rotation-alignment"]),"text-field":new o(ft.layout_symbol["text-field"]),"text-font":new o(ft.layout_symbol["text-font"]),"text-size":new o(ft.layout_symbol["text-size"]),"text-max-width":new o(ft.layout_symbol["text-max-width"]),"text-line-height":new t(ft.layout_symbol["text-line-height"]),"text-letter-spacing":new o(ft.layout_symbol["text-letter-spacing"]),"text-justify":new o(ft.layout_symbol["text-justify"]),"text-radial-offset":new o(ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new t(ft.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new o(ft.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new o(ft.layout_symbol["text-anchor"]),"text-max-angle":new t(ft.layout_symbol["text-max-angle"]),"text-writing-mode":new t(ft.layout_symbol["text-writing-mode"]),"text-rotate":new o(ft.layout_symbol["text-rotate"]),"text-padding":new t(ft.layout_symbol["text-padding"]),"text-keep-upright":new t(ft.layout_symbol["text-keep-upright"]),"text-transform":new o(ft.layout_symbol["text-transform"]),"text-offset":new o(ft.layout_symbol["text-offset"]),"text-allow-overlap":new t(ft.layout_symbol["text-allow-overlap"]),"text-overlap":new t(ft.layout_symbol["text-overlap"]),"text-ignore-placement":new t(ft.layout_symbol["text-ignore-placement"]),"text-optional":new t(ft.layout_symbol["text-optional"])})}};class rm{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:bn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Rt("FormatSectionOverride",rm,{omit:["defaultValue"]});class $c extends S{constructor(e){super(e,Dd)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const l=this.layout.get("text-writing-mode");if(l){const p=[];for(const g of l)p.indexOf(g)<0&&p.push(g);this.layout._values["text-writing-mode"]=p}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,l,p){const g=this.layout.get(e).evaluate(r,{},l,p),v=this._unevaluatedLayout._values[e];return v.isDataDriven()||fo(v.value)||!g?g:function(b,I){return I.replace(/{([^{}]+)}/g,(P,T)=>b&&T in b?String(b[T]):"")}(r.properties,g)}createBucket(e){return new Ba(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Dd.paint.overridableProperties){if(!$c.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),l=new rm(r),p=new po(l,r.property.specification);let g=null;g=r.value.kind==="constant"||r.value.kind==="source"?new xs("source",p):new Al("composite",p,r.value.zoomStops),this.paint._values[e]=new Kr(r.property,g,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,l){return!(!this.layout||r.isDataDriven()||l.isDataDriven())&&$c.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const l=e.get("text-field"),p=Dd.paint.properties[r];let g=!1;const v=b=>{for(const I of b)if(p.overrides&&p.overrides.hasOverride(I))return void(g=!0)};if(l.value.kind==="constant"&&l.value.value instanceof Qi)v(l.value.value.sections);else if(l.value.kind==="source"){const b=P=>{g||(P instanceof $n&&li(P.value)===an?v(P.value.sections):P instanceof ea?v(P.sections):P.eachChild(b))},I=l.value;I._styleExpression&&b(I._styleExpression.expression)}return g}}let nm;var av={get paint(){return nm=nm||new w({"background-color":new t(ft.paint_background["background-color"]),"background-pattern":new d(ft.paint_background["background-pattern"]),"background-opacity":new t(ft.paint_background["background-opacity"])})}};class lv extends S{constructor(e){super(e,av)}}let sm;var hv={get paint(){return sm=sm||new w({"raster-opacity":new t(ft.paint_raster["raster-opacity"]),"raster-hue-rotate":new t(ft.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new t(ft.paint_raster["raster-brightness-min"]),"raster-brightness-max":new t(ft.paint_raster["raster-brightness-max"]),"raster-saturation":new t(ft.paint_raster["raster-saturation"]),"raster-contrast":new t(ft.paint_raster["raster-contrast"]),"raster-resampling":new t(ft.paint_raster["raster-resampling"]),"raster-fade-duration":new t(ft.paint_raster["raster-fade-duration"])})}};class cv extends S{constructor(e){super(e,hv)}}class uv extends S{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class dv{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Ld=63710088e-1;class Ds{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ds(xe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,l=this.lat*r,p=e.lat*r,g=Math.sin(l)*Math.sin(p)+Math.cos(l)*Math.cos(p)*Math.cos((e.lng-this.lng)*r);return Ld*Math.acos(Math.min(g,1))}static convert(e){if(e instanceof Ds)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ds(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ds(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 [, ]")}}const om=2*Math.PI*Ld;function am(i){return om*Math.cos(i*Math.PI/180)}function lm(i){return(180+i)/360}function hm(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function cm(i,e){return i/am(e)}function Bd(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ph{constructor(e,r,l=0){this.x=+e,this.y=+r,this.z=+l}static fromLngLat(e,r=0){const l=Ds.convert(e);return new ph(lm(l.lng),hm(l.lat),cm(r,l.lat))}toLngLat(){return new Ds(360*this.x-180,Bd(this.y))}toAltitude(){return this.z*am(Bd(this.y))}meterInMercatorCoordinateUnits(){return 1/om*(e=Bd(this.y),1/Math.cos(e*Math.PI/180));var e}}function um(i,e,r){var l=2*Math.PI*6378137/256/Math.pow(2,r);return[i*l-2*Math.PI*6378137/2,e*l-2*Math.PI*6378137/2]}class Fd{constructor(e,r,l){if(!function(p,g,v){return!(p<0||p>25||v<0||v>=Math.pow(2,p)||g<0||g>=Math.pow(2,p))}(e,r,l))throw new Error(`x=${r}, y=${l}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=l,this.key=fh(0,e,e,r,l)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,l){const p=(v=this.y,b=this.z,I=um(256*(g=this.x),256*(v=Math.pow(2,b)-v-1),b),P=um(256*(g+1),256*(v+1),b),I[0]+","+I[1]+","+P[0]+","+P[1]);var g,v,b,I,P;const T=function(A,D,O){let j,q="";for(let H=A;H>0;H--)j=1<1?"@2x":"").replace(/{quadkey}/g,T).replace(/{bbox-epsg-3857}/g,p)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new B((e.x*r-this.x)*hi,(e.y*r-this.y)*hi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dm{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fh(e,r.z,r.z,r.x,r.y)}}class Dr{constructor(e,r,l,p,g){if(e= z; overscaledZ = ${e}; z = ${l}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Fd(l,+p,+g),this.key=fh(r,e,l,p,g)}clone(){return new Dr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Dr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Dr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-e;return e>this.canonical.z?fh(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):fh(this.wrap*+r,e,e,this.canonical.x>>l,this.canonical.y>>l)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Dr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,l=2*this.canonical.x,p=2*this.canonical.y;return[new Dr(r,this.wrap,r,l,p),new Dr(r,this.wrap,r,l+1,p),new Dr(r,this.wrap,r,l,p+1),new Dr(r,this.wrap,r,l+1,p+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=A),A=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,l){return e*this.redFactor+r*this.greenFactor+l*this.blueFactor-this.baseShift}getPixels(){return new kr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,l){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let p=r*this.dim,g=r*this.dim+this.dim,v=l*this.dim,b=l*this.dim+this.dim;switch(r){case-1:p=g-1;break;case 1:g=p+1}switch(l){case-1:v=b-1;break;case 1:b=v+1}const I=-r*this.dim,P=-l*this.dim;for(let T=v;T=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class mm{constructor(e,r,l,p,g){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=l,e._y=p,this.properties=e.properties,this.id=g}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class gm{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ps(hi,16,0),this.grid3D=new Ps(hi,16,0),this.featureIndexArray=new es,this.promoteId=r}insert(e,r,l,p,g,v){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,p,g);const I=v?this.grid3D:this.grid;for(let P=0;P=0&&A[3]>=0&&I.insert(b,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new As.VectorTile(new Cd(this.rawTileData)).layers,this.sourceLayerCoder=new fm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,l,p){this.loadVTLayers();const g=e.params||{},v=hi/e.tileSize/e.scale,b=bs(g.filter),I=e.queryGeometry,P=e.queryPadding*v,T=_m(I),A=this.grid.query(T.minX-P,T.minY-P,T.maxX+P,T.maxY+P),D=_m(e.cameraQueryGeometry),O=this.grid3D.query(D.minX-P,D.minY-P,D.maxX+P,D.maxY+P,(H,tt,ct,rt)=>function(at,mt,wt,Lt,Ht){for(const zt of at)if(mt<=zt.x&&wt<=zt.y&&Lt>=zt.x&&Ht>=zt.y)return!0;const Dt=[new B(mt,wt),new B(mt,Ht),new B(Lt,Ht),new B(Lt,wt)];if(at.length>2){for(const zt of Dt)if(Ea(at,zt))return!0}for(let zt=0;zt(rt||(rt=To(at)),mt.queryIntersectsFeature(I,at,wt,rt,this.z,e.transform,v,e.pixelPosMatrix)))}return j}loadMatchingFeature(e,r,l,p,g,v,b,I,P,T,A){const D=this.bucketLayerIDs[r];if(v&&!function(H,tt){for(let ct=0;ct=0)return!0;return!1}(v,D))return;const O=this.sourceLayerCoder.decode(l),j=this.vtLayers[O].feature(p);if(g.needGeometry){const H=Ao(j,!0);if(!g.filter(new Me(this.tileID.overscaledZ),H,this.tileID.canonical))return}else if(!g.filter(new Me(this.tileID.overscaledZ),j))return;const q=this.getId(j,O);for(let H=0;H{const b=e instanceof y?e.get(v):null;return b&&b.evaluate?b.evaluate(r,l,p):b})}function _m(i){let e=1/0,r=1/0,l=-1/0,p=-1/0;for(const g of i)e=Math.min(e,g.x),r=Math.min(r,g.y),l=Math.max(l,g.x),p=Math.max(p,g.y);return{minX:e,minY:r,maxX:l,maxY:p}}function pv(i,e){return e-i}function vm(i,e,r,l,p){const g=[];for(let v=0;v=l&&A.x>=l||(T.x>=l?T=new B(l,T.y+(l-T.x)/(A.x-T.x)*(A.y-T.y))._round():A.x>=l&&(A=new B(l,T.y+(l-T.x)/(A.x-T.x)*(A.y-T.y))._round()),T.y>=p&&A.y>=p||(T.y>=p?T=new B(T.x+(p-T.y)/(A.y-T.y)*(A.x-T.x),p)._round():A.y>=p&&(A=new B(T.x+(p-T.y)/(A.y-T.y)*(A.x-T.x),p)._round()),I&&T.equals(I[I.length-1])||(I=[T],g.push(I)),I.push(A)))))}}return g}Rt("FeatureIndex",gm,{omit:["rawTileData","sourceLayerCoder"]});class Ls extends B{constructor(e,r,l,p){super(e,r),this.angle=l,p!==void 0&&(this.segment=p)}clone(){return new Ls(this.x,this.y,this.angle,this.segment)}}function xm(i,e,r,l,p){if(e.segment===void 0||r===0)return!0;let g=e,v=e.segment+1,b=0;for(;b>-r/2;){if(v--,v<0)return!1;b-=i[v].dist(g),g=i[v]}b+=i[v].dist(i[v+1]),v++;const I=[];let P=0;for(;bl;)P-=I.shift().angleDelta;if(P>p)return!1;v++,b+=T.dist(A)}return!0}function bm(i){let e=0;for(let r=0;rP){const j=(P-I)/O,q=ir.number(A.x,D.x,j),H=ir.number(A.y,D.y,j),tt=new Ls(q,H,D.angleTo(A),T);return tt._round(),!v||xm(i,tt,b,v,e)?tt:void 0}I+=O}}function mv(i,e,r,l,p,g,v,b,I){const P=wm(l,g,v),T=Im(l,p),A=T*v,D=i[0].x===0||i[0].x===I||i[0].y===0||i[0].y===I;return e-A=0&&at=0&&mt=0&&D+P<=T){const wt=new Ls(at,mt,ct,j);wt._round(),l&&!xm(i,wt,g,l,p)||O.push(wt)}}A+=tt}return b||O.length||v||(O=Cm(i,A/2,r,l,p,g,v,!0,I)),O}Rt("Anchor",Ls);const Fa=ar;function Sm(i,e,r,l){const p=[],g=i.image,v=g.pixelRatio,b=g.paddedRect.w-2*Fa,I=g.paddedRect.h-2*Fa;let P={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const T=g.stretchX||[[0,b]],A=g.stretchY||[[0,I]],D=(_t,Zt)=>_t+Zt[1]-Zt[0],O=T.reduce(D,0),j=A.reduce(D,0),q=b-O,H=I-j;let tt=0,ct=O,rt=0,at=j,mt=0,wt=q,Lt=0,Ht=H;if(g.content&&l){const _t=g.content,Zt=_t[2]-_t[0],qt=_t[3]-_t[1];(g.textFitWidth||g.textFitHeight)&&(P=Yf(i)),tt=Zc(T,0,_t[0]),rt=Zc(A,0,_t[1]),ct=Zc(T,_t[0],_t[2]),at=Zc(A,_t[1],_t[3]),mt=_t[0]-tt,Lt=_t[1]-rt,wt=Zt-ct,Ht=qt-at}const Dt=P.x1,zt=P.y1,$t=P.x2-Dt,Nt=P.y2-zt,Ot=(_t,Zt,qt,Qt)=>{const ze=Gc(_t.stretch-tt,ct,$t,Dt),Te=Xc(_t.fixed-mt,wt,_t.stretch,O),fi=Gc(Zt.stretch-rt,at,Nt,zt),Jr=Xc(Zt.fixed-Lt,Ht,Zt.stretch,j),zi=Gc(qt.stretch-tt,ct,$t,Dt),mi=Xc(qt.fixed-mt,wt,qt.stretch,O),Gi=Gc(Qt.stretch-rt,at,Nt,zt),Xi=Xc(Qt.fixed-Lt,Ht,Qt.stretch,j),Wi=new B(ze,fi),ei=new B(zi,fi),gi=new B(zi,Gi),Vi=new B(ze,Gi),ki=new B(Te/v,Jr/v),Hi=new B(mi/v,Xi/v),Di=e*Math.PI/180;if(Di){const ve=Math.sin(Di),Be=Math.cos(Di),je=[Be,-ve,ve,Be];Wi._matMult(je),ei._matMult(je),Vi._matMult(je),gi._matMult(je)}const Lr=_t.stretch+_t.fixed,lr=Zt.stretch+Zt.fixed;return{tl:Wi,tr:ei,bl:Vi,br:gi,tex:{x:g.paddedRect.x+Fa+Lr,y:g.paddedRect.y+Fa+lr,w:qt.stretch+qt.fixed-Lr,h:Qt.stretch+Qt.fixed-lr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ki,pixelOffsetBR:Hi,minFontScaleX:wt/v/$t,minFontScaleY:Ht/v/Nt,isSDF:r}};if(l&&(g.stretchX||g.stretchY)){const _t=Pm(T,q,O),Zt=Pm(A,H,j);for(let qt=0;qt<_t.length-1;qt++){const Qt=_t[qt],ze=_t[qt+1];for(let Te=0;Te0&&(q=Math.max(10,q),this.circleDiameter=q)}else{const D=!((A=v.image)===null||A===void 0)&&A.content&&(v.image.textFitWidth||v.image.textFitHeight)?Yf(v):{x1:v.left,y1:v.top,x2:v.right,y2:v.bottom};D.y1=D.y1*b-I[0],D.y2=D.y2*b+I[2],D.x1=D.x1*b-I[3],D.x2=D.x2*b+I[1];const O=v.collisionPadding;if(O&&(D.x1-=O[0]*b,D.y1-=O[1]*b,D.x2+=O[2]*b,D.y2+=O[3]*b),T){const j=new B(D.x1,D.y1),q=new B(D.x2,D.y1),H=new B(D.x1,D.y2),tt=new B(D.x2,D.y2),ct=T*Math.PI/180;j._rotate(ct),q._rotate(ct),H._rotate(ct),tt._rotate(ct),D.x1=Math.min(j.x,q.x,H.x,tt.x),D.x2=Math.max(j.x,q.x,H.x,tt.x),D.y1=Math.min(j.y,q.y,H.y,tt.y),D.y2=Math.max(j.y,q.y,H.y,tt.y)}e.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,l,p,g)}this.boxEndIndex=e.length}}class gv{constructor(e=[],r=(l,p)=>lp?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:l}=this,p=r[e];for(;e>0;){const g=e-1>>1,v=r[g];if(l(p,v)>=0)break;r[e]=v,e=g}r[e]=p}_down(e){const{data:r,compare:l}=this,p=this.length>>1,g=r[e];for(;e=0)break;r[e]=r[v],e=v}r[e]=g}}function yv(i,e=1,r=!1){let l=1/0,p=1/0,g=-1/0,v=-1/0;const b=i[0];for(let O=0;Og)&&(g=j.x),(!O||j.y>v)&&(v=j.y)}const I=Math.min(g-l,v-p);let P=I/2;const T=new gv([],_v);if(I===0)return new B(l,p);for(let O=l;OA.d||!A.d)&&(A=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,D)),O.max-A.d<=e||(P=O.h/2,T.push(new Ra(O.p.x-P,O.p.y-P,P,i)),T.push(new Ra(O.p.x+P,O.p.y-P,P,i)),T.push(new Ra(O.p.x-P,O.p.y+P,P,i)),T.push(new Ra(O.p.x+P,O.p.y+P,P,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${A.d}`)),A.p}function _v(i,e){return e.max-i.max}function Ra(i,e,r,l){this.p=new B(i,e),this.h=r,this.d=function(p,g){let v=!1,b=1/0;for(let I=0;Ip.y!=j.y>p.y&&p.x<(j.x-O.x)*(p.y-O.y)/(j.y-O.y)+O.x&&(v=!v),b=Math.min(b,hf(p,O,j))}}return(v?1:-1)*Math.sqrt(b)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}var Ai;m.aq=void 0,(Ai=m.aq||(m.aq={}))[Ai.center=1]="center",Ai[Ai.left=2]="left",Ai[Ai.right=3]="right",Ai[Ai.top=4]="top",Ai[Ai.bottom=5]="bottom",Ai[Ai["top-left"]=6]="top-left",Ai[Ai["top-right"]=7]="top-right",Ai[Ai["bottom-left"]=8]="bottom-left",Ai[Ai["bottom-right"]=9]="bottom-right";const Bs=7,Rd=Number.POSITIVE_INFINITY;function Mm(i,e){return e[1]!==Rd?function(r,l,p){let g=0,v=0;switch(l=Math.abs(l),p=Math.abs(p),r){case"top-right":case"top-left":case"top":v=p-Bs;break;case"bottom-right":case"bottom-left":case"bottom":v=-p+Bs}switch(r){case"top-right":case"bottom-right":case"right":g=-l;break;case"top-left":case"bottom-left":case"left":g=l}return[g,v]}(i,e[0],e[1]):function(r,l){let p=0,g=0;l<0&&(l=0);const v=l/Math.SQRT2;switch(r){case"top-right":case"top-left":g=v-Bs;break;case"bottom-right":case"bottom-left":g=-v+Bs;break;case"bottom":g=-l+Bs;break;case"top":g=l-Bs}switch(r){case"top-right":case"bottom-right":p=-v;break;case"top-left":case"bottom-left":p=v;break;case"left":p=l;break;case"right":p=-l}return[p,g]}(i,e[0])}function Em(i,e,r){var l;const p=i.layout,g=(l=p.get("text-variable-anchor-offset"))===null||l===void 0?void 0:l.evaluate(e,{},r);if(g){const b=g.values,I=[];for(let P=0;PD*di);T.startsWith("top")?A[1]-=Bs:T.startsWith("bottom")&&(A[1]+=Bs),I[P+1]=A}return new er(I)}const v=p.get("text-variable-anchor");if(v){let b;b=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[p.get("text-radial-offset").evaluate(e,{},r)*di,Rd]:p.get("text-offset").evaluate(e,{},r).map(P=>P*di);const I=[];for(const P of v)I.push(P,Mm(P,b));return new er(I)}return null}function Od(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function vv(i,e,r,l,p,g,v,b,I,P,T){let A=g.textMaxSize.evaluate(e,{});A===void 0&&(A=v);const D=i.layers[0].layout,O=D.get("icon-offset").evaluate(e,{},T),j=Am(r.horizontal),q=v/24,H=i.tilePixelRatio*q,tt=i.tilePixelRatio*A/24,ct=i.tilePixelRatio*b,rt=i.tilePixelRatio*D.get("symbol-spacing"),at=D.get("text-padding")*i.tilePixelRatio,mt=function(_t,Zt,qt,Qt=1){const ze=_t.get("icon-padding").evaluate(Zt,{},qt),Te=ze&&ze.values;return[Te[0]*Qt,Te[1]*Qt,Te[2]*Qt,Te[3]*Qt]}(D,e,T,i.tilePixelRatio),wt=D.get("text-max-angle")/180*Math.PI,Lt=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",Ht=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Dt=D.get("symbol-placement"),zt=rt/2,$t=D.get("icon-text-fit");let Nt;l&&$t!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Nt=Qf(l,r.vertical,$t,D.get("icon-text-fit-padding"),O,q)),j&&(l=Qf(l,j,$t,D.get("icon-text-fit-padding"),O,q)));const Ot=(_t,Zt)=>{Zt.x<0||Zt.x>=hi||Zt.y<0||Zt.y>=hi||function(qt,Qt,ze,Te,fi,Jr,zi,mi,Gi,Xi,Wi,ei,gi,Vi,ki,Hi,Di,Lr,lr,ve,Be,je,gr,Je,Oa){const kn=qt.addToLineVertexArray(Qt,ze);let Dn,Yr,Br,wi,ns=0,yh=0,Lm=0,Bm=0,Gd=-1,Xd=-1;const ss={};let Fm=sd("");if(qt.allowVerticalPlacement&&Te.vertical){const Ni=mi.layout.get("text-rotate").evaluate(Be,{},Je)+90;Br=new Wc(Gi,Qt,Xi,Wi,ei,Te.vertical,gi,Vi,ki,Ni),zi&&(wi=new Wc(Gi,Qt,Xi,Wi,ei,zi,Di,Lr,ki,Ni))}if(fi){const Ni=mi.layout.get("icon-rotate").evaluate(Be,{}),Fr=mi.layout.get("icon-text-fit")!=="none",ko=Sm(fi,Ni,gr,Fr),pn=zi?Sm(zi,Ni,gr,Fr):void 0;Yr=new Wc(Gi,Qt,Xi,Wi,ei,fi,Di,Lr,!1,Ni),ns=4*ko.length;const Do=qt.iconSizeData;let Ln=null;Do.kind==="source"?(Ln=[zn*mi.layout.get("icon-size").evaluate(Be,{})],Ln[0]>ks&&qe(`${qt.layerIds[0]}: Value for "icon-size" is >= ${dh}. Reduce your "icon-size".`)):Do.kind==="composite"&&(Ln=[zn*je.compositeIconSizes[0].evaluate(Be,{},Je),zn*je.compositeIconSizes[1].evaluate(Be,{},Je)],(Ln[0]>ks||Ln[1]>ks)&&qe(`${qt.layerIds[0]}: Value for "icon-size" is >= ${dh}. Reduce your "icon-size".`)),qt.addSymbols(qt.icon,ko,Ln,ve,lr,Be,m.ah.none,Qt,kn.lineStartIndex,kn.lineLength,-1,Je),Gd=qt.icon.placedSymbolArray.length-1,pn&&(yh=4*pn.length,qt.addSymbols(qt.icon,pn,Ln,ve,lr,Be,m.ah.vertical,Qt,kn.lineStartIndex,kn.lineLength,-1,Je),Xd=qt.icon.placedSymbolArray.length-1)}const Rm=Object.keys(Te.horizontal);for(const Ni of Rm){const Fr=Te.horizontal[Ni];if(!Dn){Fm=sd(Fr.text);const pn=mi.layout.get("text-rotate").evaluate(Be,{},Je);Dn=new Wc(Gi,Qt,Xi,Wi,ei,Fr,gi,Vi,ki,pn)}const ko=Fr.positionedLines.length===1;if(Lm+=Tm(qt,Qt,Fr,Jr,mi,ki,Be,Hi,kn,Te.vertical?m.ah.horizontal:m.ah.horizontalOnly,ko?Rm:[Ni],ss,Gd,je,Je),ko)break}Te.vertical&&(Bm+=Tm(qt,Qt,Te.vertical,Jr,mi,ki,Be,Hi,kn,m.ah.vertical,["vertical"],ss,Xd,je,Je));const wv=Dn?Dn.boxStartIndex:qt.collisionBoxArray.length,Iv=Dn?Dn.boxEndIndex:qt.collisionBoxArray.length,Cv=Br?Br.boxStartIndex:qt.collisionBoxArray.length,Sv=Br?Br.boxEndIndex:qt.collisionBoxArray.length,Pv=Yr?Yr.boxStartIndex:qt.collisionBoxArray.length,Mv=Yr?Yr.boxEndIndex:qt.collisionBoxArray.length,Ev=wi?wi.boxStartIndex:qt.collisionBoxArray.length,Tv=wi?wi.boxEndIndex:qt.collisionBoxArray.length;let dn=-1;const Kc=(Ni,Fr)=>Ni&&Ni.circleDiameter?Math.max(Ni.circleDiameter,Fr):Fr;dn=Kc(Dn,dn),dn=Kc(Br,dn),dn=Kc(Yr,dn),dn=Kc(wi,dn);const Om=dn>-1?1:0;Om&&(dn*=Oa/di),qt.glyphOffsetArray.length>=Ba.MAX_GLYPHS&&qe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Be.sortKey!==void 0&&qt.addToSortKeyRanges(qt.symbolInstances.length,Be.sortKey);const Av=Em(mi,Be,Je),[zv,kv]=function(Ni,Fr){const ko=Ni.length,pn=Fr==null?void 0:Fr.values;if((pn==null?void 0:pn.length)>0)for(let Do=0;Do=0?ss.right:-1,ss.center>=0?ss.center:-1,ss.left>=0?ss.left:-1,ss.vertical||-1,Gd,Xd,Fm,wv,Iv,Cv,Sv,Pv,Mv,Ev,Tv,Xi,Lm,Bm,ns,yh,Om,0,gi,dn,zv,kv)}(i,Zt,_t,r,l,p,Nt,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,H,[at,at,at,at],Lt,I,ct,mt,Ht,O,e,g,P,T,v)};if(Dt==="line")for(const _t of vm(e.geometry,0,0,hi,hi)){const Zt=mv(_t,rt,wt,r.vertical||j,l,24,tt,i.overscaling,hi);for(const qt of Zt)j&&xv(i,j.text,zt,qt)||Ot(_t,qt)}else if(Dt==="line-center"){for(const _t of e.geometry)if(_t.length>1){const Zt=fv(_t,wt,r.vertical||j,l,24,tt);Zt&&Ot(_t,Zt)}}else if(e.type==="Polygon")for(const _t of ra(e.geometry,0)){const Zt=yv(_t,16);Ot(_t[0],new Ls(Zt.x,Zt.y,0))}else if(e.type==="LineString")for(const _t of e.geometry)Ot(_t,new Ls(_t[0].x,_t[0].y,0));else if(e.type==="Point")for(const _t of e.geometry)for(const Zt of _t)Ot([Zt],new Ls(Zt.x,Zt.y,0))}function Tm(i,e,r,l,p,g,v,b,I,P,T,A,D,O,j){const q=function(ct,rt,at,mt,wt,Lt,Ht,Dt){const zt=mt.layout.get("text-rotate").evaluate(Lt,{})*Math.PI/180,$t=[];for(const Nt of rt.positionedLines)for(const Ot of Nt.positionedGlyphs){if(!Ot.rect)continue;const _t=Ot.rect||{};let Zt=Zf+1,qt=!0,Qt=1,ze=0;const Te=(wt||Dt)&&Ot.vertical,fi=Ot.metrics.advance*Ot.scale/2;if(Dt&&rt.verticalizable&&(ze=Nt.lineOffset/2-(Ot.imageName?-(di-Ot.metrics.width*Ot.scale)/2:(Ot.scale-1)*di)),Ot.imageName){const ve=Ht[Ot.imageName];qt=ve.sdf,Qt=ve.pixelRatio,Zt=ar/Qt}const Jr=wt?[Ot.x+fi,Ot.y]:[0,0];let zi=wt?[0,0]:[Ot.x+fi+at[0],Ot.y+at[1]-ze],mi=[0,0];Te&&(mi=zi,zi=[0,0]);const Gi=Ot.metrics.isDoubleResolution?2:1,Xi=(Ot.metrics.left-Zt)*Ot.scale-fi+zi[0],Wi=(-Ot.metrics.top-Zt)*Ot.scale+zi[1],ei=Xi+_t.w/Gi*Ot.scale/Qt,gi=Wi+_t.h/Gi*Ot.scale/Qt,Vi=new B(Xi,Wi),ki=new B(ei,Wi),Hi=new B(Xi,gi),Di=new B(ei,gi);if(Te){const ve=new B(-fi,fi-ch),Be=-Math.PI/2,je=di/2-fi,gr=new B(5-ch-je,-(Ot.imageName?je:0)),Je=new B(...mi);Vi._rotateAround(Be,ve)._add(gr)._add(Je),ki._rotateAround(Be,ve)._add(gr)._add(Je),Hi._rotateAround(Be,ve)._add(gr)._add(Je),Di._rotateAround(Be,ve)._add(gr)._add(Je)}if(zt){const ve=Math.sin(zt),Be=Math.cos(zt),je=[Be,-ve,ve,Be];Vi._matMult(je),ki._matMult(je),Hi._matMult(je),Di._matMult(je)}const Lr=new B(0,0),lr=new B(0,0);$t.push({tl:Vi,tr:ki,bl:Hi,br:Di,tex:_t,writingMode:rt.writingMode,glyphOffset:Jr,sectionIndex:Ot.sectionIndex,isSDF:qt,pixelOffsetTL:Lr,pixelOffsetBR:lr,minFontScaleX:0,minFontScaleY:0})}return $t}(0,r,b,p,g,v,l,i.allowVerticalPlacement),H=i.textSizeData;let tt=null;H.kind==="source"?(tt=[zn*p.layout.get("text-size").evaluate(v,{})],tt[0]>ks&&qe(`${i.layerIds[0]}: Value for "text-size" is >= ${dh}. Reduce your "text-size".`)):H.kind==="composite"&&(tt=[zn*O.compositeTextSizes[0].evaluate(v,{},j),zn*O.compositeTextSizes[1].evaluate(v,{},j)],(tt[0]>ks||tt[1]>ks)&&qe(`${i.layerIds[0]}: Value for "text-size" is >= ${dh}. Reduce your "text-size".`)),i.addSymbols(i.text,q,tt,b,g,v,P,e,I.lineStartIndex,I.lineLength,D,j);for(const ct of T)A[ct]=i.text.placedSymbolArray.length-1;return 4*q.length}function Am(i){for(const e in i)return i[e];return null}function xv(i,e,r,l){const p=i.compareText;if(e in p){const g=p[e];for(let v=g.length-1;v>=0;v--)if(l.dist(g[v])>4;if(p!==1)throw new Error(`Got v${p} data when expected v1.`);const g=zm[15&l];if(!g)throw new Error("Unrecognized array type.");const[v]=new Uint16Array(e,2,1),[b]=new Uint32Array(e,4,1);return new Vd(b,v,g,e)}constructor(e,r=64,l=Float64Array,p){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=l,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const g=zm.indexOf(this.ArrayType),v=2*e*this.ArrayType.BYTES_PER_ELEMENT,b=e*this.IndexArrayType.BYTES_PER_ELEMENT,I=(8-b%8)%8;if(g<0)throw new Error(`Unexpected typed array class: ${l}.`);p&&p instanceof ArrayBuffer?(this.data=p,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+b+I,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+v+b+I),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+b+I,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+g]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const l=this._pos>>1;return this.ids[l]=l,this.coords[this._pos++]=e,this.coords[this._pos++]=r,l}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Nd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,l,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:v,nodeSize:b}=this,I=[0,g.length-1,0],P=[];for(;I.length;){const T=I.pop()||0,A=I.pop()||0,D=I.pop()||0;if(A-D<=b){for(let H=D;H<=A;H++){const tt=v[2*H],ct=v[2*H+1];tt>=e&&tt<=l&&ct>=r&&ct<=p&&P.push(g[H])}continue}const O=D+A>>1,j=v[2*O],q=v[2*O+1];j>=e&&j<=l&&q>=r&&q<=p&&P.push(g[O]),(T===0?e<=j:r<=q)&&(I.push(D),I.push(O-1),I.push(1-T)),(T===0?l>=j:p>=q)&&(I.push(O+1),I.push(A),I.push(1-T))}return P}within(e,r,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:g,nodeSize:v}=this,b=[0,p.length-1,0],I=[],P=l*l;for(;b.length;){const T=b.pop()||0,A=b.pop()||0,D=b.pop()||0;if(A-D<=v){for(let H=D;H<=A;H++)Dm(g[2*H],g[2*H+1],e,r)<=P&&I.push(p[H]);continue}const O=D+A>>1,j=g[2*O],q=g[2*O+1];Dm(j,q,e,r)<=P&&I.push(p[O]),(T===0?e-l<=j:r-l<=q)&&(b.push(D),b.push(O-1),b.push(1-T)),(T===0?e+l>=j:r+l>=q)&&(b.push(O+1),b.push(A),b.push(1-T))}return I}}function Nd(i,e,r,l,p,g){if(p-l<=r)return;const v=l+p>>1;km(i,e,v,l,p,g),Nd(i,e,r,l,v-1,1-g),Nd(i,e,r,v+1,p,1-g)}function km(i,e,r,l,p,g){for(;p>l;){if(p-l>600){const P=p-l+1,T=r-l+1,A=Math.log(P),D=.5*Math.exp(2*A/3),O=.5*Math.sqrt(A*D*(P-D)/P)*(T-P/2<0?-1:1);km(i,e,r,Math.max(l,Math.floor(r-T*D/P+O)),Math.min(p,Math.floor(r+(P-T)*D/P+O)),g)}const v=e[2*r+g];let b=l,I=p;for(mh(i,e,l,r),e[2*p+g]>v&&mh(i,e,l,p);bv;)I--}e[2*l+g]===v?mh(i,e,l,I):(I++,mh(i,e,I,p)),I<=r&&(l=I+1),r<=I&&(p=I-1)}}function mh(i,e,r,l){jd(i,r,l),jd(e,2*r,2*l),jd(e,2*r+1,2*l+1)}function jd(i,e,r){const l=i[e];i[e]=i[r],i[r]=l}function Dm(i,e,r,l){const p=i-r,g=e-l;return p*p+g*g}var Ud;m.bf=void 0,(Ud=m.bf||(m.bf={})).create="create",Ud.load="load",Ud.fullLoad="fullLoad";let Hc=null,gh=[];const qd=1e3/60,$d="loadTime",Zd="fullLoadTime",bv={mark(i){performance.mark(i)},frame(i){const e=i;Hc!=null&&gh.push(e-Hc),Hc=e},clearMetrics(){Hc=null,gh=[],performance.clearMeasures($d),performance.clearMeasures(Zd);for(const i in m.bf)performance.clearMarks(m.bf[i])},getPerformanceMetrics(){performance.measure($d,m.bf.create,m.bf.load),performance.measure(Zd,m.bf.create,m.bf.fullLoad);const i=performance.getEntriesByName($d)[0].duration,e=performance.getEntriesByName(Zd)[0].duration,r=gh.length,l=1/(gh.reduce((g,v)=>g+v,0)/r/1e3),p=gh.filter(g=>g>qd).reduce((g,v)=>g+(v-qd)/qd,0);return{loadTime:i,fullLoadTime:e,fps:l,percentDroppedFrames:p/(r+p)*100,totalFrames:r}}};m.$=class extends X{},m.A=Ta,m.B=Yu,m.C=function(i){if(rn==null){const e=i.navigator?i.navigator.userAgent:null;rn=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return rn},m.D=t,m.E=ps,m.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new dv(()=>this.process()),this.subscription=function(r,l,p,g){return r.addEventListener(l,p,!1),{unsubscribe:()=>{r.removeEventListener(l,p,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=xi(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,l)=>{const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[p]={resolve:r,reject:l},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[p];const b={id:p,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const g=[],v=Object.assign(Object.assign({},i),{id:p,sourceMapId:this.mapId,origin:location.origin,data:bo(i.data,g)});this.target.postMessage(v,{transfer:g})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];const l=this.abortControllers[r];return delete this.abortControllers[r],void(l&&l.abort())}if(xi(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return h(this,void 0,void 0,function*(){if(e.type===""){const p=this.resolveRejects[i];return delete this.resolveRejects[i],p?void(e.error?p.reject(wo(e.error)):p.resolve(wo(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=wo(e.data),l=new AbortController;this.abortControllers[i]=l;try{const p=yield this.messageHandlers[e.type](e.sourceMapId,r,l);this.completeTask(i,null,p)}catch(p){this.completeTask(i,p)}})}completeTask(i,e,r){const l=[];delete this.abortControllers[i];const p={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?bo(e):null,data:bo(r,l)};this.target.postMessage(p,{transfer:l})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},m.G=ds,m.H=function(){var i=new Ta(16);return Ta!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},m.I=Pd,m.J=function(i,e,r){var l,p,g,v,b,I,P,T,A,D,O,j,q=r[0],H=r[1],tt=r[2];return e===i?(i[12]=e[0]*q+e[4]*H+e[8]*tt+e[12],i[13]=e[1]*q+e[5]*H+e[9]*tt+e[13],i[14]=e[2]*q+e[6]*H+e[10]*tt+e[14],i[15]=e[3]*q+e[7]*H+e[11]*tt+e[15]):(p=e[1],g=e[2],v=e[3],b=e[4],I=e[5],P=e[6],T=e[7],A=e[8],D=e[9],O=e[10],j=e[11],i[0]=l=e[0],i[1]=p,i[2]=g,i[3]=v,i[4]=b,i[5]=I,i[6]=P,i[7]=T,i[8]=A,i[9]=D,i[10]=O,i[11]=j,i[12]=l*q+b*H+A*tt+e[12],i[13]=p*q+I*H+D*tt+e[13],i[14]=g*q+P*H+O*tt+e[14],i[15]=v*q+T*H+j*tt+e[15]),i},m.K=function(i,e,r){var l=r[0],p=r[1],g=r[2];return i[0]=e[0]*l,i[1]=e[1]*l,i[2]=e[2]*l,i[3]=e[3]*l,i[4]=e[4]*p,i[5]=e[5]*p,i[6]=e[6]*p,i[7]=e[7]*p,i[8]=e[8]*g,i[9]=e[9]*g,i[10]=e[10]*g,i[11]=e[11]*g,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},m.L=pf,m.M=function(i,e){const r={};for(let l=0;l{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const l of i){const p=window.document.createElement("source");Un(l)||(e.crossOrigin="Anonymous"),p.src=l,e.appendChild(p)}})},m.a4=function(){return Qe++},m.a5=Pi,m.a6=Ba,m.a7=bs,m.a8=Ao,m.a9=mm,m.aA=function(i){if(i.type==="custom")return new uv(i);switch(i.type){case"background":return new lv(i);case"circle":return new Hy(i);case"fill":return new d_(i);case"fill-extrusion":return new M_(i);case"heatmap":return new Jy(i);case"hillshade":return new Qy(i);case"line":return new B_(i);case"raster":return new cv(i);case"symbol":return new $c(i)}},m.aB=le,m.aC=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!be(i.version,e.version))return[{command:"setStyle",args:[e]}];be(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),be(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),be(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),be(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),be(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),be(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),be(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),be(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),be(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),be(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),be(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const l={},p=[];(function(v,b,I,P){let T;for(T in b=b||{},v=v||{})Object.prototype.hasOwnProperty.call(v,T)&&(Object.prototype.hasOwnProperty.call(b,T)||xn(T,I,P));for(T in b)Object.prototype.hasOwnProperty.call(b,T)&&(Object.prototype.hasOwnProperty.call(v,T)?be(v[T],b[T])||(v[T].type==="geojson"&&b[T].type==="geojson"&&fs(v,b,T)?Xe(I,{command:"setGeoJSONSourceData",args:[T,b[T].data]}):on(T,b,I,P)):Xs(T,b,I))})(i.sources,e.sources,p,l);const g=[];i.layers&&i.layers.forEach(v=>{"source"in v&&l[v.source]?r.push({command:"removeLayer",args:[v.id]}):g.push(v)}),r=r.concat(p),function(v,b,I){b=b||[];const P=(v=v||[]).map(Ws),T=b.map(Ws),A=v.reduce(Hs,{}),D=b.reduce(Hs,{}),O=P.slice(),j=Object.create(null);let q,H,tt,ct,rt;for(let at=0,mt=0;at@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,l,p,g)=>{const v=p||g;return e[l]=!v||v.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},m.ab=function(i,e){const r=[];for(const l in i)l in e||r.push(l);return r},m.ac=ce,m.ad=function(i,e,r){var l=Math.sin(r),p=Math.cos(r),g=e[0],v=e[1],b=e[2],I=e[3],P=e[4],T=e[5],A=e[6],D=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=g*p+P*l,i[1]=v*p+T*l,i[2]=b*p+A*l,i[3]=I*p+D*l,i[4]=P*p-g*l,i[5]=T*p-v*l,i[6]=A*p-b*l,i[7]=D*p-I*l,i},m.ae=function(i){var e=new Ta(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},m.af=Bc,m.ag=function(i,e){let r=0,l=0;if(i.kind==="constant")l=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:p,minZoom:g,maxZoom:v}=i,b=p?ce(rr.interpolationFactor(p,e,g,v),0,1):0;i.kind==="camera"?l=ir.number(i.minSize,i.maxSize,b):r=b}return{uSizeT:r,uSize:l}},m.ai=function(i,{uSize:e,uSizeT:r},{lowerSize:l,upperSize:p}){return i.kind==="source"?l/zn:i.kind==="composite"?ir.number(l/zn,p/zn,r):e},m.aj=Ad,m.ak=function(i,e,r,l){const p=e.y-i.y,g=e.x-i.x,v=l.y-r.y,b=l.x-r.x,I=v*g-b*p;if(I===0)return null;const P=(b*(i.y-r.y)-v*(i.x-r.x))/I;return new B(i.x+P*g,i.y+P*p)},m.al=vm,m.am=af,m.an=dd,m.ao=function(i){let e=1/0,r=1/0,l=-1/0,p=-1/0;for(const g of i)e=Math.min(e,g.x),r=Math.min(r,g.y),l=Math.max(l,g.x),p=Math.max(p,g.y);return[e,r,l,p]},m.ap=di,m.ar=Td,m.as=function(i,e){var r=e[0],l=e[1],p=e[2],g=e[3],v=e[4],b=e[5],I=e[6],P=e[7],T=e[8],A=e[9],D=e[10],O=e[11],j=e[12],q=e[13],H=e[14],tt=e[15],ct=r*b-l*v,rt=r*I-p*v,at=r*P-g*v,mt=l*I-p*b,wt=l*P-g*b,Lt=p*P-g*I,Ht=T*q-A*j,Dt=T*H-D*j,zt=T*tt-O*j,$t=A*H-D*q,Nt=A*tt-O*q,Ot=D*tt-O*H,_t=ct*Ot-rt*Nt+at*$t+mt*zt-wt*Dt+Lt*Ht;return _t?(i[0]=(b*Ot-I*Nt+P*$t)*(_t=1/_t),i[1]=(p*Nt-l*Ot-g*$t)*_t,i[2]=(q*Lt-H*wt+tt*mt)*_t,i[3]=(D*wt-A*Lt-O*mt)*_t,i[4]=(I*zt-v*Ot-P*Dt)*_t,i[5]=(r*Ot-p*zt+g*Dt)*_t,i[6]=(H*at-j*Lt-tt*rt)*_t,i[7]=(T*Lt-D*at+O*rt)*_t,i[8]=(v*Nt-b*zt+P*Ht)*_t,i[9]=(l*zt-r*Nt-g*Ht)*_t,i[10]=(j*wt-q*at+tt*ct)*_t,i[11]=(A*at-T*wt-O*ct)*_t,i[12]=(b*Dt-v*$t-I*Ht)*_t,i[13]=(r*$t-l*Dt+p*Ht)*_t,i[14]=(q*rt-j*mt-H*ct)*_t,i[15]=(T*mt-A*rt+D*ct)*_t,i):null},m.at=Od,m.au=Ed,m.av=Vd,m.aw=function(){const i={},e=ft.$version;for(const r in ft.$root){const l=ft.$root[r];if(l.required){let p=null;p=r==="version"?e:l.type==="array"?[]:{},p!=null&&(i[r]=p)}}return i},m.ax=Qn,m.ay=wr,m.az=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r25||l<0||l>=1||r<0||r>=1)},m.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},m.bc=class extends J{},m.bd=Ld,m.be=bv,m.bg=Yi,m.bh=function(i,e){yn.REGISTERED_PROTOCOLS[i]=e},m.bi=function(i){delete yn.REGISTERED_PROTOCOLS[i]},m.bj=function(i,e){const r={};for(let p=0;pOt*di)}let Dt=v?"center":r.get("text-justify").evaluate(P,{},i.canonical);const zt=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(P,{},i.canonical)*di:1/0,$t=()=>{i.bucket.allowVerticalPlacement&&$l(at)&&(j.vertical=jc(q,i.glyphMap,i.glyphPositions,i.imagePositions,T,zt,g,Lt,"left",wt,tt,m.ah.vertical,!0,D,A))};if(!v&&Ht){const Nt=new Set;if(Dt==="auto")for(let _t=0;_th(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),m.e=ye,m.f=i=>new Promise((e,r)=>{const l=new Image;l.onload=()=>{e(l),URL.revokeObjectURL(l.src),l.onload=null,window.requestAnimationFrame(()=>{l.src=gn})},l.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const p=new Blob([new Uint8Array(i)],{type:"image/png"});l.src=i.byteLength?URL.createObjectURL(p):gn}),m.g=Ur,m.h=(i,e)=>jn(ye(i,{type:"json"}),e),m.i=xi,m.j=vn,m.k=_n,m.l=(i,e)=>jn(ye(i,{type:"arrayBuffer"}),e),m.m=jn,m.n=function(i){return new Cd(i).readFields(K_,[])},m.o=rh,m.p=Gf,m.q=w,m.r=wa,m.s=Un,m.t=bc,m.u=Yn,m.v=ft,m.w=qe,m.x=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},m.y=ir,m.z=Me}),c("worker",["./shared"],function(m){class h{constructor(R){this.keyCache={},R&&this.replace(R)}replace(R){this._layerConfigs={},this._layers={},this.update(R,[])}update(R,F){for(const K of R){this._layerConfigs[K.id]=K;const nt=this._layers[K.id]=m.aA(K);nt._featureFilter=m.a7(nt.filter),this.keyCache[K.id]&&delete this.keyCache[K.id]}for(const K of F)delete this.keyCache[K],delete this._layerConfigs[K],delete this._layers[K];this.familiesBySource={};const $=m.bj(Object.values(this._layerConfigs),this.keyCache);for(const K of $){const nt=K.map(pt=>this._layers[pt.id]),st=nt[0];if(st.visibility==="none")continue;const lt=st.source||"";let et=this.familiesBySource[lt];et||(et=this.familiesBySource[lt]={});const yt=st.sourceLayer||"_geojsonTileLayer";let bt=et[yt];bt||(bt=et[yt]=[]),bt.push(nt)}}}class M{constructor(R){const F={},$=[];for(const lt in R){const et=R[lt],yt=F[lt]={};for(const bt in et){const pt=et[+bt];if(!pt||pt.bitmap.width===0||pt.bitmap.height===0)continue;const Mt={x:0,y:0,w:pt.bitmap.width+2,h:pt.bitmap.height+2};$.push(Mt),yt[bt]={rect:Mt,metrics:pt.metrics}}}const{w:K,h:nt}=m.p($),st=new m.o({width:K||1,height:nt||1});for(const lt in R){const et=R[lt];for(const yt in et){const bt=et[+yt];if(!bt||bt.bitmap.width===0||bt.bitmap.height===0)continue;const pt=F[lt][yt].rect;m.o.copy(bt.bitmap,st,{x:0,y:0},{x:pt.x+1,y:pt.y+1},bt.bitmap)}}this.image=st,this.positions=F}}m.bk("GlyphAtlas",M);class L{constructor(R){this.tileID=new m.S(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.uid=R.uid,this.zoom=R.zoom,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.returnDependencies=!!R.returnDependencies,this.promoteId=R.promoteId,this.inFlightDependencies=[]}parse(R,F,$,K){return m._(this,void 0,void 0,function*(){this.status="parsing",this.data=R,this.collisionBoxArray=new m.a5;const nt=new m.bl(Object.keys(R.layers).sort()),st=new m.bm(this.tileID,this.promoteId);st.bucketLayerIDs=[];const lt={},et={featureIndex:st,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:$},yt=F.familiesBySource[this.source];for(const ue in yt){const Ie=R.layers[ue];if(!Ie)continue;Ie.version===1&&m.w(`Vector tile source "${this.source}" layer "${ue}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $e=nt.encode(ue),ui=[];for(let Ii=0;Ii=Ci.maxzoom||Ci.visibility!=="none"&&(V(Ii,this.zoom,$),(lt[Ci.id]=Ci.createBucket({index:st.bucketLayerIDs.length,layers:Ii,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$e,sourceID:this.source})).populate(ui,et,this.tileID.canonical),st.bucketLayerIDs.push(Ii.map(Ks=>Ks.id)))}}const bt=m.aF(et.glyphDependencies,ue=>Object.keys(ue).map(Number));this.inFlightDependencies.forEach(ue=>ue==null?void 0:ue.abort()),this.inFlightDependencies=[];let pt=Promise.resolve({});if(Object.keys(bt).length){const ue=new AbortController;this.inFlightDependencies.push(ue),pt=K.sendAsync({type:"GG",data:{stacks:bt,source:this.source,tileID:this.tileID,type:"glyphs"}},ue)}const Mt=Object.keys(et.iconDependencies);let Xt=Promise.resolve({});if(Mt.length){const ue=new AbortController;this.inFlightDependencies.push(ue),Xt=K.sendAsync({type:"GI",data:{icons:Mt,source:this.source,tileID:this.tileID,type:"icons"}},ue)}const Wt=Object.keys(et.patternDependencies);let re=Promise.resolve({});if(Wt.length){const ue=new AbortController;this.inFlightDependencies.push(ue),re=K.sendAsync({type:"GI",data:{icons:Wt,source:this.source,tileID:this.tileID,type:"patterns"}},ue)}const[_e,ie,ke]=yield Promise.all([pt,Xt,re]),We=new M(_e),ai=new m.bn(ie,ke);for(const ue in lt){const Ie=lt[ue];Ie instanceof m.a6?(V(Ie.layers,this.zoom,$),m.bo({bucket:Ie,glyphMap:_e,glyphPositions:We.positions,imageMap:ie,imagePositions:ai.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ie.hasPattern&&(Ie instanceof m.bp||Ie instanceof m.bq||Ie instanceof m.br)&&(V(Ie.layers,this.zoom,$),Ie.addFeatures(et,this.tileID.canonical,ai.patternPositions))}return this.status="done",{buckets:Object.values(lt).filter(ue=>!ue.isEmpty()),featureIndex:st,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:We.image,imageAtlas:ai,glyphMap:this.returnDependencies?_e:null,iconMap:this.returnDependencies?ie:null,glyphPositions:this.returnDependencies?We.positions:null}})}}function V(Y,R,F){const $=new m.z(R);for(const K of Y)K.recalculate($,F)}class B{constructor(R,F,$){this.actor=R,this.layerIndex=F,this.availableImages=$,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(R,F){return m._(this,void 0,void 0,function*(){const $=yield m.l(R.request,F);try{return{vectorTile:new m.bs.VectorTile(new m.bt($.data)),rawData:$.data,cacheControl:$.cacheControl,expires:$.expires}}catch(K){const nt=new Uint8Array($.data);let st=`Unable to parse the tile at ${R.request.url}, `;throw st+=nt[0]===31&&nt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${K.message}`,new Error(st)}})}loadTile(R){return m._(this,void 0,void 0,function*(){const F=R.uid,$=!!(R&&R.request&&R.request.collectResourceTiming)&&new m.bu(R.request),K=new L(R);this.loading[F]=K;const nt=new AbortController;K.abort=nt;try{const st=yield this.loadVectorTile(R,nt);if(delete this.loading[F],!st)return null;const lt=st.rawData,et={};st.expires&&(et.expires=st.expires),st.cacheControl&&(et.cacheControl=st.cacheControl);const yt={};if($){const pt=$.finish();pt&&(yt.resourceTiming=JSON.parse(JSON.stringify(pt)))}K.vectorTile=st.vectorTile;const bt=K.parse(st.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[F]=K,this.fetching[F]={rawTileData:lt,cacheControl:et,resourceTiming:yt};try{const pt=yield bt;return m.e({rawTileData:lt.slice(0)},pt,et,yt)}finally{delete this.fetching[F]}}catch(st){throw delete this.loading[F],K.status="done",this.loaded[F]=K,st}})}reloadTile(R){return m._(this,void 0,void 0,function*(){const F=R.uid;if(!this.loaded||!this.loaded[F])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const $=this.loaded[F];if($.showCollisionBoxes=R.showCollisionBoxes,$.status==="parsing"){const K=yield $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor);let nt;if(this.fetching[F]){const{rawTileData:st,cacheControl:lt,resourceTiming:et}=this.fetching[F];delete this.fetching[F],nt=m.e({rawTileData:st.slice(0)},K,lt,et)}else nt=K;return nt}if($.status==="done"&&$.vectorTile)return $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(R){return m._(this,void 0,void 0,function*(){const F=this.loading,$=R.uid;F&&F[$]&&F[$].abort&&(F[$].abort.abort(),delete F[$])})}removeTile(R){return m._(this,void 0,void 0,function*(){this.loaded&&this.loaded[R.uid]&&delete this.loaded[R.uid]})}}class U{constructor(){this.loaded={}}loadTile(R){return m._(this,void 0,void 0,function*(){const{uid:F,encoding:$,rawImageData:K,redFactor:nt,greenFactor:st,blueFactor:lt,baseShift:et}=R,yt=K.width+2,bt=K.height+2,pt=m.b(K)?new m.R({width:yt,height:bt},yield m.bv(K,-1,-1,yt,bt)):K,Mt=new m.bw(F,pt,$,nt,st,lt,et);return this.loaded=this.loaded||{},this.loaded[F]=Mt,Mt})}removeTile(R){const F=this.loaded,$=R.uid;F&&F[$]&&delete F[$]}}function ut(Y,R){if(Y.length!==0){vt(Y[0],R);for(var F=1;F=Math.abs(lt)?F-et+lt:lt-et+F,F=et}F+$>=0!=!!R&&Y.reverse()}var Tt=m.bx(function Y(R,F){var $,K=R&&R.type;if(K==="FeatureCollection")for($=0;$>31}function xi(Y,R){for(var F=Y.loadGeometry(),$=Y.type,K=0,nt=0,st=F.length,lt=0;ltY},Nn=Math.fround||(nn=new Float32Array(1),Y=>(nn[0]=+Y,nn[0]));var nn;const Ui=3,br=5,us=6;class yn{constructor(R){this.options=Object.assign(Object.create(gn),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:F,minZoom:$,maxZoom:K}=this.options;F&&console.time("total time");const nt=`prepare ${R.length} points`;F&&console.time(nt),this.points=R;const st=[];for(let et=0;et=$;et--){const yt=+Date.now();lt=this.trees[et]=this._createTree(this._cluster(lt,et)),F&&console.log("z%d: %d clusters in %dms",et,lt.numItems,+Date.now()-yt)}return F&&console.timeEnd("total time"),this}getClusters(R,F){let $=((R[0]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,R[1]));let nt=R[2]===180?180:((R[2]+180)%360+360)%360-180;const st=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)$=-180,nt=180;else if($>nt){const pt=this.getClusters([$,K,180,st],F),Mt=this.getClusters([-180,K,nt,st],F);return pt.concat(Mt)}const lt=this.trees[this._limitZoom(F)],et=lt.range(Yi($),wr(st),Yi(nt),wr(K)),yt=lt.data,bt=[];for(const pt of et){const Mt=this.stride*pt;bt.push(yt[Mt+br]>1?Ur(yt,Mt,this.clusterProps):this.points[yt[Mt+Ui]])}return bt}getChildren(R){const F=this._getOriginId(R),$=this._getOriginZoom(R),K="No cluster with the specified id.",nt=this.trees[$];if(!nt)throw new Error(K);const st=nt.data;if(F*this.stride>=st.length)throw new Error(K);const lt=this.options.radius/(this.options.extent*Math.pow(2,$-1)),et=nt.within(st[F*this.stride],st[F*this.stride+1],lt),yt=[];for(const bt of et){const pt=bt*this.stride;st[pt+4]===R&&yt.push(st[pt+br]>1?Ur(st,pt,this.clusterProps):this.points[st[pt+Ui]])}if(yt.length===0)throw new Error(K);return yt}getLeaves(R,F,$){const K=[];return this._appendLeaves(K,R,F=F||10,$=$||0,0),K}getTile(R,F,$){const K=this.trees[this._limitZoom(R)],nt=Math.pow(2,R),{extent:st,radius:lt}=this.options,et=lt/st,yt=($-et)/nt,bt=($+1+et)/nt,pt={features:[]};return this._addTileFeatures(K.range((F-et)/nt,yt,(F+1+et)/nt,bt),K.data,F,$,nt,pt),F===0&&this._addTileFeatures(K.range(1-et/nt,yt,1,bt),K.data,nt,$,nt,pt),F===nt-1&&this._addTileFeatures(K.range(0,yt,et/nt,bt),K.data,-1,$,nt,pt),pt.features.length?pt:null}getClusterExpansionZoom(R){let F=this._getOriginZoom(R)-1;for(;F<=this.options.maxZoom;){const $=this.getChildren(R);if(F++,$.length!==1)break;R=$[0].properties.cluster_id}return F}_appendLeaves(R,F,$,K,nt){const st=this.getChildren(F);for(const lt of st){const et=lt.properties;if(et&&et.cluster?nt+et.point_count<=K?nt+=et.point_count:nt=this._appendLeaves(R,et.cluster_id,$,K,nt):nt1;let bt,pt,Mt;if(yt)bt=ds(F,et,this.clusterProps),pt=F[et],Mt=F[et+1];else{const re=this.points[F[et+Ui]];bt=re.properties;const[_e,ie]=re.geometry.coordinates;pt=Yi(_e),Mt=wr(ie)}const Xt={type:1,geometry:[[Math.round(this.options.extent*(pt*nt-$)),Math.round(this.options.extent*(Mt*nt-K))]],tags:bt};let Wt;Wt=yt||this.options.generateId?F[et+Ui]:this.points[F[et+Ui]].id,Wt!==void 0&&(Xt.id=Wt),st.features.push(Xt)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,F){const{radius:$,extent:K,reduce:nt,minPoints:st}=this.options,lt=$/(K*Math.pow(2,F)),et=R.data,yt=[],bt=this.stride;for(let pt=0;ptF&&(_e+=et[ke+br])}if(_e>re&&_e>=st){let ie,ke=Mt*re,We=Xt*re,ai=-1;const ue=((pt/bt|0)<<5)+(F+1)+this.points.length;for(const Ie of Wt){const $e=Ie*bt;if(et[$e+2]<=F)continue;et[$e+2]=F;const ui=et[$e+br];ke+=et[$e]*ui,We+=et[$e+1]*ui,et[$e+4]=ue,nt&&(ie||(ie=this._map(et,pt,!0),ai=this.clusterProps.length,this.clusterProps.push(ie)),nt(ie,this._map(et,$e)))}et[pt+4]=ue,yt.push(ke/_e,We/_e,1/0,ue,-1,_e),nt&&yt.push(ai)}else{for(let ie=0;ie1)for(const ie of Wt){const ke=ie*bt;if(!(et[ke+2]<=F)){et[ke+2]=F;for(let We=0;We>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,F,$){if(R[F+br]>1){const st=this.clusterProps[R[F+us]];return $?Object.assign({},st):st}const K=this.points[R[F+Ui]].properties,nt=this.options.map(K);return $&&nt===K?Object.assign({},nt):nt}}function Ur(Y,R,F){return{type:"Feature",id:Y[R+Ui],properties:ds(Y,R,F),geometry:{type:"Point",coordinates:[($=Y[R],360*($-.5)),jn(Y[R+1])]}};var $}function ds(Y,R,F){const $=Y[R+br],K=$>=1e4?`${Math.round($/1e3)}k`:$>=1e3?Math.round($/100)/10+"k":$,nt=Y[R+us],st=nt===-1?{}:Object.assign({},F[nt]);return Object.assign(st,{cluster:!0,cluster_id:Y[R+Ui],point_count:$,point_count_abbreviated:K})}function Yi(Y){return Y/360+.5}function wr(Y){const R=Math.sin(Y*Math.PI/180),F=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return F<0?0:F>1?1:F}function jn(Y){const R=(180-360*Y)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function Un(Y,R,F,$){let K=$;const nt=R+(F-R>>1);let st,lt=F-R;const et=Y[R],yt=Y[R+1],bt=Y[F],pt=Y[F+1];for(let Mt=R+3;MtK)st=Mt,K=Xt;else if(Xt===K){const Wt=Math.abs(Mt-nt);Wt$&&(st-R>3&&Un(Y,R,st,$),Y[st+2]=K,F-st>3&&Un(Y,st,F,$))}function Zs(Y,R,F,$,K,nt){let st=K-F,lt=nt-$;if(st!==0||lt!==0){const et=((Y-F)*st+(R-$)*lt)/(st*st+lt*lt);et>1?(F=K,$=nt):et>0&&(F+=st*et,$+=lt*et)}return st=Y-F,lt=R-$,st*st+lt*lt}function sn(Y,R,F,$){const K={id:Y??null,type:R,geometry:F,tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(R==="Point"||R==="MultiPoint"||R==="LineString")_n(K,F);else if(R==="Polygon")_n(K,F[0]);else if(R==="MultiLineString")for(const nt of F)_n(K,nt);else if(R==="MultiPolygon")for(const nt of F)_n(K,nt[0]);return K}function _n(Y,R){for(let F=0;F0&&(st+=$?(K*bt-yt*nt)/2:Math.sqrt(Math.pow(yt-K,2)+Math.pow(bt-nt,2))),K=yt,nt=bt}const lt=R.length-3;R[2]=1,Un(R,0,lt,F),R[lt+2]=1,R.size=Math.abs(st),R.start=0,R.end=R.size}function qn(Y,R,F,$){for(let K=0;K1?1:F}function Xe(Y,R,F,$,K,nt,st,lt){if($/=R,nt>=(F/=R)&&st<$)return Y;if(st=$)return null;const et=[];for(const yt of Y){const bt=yt.geometry;let pt=yt.type;const Mt=K===0?yt.minX:yt.minY,Xt=K===0?yt.maxX:yt.maxY;if(Mt>=F&&Xt<$){et.push(yt);continue}if(Xt=$)continue;let Wt=[];if(pt==="Point"||pt==="MultiPoint")Xs(bt,Wt,F,$,K);else if(pt==="LineString")xn(bt,Wt,F,$,K,!1,lt.lineMetrics);else if(pt==="MultiLineString")fs(bt,Wt,F,$,K,!1);else if(pt==="Polygon")fs(bt,Wt,F,$,K,!0);else if(pt==="MultiPolygon")for(const re of bt){const _e=[];fs(re,_e,F,$,K,!0),_e.length&&Wt.push(_e)}if(Wt.length){if(lt.lineMetrics&&pt==="LineString"){for(const re of Wt)et.push(sn(yt.id,pt,re,yt.tags));continue}pt!=="LineString"&&pt!=="MultiLineString"||(Wt.length===1?(pt="LineString",Wt=Wt[0]):pt="MultiLineString"),pt!=="Point"&&pt!=="MultiPoint"||(pt=Wt.length===3?"Point":"MultiPoint"),et.push(sn(yt.id,pt,Wt,yt.tags))}}return et.length?et:null}function Xs(Y,R,F,$,K){for(let nt=0;nt=F&&st<=$&&dr(R,Y[nt],Y[nt+1],Y[nt+2])}}function xn(Y,R,F,$,K,nt,st){let lt=on(Y);const et=K===0?Ws:Hs;let yt,bt,pt=Y.start;for(let _e=0;_eF&&(bt=et(lt,ie,ke,ai,ue,F),st&&(lt.start=pt+yt*bt)):Ie>$?$e<$&&(bt=et(lt,ie,ke,ai,ue,$),st&&(lt.start=pt+yt*bt)):dr(lt,ie,ke,We),$e=F&&(bt=et(lt,ie,ke,ai,ue,F),ui=!0),$e>$&&Ie<=$&&(bt=et(lt,ie,ke,ai,ue,$),ui=!0),!nt&&ui&&(st&&(lt.end=pt+yt*bt),R.push(lt),lt=on(Y)),st&&(pt+=yt)}let Mt=Y.length-3;const Xt=Y[Mt],Wt=Y[Mt+1],re=K===0?Xt:Wt;re>=F&&re<=$&&dr(lt,Xt,Wt,Y[Mt+2]),Mt=lt.length-3,nt&&Mt>=3&&(lt[Mt]!==lt[0]||lt[Mt+1]!==lt[1])&&dr(lt,lt[0],lt[1],lt[2]),lt.length&&R.push(lt)}function on(Y){const R=[];return R.size=Y.size,R.start=Y.start,R.end=Y.end,R}function fs(Y,R,F,$,K,nt){for(const st of Y)xn(st,R,F,$,K,nt,!1)}function dr(Y,R,F,$){Y.push(R,F,$)}function Ws(Y,R,F,$,K,nt){const st=(nt-R)/($-R);return dr(Y,nt,F+(K-F)*st,1),st}function Hs(Y,R,F,$,K,nt){const st=(nt-F)/(K-F);return dr(Y,R+($-R)*st,nt,1),st}function Pt(Y,R){const F=[];for(let $=0;$0&&R.size<(K?st:$))return void(F.numPoints+=R.length/3);const lt=[];for(let et=0;etst)&&(F.numSimplified++,lt.push(R[et],R[et+1])),F.numPoints++;K&&function(et,yt){let bt=0;for(let pt=0,Mt=et.length,Xt=Mt-2;pt0===yt)for(let pt=0,Mt=et.length;pt24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let K=function(nt,st){const lt=[];if(nt.type==="FeatureCollection")for(let et=0;et1&&console.time("creation"),Xt=this.tiles[Mt]=bn(R,F,$,K,yt),this.tileCoords.push({z:F,x:$,y:K}),bt)){bt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,$,K,Xt.numFeatures,Xt.numPoints,Xt.numSimplified),console.timeEnd("creation"));const ui=`z${F}`;this.stats[ui]=(this.stats[ui]||0)+1,this.total++}if(Xt.source=R,nt==null){if(F===yt.indexMaxZoom||Xt.numPoints<=yt.indexMaxPoints)continue}else{if(F===yt.maxZoom||F===nt)continue;if(nt!=null){const ui=nt-F;if($!==st>>ui||K!==lt>>ui)continue}}if(Xt.source=null,R.length===0)continue;bt>1&&console.time("clipping");const Wt=.5*yt.buffer/yt.extent,re=.5-Wt,_e=.5+Wt,ie=1+Wt;let ke=null,We=null,ai=null,ue=null,Ie=Xe(R,pt,$-Wt,$+_e,0,Xt.minX,Xt.maxX,yt),$e=Xe(R,pt,$+re,$+ie,0,Xt.minX,Xt.maxX,yt);R=null,Ie&&(ke=Xe(Ie,pt,K-Wt,K+_e,1,Xt.minY,Xt.maxY,yt),We=Xe(Ie,pt,K+re,K+ie,1,Xt.minY,Xt.maxY,yt),Ie=null),$e&&(ai=Xe($e,pt,K-Wt,K+_e,1,Xt.minY,Xt.maxY,yt),ue=Xe($e,pt,K+re,K+ie,1,Xt.minY,Xt.maxY,yt),$e=null),bt>1&&console.timeEnd("clipping"),et.push(ke||[],F+1,2*$,2*K),et.push(We||[],F+1,2*$,2*K+1),et.push(ai||[],F+1,2*$+1,2*K),et.push(ue||[],F+1,2*$+1,2*K+1)}}getTile(R,F,$){R=+R,F=+F,$=+$;const K=this.options,{extent:nt,debug:st}=K;if(R<0||R>24)return null;const lt=1<1&&console.log("drilling down to z%d-%d-%d",R,F,$);let yt,bt=R,pt=F,Mt=$;for(;!yt&&bt>0;)bt--,pt>>=1,Mt>>=1,yt=this.tiles[Ir(bt,pt,Mt)];return yt&&yt.source?(st>1&&(console.log("found parent tile z%d-%d-%d",bt,pt,Mt),console.time("drilling down")),this.splitTile(yt.source,bt,pt,Mt,R,F,$),st>1&&console.timeEnd("drilling down"),this.tiles[et]?Fi(this.tiles[et],nt):null):null}}function Ir(Y,R,F){return 32*((1<{pt.properties=Xt;const Wt={};for(const re of Mt)Wt[re]=et[re].evaluate(bt,pt);return Wt},st.reduce=(Xt,Wt)=>{pt.properties=Wt;for(const re of Mt)bt.accumulated=Xt[re],Xt[re]=yt[re].evaluate(bt,pt)},st}(R)).load((yield this._pendingData).features):(K=yield this._pendingData,new qi(K,R.geojsonVtOptions)),this.loaded={};const nt={};if($){const st=$.finish();st&&(nt.resourceTiming={},nt.resourceTiming[R.source]=JSON.parse(JSON.stringify(st)))}return nt}catch(nt){if(delete this._pendingRequest,m.bA(nt))return{abandoned:!0};throw nt}var K})}getData(){return m._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(R){const F=this.loaded;return F&&F[R.uid]?super.reloadTile(R):this.loadTile(R)}loadAndProcessGeoJSON(R,F){return m._(this,void 0,void 0,function*(){let $=yield this.loadGeoJSON(R,F);if(delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(Tt($,!0),R.filter){const K=m.bB(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(K.result==="error")throw new Error(K.value.map(st=>`${st.key}: ${st.message}`).join(", "));$={type:"FeatureCollection",features:$.features.filter(st=>K.value.evaluate({zoom:0},st))}}return $})}loadGeoJSON(R,F){return m._(this,void 0,void 0,function*(){const{promoteId:$}=R;if(R.request){const K=yield m.h(R.request,F);return this._dataUpdateable=Zr(K.data,$)?an(K.data,$):void 0,K.data}if(typeof R.data=="string")try{const K=JSON.parse(R.data);return this._dataUpdateable=Zr(K,$)?an(K,$):void 0,K}catch{throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`)}if(!R.dataDiff)throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${R.source}`);return function(K,nt,st){var lt,et,yt,bt;if(nt.removeAll&&K.clear(),nt.remove)for(const pt of nt.remove)K.delete(pt);if(nt.add)for(const pt of nt.add){const Mt=ee(pt,st);Mt!=null&&K.set(Mt,pt)}if(nt.update)for(const pt of nt.update){let Mt=K.get(pt.id);if(Mt==null)continue;const Xt=!pt.removeAllProperties&&(((lt=pt.removeProperties)===null||lt===void 0?void 0:lt.length)>0||((et=pt.addOrUpdateProperties)===null||et===void 0?void 0:et.length)>0);if((pt.newGeometry||pt.removeAllProperties||Xt)&&(Mt=Object.assign({},Mt),K.set(pt.id,Mt),Xt&&(Mt.properties=Object.assign({},Mt.properties))),pt.newGeometry&&(Mt.geometry=pt.newGeometry),pt.removeAllProperties)Mt.properties={};else if(((yt=pt.removeProperties)===null||yt===void 0?void 0:yt.length)>0)for(const Wt of pt.removeProperties)Object.prototype.hasOwnProperty.call(Mt.properties,Wt)&&delete Mt.properties[Wt];if(((bt=pt.addOrUpdateProperties)===null||bt===void 0?void 0:bt.length)>0)for(const{key:Wt,value:re}of pt.addOrUpdateProperties)Mt.properties[Wt]=re}}(this._dataUpdateable,R.dataDiff,$),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(R){return m._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(R){return this._geoJSONIndex.getClusterExpansionZoom(R.clusterId)}getClusterChildren(R){return this._geoJSONIndex.getChildren(R.clusterId)}getClusterLeaves(R){return this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset)}}class Gr{constructor(R){this.self=R,this.actor=new m.F(R),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(F,$)=>{if(this.externalWorkerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.externalWorkerSourceTypes[F]=$},this.self.addProtocol=m.bh,this.self.removeProtocol=m.bi,this.self.registerRTLTextPlugin=F=>{if(m.bC.isParsed())throw new Error("RTL text plugin already registered.");m.bC.setMethods(F)},this.actor.registerMessageHandler("LDT",(F,$)=>this._getDEMWorkerSource(F,$.source).loadTile($)),this.actor.registerMessageHandler("RDT",(F,$)=>m._(this,void 0,void 0,function*(){this._getDEMWorkerSource(F,$.source).removeTile($)})),this.actor.registerMessageHandler("GCEZ",(F,$)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,$.type,$.source).getClusterExpansionZoom($)})),this.actor.registerMessageHandler("GCC",(F,$)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,$.type,$.source).getClusterChildren($)})),this.actor.registerMessageHandler("GCL",(F,$)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,$.type,$.source).getClusterLeaves($)})),this.actor.registerMessageHandler("LD",(F,$)=>this._getWorkerSource(F,$.type,$.source).loadData($)),this.actor.registerMessageHandler("GD",(F,$)=>this._getWorkerSource(F,$.type,$.source).getData()),this.actor.registerMessageHandler("LT",(F,$)=>this._getWorkerSource(F,$.type,$.source).loadTile($)),this.actor.registerMessageHandler("RT",(F,$)=>this._getWorkerSource(F,$.type,$.source).reloadTile($)),this.actor.registerMessageHandler("AT",(F,$)=>this._getWorkerSource(F,$.type,$.source).abortTile($)),this.actor.registerMessageHandler("RMT",(F,$)=>this._getWorkerSource(F,$.type,$.source).removeTile($)),this.actor.registerMessageHandler("RS",(F,$)=>m._(this,void 0,void 0,function*(){if(!this.workerSources[F]||!this.workerSources[F][$.type]||!this.workerSources[F][$.type][$.source])return;const K=this.workerSources[F][$.type][$.source];delete this.workerSources[F][$.type][$.source],K.removeSource!==void 0&&K.removeSource($)})),this.actor.registerMessageHandler("RM",F=>m._(this,void 0,void 0,function*(){delete this.layerIndexes[F],delete this.availableImages[F],delete this.workerSources[F],delete this.demWorkerSources[F]})),this.actor.registerMessageHandler("SR",(F,$)=>m._(this,void 0,void 0,function*(){this.referrer=$})),this.actor.registerMessageHandler("SRPS",(F,$)=>this._syncRTLPluginState(F,$)),this.actor.registerMessageHandler("IS",(F,$)=>m._(this,void 0,void 0,function*(){this.self.importScripts($)})),this.actor.registerMessageHandler("SI",(F,$)=>this._setImages(F,$)),this.actor.registerMessageHandler("UL",(F,$)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).update($.layers,$.removedIds)})),this.actor.registerMessageHandler("SL",(F,$)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).replace($)}))}_setImages(R,F){return m._(this,void 0,void 0,function*(){this.availableImages[R]=F;for(const $ in this.workerSources[R]){const K=this.workerSources[R][$];for(const nt in K)K[nt].availableImages=F}})}_syncRTLPluginState(R,F){return m._(this,void 0,void 0,function*(){if(m.bC.isParsed())return m.bC.getState();if(F.pluginStatus!=="loading")return m.bC.setState(F),F;const $=F.pluginURL;if(this.self.importScripts($),m.bC.isParsed()){const K={pluginStatus:"loaded",pluginURL:$};return m.bC.setState(K),K}throw m.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${$}`)})}_getAvailableImages(R){let F=this.availableImages[R];return F||(F=[]),F}_getLayerIndex(R){let F=this.layerIndexes[R];return F||(F=this.layerIndexes[R]=new h),F}_getWorkerSource(R,F,$){if(this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][F]||(this.workerSources[R][F]={}),!this.workerSources[R][F][$]){const K={sendAsync:(nt,st)=>(nt.targetMapId=R,this.actor.sendAsync(nt,st))};switch(F){case"vector":this.workerSources[R][F][$]=new B(K,this._getLayerIndex(R),this._getAvailableImages(R));break;case"geojson":this.workerSources[R][F][$]=new wn(K,this._getLayerIndex(R),this._getAvailableImages(R));break;default:this.workerSources[R][F][$]=new this.externalWorkerSourceTypes[F](K,this._getLayerIndex(R),this._getAvailableImages(R))}}return this.workerSources[R][F][$]}_getDEMWorkerSource(R,F){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][F]||(this.demWorkerSources[R][F]=new U),this.demWorkerSources[R][F]}}return m.i(self)&&(self.worker=new Gr(self)),Gr}),c("index",["exports","./shared"],function(m,h){var M="4.6.0";let L,V;const B={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((t,o)=>{const u=requestAnimationFrame(t);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(u),o(h.c())})}),getImageData(y,t=0){return this.getImageCanvasContext(y).getImageData(-t,-t,y.width+2*t,y.height+2*t)},getImageCanvasContext(y){const t=window.document.createElement("canvas"),o=t.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return t.width=y.width,t.height=y.height,o.drawImage(y,0,0,y.width,y.height),o},resolveURL:y=>(L||(L=document.createElement("a")),L.href=y,L.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(V==null&&(V=matchMedia("(prefers-reduced-motion: reduce)")),V.matches)}};class U{static testProp(t){if(!U.docStyle)return t[0];for(let o=0;o{window.removeEventListener("click",U.suppressClickInternal,!0)},0)}static getScale(t){const o=t.getBoundingClientRect();return{x:o.width/t.offsetWidth||1,y:o.height/t.offsetHeight||1,boundingClientRect:o}}static getPoint(t,o,u){const d=o.boundingClientRect;return new h.P((u.clientX-d.left)/o.x-t.clientLeft,(u.clientY-d.top)/o.y-t.clientTop)}static mousePos(t,o){const u=U.getScale(t);return U.getPoint(t,u,o)}static touchPos(t,o){const u=[],d=U.getScale(t);for(let _=0;_{vt&&se(vt),vt=null,jt=!0},Tt.onerror=()=>{Vt=!0,vt=null},Tt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(y){let t,o,u,d;y.resetRequestQueue=()=>{t=[],o=0,u=0,d={}},y.addThrottleControl=S=>{const E=u++;return d[E]=S,E},y.removeThrottleControl=S=>{delete d[S],w()},y.getImage=(S,E,k=!0)=>new Promise((z,N)=>{ut.supported&&(S.headers||(S.headers={}),S.headers.accept="image/webp,*/*"),h.e(S,{type:"image"}),t.push({abortController:E,requestParameters:S,supportImageRefresh:k,state:"queued",onError:Z=>{N(Z)},onSuccess:Z=>{z(Z)}}),w()});const _=S=>h._(this,void 0,void 0,function*(){S.state="running";const{requestParameters:E,supportImageRefresh:k,onError:z,onSuccess:N,abortController:Z}=S,G=k===!1&&!h.i(self)&&!h.g(E.url)&&(!E.headers||Object.keys(E.headers).reduce((Q,it)=>Q&&it==="accept",!0));o++;const J=G?C(E,Z):h.m(E,Z);try{const Q=yield J;delete S.abortController,S.state="completed",Q.data instanceof HTMLImageElement||h.b(Q.data)?N(Q):Q.data&&N({data:yield(X=Q.data,typeof createImageBitmap=="function"?h.d(X):h.f(X)),cacheControl:Q.cacheControl,expires:Q.expires})}catch(Q){delete S.abortController,z(Q)}finally{o--,w()}var X}),w=()=>{const S=(()=>{for(const E of Object.keys(d))if(d[E]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let E=o;E0;E++){const k=t.shift();k.abortController.signal.aborted?E--:_(k)}},C=(S,E)=>new Promise((k,z)=>{const N=new Image,Z=S.url,G=S.credentials;G&&G==="include"?N.crossOrigin="use-credentials":(G&&G==="same-origin"||!h.s(Z))&&(N.crossOrigin="anonymous"),E.signal.addEventListener("abort",()=>{N.src="",z(h.c())}),N.fetchPriority="high",N.onload=()=>{N.onerror=N.onload=null,k({data:N})},N.onerror=()=>{N.onerror=N.onload=null,E.signal.aborted||z(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."))},N.src=Z})}(Yt||(Yt={})),Yt.resetRequestQueue();class oe{constructor(t){this._transformRequestFn=t}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function ce(y){var t=new h.A(3);return t[0]=y[0],t[1]=y[1],t[2]=y[2],t}var xe,ye=function(y,t,o){return y[0]=t[0]-o[0],y[1]=t[1]-o[1],y[2]=t[2]-o[2],y};xe=new h.A(3),h.A!=Float32Array&&(xe[0]=0,xe[1]=0,xe[2]=0);var Qe=function(y){var t=y[0],o=y[1];return t*t+o*o};function ii(y){const t=[];if(typeof y=="string")t.push({id:"default",url:y});else if(y&&y.length>0){const o=[];for(const{id:u,url:d}of y){const _=`${u}${d}`;o.indexOf(_)===-1&&(o.push(_),t.push({id:u,url:d}))}}return t}function pi(y,t,o){const u=y.split("?");return u[0]+=`${t}${o}`,u.join("?")}(function(){var y=new h.A(2);h.A!=Float32Array&&(y[0]=0,y[1]=0)})();class le{constructor(t,o,u,d){this.context=t,this.format=u,this.texture=t.gl.createTexture(),this.update(o,d)}update(t,o,u){const{width:d,height:_}=t,w=!(this.size&&this.size[0]===d&&this.size[1]===_||u),{context:C}=this,{gl:S}=C;if(this.useMipmap=!!(o&&o.useMipmap),S.bindTexture(S.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA&&(!o||o.premultiply!==!1)),w)this.size=[d,_],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.b(t)?S.texImage2D(S.TEXTURE_2D,0,this.format,this.format,S.UNSIGNED_BYTE,t):S.texImage2D(S.TEXTURE_2D,0,this.format,d,_,0,this.format,S.UNSIGNED_BYTE,t.data);else{const{x:E,y:k}=u||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.b(t)?S.texSubImage2D(S.TEXTURE_2D,0,E,k,S.RGBA,S.UNSIGNED_BYTE,t):S.texSubImage2D(S.TEXTURE_2D,0,E,k,d,_,S.RGBA,S.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&S.generateMipmap(S.TEXTURE_2D)}bind(t,o,u){const{context:d}=this,{gl:_}=d;_.bindTexture(_.TEXTURE_2D,this.texture),u!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(u=_.LINEAR),t!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,t),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,u||t),this.filter=t),o!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,o),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function vi(y){const{userImage:t}=y;return!!(t&&t.render&&t.render())&&(y.data.replace(new Uint8Array(t.data.buffer)),!0)}class qe extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:o,promiseResolve:u}of this.requestors)u(this._getImagesForIds(o));this.requestors=[]}}getImage(t){const o=this.images[t];if(o&&!o.data&&o.spriteData){const u=o.spriteData;o.data=new h.R({width:u.width,height:u.height},u.context.getImageData(u.x,u.y,u.width,u.height).data),o.spriteData=null}return o}addImage(t,o){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,o)&&(this.images[t]=o)}_validate(t,o){let u=!0;const d=o.data||o.spriteData;return this._validateStretch(o.stretchX,d&&d.width)||(this.fire(new h.j(new Error(`Image "${t}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,d&&d.height)||(this.fire(new h.j(new Error(`Image "${t}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new h.j(new Error(`Image "${t}" has invalid "content" value`))),u=!1),u}_validateStretch(t,o){if(!t)return!0;let u=0;for(const d of t){if(d[0]{let d=!0;if(!this.isLoaded())for(const _ of t)this.images[_]||(d=!1);this.isLoaded()||d?o(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:o})})}_getImagesForIds(t){const o={};for(const u of t){let d=this.getImage(u);d||(this.fire(new h.k("styleimagemissing",{id:u})),d=this.getImage(u)),d?o[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,textFitWidth:d.textFitWidth,textFitHeight:d.textFitHeight,hasRenderCallback:!!(d.userImage&&d.userImage.render)}:h.w(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return o}getPixelSize(){const{width:t,height:o}=this.atlasImage;return{width:t,height:o}}getPattern(t){const o=this.patterns[t],u=this.getImage(t);if(!u)return null;if(o&&o.position.version===u.version)return o.position;if(o)o.position.version=u.version;else{const d={w:u.data.width+2,h:u.data.height+2,x:0,y:0},_=new h.I(d,u);this.patterns[t]={bin:d,position:_}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const o=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new le(t,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const _ in this.patterns)t.push(this.patterns[_].bin);const{w:o,h:u}=h.p(t),d=this.atlasImage;d.resize({width:o||1,height:u||1});for(const _ in this.patterns){const{bin:w}=this.patterns[_],C=w.x+1,S=w.y+1,E=this.getImage(_).data,k=E.width,z=E.height;h.R.copy(E,d,{x:0,y:0},{x:C,y:S},{width:k,height:z}),h.R.copy(E,d,{x:0,y:z-1},{x:C,y:S-1},{width:k,height:1}),h.R.copy(E,d,{x:0,y:0},{x:C,y:S+z},{width:k,height:1}),h.R.copy(E,d,{x:k-1,y:0},{x:C-1,y:S},{width:1,height:z}),h.R.copy(E,d,{x:0,y:0},{x:C+k,y:S},{width:1,height:z})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const o of t){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;const u=this.getImage(o);u||h.w(`Image with ID: "${o}" was not found`),vi(u)&&this.updateImage(o,u)}}}const ri=1e20;function xi(y,t,o,u,d,_,w,C,S){for(let E=t;E-1);S++,_[S]=C,w[S]=E,w[S+1]=ri}for(let C=0,S=0;C65535)throw new Error("glyphs > 65535 not supported");if(u.ranges[_])return{stack:t,id:o,glyph:d};if(!this.url)throw new Error("glyphsUrl is not set");if(!u.requests[_]){const C=ji.loadGlyphRange(t,_,this.url,this.requestManager);u.requests[_]=C}const w=yield u.requests[_];for(const C in w)this._doesCharSupportLocalGlyph(+C)||(u.glyphs[+C]=w[+C]);return u.ranges[_]=!0,{stack:t,id:o,glyph:w[o]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(t))}_tinySDF(t,o,u){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(u))return;let _=t.tinySDF;if(!_){let C="400";/bold/i.test(o)?C="900":/medium/i.test(o)?C="500":/light/i.test(o)&&(C="200"),_=t.tinySDF=new ji.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:d,fontWeight:C})}const w=_.draw(String.fromCharCode(u));return{id:u,bitmap:new h.o({width:w.width||60,height:w.height||60},w.data),metrics:{width:w.glyphWidth/2||24,height:w.glyphHeight/2||24,left:w.glyphLeft/2+.5||0,top:w.glyphTop/2-27.5||-8,advance:w.glyphAdvance/2||24,isDoubleResolution:!0}}}}ji.loadGlyphRange=function(y,t,o,u){return h._(this,void 0,void 0,function*(){const d=256*t,_=d+255,w=u.transformRequest(o.replace("{fontstack}",y).replace("{range}",`${d}-${_}`),"Glyphs"),C=yield h.l(w,new AbortController);if(!C||!C.data)throw new Error(`Could not load glyph range. range: ${t}, ${d}-${_}`);const S={};for(const E of h.n(C.data))S[E.id]=E;return S})},ji.TinySDF=class{constructor({fontSize:y=24,buffer:t=3,radius:o=8,cutoff:u=.25,fontFamily:d="sans-serif",fontWeight:_="normal",fontStyle:w="normal"}={}){this.buffer=t,this.cutoff=u,this.radius=o;const C=this.size=y+4*t,S=this._createCanvas(C),E=this.ctx=S.getContext("2d",{willReadFrequently:!0});E.font=`${w} ${_} ${y}px ${d}`,E.textBaseline="alphabetic",E.textAlign="left",E.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(y){const t=document.createElement("canvas");return t.width=t.height=y,t}draw(y){const{width:t,actualBoundingBoxAscent:o,actualBoundingBoxDescent:u,actualBoundingBoxLeft:d,actualBoundingBoxRight:_}=this.ctx.measureText(y),w=Math.ceil(o),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-d))),S=Math.min(this.size-this.buffer,w+Math.ceil(u)),E=C+2*this.buffer,k=S+2*this.buffer,z=Math.max(E*k,0),N=new Uint8ClampedArray(z),Z={data:N,width:E,height:k,glyphWidth:C,glyphHeight:S,glyphTop:w,glyphLeft:0,glyphAdvance:t};if(C===0||S===0)return Z;const{ctx:G,buffer:J,gridInner:X,gridOuter:Q}=this;G.clearRect(J,J,C,S),G.fillText(y,J,J+w);const it=G.getImageData(J,J,C,S);Q.fill(ri,0,z),X.fill(0,0,z);for(let W=0;W0?xt*xt:0,X[dt]=xt<0?xt*xt:0}}xi(Q,0,0,E,k,E,this.f,this.v,this.z),xi(X,J,J,C,S,E,this.f,this.v,this.z);for(let W=0;W1&&(S=t[++C]);const k=Math.abs(E-S.left),z=Math.abs(E-S.right),N=Math.min(k,z);let Z;const G=_/u*(d+1);if(S.isDash){const J=d-Math.abs(G);Z=Math.sqrt(N*N+J*J)}else Z=d-Math.sqrt(N*N+G*G);this.data[w+E]=Math.max(0,Math.min(255,Z+128))}}}addRegularDash(t){for(let C=t.length-1;C>=0;--C){const S=t[C],E=t[C+1];S.zeroLength?t.splice(C,1):E&&E.isDash===S.isDash&&(E.left=S.left,t.splice(C,1))}const o=t[0],u=t[t.length-1];o.isDash===u.isDash&&(o.left=u.left-this.width,u.right=o.right+this.width);const d=this.width*this.nextRow;let _=0,w=t[_];for(let C=0;C1&&(w=t[++_]);const S=Math.abs(C-w.left),E=Math.abs(C-w.right),k=Math.min(S,E);this.data[d+C]=Math.max(0,Math.min(255,(w.isDash?k:-k)+128))}}addDash(t,o){const u=o?7:0,d=2*u+1;if(this.nextRow+d>this.height)return h.w("LineAtlas out of space"),null;let _=0;for(let C=0;C{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[yn]}numActive(){return Object.keys(this.active).length}}const ds=Math.floor(B.hardwareConcurrency/2);let Yi,wr;function jn(){return Yi||(Yi=new Ur),Yi}Ur.workerCount=h.C(globalThis)?Math.max(Math.min(ds,3),1):1;class Un{constructor(t,o){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=o;const u=this.workerPool.acquire(o);for(let d=0;d{o.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,o){for(const u of this.actors)u.registerMessageHandler(t,o)}}function Zs(){return wr||(wr=new Un(jn(),h.G),wr.registerMessageHandler("GR",(y,t,o)=>h.m(t,o))),wr}function sn(y,t){const o=h.H();return h.J(o,o,[1,1,0]),h.K(o,o,[.5*y.width,.5*y.height,1]),h.L(o,o,y.calculatePosMatrix(t.toUnwrapped()))}function _n(y,t,o,u,d,_){const w=function(z,N,Z){if(z)for(const G of z){const J=N[G];if(J&&J.source===Z&&J.type==="fill-extrusion")return!0}else for(const G in N){const J=N[G];if(J.source===Z&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,t,y.id),C=_.maxPitchScaleFactor(),S=y.tilesIn(u,C,w);S.sort(vn);const E=[];for(const z of S)E.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(t,o,y._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,d,_,C,sn(y.transform,z.tileID))});const k=function(z){const N={},Z={};for(const G of z){const J=G.queryResults,X=G.wrappedTileID,Q=Z[X]=Z[X]||{};for(const it in J){const W=J[it],ot=Q[it]=Q[it]||{},ht=N[it]=N[it]||[];for(const dt of W)ot[dt.featureIndex]||(ot[dt.featureIndex]=!0,ht.push(dt))}}return N}(E);for(const z in k)k[z].forEach(N=>{const Z=N.feature,G=y.getFeatureState(Z.layer["source-layer"],Z.id);Z.source=Z.layer.source,Z.layer["source-layer"]&&(Z.sourceLayer=Z.layer["source-layer"]),Z.state=G});return k}function vn(y,t){const o=y.tileID,u=t.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}function ps(y,t,o){return h._(this,void 0,void 0,function*(){let u=y;if(y.url?u=(yield h.h(t.transformRequest(y.url,"Source"),o)).data:yield B.frameAsync(o),!u)return null;const d=h.M(h.e(u,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in u&&u.vector_layers&&(d.vectorLayerIds=u.vector_layers.map(_=>_.id)),d})}class ft{constructor(t,o){t&&(o?this.setSouthWest(t).setNorthEast(o):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof h.N?new h.N(t.lng,t.lat):h.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.N?new h.N(t.lng,t.lat):h.N.convert(t),this}extend(t){const o=this._sw,u=this._ne;let d,_;if(t instanceof h.N)d=t,_=t;else{if(!(t instanceof ft))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ft.convert(t)):this.extend(h.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.N.convert(t)):this;if(d=t._sw,_=t._ne,!d||!_)return this}return o||u?(o.lng=Math.min(d.lng,o.lng),o.lat=Math.min(d.lat,o.lat),u.lng=Math.max(_.lng,u.lng),u.lat=Math.max(_.lat,u.lat)):(this._sw=new h.N(d.lng,d.lat),this._ne=new h.N(_.lng,_.lat)),this}getCenter(){return new h.N((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 h.N(this.getWest(),this.getNorth())}getSouthEast(){return new h.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:o,lat:u}=h.N.convert(t);let d=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=u&&u<=this._ne.lat&&d}static convert(t){return t instanceof ft?t:t&&new ft(t)}static fromLngLat(t,o=0){const u=360*o/40075017,d=u/Math.cos(Math.PI/180*t.lat);return new ft(new h.N(t.lng-d,t.lat-u),new h.N(t.lng+d,t.lat+u))}}class qn{constructor(t,o,u){this.bounds=ft.convert(this.validateBounds(t)),this.minzoom=o||0,this.maxzoom=u||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const o=Math.pow(2,t.z),u=Math.floor(h.O(this.bounds.getWest())*o),d=Math.floor(h.Q(this.bounds.getNorth())*o),_=Math.ceil(h.O(this.bounds.getEast())*o),w=Math.ceil(h.Q(this.bounds.getSouth())*o);return t.x>=u&&t.x<_&&t.y>=d&&t.y{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return h.e({},this._options)}loadTile(t){return h._(this,void 0,void 0,function*(){const o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(o,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.request.collectResourceTiming=this._collectResourceTiming;let d="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((_,w)=>{t.reloadPromise={resolve:_,reject:w}})}else t.actor=this.dispatcher.getActor(),d="LT";t.abortController=new AbortController;try{const _=yield t.actor.sendAsync({type:d,data:u},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,_)}catch(_){if(delete t.abortController,t.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,o){if(o&&o.resourceTiming&&(t.resourceTiming=o.resourceTiming),o&&this.map._refreshExpiredTiles&&t.setExpiryData(o),t.loadVectorData(o,this.map.painter),t.reloadPromise){const u=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(u.resolve).catch(u.reject)}}abortTile(t){return h._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return h._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class be extends h.E{constructor(t,o,u,d){super(),this.id=t,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.e({type:"raster"},o),h.e(this,h.M(o,["url","scheme","tileSize"]))}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield ps(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(h.e(this,t),t.bounds&&(this.tileBounds=new qn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new h.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return h.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return h._(this,void 0,void 0,function*(){const o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const u=yield Yt.getImage(this.map._requestManager.transformRequest(o,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(u&&u.data){this.map._refreshExpiredTiles&&u.cacheControl&&u.expires&&t.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const d=this.map.painter.context,_=d.gl,w=u.data;t.texture=this.map.painter.getTileTexture(w.width),t.texture?t.texture.update(w,{useMipmap:!0}):(t.texture=new le(d,w,_.RGBA,{useMipmap:!0}),t.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(u){if(delete t.abortController,t.aborted)t.state="unloaded";else if(u)throw t.state="errored",u}})}abortTile(t){return h._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return h._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Xe extends be{constructor(t,o,u,d){super(t,o,u,d),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox",this.redFactor=o.redFactor,this.greenFactor=o.greenFactor,this.blueFactor=o.blueFactor,this.baseShift=o.baseShift}loadTile(t){return h._(this,void 0,void 0,function*(){const o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u=this.map._requestManager.transformRequest(o,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const d=yield Yt.getImage(u,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(d&&d.data){const _=d.data;this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&t.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const w=h.b(_)&&h.U()?_:yield this.readImageNow(_),C={type:this.type,uid:t.uid,source:this.id,rawImageData:w,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const S=yield t.actor.sendAsync({type:"LDT",data:C});t.dem=S,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(d){if(delete t.abortController,t.aborted)t.state="unloaded";else if(d)throw t.state="errored",d}})}readImageNow(t){return h._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&h.V()){const o=t.width+2,u=t.height+2;try{return new h.R({width:o,height:u},yield h.W(t,-1,-1,o,u))}catch{}}return B.getImageData(t,1)})}_getNeighboringTiles(t){const o=t.canonical,u=Math.pow(2,o.z),d=(o.x-1+u)%u,_=o.x===0?t.wrap-1:t.wrap,w=(o.x+1+u)%u,C=o.x+1===u?t.wrap+1:t.wrap,S={};return S[new h.S(t.overscaledZ,_,o.z,d,o.y).key]={backfilled:!1},S[new h.S(t.overscaledZ,C,o.z,w,o.y).key]={backfilled:!1},o.y>0&&(S[new h.S(t.overscaledZ,_,o.z,d,o.y-1).key]={backfilled:!1},S[new h.S(t.overscaledZ,t.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},S[new h.S(t.overscaledZ,C,o.z,w,o.y-1).key]={backfilled:!1}),o.y+10&&h.e(_,{resourceTiming:d}),this.fire(new h.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new h.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(u){if(this._pendingLoads--,this._removed)return void this.fire(new h.k("dataabort",{dataType:"source"}));this.fire(new h.j(u))}})}loaded(){return this._pendingLoads===0}loadTile(t){return h._(this,void 0,void 0,function*(){const o=t.actor?"RT":"LT";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const d=yield this.actor.sendAsync({type:o,data:u},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(d,this.map.painter,o==="RT")})}abortTile(t){return h._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return h._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return h.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var xn=h.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class on extends h.E{constructor(t,o,u,d){super(),this.id=t,this.dispatcher=u,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=o}load(t){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const o=yield Yt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,o&&o.data&&(this.image=o.data,t&&(this.coordinates=t),this._finishLoading())}catch(o){this._request=null,this._loaded=!0,this.fire(new h.j(o))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const o=t.map(h.Z.fromLngLat);this.tileID=function(d){let _=1/0,w=1/0,C=-1/0,S=-1/0;for(const N of d)_=Math.min(_,N.x),w=Math.min(w,N.y),C=Math.max(C,N.x),S=Math.max(S,N.y);const E=Math.max(C-_,S-w),k=Math.max(0,Math.floor(-Math.log(E)/Math.LN2)),z=Math.pow(2,k);return new h.a1(k,Math.floor((_+C)/2*z),Math.floor((w+S)/2*z))}(o),this.minzoom=this.maxzoom=this.tileID.z;const u=o.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new h.$,this._boundsArray.emplaceBack(u[0].x,u[0].y,0,0),this._boundsArray.emplaceBack(u[1].x,u[1].y,h.X,0),this._boundsArray.emplaceBack(u[3].x,u[3].y,0,h.X),this._boundsArray.emplaceBack(u[2].x,u[2].y,h.X,h.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,o=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,xn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new le(t,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const _=this.tiles[d];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return h._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class fs extends on{constructor(t,o,u,d){super(t,o,u,d),this.roundZoom=!0,this.type="video",this.options=o}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const o of t.urls)this.urls.push(this.map._requestManager.transformRequest(o,"Source").url);try{const o=yield h.a3(this.urls);if(this._loaded=!0,!o)return;this.video=o,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(o){this.fire(new h.j(o))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const o=this.video.seekable;to.end(0)?this.fire(new h.j(new h.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,o=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,xn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,this.video)):(this.texture=new le(t,this.video,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const _=this.tiles[d];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class dr extends on{constructor(t,o,u,d){super(t,o,u,d),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(w=>typeof w!="number"))||this.fire(new h.j(new h.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.j(new h.a2(`sources.${t}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new h.j(new h.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new h.j(new h.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.j(new h.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.animate}load(){return h._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const o=this.map.painter.context,u=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,xn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new le(o,this.canvas,u.RGBA,{premultiply:!0});let d=!1;for(const _ in this.tiles){const w=this.tiles[_];w.state!=="loaded"&&(w.state="loaded",w.texture=this.texture,d=!0)}d&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Ws={},Hs=y=>{switch(y){case"geojson":return Xs;case"image":return on;case"raster":return be;case"raster-dem":return Xe;case"vector":return Gs;case"video":return fs;case"canvas":return dr}return Ws[y]},Pt="RTLPluginLoaded";class qr extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Zs()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(o=>{throw this.status="error",o})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return h._(this,arguments,void 0,function*(o,u=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=B.resolveURL(o),!this.url)throw new Error(`requested url ${o} is invalid`);if(this.status==="unavailable"){if(!u)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return h._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.k(Pt))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Fi=null;function $r(){return Fi||(Fi=new qr),Fi}class bn{constructor(t,o){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=h.a4(),this.uses=0,this.tileSize=o,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const o=t+this.timeAdded;o_.getLayer(E)).filter(Boolean);if(S.length!==0){C.layers=S,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(E=>S.filter(k=>k.id===E)[0]));for(const E of S)w[E.id]=C}}return w}(t.buckets,o.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const _=this.buckets[d];if(_ instanceof h.a6){if(this.hasSymbolBuckets=!0,!u)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const _=this.buckets[d];if(_ instanceof h.a6&&_.hasRTLText){this.hasRTLText=!0,$r().lazyLoad();break}}this.queryPadding=0;for(const d in this.buckets){const _=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(d).queryRadius(_))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const u in this.buckets){const d=this.buckets[u];d.uploadPending()&&d.upload(t)}const o=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new le(t,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new le(t,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,o,u,d,_,w,C,S,E,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:_,scale:w,tileSize:this.tileSize,pixelPosMatrix:k,transform:S,params:C,queryPadding:this.queryPadding*E},t,o,u):{}}querySourceFeatures(t,o){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),_=o&&o.sourceLayer?o.sourceLayer:"",w=d._geojsonTileLayer||d[_];if(!w)return;const C=h.a7(o&&o.filter),{z:S,x:E,y:k}=this.tileID.canonical,z={z:S,x:E,y:k};for(let N=0;Nu)d=!1;else if(o)if(this.expirationTime{this.remove(t,_)},u)),this.data[d].push(_),this.order.push(d),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const u=t.wrapped().key,d=o===void 0?0:this.data[u].indexOf(o),_=this.data[u][d];return this.data[u].splice(d,1),_.timeout&&clearTimeout(_.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(_.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const u in this.data)for(const d of this.data[u])t(d.value)||o.push(d);for(const u of o)this.remove(u.value.tileID,u)}}class he{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,u){const d=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},h.e(this.stateChanges[t][d],u),this.deletedStates[t]===null){this.deletedStates[t]={};for(const _ in this.state[t])_!==d&&(this.deletedStates[t][_]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const _ in this.state[t][d])u[_]||(this.deletedStates[t][d][_]=null)}else for(const _ in u)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][_]===null&&delete this.deletedStates[t][d][_]}removeFeatureState(t,o,u){if(this.deletedStates[t]===null)return;const d=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},u&&o!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][u]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(u in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][u]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,o){const u=String(o),d=h.e({},(this.state[t]||{})[u],(this.stateChanges[t]||{})[u]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const _=this.deletedStates[t][o];if(_===null)return{};for(const w in _)delete d[w]}return d}initializeTileState(t,o){t.setFeatureState(this.state,o)}coalesceChanges(t,o){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const _={};for(const w in this.stateChanges[d])this.state[d][w]||(this.state[d][w]={}),h.e(this.state[d][w],this.stateChanges[d][w]),_[w]=this.state[d][w];u[d]=_}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const _={};if(this.deletedStates[d]===null)for(const w in this.state[d])_[w]={},this.state[d][w]={};else for(const w in this.deletedStates[d]){if(this.deletedStates[d][w]===null)this.state[d][w]={};else for(const C of Object.keys(this.deletedStates[d][w]))delete this.state[d][w][C];_[w]=this.state[d][w]}u[d]=u[d]||{},h.e(u[d],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in t)t[d].setFeatureState(u,o)}}class Kt extends h.E{constructor(t,o,u){super(),this.id=t,this.dispatcher=u,this.on("data",d=>this._dataHandler(d)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((d,_,w,C)=>{const S=new(Hs(_.type))(d,_,w,C);if(S.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${S.id}`);return S})(t,o,u,this),this._tiles={},this._cache=new At(0,d=>this._unloadTile(d)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new he,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const o=this._tiles[t];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,o,u){return h._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,o,u)}catch(d){t.state="errored",d.status!==404?this._source.fire(new h.j(d,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new h.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(t),u.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(qi).map(t=>t.key)}getRenderableIds(t){const o=[];for(const u in this._tiles)this._isIdRenderable(u,t)&&o.push(this._tiles[u]);return t?o.sort((u,d)=>{const _=u.tileID,w=d.tileID,C=new h.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),S=new h.P(w.canonical.x,w.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-w.overscaledZ||S.y-C.y||S.x-C.x}).map(u=>u.tileID.key):o.map(u=>u.tileID).sort(qi).map(u=>u.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,o){return h._(this,void 0,void 0,function*(){const u=this._tiles[t];u&&(u.state!=="loading"&&(u.state=o),yield this._loadTile(u,t,o))})}_tileLoaded(t,o,u){t.timeAdded=B.now(),u==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const o=this.getRenderableIds();for(let d=0;d1||(Math.abs(w)>1&&(Math.abs(w+S)===1?w+=S:Math.abs(w-S)===1&&(w-=S)),_.dem&&d.dem&&(d.dem.backfillBorder(_.dem,w,C),d.neighboringTiles&&d.neighboringTiles[E]&&(d.neighboringTiles[E].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,u,d){for(const _ in this._tiles){let w=this._tiles[_];if(d[_]||!w.hasData()||w.tileID.overscaledZ<=o||w.tileID.overscaledZ>u)continue;let C=w.tileID;for(;w&&w.tileID.overscaledZ>o+1;){const E=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[E.key],w&&w.hasData()&&(C=E)}let S=C;for(;S.overscaledZ>o;)if(S=S.scaledTo(S.overscaledZ-1),t[S.key]){d[C.key]=C;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const u=this._loadedParentTiles[t.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=t.overscaledZ-1;u>=o;u--){const d=t.scaledTo(u),_=this._getLoadedTile(d);if(_)return _}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const o=Math.ceil(t.width/this._source.tileSize)+1,u=Math.ceil(t.height/this._source.tileSize)+1,d=Math.floor(o*u*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(_)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const u={};for(const d in this._tiles){const _=this._tiles[d];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+o),u[_.tileID.key]=_}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}_updateCoveredAndRetainedTiles(t,o,u,d,_,w){const C={},S={},E=Object.keys(t),k=B.now();for(const z of E){const N=t[z],Z=this._tiles[z];if(!Z||Z.fadeEndTime!==0&&Z.fadeEndTime<=k)continue;const G=this.findLoadedParent(N,o),J=this.findLoadedSibling(N),X=G||J||null;X&&(this._addTile(X.tileID),C[X.tileID.key]=X.tileID),S[z]=N}this._retainLoadedChildren(S,d,u,t);for(const z in C)t[z]||(this._coveredTiles[z]=!0,t[z]=C[z]);if(w){const z={},N={};for(const Z of _)this._tiles[Z.key].hasData()?z[Z.key]=Z:N[Z.key]=Z;for(const Z in N){const G=N[Z].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(z[G[0].key]=t[G[0].key]=G[0],z[G[1].key]=t[G[1].key]=G[1],z[G[2].key]=t[G[2].key]=G[2],z[G[3].key]=t[G[3].key]=G[3],delete N[Z])}for(const Z in N){const G=N[Z],J=this.findLoadedParent(G,this._source.minzoom),X=this.findLoadedSibling(G),Q=J||X||null;if(Q){z[Q.tileID.key]=t[Q.tileID.key]=Q.tileID;for(const it in z)z[it].isChildOf(Q.tileID)&&delete z[it]}}for(const Z in this._tiles)z[Z]||(this._coveredTiles[Z]=!0)}}update(t,o){if(!this._sourceLoaded||this._paused)return;let u;this.transform=t,this.terrain=o,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?u=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(k=>new h.S(k.canonical.z,k.wrap,k.canonical.z,k.canonical.x,k.canonical.y)):(u=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:o}),this._source.hasTile&&(u=u.filter(k=>this._source.hasTile(k)))):u=[];const d=t.coveringZoomLevel(this._source),_=Math.max(d-Kt.maxOverzooming,this._source.minzoom),w=Math.max(d+Kt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const k={};for(const z of u)if(z.canonical.z>this._source.minzoom){const N=z.scaledTo(z.canonical.z-1);k[N.key]=N;const Z=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));k[Z.key]=Z}u=u.concat(Object.values(k))}const C=u.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new h.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const S=this._updateRetainedTiles(u,d);Ir(this._source.type)&&this._updateCoveredAndRetainedTiles(S,_,w,d,u,o);for(const k in S)this._tiles[k].clearFadeHold();const E=h.ab(this._tiles,S);for(const k of E){const z=this._tiles[k];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(k)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,o){var u;const d={},_={},w=Math.max(o-Kt.maxOverzooming,this._source.minzoom),C=Math.max(o+Kt.maxUnderzooming,this._source.minzoom),S={};for(const E of t){const k=this._addTile(E);d[E.key]=E,k.hasData()||othis._source.maxzoom){const N=E.children(this._source.maxzoom)[0],Z=this.getTile(N);if(Z&&Z.hasData()){d[N.key]=N;continue}}else{const N=E.children(this._source.maxzoom);if(d[N[0].key]&&d[N[1].key]&&d[N[2].key]&&d[N[3].key])continue}let z=k.wasRequested();for(let N=E.overscaledZ-1;N>=w;--N){const Z=E.scaledTo(N);if(_[Z.key])break;if(_[Z.key]=!0,k=this.getTile(Z),!k&&z&&(k=this._addTile(Z)),k){const G=k.hasData();if((G||!(!((u=this.map)===null||u===void 0)&&u.cancelPendingTileRequestsWhileZooming)||z)&&(d[Z.key]=Z),z=k.wasRequested(),G)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let u,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}o.push(d.key);const _=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(_),u)break;d=_}for(const _ of o)this._loadedParentTiles[_]=u}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const o=this._tiles[t].tileID,u=this._getLoadedTile(o);this._loadedSiblingTiles[o.key]=u}}_addTile(t){let o=this._tiles[t.key];if(o)return o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const u=o;return o||(o=new bn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(o,t.key,o.state)),o.uses++,this._tiles[t.key]=o,u||this._source.fire(new h.k("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const u=o.getExpiryTimeout();u&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},u))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}_dataHandler(t){const o=t.sourceDataType;t.dataType==="source"&&o==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&o==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,o,u){const d=[],_=this.transform;if(!_)return d;const w=u?_.getCameraQueryGeometry(t):t,C=t.map(G=>_.pointCoordinate(G,this.terrain)),S=w.map(G=>_.pointCoordinate(G,this.terrain)),E=this.getIds();let k=1/0,z=1/0,N=-1/0,Z=-1/0;for(const G of S)k=Math.min(k,G.x),z=Math.min(z,G.y),N=Math.max(N,G.x),Z=Math.max(Z,G.y);for(let G=0;G=0&&W[1].y+it>=0){const ot=C.map(dt=>X.getTilePoint(dt)),ht=S.map(dt=>X.getTilePoint(dt));d.push({tile:J,tileID:X,queryGeometry:ot,cameraQueryGeometry:ht,scale:Q})}}return d}getVisibleCoordinates(t){const o=this.getRenderableIds(t).map(u=>this._tiles[u].tileID);for(const u of o)u.posMatrix=this.transform.calculatePosMatrix(u.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(Ir(this._source.type)){const t=B.now();for(const o in this._tiles)if(this._tiles[o].fadeEndTime>=t)return!0}return!1}setFeatureState(t,o,u){this._state.updateState(t=t||"_geojsonTileLayer",o,u)}removeFeatureState(t,o,u){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,u)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,u){const d=this._tiles[t];d&&d.setDependencies(o,u)}reloadTilesForDependencies(t,o){for(const u in this._tiles)this._tiles[u].hasDependency(t,o)&&this._reloadTile(u,"reloading");this._cache.filter(u=>!u.hasDependency(t,o))}}function qi(y,t){const o=Math.abs(2*y.wrap)-+(y.wrap<0),u=Math.abs(2*t.wrap)-+(t.wrap<0);return y.overscaledZ-t.overscaledZ||u-o||t.canonical.y-y.canonical.y||t.canonical.x-y.canonical.x}function Ir(y){return y==="raster"||y==="image"||y==="video"}Kt.maxOverzooming=10,Kt.maxUnderzooming=3;class ee{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let u=1;u0?(d-w)/C:0;return this.points[_].mult(1-S).add(this.points[o].mult(S))}}function Zr(y,t){let o=!0;return y==="always"||y!=="never"&&t!=="never"||(o=!1),o}class an{constructor(t,o,u){const d=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(t/u),this.yCellCount=Math.ceil(o/u);for(let w=0;wthis.width||d<0||o>this.height)return[];const S=[];if(t<=0&&o<=0&&this.width<=u&&this.height<=d){if(_)return[{key:null,x1:t,y1:o,x2:u,y2:d}];for(let E=0;E0}hitTestCircle(t,o,u,d,_){const w=t-u,C=t+u,S=o-u,E=o+u;if(C<0||w>this.width||E<0||S>this.height)return!1;const k=[];return this._forEachCell(w,S,C,E,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:t,y:o,radius:u},seenUids:{box:{},circle:{}}},_),k.length>0}_queryCell(t,o,u,d,_,w,C,S){const{seenUids:E,hitTest:k,overlapMode:z}=C,N=this.boxCells[_];if(N!==null){const G=this.bboxes;for(const J of N)if(!E.box[J]){E.box[J]=!0;const X=4*J,Q=this.boxKeys[J];if(t<=G[X+2]&&o<=G[X+3]&&u>=G[X+0]&&d>=G[X+1]&&(!S||S(Q))&&(!k||!Zr(z,Q.overlapMode))&&(w.push({key:Q,x1:G[X],y1:G[X+1],x2:G[X+2],y2:G[X+3]}),k))return!0}}const Z=this.circleCells[_];if(Z!==null){const G=this.circles;for(const J of Z)if(!E.circle[J]){E.circle[J]=!0;const X=3*J,Q=this.circleKeys[J];if(this._circleAndRectCollide(G[X],G[X+1],G[X+2],t,o,u,d)&&(!S||S(Q))&&(!k||!Zr(z,Q.overlapMode))){const it=G[X],W=G[X+1],ot=G[X+2];if(w.push({key:Q,x1:it-ot,y1:W-ot,x2:it+ot,y2:W+ot}),k)return!0}}}return!1}_queryCellCircle(t,o,u,d,_,w,C,S){const{circle:E,seenUids:k,overlapMode:z}=C,N=this.boxCells[_];if(N!==null){const G=this.bboxes;for(const J of N)if(!k.box[J]){k.box[J]=!0;const X=4*J,Q=this.boxKeys[J];if(this._circleAndRectCollide(E.x,E.y,E.radius,G[X+0],G[X+1],G[X+2],G[X+3])&&(!S||S(Q))&&!Zr(z,Q.overlapMode))return w.push(!0),!0}}const Z=this.circleCells[_];if(Z!==null){const G=this.circles;for(const J of Z)if(!k.circle[J]){k.circle[J]=!0;const X=3*J,Q=this.circleKeys[J];if(this._circlesCollide(G[X],G[X+1],G[X+2],E.x,E.y,E.radius)&&(!S||S(Q))&&!Zr(z,Q.overlapMode))return w.push(!0),!0}}}_forEachCell(t,o,u,d,_,w,C,S){const E=this._convertToXCellCoord(t),k=this._convertToYCellCoord(o),z=this._convertToXCellCoord(u),N=this._convertToYCellCoord(d);for(let Z=E;Z<=z;Z++)for(let G=k;G<=N;G++)if(_.call(this,t,o,u,d,this.xCellCount*G+Z,w,C,S))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,o,u,d,_,w){const C=d-t,S=_-o,E=u+w;return E*E>C*C+S*S}_circleAndRectCollide(t,o,u,d,_,w,C){const S=(w-d)/2,E=Math.abs(t-(d+S));if(E>S+u)return!1;const k=(C-_)/2,z=Math.abs(o-(_+k));if(z>k+u)return!1;if(E<=S||z<=k)return!0;const N=E-S,Z=z-k;return N*N+Z*Z<=u*u}}function wn(y,t,o,u,d){const _=h.H();return t?(h.K(_,_,[1/d,1/d,1]),o||h.ad(_,_,u.angle)):h.L(_,u.labelPlaneMatrix,y),_}function Gr(y,t,o,u,d){if(t){const _=h.ae(y);return h.K(_,_,[d,d,1]),o||h.ad(_,_,-u.angle),_}return u.glCoordMatrix}function Y(y,t,o){let u;o?(u=[y.x,y.y,o(y.x,y.y),1],h.af(u,u,t)):(u=[y.x,y.y,0,1],function(_,w,C){const S=w[0],E=w[1];_[0]=C[0]*S+C[4]*E+C[12],_[1]=C[1]*S+C[5]*E+C[13],_[3]=C[3]*S+C[7]*E+C[15]}(u,u,t));const d=u[3];return{point:new h.P(u[0]/d,u[1]/d),signedDistanceFromCamera:d,isOccluded:!1}}function R(y,t){return .5+y/t*.5}function F(y,t){return y.x>=-t[0]&&y.x<=t[0]&&y.y>=-t[1]&&y.y<=t[1]}function $(y,t,o,u,d,_,w,C,S,E,k,z,N,Z,G){const J=u?y.textSizeData:y.iconSizeData,X=h.ag(J,o.transform.zoom),Q=[256/o.width*2+1,256/o.height*2+1],it=u?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;it.clear();const W=y.lineVertexArray,ot=u?y.text.placedSymbolArray:y.icon.placedSymbolArray,ht=o.transform.width/o.transform.height;let dt=!1;for(let xt=0;xtMath.abs(o.x-t.x)*u?{useVertical:!0}:(y===h.ah.vertical?t.yo.x)?{needsFlipping:!0}:null}function st(y,t,o,u,d,_,w,C,S,E,k){const z=o/24,N=t.lineOffsetX*z,Z=t.lineOffsetY*z;let G;if(t.numGlyphs>1){const J=t.glyphStartIndex+t.numGlyphs,X=t.lineStartIndex,Q=t.lineStartIndex+t.lineLength,it=K(z,C,N,Z,u,t,k,y);if(!it)return{notEnoughRoom:!0};const W=Y(it.first.point,w,y.getElevation).point,ot=Y(it.last.point,w,y.getElevation).point;if(d&&!u){const ht=nt(t.writingMode,W,ot,E);if(ht)return ht}G=[it.first];for(let ht=t.glyphStartIndex+1;ht0?W.point:function(dt,xt,It,Bt,Ft,Ct){return lt(dt,xt,It,1,Ft,Ct)}(y.tileAnchorPoint,it,X,0,_,y),ht=nt(t.writingMode,X,ot,E);if(ht)return ht}const J=Mt(z*C.getoffsetX(t.glyphStartIndex),N,Z,u,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,y,k);if(!J||y.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[J]}for(const J of G)h.aj(S,J.point,J.angle);return{}}function lt(y,t,o,u,d,_){const w=y.add(y.sub(t)._unit()),C=d!==void 0?Y(w,d,_.getElevation).point:yt(w.x,w.y,_).point,S=o.sub(C);return o.add(S._mult(u/S.mag()))}function et(y,t,o){const u=t.projectionCache;if(u.projections[y])return u.projections[y];const d=new h.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),_=yt(d.x,d.y,t);if(_.signedDistanceFromCamera>0)return u.projections[y]=_.point,u.anyProjectionOccluded=u.anyProjectionOccluded||_.isOccluded,_.point;const w=y-o.direction;return function(C,S,E,k,z){return lt(C,S,E,k,void 0,z)}(o.distanceFromAnchor===0?t.tileAnchorPoint:new h.P(t.lineVertexArray.getx(w),t.lineVertexArray.gety(w)),d,o.previousVertex,o.absOffsetX-o.distanceFromAnchor+1,t)}function yt(y,t,o){const u=y+o.translation[0],d=t+o.translation[1];let _;return!o.pitchWithMap&&o.projection.useSpecialProjectionForSymbols?(_=o.projection.projectTileCoordinates(u,d,o.unwrappedTileID,o.getElevation),_.point.x=(.5*_.point.x+.5)*o.width,_.point.y=(.5*-_.point.y+.5)*o.height):(_=Y(new h.P(u,d),o.labelPlaneMatrix,o.getElevation),_.isOccluded=!1),_}function bt(y,t,o){return y._unit()._perp()._mult(t*o)}function pt(y,t,o,u,d,_,w,C,S){if(C.projectionCache.offsets[y])return C.projectionCache.offsets[y];const E=o.add(t);if(y+S.direction=d)return C.projectionCache.offsets[y]=E,E;const k=et(y+S.direction,C,S),z=bt(k.sub(o),w,S.direction),N=o.add(z),Z=k.add(z);return C.projectionCache.offsets[y]=h.ak(_,E,N,Z)||E,C.projectionCache.offsets[y]}function Mt(y,t,o,u,d,_,w,C,S){const E=u?y-t:y+t;let k=E>0?1:-1,z=0;u&&(k*=-1,z=Math.PI),k<0&&(z+=Math.PI);let N,Z=k>0?_+d:_+d+1;C.projectionCache.cachedAnchorPoint?N=C.projectionCache.cachedAnchorPoint:(N=yt(C.tileAnchorPoint.x,C.tileAnchorPoint.y,C).point,C.projectionCache.cachedAnchorPoint=N);let G,J,X=N,Q=N,it=0,W=0;const ot=Math.abs(E),ht=[];let dt;for(;it+W<=ot;){if(Z+=k,Z<_||Z>=w)return null;it+=W,Q=X,J=G;const Bt={absOffsetX:ot,direction:k,distanceFromAnchor:it,previousVertex:Q};if(X=et(Z,C,Bt),o===0)ht.push(Q),dt=X.sub(Q);else{let Ft;const Ct=X.sub(Q);Ft=Ct.mag()===0?bt(et(Z+k,C,Bt).sub(X),o,k):bt(Ct,o,k),J||(J=Q.add(Ft)),G=pt(Z,Ft,X,_,w,J,o,C,Bt),ht.push(J),dt=G.sub(J)}W=dt.mag()}const xt=dt._mult((ot-it)/W)._add(J||Q),It=z+Math.atan2(X.y-Q.y,X.x-Q.x);return ht.push(xt),{point:xt,angle:S?It:0,path:ht}}const Xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Wt(y,t){for(let o=0;o=1;ae--)kt.push(te.path[ae]);for(let ae=1;aede.signedDistanceFromCamera<=0)?[]:ae.map(de=>de.point)}let Le=[];if(kt.length>0){const ae=kt[0].clone(),de=kt[0].clone();for(let Ve=1;Ve=Ct.x&&de.x<=St.x&&ae.y>=Ct.y&&de.y<=St.y?[kt]:de.xSt.x||de.ySt.y?[]:h.al([kt],Ct.x,Ct.y,St.x,St.y)}for(const ae of Le){Ut.reset(ae,.25*Ft);let de=0;de=Ut.length<=.5*Ft?1:Math.ceil(Ut.paddedLength/Jt)+1;for(let Ve=0;VeY(d,u,o.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,d=1/0,_=-1/0,w=-1/0;for(const k of t){const z=new h.P(k.x+re,k.y+re);u=Math.min(u,z.x),d=Math.min(d,z.y),_=Math.max(_,z.x),w=Math.max(w,z.y),o.push(z)}const C=this.grid.query(u,d,_,w).concat(this.ignoredGrid.query(u,d,_,w)),S={},E={};for(const k of C){const z=k.key;if(S[z.bucketInstanceId]===void 0&&(S[z.bucketInstanceId]={}),S[z.bucketInstanceId][z.featureIndex])continue;const N=[new h.P(k.x1,k.y1),new h.P(k.x2,k.y1),new h.P(k.x2,k.y2),new h.P(k.x1,k.y2)];h.am(o,N)&&(S[z.bucketInstanceId][z.featureIndex]=!0,E[z.bucketInstanceId]===void 0&&(E[z.bucketInstanceId]=[]),E[z.bucketInstanceId].push(z.featureIndex))}return E}insertCollisionBox(t,o,u,d,_,w){(u?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:_,collisionGroupID:w,overlapMode:o},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,u,d,_,w){const C=u?this.ignoredGrid:this.grid,S={bucketInstanceId:d,featureIndex:_,collisionGroupID:w,overlapMode:o};for(let E=0;E=this.screenRightBoundary||dthis.screenBottomBoundary}isInsideGrid(t,o,u,d){return u>=0&&t=0&&othis.projectAndGetPerspectiveRatio(u,Ct.x,Ct.y,d,E));Bt=Ft.some(Ct=>!Ct.isOccluded),It=Ft.map(Ct=>Ct.point)}else Bt=!0;return{box:h.ao(It),allPointsOccluded:!Bt}}}function ie(y,t,o){return t*(h.X/(y.tileSize*Math.pow(2,o-y.tileID.overscaledZ)))}class ke{constructor(t,o,u,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class We{constructor(t,o,u,d,_){this.text=new ke(t?t.text:null,o,u,_),this.icon=new ke(t?t.icon:null,o,d,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ai{constructor(t,o,u){this.text=t,this.icon=o,this.skipFade=u}}class ue{constructor(){this.invProjMatrix=h.H(),this.viewportMatrix=h.H(),this.circles=[]}}class Ie{constructor(t,o,u,d,_){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=_}}class $e{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[t]}}function ui(y,t,o,u,d){const{horizontalAlign:_,verticalAlign:w}=h.au(y);return new h.P(-(_-.5)*t+u[0]*d,-(w-.5)*o+u[1]*d)}class Ii{constructor(t,o,u,d,_,w){this.transform=t.clone(),this.terrain=u,this.collisionIndex=new _e(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new $e(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=w,w&&(w.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const o=this.terrain;return o?(u,d)=>o.getElevation(t,u,d):null}getBucketParts(t,o,u,d){const _=u.getBucket(o),w=u.latestFeatureIndex;if(!_||!w||o.id!==_.layerIds[0])return;const C=u.collisionBoxArray,S=_.layers[0].layout,E=_.layers[0].paint,k=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),z=u.tileSize/h.X,N=u.tileID.toUnwrapped(),Z=this.transform.calculatePosMatrix(N),G=S.get("text-pitch-alignment")==="map",J=S.get("text-rotation-alignment")==="map",X=ie(u,1,this.transform.zoom),Q=this.collisionIndex.mapProjection.translatePosition(this.transform,u,E.get("text-translate"),E.get("text-translate-anchor")),it=this.collisionIndex.mapProjection.translatePosition(this.transform,u,E.get("icon-translate"),E.get("icon-translate-anchor")),W=wn(Z,G,J,this.transform,X);let ot=null;if(G){const dt=Gr(Z,G,J,this.transform,X);ot=h.L([],this.transform.labelPlaneMatrix,dt)}this.retainedQueryData[_.bucketInstanceId]=new Ie(_.bucketInstanceId,w,_.sourceLayerIndex,_.index,u.tileID);const ht={bucket:_,layout:S,translationText:Q,translationIcon:it,posMatrix:Z,unwrappedTileID:N,textLabelPlaneMatrix:W,labelToScreenMatrix:ot,scale:k,textPixelRatio:z,holdingForFade:u.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:h.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(d)for(const dt of _.sortKeyRanges){const{sortKey:xt,symbolInstanceStart:It,symbolInstanceEnd:Bt}=dt;t.push({sortKey:xt,symbolInstanceStart:It,symbolInstanceEnd:Bt,parameters:ht})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:ht})}attemptAnchorPlacement(t,o,u,d,_,w,C,S,E,k,z,N,Z,G,J,X,Q,it,W){const ot=h.aq[t.textAnchor],ht=[t.textOffset0,t.textOffset1],dt=ui(ot,u,d,ht,_),xt=this.collisionIndex.placeCollisionBox(o,N,S,E,k,C,w,X,z.predicate,W,dt);if((!it||this.collisionIndex.placeCollisionBox(it,N,S,E,k,C,w,Q,z.predicate,W,dt).placeable)&&xt.placeable){let It;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(It=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:ht,width:u,height:d,anchor:ot,textBoxScale:_,prevAnchor:It},this.markUsedJustification(G,ot,Z,J),G.allowVerticalPlacement&&(this.markUsedOrientation(G,J,Z),this.placedOrientations[Z.crossTileID]=J),{shift:dt,placedGlyphBoxes:xt}}}placeLayerBucketPart(t,o,u){const{bucket:d,layout:_,translationText:w,translationIcon:C,posMatrix:S,unwrappedTileID:E,textLabelPlaneMatrix:k,labelToScreenMatrix:z,textPixelRatio:N,holdingForFade:Z,collisionBoxArray:G,partiallyEvaluatedTextSize:J,collisionGroup:X}=t.parameters,Q=_.get("text-optional"),it=_.get("icon-optional"),W=h.ar(_,"text-overlap","text-allow-overlap"),ot=W==="always",ht=h.ar(_,"icon-overlap","icon-allow-overlap"),dt=ht==="always",xt=_.get("text-rotation-alignment")==="map",It=_.get("text-pitch-alignment")==="map",Bt=_.get("icon-text-fit")!=="none",Ft=_.get("symbol-z-order")==="viewport-y",Ct=ot&&(dt||!d.hasIconData()||it),St=dt&&(ot||!d.hasTextData()||Q);!d.collisionArrays&&G&&d.deserializeCollisionBoxes(G);const Ut=this._getTerrainElevationFunc(this.retainedQueryData[d.bucketInstanceId].tileID),te=(Et,kt,Jt)=>{var Le,ae;if(o[Et.crossTileID])return;if(Z)return void(this.placements[Et.crossTileID]=new ai(!1,!1,!1));let de=!1,Ve=!1,Pi=!0,Er=null,Ne={box:null,placeable:!1,offscreen:null},$i={box:null,placeable:!1,offscreen:null},Ri=null,Mi=null,Ei=null,Tr=0,ts=0,Io=0;kt.textFeatureIndex?Tr=kt.textFeatureIndex:Et.useRuntimeCollisionCircles&&(Tr=Et.featureIndex),kt.verticalTextFeatureIndex&&(ts=kt.verticalTextFeatureIndex);const es=kt.textBox;if(es){const mr=Oi=>{let Ti=h.ah.horizontal;if(d.allowVerticalPlacement&&!Oi&&this.prevPlacement){const or=this.prevPlacement.placedOrientations[Et.crossTileID];or&&(this.placedOrientations[Et.crossTileID]=or,Ti=or,this.markUsedOrientation(d,Ti,Et))}return Ti},Ar=(Oi,Ti)=>{if(d.allowVerticalPlacement&&Et.numVerticalGlyphVertices>0&&kt.verticalTextBox){for(const or of d.writingModes)if(or===h.ah.vertical?(Ne=Ti(),$i=Ne):Ne=Oi(),Ne&&Ne.placeable)break}else Ne=Oi()},En=Et.textAnchorOffsetStartIndex,zr=Et.textAnchorOffsetEndIndex;if(zr===En){const Oi=(Ti,or)=>{const Ke=this.collisionIndex.placeCollisionBox(Ti,W,N,S,E,It,xt,w,X.predicate,Ut);return Ke&&Ke.placeable&&(this.markUsedOrientation(d,or,Et),this.placedOrientations[Et.crossTileID]=or),Ke};Ar(()=>Oi(es,h.ah.horizontal),()=>{const Ti=kt.verticalTextBox;return d.allowVerticalPlacement&&Et.numVerticalGlyphVertices>0&&Ti?Oi(Ti,h.ah.vertical):{box:null,offscreen:null}}),mr(Ne&&Ne.placeable)}else{let Oi=h.aq[(ae=(Le=this.prevPlacement)===null||Le===void 0?void 0:Le.variableOffsets[Et.crossTileID])===null||ae===void 0?void 0:ae.anchor];const Ti=(Ke,Es,Tn)=>{const Co=Ke.x2-Ke.x1,rd=Ke.y2-Ke.y1,nd=Et.textBoxScale,bi=Bt&&ht==="never"?Es:null;let An=null,So=W==="never"?1:2,Po="never";Oi&&So++;for(let Jl=0;JlTi(es,kt.iconBox,h.ah.horizontal),()=>{const Ke=kt.verticalTextBox;return d.allowVerticalPlacement&&(!Ne||!Ne.placeable)&&Et.numVerticalGlyphVertices>0&&Ke?Ti(Ke,kt.verticalIconBox,h.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Ne&&(de=Ne.placeable,Pi=Ne.offscreen);const or=mr(Ne&&Ne.placeable);if(!de&&this.prevPlacement){const Ke=this.prevPlacement.variableOffsets[Et.crossTileID];Ke&&(this.variableOffsets[Et.crossTileID]=Ke,this.markUsedJustification(d,Ke.anchor,Et,or))}}}if(Ri=Ne,de=Ri&&Ri.placeable,Pi=Ri&&Ri.offscreen,Et.useRuntimeCollisionCircles){const mr=d.text.placedSymbolArray.get(Et.centerJustifiedTextSymbolIndex),Ar=h.ai(d.textSizeData,J,mr),En=_.get("text-padding");Mi=this.collisionIndex.placeCollisionCircles(W,mr,d.lineVertexArray,d.glyphOffsetArray,Ar,S,E,k,z,u,It,X.predicate,Et.collisionCircleDiameter,En,w,Ut),Mi.circles.length&&Mi.collisionDetected&&!u&&h.w("Collisions detected, but collision boxes are not shown"),de=ot||Mi.circles.length>0&&!Mi.collisionDetected,Pi=Pi&&Mi.offscreen}if(kt.iconFeatureIndex&&(Io=kt.iconFeatureIndex),kt.iconBox){const mr=Ar=>this.collisionIndex.placeCollisionBox(Ar,ht,N,S,E,It,xt,C,X.predicate,Ut,Bt&&Er?Er:void 0);$i&&$i.placeable&&kt.verticalIconBox?(Ei=mr(kt.verticalIconBox),Ve=Ei.placeable):(Ei=mr(kt.iconBox),Ve=Ei.placeable),Pi=Pi&&Ei.offscreen}const Mn=Q||Et.numHorizontalGlyphVertices===0&&Et.numVerticalGlyphVertices===0,Sa=it||Et.numIconVertices===0;Mn||Sa?Sa?Mn||(Ve=Ve&&de):de=Ve&&de:Ve=de=Ve&&de;const Kl=Ve&&Ei.placeable;if(de&&Ri.placeable&&this.collisionIndex.insertCollisionBox(Ri.box,W,_.get("text-ignore-placement"),d.bucketInstanceId,$i&&$i.placeable&&ts?ts:Tr,X.ID),Kl&&this.collisionIndex.insertCollisionBox(Ei.box,ht,_.get("icon-ignore-placement"),d.bucketInstanceId,Io,X.ID),Mi&&de&&this.collisionIndex.insertCollisionCircles(Mi.circles,W,_.get("text-ignore-placement"),d.bucketInstanceId,Tr,X.ID),u&&this.storeCollisionData(d.bucketInstanceId,Jt,kt,Ri,Ei,Mi),Et.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(d.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Et.crossTileID]=new ai(de||Ct,Ve||St,Pi||d.justReloaded),o[Et.crossTileID]=!0};if(Ft){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Et=d.getSortedSymbolIndexes(this.transform.angle);for(let kt=Et.length-1;kt>=0;--kt){const Jt=Et[kt];te(d.symbolInstances.get(Jt),d.collisionArrays[Jt],Jt)}}else for(let Et=t.symbolInstanceStart;Et=0&&(t.text.placedSymbolArray.get(C).crossTileID=_>=0&&C!==_?0:u.crossTileID)}markUsedOrientation(t,o,u){const d=o===h.ah.horizontal||o===h.ah.horizontalOnly?o:0,_=o===h.ah.vertical?o:0,w=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex];for(const C of w)t.text.placedSymbolArray.get(C).placedOrientation=d;u.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(t):1,_=o?o.opacities:{},w=o?o.variableOffsets:{},C=o?o.placedOrientations:{};for(const S in this.placements){const E=this.placements[S],k=_[S];k?(this.opacities[S]=new We(k,d,E.text,E.icon),u=u||E.text!==k.text.placed||E.icon!==k.icon.placed):(this.opacities[S]=new We(null,d,E.text,E.icon,E.skipFade),u=u||E.text||E.icon)}for(const S in _){const E=_[S];if(!this.opacities[S]){const k=new We(E,d,!1,!1);k.isHidden()||(this.opacities[S]=k,u=u||E.text.placed||E.icon.placed)}}for(const S in w)this.variableOffsets[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.variableOffsets[S]=w[S]);for(const S in C)this.placedOrientations[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.placedOrientations[S]=C[S]);if(o&&o.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");u?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o){const u={};for(const d of o){const _=d.getBucket(t);_&&d.latestFeatureIndex&&t.id===_.layerIds[0]&&this.updateBucketOpacities(_,d.tileID,u,d.collisionBoxArray)}}updateBucketOpacities(t,o,u,d){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const _=t.layers[0],w=_.layout,C=new We(null,0,!1,!1,!0),S=w.get("text-allow-overlap"),E=w.get("icon-allow-overlap"),k=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=w.get("text-rotation-alignment")==="map",N=w.get("text-pitch-alignment")==="map",Z=w.get("icon-text-fit")!=="none",G=new We(null,0,S&&(E||!t.hasIconData()||w.get("icon-optional")),E&&(S||!t.hasTextData()||w.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const J=(Q,it,W)=>{for(let ot=0;ot0,It=this.placedOrientations[it.crossTileID],Bt=It===h.ah.vertical,Ft=It===h.ah.horizontal||It===h.ah.horizontalOnly;if(W>0||ot>0){const St=er(dt.text);J(t.text,W,Bt?Si:St),J(t.text,ot,Ft?Si:St);const Ut=dt.text.isHidden();[it.rightJustifiedTextSymbolIndex,it.centerJustifiedTextSymbolIndex,it.leftJustifiedTextSymbolIndex].forEach(kt=>{kt>=0&&(t.text.placedSymbolArray.get(kt).hidden=Ut||Bt?1:0)}),it.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(it.verticalPlacedTextSymbolIndex).hidden=Ut||Ft?1:0);const te=this.variableOffsets[it.crossTileID];te&&this.markUsedJustification(t,te.anchor,it,It);const Et=this.placedOrientations[it.crossTileID];Et&&(this.markUsedJustification(t,"left",it,Et),this.markUsedOrientation(t,Et,it))}if(xt){const St=er(dt.icon),Ut=!(Z&&it.verticalPlacedIconSymbolIndex&&Bt);it.placedIconSymbolIndex>=0&&(J(t.icon,it.numIconVertices,Ut?St:Si),t.icon.placedSymbolArray.get(it.placedIconSymbolIndex).hidden=dt.icon.isHidden()),it.verticalPlacedIconSymbolIndex>=0&&(J(t.icon,it.numVerticalIconVertices,Ut?Si:St),t.icon.placedSymbolArray.get(it.verticalPlacedIconSymbolIndex).hidden=dt.icon.isHidden())}const Ct=X&&X.has(Q)?X.get(Q):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const St=t.collisionArrays[Q];if(St){let Ut=new h.P(0,0);if(St.textBox||St.verticalTextBox){let te=!0;if(k){const Et=this.variableOffsets[ht];Et?(Ut=ui(Et.anchor,Et.width,Et.height,Et.textOffset,Et.textBoxScale),z&&Ut._rotate(N?this.transform.angle:-this.transform.angle)):te=!1}if(St.textBox||St.verticalTextBox){let Et;St.textBox&&(Et=Bt),St.verticalTextBox&&(Et=Ft),Ci(t.textCollisionBox.collisionVertexArray,dt.text.placed,!te||Et,Ct.text,Ut.x,Ut.y)}}if(St.iconBox||St.verticalIconBox){const te=!!(!Ft&&St.verticalIconBox);let Et;St.iconBox&&(Et=te),St.verticalIconBox&&(Et=!te),Ci(t.iconCollisionBox.collisionVertexArray,dt.icon.placed,Et,Ct.icon,Z?Ut.x:0,Z?Ut.y:0)}}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const Q=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=Q.invProjMatrix,t.placementViewportMatrix=Q.viewportMatrix,t.collisionCircleArray=Q.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function Ci(y,t,o,u,d,_){u&&u.length!==0||(u=[0,0,0,0]);const w=u[0]-re,C=u[1]-re,S=u[2]-re,E=u[3]-re;y.emplaceBack(t?1:0,o?1:0,d||0,_||0,w,C),y.emplaceBack(t?1:0,o?1:0,d||0,_||0,S,C),y.emplaceBack(t?1:0,o?1:0,d||0,_||0,S,E),y.emplaceBack(t?1:0,o?1:0,d||0,_||0,w,E)}const Ks=Math.pow(2,25),Ce=Math.pow(2,24),hl=Math.pow(2,17),cl=Math.pow(2,16),Qi=Math.pow(2,9),tr=Math.pow(2,8),Bu=Math.pow(2,1);function er(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const t=y.placed?1:0,o=Math.floor(127*y.opacity);return o*Ks+t*Ce+o*hl+t*cl+o*Qi+t*tr+o*Bu+t}const Si=0;function Go(){return{isOccluded:(y,t,o)=>!1,getPitchedTextCorrection:(y,t,o)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(y,t,o,u){throw new Error("Not implemented.")},translatePosition:(y,t,o,u)=>function(d,_,w,C,S=!1){if(!w[0]&&!w[1])return[0,0];const E=S?C==="map"?d.angle:0:C==="viewport"?-d.angle:0;if(E){const k=Math.sin(E),z=Math.cos(E);w=[w[0]*z-w[1]*k,w[0]*k+w[1]*z]}return[S?w[0]:ie(_,w[0],d.zoom),S?w[1]:ie(_,w[1],d.zoom)]}(y,t,o,u),getCircleRadiusCorrection:y=>1}}class Js{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,o,u,d,_){const w=this._bucketParts;for(;this._currentTileIndexC.sortKey-S.sortKey));this._currentPartIndex!this._forceFullPlacement&&B.now()-d>2;for(;this._currentPlacementIndex>=0;){const w=o[t[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&(!w.minzoom||w.minzoom<=C)&&(!w.maxzoom||w.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new Js(w)),this._inProgressLayer.continuePlacement(u[w.source],this.placement,this._showCollisionBoxes,w,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ln=512/h.X/2;class $n{constructor(t,o,u){this.tileID=t,this.bucketInstanceId=u,this._symbolsByKey={};const d=new Map;for(let _=0;_({x:Math.floor(S.anchorX*ln),y:Math.floor(S.anchorY*ln)})),crossTileIDs:w.map(S=>S.crossTileID)};if(C.positions.length>128){const S=new h.av(C.positions.length,16,Uint16Array);for(const{x:E,y:k}of C.positions)S.add(E,k);S.finish(),delete C.positions,C.index=S}this._symbolsByKey[_]=C}}getScaledCoordinates(t,o){const{x:u,y:d,z:_}=this.tileID.canonical,{x:w,y:C,z:S}=o.canonical,E=ln/Math.pow(2,S-_),k=(C*h.X+t.anchorY)*E,z=d*h.X*ln;return{x:Math.floor((w*h.X+t.anchorX)*E-u*h.X*ln),y:Math.floor(k-z)}}findMatches(t,o,u){const d=this.tileID.canonical.zt)}}class ni{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Xo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const u in this.indexes){const d=this.indexes[u],_={};for(const w in d){const C=d[w];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+o),_[C.tileID.key]=C}this.indexes[u]=_}this.lng=t}addBucket(t,o,u){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let _=0;_t.overscaledZ)for(const C in w){const S=w[C];S.tileID.isChildOf(t)&&S.findMatches(o.symbolInstances,t,d)}else{const C=w[t.scaledTo(Number(_)).key];C&&C.findMatches(o.symbolInstances,t,d)}}for(let _=0;_{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}const Ys=(y,t)=>h.t(y,t&&t.filter(o=>o.identifier!=="source.canvas")),In=h.aw();class ul extends h.E{constructor(t,o={}){super(),this._rtlPluginLoaded=()=>{for(const u in this.sourceCaches){const d=this.sourceCaches[u].getSource().type;d!=="vector"&&d!=="geojson"||this.sourceCaches[u].reload()}},this.map=t,this.dispatcher=new Un(jn(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(u,d)=>this.getGlyphs(u,d)),this.dispatcher.registerMessageHandler("GI",(u,d)=>this.getImages(u,d)),this.imageManager=new qe,this.imageManager.setEventedParent(this),this.glyphManager=new ji(t._requestManager,o.localIdeographFontFamily),this.lineAtlas=new us(256,512),this.crossTileSymbolIndex=new pr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",h.ay()),$r().on(Pt,this._rtlPluginLoaded),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const _=d.getSource();if(_&&_.vectorLayerIds)for(const w in this._layers){const C=this._layers[w];C.source===_.id&&this._validateLayer(C)}})}loadURL(t,o={},u){this.fire(new h.k("dataloading",{dataType:"style"})),o.validate=typeof o.validate!="boolean"||o.validate;const d=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;h.h(d,this._loadStyleRequest).then(w=>{this._loadStyleRequest=null,this._load(w.data,o,u)}).catch(w=>{this._loadStyleRequest=null,w&&!_.signal.aborted&&this.fire(new h.j(w))})}loadJSON(t,o={},u){this.fire(new h.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,B.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,o.validate=o.validate!==!1,this._load(t,o,u)}).catch(()=>{})}loadEmpty(){this.fire(new h.k("dataloading",{dataType:"style"})),this._load(In,{validate:!1})}_load(t,o,u){var d;const _=o.transformStyle?o.transformStyle(u,t):t;if(!o.validate||!Ys(this,h.u(_))){this._loaded=!0,this.stylesheet=_;for(const w in _.sources)this.addSource(w,_.sources[w],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new nn(this.stylesheet.light),this.sky=new br(this.stylesheet.sky),this.map.setTerrain((d=this.stylesheet.terrain)!==null&&d!==void 0?d:null),this.fire(new h.k("data",{dataType:"style"})),this.fire(new h.k("style.load"))}}_createLayers(){const t=h.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(o=>o.id),this._layers={},this._serializedLayers=null;for(const o of t){const u=h.aA(o);u.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=u}}_loadSprite(t,o=!1,u=void 0){let d;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,w,C,S){return h._(this,void 0,void 0,function*(){const E=ii(_),k=C>1?"@2x":"",z={},N={};for(const{id:Z,url:G}of E){const J=w.transformRequest(pi(G,k,".json"),"SpriteJSON");z[Z]=h.h(J,S);const X=w.transformRequest(pi(G,k,".png"),"SpriteImage");N[Z]=Yt.getImage(X,S)}return yield Promise.all([...Object.values(z),...Object.values(N)]),function(Z,G){return h._(this,void 0,void 0,function*(){const J={};for(const X in Z){J[X]={};const Q=B.getImageCanvasContext((yield G[X]).data),it=(yield Z[X]).data;for(const W in it){const{width:ot,height:ht,x:dt,y:xt,sdf:It,pixelRatio:Bt,stretchX:Ft,stretchY:Ct,content:St,textFitWidth:Ut,textFitHeight:te}=it[W];J[X][W]={data:null,pixelRatio:Bt,sdf:It,stretchX:Ft,stretchY:Ct,content:St,textFitWidth:Ut,textFitHeight:te,spriteData:{width:ot,height:ht,x:dt,y:xt,context:Q}}}}return J})}(z,N)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const w in _){this._spritesImagesIds[w]=[];const C=this._spritesImagesIds[w]?this._spritesImagesIds[w].filter(S=>!(S in _)):[];for(const S of C)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in _[w]){const E=w==="default"?S:`${w}:${S}`;this._spritesImagesIds[w].push(E),E in this.imageManager.images?this.imageManager.updateImage(E,_[w][S],!1):this.imageManager.addImage(E,_[w][S]),o&&(this._changedImages[E]=!0)}}}).catch(_=>{this._spriteRequest=null,d=_,this.fire(new h.j(d))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),o&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"})),u&&u(d)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}_validateLayer(t){const o=this.sourceCaches[t.source];if(!o)return;const u=t.sourceLayer;if(!u)return;const d=o.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(u)===-1)&&this.fire(new h.j(new Error(`Source layer "${u}" does not exist on source "${d.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,o=!1){const u=this._serializedAllLayers();if(!t||t.length===0)return Object.values(o?h.aB(u):u);const d=[];for(const _ of t)if(u[_]){const w=o?h.aB(u[_]):u[_];d.push(w)}return d}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const o=Object.keys(this._layers);for(const u of o){const d=this._layers[u];d.type!=="custom"&&(t[u]=d.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const o=this._changed;if(o){const d=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(d.length||_.length)&&this._updateWorkerLayers(d,_);for(const w in this._updatedSources){const C=this._updatedSources[w];if(C==="reload")this._reloadSource(w);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(w)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const w in this._updatedPaintProps)this._layers[w].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const u={};for(const d in this.sourceCaches){const _=this.sourceCaches[d];u[d]=_.used,_.used=!1}for(const d of this._order){const _=this._layers[d];_.recalculate(t,this._availableImages),!_.isHidden(t.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const d in u){const _=this.sourceCaches[d];!!u[d]!=!!_.used&&_.fire(new h.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,o&&this.fire(new h.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,o){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,o={}){var u;this._checkLoaded();const d=this.serialize();if(t=o.transformStyle?o.transformStyle(d,t):t,((u=o.validate)===null||u===void 0||u)&&Ys(this,h.u(t)))return!1;(t=h.aB(t)).layers=h.az(t.layers);const _=h.aC(d,t),w=this._getOperationsToPerform(_);if(w.unimplemented.length>0)throw new Error(`Unimplemented: ${w.unimplemented.join(", ")}.`);if(w.operations.length===0)return!1;for(const C of w.operations)C();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const o=[],u=[];for(const d of t)switch(d.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":o.push(()=>this.addLayer.apply(this,d.args));break;case"removeLayer":o.push(()=>this.removeLayer.apply(this,d.args));break;case"setPaintProperty":o.push(()=>this.setPaintProperty.apply(this,d.args));break;case"setLayoutProperty":o.push(()=>this.setLayoutProperty.apply(this,d.args));break;case"setFilter":o.push(()=>this.setFilter.apply(this,d.args));break;case"addSource":o.push(()=>this.addSource.apply(this,d.args));break;case"removeSource":o.push(()=>this.removeSource.apply(this,d.args));break;case"setLayerZoomRange":o.push(()=>this.setLayerZoomRange.apply(this,d.args));break;case"setLight":o.push(()=>this.setLight.apply(this,d.args));break;case"setGeoJSONSourceData":o.push(()=>this.setGeoJSONSourceData.apply(this,d.args));break;case"setGlyphs":o.push(()=>this.setGlyphs.apply(this,d.args));break;case"setSprite":o.push(()=>this.setSprite.apply(this,d.args));break;case"setSky":o.push(()=>this.setSky.apply(this,d.args));break;case"setTerrain":o.push(()=>this.map.setTerrain.apply(this,d.args));break;case"setTransition":o.push(()=>{});break;default:u.push(d.command)}return{operations:o,unimplemented:u}}addImage(t,o){if(this.getImage(t))return this.fire(new h.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,o),this._afterImageUpdated(t)}updateImage(t,o){this.imageManager.updateImage(t,o)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,o,u={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(h.u.source,`sources.${t}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=this.sourceCaches[t]=new Kt(t,o,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:d.loaded(),source:d.serialize(),sourceId:t})),d.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const u in this._layers)if(this._layers[u].source===t)return this.fire(new h.j(new Error(`Source "${t}" cannot be removed while layer "${u}" is using it.`)));const o=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],o.fire(new h.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,o){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const u=this.sourceCaches[t].getSource();if(u.type!=="geojson")throw new Error(`geojsonSource.type is ${u.type}, which is !== 'geojson`);u.setData(o),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,o,u={}){this._checkLoaded();const d=t.id;if(this.getLayer(d))return void this.fire(new h.j(new Error(`Layer "${d}" already exists on this map.`)));let _;if(t.type==="custom"){if(Ys(this,h.aD(t)))return;_=h.aA(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(d,t.source),t=h.aB(t),t=h.e(t,{source:d})),this._validate(h.u.layer,`layers.${d}`,t,{arrayIndex:-1},u))return;_=h.aA(t),this._validateLayer(_),_.setEventedParent(this,{layer:{id:d}})}const w=o?this._order.indexOf(o):this._order.length;if(o&&w===-1)this.fire(new h.j(new Error(`Cannot add layer "${d}" before non-existing layer "${o}".`)));else{if(this._order.splice(w,0,d),this._layerOrderChanged=!0,this._layers[d]=_,this._removedLayers[d]&&_.source&&_.type!=="custom"){const C=this._removedLayers[d];delete this._removedLayers[d],C.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(t,o){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===o)return;const u=this._order.indexOf(t);this._order.splice(u,1);const d=o?this._order.indexOf(o):this._order.length;o&&d===-1?this.fire(new h.j(new Error(`Cannot move layer "${t}" before non-existing layer "${o}".`))):(this._order.splice(d,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const o=this._layers[t];if(!o)return void this.fire(new h.j(new Error(`Cannot remove non-existing layer "${t}".`)));o.setEventedParent(null);const u=this._order.indexOf(t);this._order.splice(u,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=o,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],o.onRemove&&o.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,o,u){this._checkLoaded();const d=this.getLayer(t);d?d.minzoom===o&&d.maxzoom===u||(o!=null&&(d.minzoom=o),u!=null&&(d.maxzoom=u),this._updateLayer(d)):this.fire(new h.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,o,u={}){this._checkLoaded();const d=this.getLayer(t);if(d){if(!h.aE(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(h.u.filter,`layers.${d.id}.filter`,o,null,u)||(d.filter=h.aB(o),this._updateLayer(d)))}else this.fire(new h.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.aB(this.getLayer(t).filter)}setLayoutProperty(t,o,u,d={}){this._checkLoaded();const _=this.getLayer(t);_?h.aE(_.getLayoutProperty(o),u)||(_.setLayoutProperty(o,u,d),this._updateLayer(_)):this.fire(new h.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,o){const u=this.getLayer(t);if(u)return u.getLayoutProperty(o);this.fire(new h.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,o,u,d={}){this._checkLoaded();const _=this.getLayer(t);_?h.aE(_.getPaintProperty(o),u)||(_.setPaintProperty(o,u,d)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new h.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,o){return this.getLayer(t).getPaintProperty(o)}setFeatureState(t,o){this._checkLoaded();const u=t.source,d=t.sourceLayer,_=this.sourceCaches[u];if(_===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const w=_.getSource().type;w==="geojson"&&d?this.fire(new h.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):w!=="vector"||d?(t.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(d,t.id,o)):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,o){this._checkLoaded();const u=t.source,d=this.sourceCaches[u];if(d===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const _=d.getSource().type,w=_==="vector"?t.sourceLayer:void 0;_!=="vector"||w?o&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.j(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(w,t.id,o):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const o=t.source,u=t.sourceLayer,d=this.sourceCaches[o];if(d!==void 0)return d.getSource().type!=="vector"||u?(t.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),d.getFeatureState(u,t.id)):void this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.j(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){return h.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=h.aF(this.sourceCaches,_=>_.serialize()),o=this._serializeByIds(this._order,!0),u=this.map.getTerrain()||void 0,d=this.stylesheet;return h.aG({version:d.version,name:d.name,metadata:d.metadata,light:d.light,sky:d.sky,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:t,layers:o,terrain:u},_=>_!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const o=w=>this._layers[w].type==="fill-extrusion",u={},d=[];for(let w=this._order.length-1;w>=0;w--){const C=this._order[w];if(o(C)){u[C]=w;for(const S of t){const E=S[C];if(E)for(const k of E)d.push(k)}}}d.sort((w,C)=>C.intersectionZ-w.intersectionZ);const _=[];for(let w=this._order.length-1;w>=0;w--){const C=this._order[w];if(o(C))for(let S=d.length-1;S>=0;S--){const E=d[S].feature;if(u[E.layer.id]{const It=Q.featureSortOrder;if(It){const Bt=It.indexOf(dt.featureIndex);return It.indexOf(xt.featureIndex)-Bt}return xt.featureIndex-dt.featureIndex});for(const dt of ht)ot.push(dt)}}for(const Q in G)G[Q].forEach(it=>{const W=it.feature,ot=E[C[Q].source].getFeatureState(W.layer["source-layer"],W.id);W.source=W.layer.source,W.layer["source-layer"]&&(W.sourceLayer=W.layer["source-layer"]),W.state=ot});return G}(this._layers,w,this.sourceCaches,t,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(t,o){o&&o.filter&&this._validate(h.u.filter,"querySourceFeatures.filter",o.filter,null,o);const u=this.sourceCaches[t];return u?function(d,_){const w=d.getRenderableIds().map(E=>d.getTileByID(E)),C=[],S={};for(let E=0;EN.getTileByID(Z)).sort((Z,G)=>G.tileID.overscaledZ-Z.tileID.overscaledZ||(Z.tileID.isLessThan(G.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(k,S[k.source],t.center.lng);w=w||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||u===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(B.now(),t.zoom))&&(this.pauseablePlacement=new li(t,this.map.terrain,this._order,_,o,u,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,S),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(B.now()),C=!0),w&&this.pauseablePlacement.placement.setStale()),C||w)for(const E of this._order){const k=this._layers[E];k.type==="symbol"&&this.placement.updateLayerOpacities(k,S[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(B.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,o){return h._(this,void 0,void 0,function*(){const u=yield this.imageManager.getImages(o.icons);this._updateTilesForChangedImages();const d=this.sourceCaches[o.source];return d&&d.setDependencies(o.tileID.key,o.type,o.icons),u})}getGlyphs(t,o){return h._(this,void 0,void 0,function*(){const u=yield this.glyphManager.getGlyphs(o.stacks),d=this.sourceCaches[o.source];return d&&d.setDependencies(o.tileID.key,o.type,[""]),u})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,o={}){this._checkLoaded(),t&&this._validate(h.u.glyphs,"glyphs",t,null,o)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,o,u={},d){this._checkLoaded();const _=[{id:t,url:o}],w=[...ii(this.stylesheet.sprite),..._];this._validate(h.u.sprite,"sprite",w,null,u)||(this.stylesheet.sprite=w,this._loadSprite(_,!0,d))}removeSprite(t){this._checkLoaded();const o=ii(this.stylesheet.sprite);if(o.find(u=>u.id===t)){if(this._spritesImagesIds[t])for(const u of this._spritesImagesIds[t])this.imageManager.removeImage(u),this._changedImages[u]=!0;o.splice(o.findIndex(u=>u.id===t),1),this.stylesheet.sprite=o.length>0?o:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}else this.fire(new h.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ii(this.stylesheet.sprite)}setSprite(t,o={},u){this._checkLoaded(),t&&this._validate(h.u.sprite,"sprite",t,null,o)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,u):(this._unloadSprite(),u&&u(null)))}}var Qs=h.Y([{name:"a_pos",type:"Int16",components:2}]);const Cn={prelude:we(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}`),background:we(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:we(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:we(`varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:we("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:we(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:we(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:we("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:we("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:we("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:we(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:we(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:we(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:we(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:we(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:we(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:we(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:we(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:we(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:we(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:we(`#ifdef GL_ES +precision highp float; +#endif +uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:we(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:we(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:we(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:we(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:we(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:we("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:we("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:we("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:we("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function we(y,t){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,u=t.match(/attribute ([\w]+) ([\w]+)/g),d=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=_?_.concat(d):d,C={};return{fragmentSource:y=y.replace(o,(S,E,k,z,N)=>(C[N]=!0,E==="define"?` +#ifndef HAS_UNIFORM_u_${N} +varying ${k} ${z} ${N}; +#else +uniform ${k} ${z} u_${N}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${N} + ${k} ${z} ${N} = u_${N}; +#endif +`)),vertexSource:t=t.replace(o,(S,E,k,z,N)=>{const Z=z==="float"?"vec2":"vec4",G=N.match(/color/)?"color":Z;return C[N]?E==="define"?` +#ifndef HAS_UNIFORM_u_${N} +uniform lowp float u_${N}_t; +attribute ${k} ${Z} a_${N}; +varying ${k} ${z} ${N}; +#else +uniform ${k} ${z} u_${N}; +#endif +`:G==="vec4"?` +#ifndef HAS_UNIFORM_u_${N} + ${N} = a_${N}; +#else + ${k} ${z} ${N} = u_${N}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${N} + ${N} = unpack_mix_${G}(a_${N}, u_${N}_t); +#else + ${k} ${z} ${N} = u_${N}; +#endif +`:E==="define"?` +#ifndef HAS_UNIFORM_u_${N} +uniform lowp float u_${N}_t; +attribute ${k} ${Z} a_${N}; +#else +uniform ${k} ${z} u_${N}; +#endif +`:G==="vec4"?` +#ifndef HAS_UNIFORM_u_${N} + ${k} ${z} ${N} = a_${N}; +#else + ${k} ${z} ${N} = u_${N}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${N} + ${k} ${z} ${N} = unpack_mix_${G}(a_${N}, u_${N}_t); +#else + ${k} ${z} ${N} = u_${N}; +#endif +`}),staticAttributes:u,staticUniforms:w}}class Wo{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,o,u,d,_,w,C,S,E){this.context=t;let k=this.boundPaintVertexBuffers.length!==d.length;for(let z=0;!k&&z({u_matrix:y,u_texture:0,u_ele_delta:t,u_fog_matrix:o,u_fog_color:u?u.properties.get("fog-color"):h.aM.white,u_fog_ground_blend:u?u.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?u.calculateFogBlendOpacity(d):0,u_horizon_color:u?u.properties.get("horizon-color"):h.aM.white,u_horizon_fog_blend:u?u.properties.get("horizon-fog-blend"):1});function to(y){const t=[];for(let o=0;o({u_depth:new h.aH(dt,xt.u_depth),u_terrain:new h.aH(dt,xt.u_terrain),u_terrain_dim:new h.aI(dt,xt.u_terrain_dim),u_terrain_matrix:new h.aJ(dt,xt.u_terrain_matrix),u_terrain_unpack:new h.aK(dt,xt.u_terrain_unpack),u_terrain_exaggeration:new h.aI(dt,xt.u_terrain_exaggeration)}))(t,ht),this.binderUniforms=u?u.getUniforms(t,ht):[]}draw(t,o,u,d,_,w,C,S,E,k,z,N,Z,G,J,X,Q,it){const W=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(u),t.setStencilMode(d),t.setColorMode(_),t.setCullFace(w),S){t.activeTexture.set(W.TEXTURE2),W.bindTexture(W.TEXTURE_2D,S.depthTexture),t.activeTexture.set(W.TEXTURE3),W.bindTexture(W.TEXTURE_2D,S.texture);for(const ht in this.terrainUniforms)this.terrainUniforms[ht].set(S[ht])}for(const ht in this.fixedUniforms)this.fixedUniforms[ht].set(C[ht]);J&&J.setUniforms(t,this.binderUniforms,Z,{zoom:G});let ot=0;switch(o){case W.LINES:ot=2;break;case W.TRIANGLES:ot=3;break;case W.LINE_STRIP:ot=1}for(const ht of N.get()){const dt=ht.vaos||(ht.vaos={});(dt[E]||(dt[E]=new Wo)).bind(t,this,k,J?J.getPaintVertexBuffers():[],z,ht.vertexOffset,X,Q,it),W.drawElements(o,ht.primitiveLength*ot,W.UNSIGNED_SHORT,ht.primitiveOffset*ot*2)}}}function Ko(y,t,o){const u=1/ie(o,1,t.transform.tileZoom),d=Math.pow(2,o.tileID.overscaledZ),_=o.tileSize*Math.pow(2,t.transform.tileZoom)/d,w=_*(o.tileID.canonical.x+o.tileID.wrap*d),C=_*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[u,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[w>>16,C>>16],u_pixel_coord_lower:[65535&w,65535&C]}}const Jo=(y,t,o,u)=>{const d=t.style.light,_=d.properties.get("position"),w=[_.x,_.y,_.z],C=function(){var E=new h.A(9);return h.A!=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}();d.properties.get("anchor")==="viewport"&&function(E,k){var z=Math.sin(k),N=Math.cos(k);E[0]=N,E[1]=z,E[2]=0,E[3]=-z,E[4]=N,E[5]=0,E[6]=0,E[7]=0,E[8]=1}(C,-t.transform.angle),function(E,k,z){var N=k[0],Z=k[1],G=k[2];E[0]=N*z[0]+Z*z[3]+G*z[6],E[1]=N*z[1]+Z*z[4]+G*z[7],E[2]=N*z[2]+Z*z[5]+G*z[8]}(w,w,C);const S=d.properties.get("color");return{u_matrix:y,u_lightpos:w,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+o,u_opacity:u}},Yo=(y,t,o,u,d,_,w)=>h.e(Jo(y,t,o,u),Ko(_,t,w),{u_height_factor:-Math.pow(2,d.overscaledZ)/w.tileSize/8}),eo=y=>({u_matrix:y}),ms=(y,t,o,u)=>h.e(eo(y),Ko(o,t,u)),Fu=(y,t)=>({u_matrix:y,u_world:t}),Ru=(y,t,o,u,d)=>h.e(ms(y,t,o,u),{u_world:d}),Wh=(y,t,o,u)=>{const d=y.transform;let _,w;if(u.paint.get("circle-pitch-alignment")==="map"){const C=ie(o,1,d.zoom);_=!0,w=[C,C]}else _=!1,w=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(u.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(t.posMatrix,o,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:w}},Ou=(y,t,o)=>({u_matrix:y,u_inv_matrix:t,u_camera_to_center_distance:o.cameraToCenterDistance,u_viewport_size:[o.width,o.height]}),Sn=(y,t,o=1)=>({u_matrix:y,u_color:t,u_overlay:0,u_overlay_scale:o}),io=y=>({u_matrix:y}),ir=(y,t,o,u)=>({u_matrix:y,u_extrude_scale:ie(t,1,o),u_intensity:u});function rr(y,t){const o=Math.pow(2,t.canonical.z),u=t.canonical.y;return[new h.Z(0,u/o).toLngLat().lat,new h.Z(0,(u+1)/o).toLngLat().lat]}const ro=(y,t,o,u)=>{const d=y.transform;return{u_matrix:Jh(y,t,o,u),u_ratio:1/ie(t,1,d.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Qo=(y,t,o,u,d)=>h.e(ro(y,t,o,d),{u_image:0,u_image_height:u}),Hh=(y,t,o,u,d)=>{const _=y.transform,w=Zn(t,_);return{u_matrix:Jh(y,t,o,d),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ie(t,1,_.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[w,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},Kh=(y,t,o,u,d,_)=>{const w=y.lineAtlas,C=Zn(t,y.transform),S=o.layout.get("line-cap")==="round",E=w.getDash(u.from,S),k=w.getDash(u.to,S),z=E.width*d.fromScale,N=k.width*d.toScale;return h.e(ro(y,t,o,_),{u_patternscale_a:[C/z,-E.height/2],u_patternscale_b:[C/N,-k.height/2],u_sdfgamma:w.width/(256*Math.min(z,N)*y.pixelRatio)/2,u_image:0,u_tex_y_a:E.y,u_tex_y_b:k.y,u_mix:d.t})};function Zn(y,t){return 1/ie(y,1,t.tileZoom)}function Jh(y,t,o,u){return y.translatePosMatrix(u?u.posMatrix:t.tileID.posMatrix,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const Vu=(y,t,o,u,d)=>{return{u_matrix:y,u_tl_parent:t,u_scale_parent:o,u_buffer_scale:1,u_fade_t:u.mix,u_opacity:u.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(w=d.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(_=d.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:Nu(d.paint.get("raster-hue-rotate"))};var _,w};function Nu(y){y*=Math.PI/180;const t=Math.sin(y),o=Math.cos(y);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Yh=(y,t,o,u,d,_,w,C,S,E,k,z,N,Z)=>{const G=w.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:G.width/G.height,u_fade_change:w.options.fadeDuration?w.symbolFadeChange:1,u_matrix:C,u_label_plane_matrix:S,u_coord_matrix:E,u_is_text:+z,u_pitch_with_map:+u,u_is_along_line:d,u_is_variable_anchor:_,u_texsize:N,u_texture:0,u_translation:k,u_pitched_scale:Z}},Qh=(y,t,o,u,d,_,w,C,S,E,k,z,N,Z,G)=>{const J=w.transform;return h.e(Yh(y,t,o,u,d,_,w,C,S,E,k,z,N,G),{u_gamma_scale:u?Math.cos(J._pitch)*J.cameraToCenterDistance:1,u_device_pixel_ratio:w.pixelRatio,u_is_halo:+Z})},ju=(y,t,o,u,d,_,w,C,S,E,k,z,N,Z)=>h.e(Qh(y,t,o,u,d,_,w,C,S,E,k,!0,z,!0,Z),{u_texsize_icon:N,u_texture_icon:1}),ta=(y,t,o)=>({u_matrix:y,u_opacity:t,u_color:o}),pl=(y,t,o,u,d,_)=>h.e(function(w,C,S,E){const k=S.imageManager.getPattern(w.from.toString()),z=S.imageManager.getPattern(w.to.toString()),{width:N,height:Z}=S.imageManager.getPixelSize(),G=Math.pow(2,E.tileID.overscaledZ),J=E.tileSize*Math.pow(2,S.transform.tileZoom)/G,X=J*(E.tileID.canonical.x+E.tileID.wrap*G),Q=J*E.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[N,Z],u_mix:C.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/ie(E,1,S.transform.tileZoom),u_pixel_coord_upper:[X>>16,Q>>16],u_pixel_coord_lower:[65535&X,65535&Q]}}(u,_,o,d),{u_matrix:y,u_opacity:t}),ea={fillExtrusion:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_lightpos:new h.aN(y,t.u_lightpos),u_lightintensity:new h.aI(y,t.u_lightintensity),u_lightcolor:new h.aN(y,t.u_lightcolor),u_vertical_gradient:new h.aI(y,t.u_vertical_gradient),u_opacity:new h.aI(y,t.u_opacity)}),fillExtrusionPattern:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_lightpos:new h.aN(y,t.u_lightpos),u_lightintensity:new h.aI(y,t.u_lightintensity),u_lightcolor:new h.aN(y,t.u_lightcolor),u_vertical_gradient:new h.aI(y,t.u_vertical_gradient),u_height_factor:new h.aI(y,t.u_height_factor),u_image:new h.aH(y,t.u_image),u_texsize:new h.aO(y,t.u_texsize),u_pixel_coord_upper:new h.aO(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(y,t.u_pixel_coord_lower),u_scale:new h.aN(y,t.u_scale),u_fade:new h.aI(y,t.u_fade),u_opacity:new h.aI(y,t.u_opacity)}),fill:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix)}),fillPattern:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_image:new h.aH(y,t.u_image),u_texsize:new h.aO(y,t.u_texsize),u_pixel_coord_upper:new h.aO(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(y,t.u_pixel_coord_lower),u_scale:new h.aN(y,t.u_scale),u_fade:new h.aI(y,t.u_fade)}),fillOutline:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_world:new h.aO(y,t.u_world)}),fillOutlinePattern:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_world:new h.aO(y,t.u_world),u_image:new h.aH(y,t.u_image),u_texsize:new h.aO(y,t.u_texsize),u_pixel_coord_upper:new h.aO(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(y,t.u_pixel_coord_lower),u_scale:new h.aN(y,t.u_scale),u_fade:new h.aI(y,t.u_fade)}),circle:(y,t)=>({u_camera_to_center_distance:new h.aI(y,t.u_camera_to_center_distance),u_scale_with_map:new h.aH(y,t.u_scale_with_map),u_pitch_with_map:new h.aH(y,t.u_pitch_with_map),u_extrude_scale:new h.aO(y,t.u_extrude_scale),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_matrix:new h.aJ(y,t.u_matrix)}),collisionBox:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_pixel_extrude_scale:new h.aO(y,t.u_pixel_extrude_scale)}),collisionCircle:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_inv_matrix:new h.aJ(y,t.u_inv_matrix),u_camera_to_center_distance:new h.aI(y,t.u_camera_to_center_distance),u_viewport_size:new h.aO(y,t.u_viewport_size)}),debug:(y,t)=>({u_color:new h.aL(y,t.u_color),u_matrix:new h.aJ(y,t.u_matrix),u_overlay:new h.aH(y,t.u_overlay),u_overlay_scale:new h.aI(y,t.u_overlay_scale)}),clippingMask:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix)}),heatmap:(y,t)=>({u_extrude_scale:new h.aI(y,t.u_extrude_scale),u_intensity:new h.aI(y,t.u_intensity),u_matrix:new h.aJ(y,t.u_matrix)}),heatmapTexture:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_world:new h.aO(y,t.u_world),u_image:new h.aH(y,t.u_image),u_color_ramp:new h.aH(y,t.u_color_ramp),u_opacity:new h.aI(y,t.u_opacity)}),hillshade:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_image:new h.aH(y,t.u_image),u_latrange:new h.aO(y,t.u_latrange),u_light:new h.aO(y,t.u_light),u_shadow:new h.aL(y,t.u_shadow),u_highlight:new h.aL(y,t.u_highlight),u_accent:new h.aL(y,t.u_accent)}),hillshadePrepare:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_image:new h.aH(y,t.u_image),u_dimension:new h.aO(y,t.u_dimension),u_zoom:new h.aI(y,t.u_zoom),u_unpack:new h.aK(y,t.u_unpack)}),line:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_ratio:new h.aI(y,t.u_ratio),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_units_to_pixels:new h.aO(y,t.u_units_to_pixels)}),lineGradient:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_ratio:new h.aI(y,t.u_ratio),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_units_to_pixels:new h.aO(y,t.u_units_to_pixels),u_image:new h.aH(y,t.u_image),u_image_height:new h.aI(y,t.u_image_height)}),linePattern:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_texsize:new h.aO(y,t.u_texsize),u_ratio:new h.aI(y,t.u_ratio),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_image:new h.aH(y,t.u_image),u_units_to_pixels:new h.aO(y,t.u_units_to_pixels),u_scale:new h.aN(y,t.u_scale),u_fade:new h.aI(y,t.u_fade)}),lineSDF:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_ratio:new h.aI(y,t.u_ratio),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_units_to_pixels:new h.aO(y,t.u_units_to_pixels),u_patternscale_a:new h.aO(y,t.u_patternscale_a),u_patternscale_b:new h.aO(y,t.u_patternscale_b),u_sdfgamma:new h.aI(y,t.u_sdfgamma),u_image:new h.aH(y,t.u_image),u_tex_y_a:new h.aI(y,t.u_tex_y_a),u_tex_y_b:new h.aI(y,t.u_tex_y_b),u_mix:new h.aI(y,t.u_mix)}),raster:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_tl_parent:new h.aO(y,t.u_tl_parent),u_scale_parent:new h.aI(y,t.u_scale_parent),u_buffer_scale:new h.aI(y,t.u_buffer_scale),u_fade_t:new h.aI(y,t.u_fade_t),u_opacity:new h.aI(y,t.u_opacity),u_image0:new h.aH(y,t.u_image0),u_image1:new h.aH(y,t.u_image1),u_brightness_low:new h.aI(y,t.u_brightness_low),u_brightness_high:new h.aI(y,t.u_brightness_high),u_saturation_factor:new h.aI(y,t.u_saturation_factor),u_contrast_factor:new h.aI(y,t.u_contrast_factor),u_spin_weights:new h.aN(y,t.u_spin_weights)}),symbolIcon:(y,t)=>({u_is_size_zoom_constant:new h.aH(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(y,t.u_is_size_feature_constant),u_size_t:new h.aI(y,t.u_size_t),u_size:new h.aI(y,t.u_size),u_camera_to_center_distance:new h.aI(y,t.u_camera_to_center_distance),u_pitch:new h.aI(y,t.u_pitch),u_rotate_symbol:new h.aH(y,t.u_rotate_symbol),u_aspect_ratio:new h.aI(y,t.u_aspect_ratio),u_fade_change:new h.aI(y,t.u_fade_change),u_matrix:new h.aJ(y,t.u_matrix),u_label_plane_matrix:new h.aJ(y,t.u_label_plane_matrix),u_coord_matrix:new h.aJ(y,t.u_coord_matrix),u_is_text:new h.aH(y,t.u_is_text),u_pitch_with_map:new h.aH(y,t.u_pitch_with_map),u_is_along_line:new h.aH(y,t.u_is_along_line),u_is_variable_anchor:new h.aH(y,t.u_is_variable_anchor),u_texsize:new h.aO(y,t.u_texsize),u_texture:new h.aH(y,t.u_texture),u_translation:new h.aO(y,t.u_translation),u_pitched_scale:new h.aI(y,t.u_pitched_scale)}),symbolSDF:(y,t)=>({u_is_size_zoom_constant:new h.aH(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(y,t.u_is_size_feature_constant),u_size_t:new h.aI(y,t.u_size_t),u_size:new h.aI(y,t.u_size),u_camera_to_center_distance:new h.aI(y,t.u_camera_to_center_distance),u_pitch:new h.aI(y,t.u_pitch),u_rotate_symbol:new h.aH(y,t.u_rotate_symbol),u_aspect_ratio:new h.aI(y,t.u_aspect_ratio),u_fade_change:new h.aI(y,t.u_fade_change),u_matrix:new h.aJ(y,t.u_matrix),u_label_plane_matrix:new h.aJ(y,t.u_label_plane_matrix),u_coord_matrix:new h.aJ(y,t.u_coord_matrix),u_is_text:new h.aH(y,t.u_is_text),u_pitch_with_map:new h.aH(y,t.u_pitch_with_map),u_is_along_line:new h.aH(y,t.u_is_along_line),u_is_variable_anchor:new h.aH(y,t.u_is_variable_anchor),u_texsize:new h.aO(y,t.u_texsize),u_texture:new h.aH(y,t.u_texture),u_gamma_scale:new h.aI(y,t.u_gamma_scale),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_is_halo:new h.aH(y,t.u_is_halo),u_translation:new h.aO(y,t.u_translation),u_pitched_scale:new h.aI(y,t.u_pitched_scale)}),symbolTextAndIcon:(y,t)=>({u_is_size_zoom_constant:new h.aH(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(y,t.u_is_size_feature_constant),u_size_t:new h.aI(y,t.u_size_t),u_size:new h.aI(y,t.u_size),u_camera_to_center_distance:new h.aI(y,t.u_camera_to_center_distance),u_pitch:new h.aI(y,t.u_pitch),u_rotate_symbol:new h.aH(y,t.u_rotate_symbol),u_aspect_ratio:new h.aI(y,t.u_aspect_ratio),u_fade_change:new h.aI(y,t.u_fade_change),u_matrix:new h.aJ(y,t.u_matrix),u_label_plane_matrix:new h.aJ(y,t.u_label_plane_matrix),u_coord_matrix:new h.aJ(y,t.u_coord_matrix),u_is_text:new h.aH(y,t.u_is_text),u_pitch_with_map:new h.aH(y,t.u_pitch_with_map),u_is_along_line:new h.aH(y,t.u_is_along_line),u_is_variable_anchor:new h.aH(y,t.u_is_variable_anchor),u_texsize:new h.aO(y,t.u_texsize),u_texsize_icon:new h.aO(y,t.u_texsize_icon),u_texture:new h.aH(y,t.u_texture),u_texture_icon:new h.aH(y,t.u_texture_icon),u_gamma_scale:new h.aI(y,t.u_gamma_scale),u_device_pixel_ratio:new h.aI(y,t.u_device_pixel_ratio),u_is_halo:new h.aH(y,t.u_is_halo),u_translation:new h.aO(y,t.u_translation),u_pitched_scale:new h.aI(y,t.u_pitched_scale)}),background:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_opacity:new h.aI(y,t.u_opacity),u_color:new h.aL(y,t.u_color)}),backgroundPattern:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_opacity:new h.aI(y,t.u_opacity),u_image:new h.aH(y,t.u_image),u_pattern_tl_a:new h.aO(y,t.u_pattern_tl_a),u_pattern_br_a:new h.aO(y,t.u_pattern_br_a),u_pattern_tl_b:new h.aO(y,t.u_pattern_tl_b),u_pattern_br_b:new h.aO(y,t.u_pattern_br_b),u_texsize:new h.aO(y,t.u_texsize),u_mix:new h.aI(y,t.u_mix),u_pattern_size_a:new h.aO(y,t.u_pattern_size_a),u_pattern_size_b:new h.aO(y,t.u_pattern_size_b),u_scale_a:new h.aI(y,t.u_scale_a),u_scale_b:new h.aI(y,t.u_scale_b),u_pixel_coord_upper:new h.aO(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(y,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.aI(y,t.u_tile_units_to_pixels)}),terrain:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_texture:new h.aH(y,t.u_texture),u_ele_delta:new h.aI(y,t.u_ele_delta),u_fog_matrix:new h.aJ(y,t.u_fog_matrix),u_fog_color:new h.aL(y,t.u_fog_color),u_fog_ground_blend:new h.aI(y,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.aI(y,t.u_fog_ground_blend_opacity),u_horizon_color:new h.aL(y,t.u_horizon_color),u_horizon_fog_blend:new h.aI(y,t.u_horizon_fog_blend)}),terrainDepth:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_ele_delta:new h.aI(y,t.u_ele_delta)}),terrainCoords:(y,t)=>({u_matrix:new h.aJ(y,t.u_matrix),u_texture:new h.aH(y,t.u_texture),u_terrain_coords_id:new h.aI(y,t.u_terrain_coords_id),u_ele_delta:new h.aI(y,t.u_ele_delta)}),sky:(y,t)=>({u_sky_color:new h.aL(y,t.u_sky_color),u_horizon_color:new h.aL(y,t.u_horizon_color),u_horizon:new h.aI(y,t.u_horizon),u_sky_horizon_blend:new h.aI(y,t.u_sky_horizon_blend)})};class fl{constructor(t,o,u){this.context=t;const d=t.gl;this.buffer=d.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ml={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Xr{constructor(t,o,u,d){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.context=t;const _=t.gl;this.buffer=_.createBuffer(),t.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let u=0;u0){const dt=h.H();h.aQ(dt,W.placementInvProjMatrix,y.transform.glCoordMatrix),h.aQ(dt,dt,W.placementViewportMatrix),S.push({circleArray:ht,circleOffset:k,transform:it.posMatrix,invTransform:dt,coord:it}),E+=ht.length/4,k=E}ot&&C.draw(_,w.LINES,pe.disabled,Ze.disabled,y.colorModeForRenderPass(),De.disabled,{u_matrix:it.posMatrix,u_pixel_extrude_scale:[1/(z=y.transform).width,1/z.height]},y.style.map.terrain&&y.style.map.terrain.getTerrainData(it),o.id,ot.layoutVertexBuffer,ot.indexBuffer,ot.segments,null,y.transform.zoom,null,null,ot.collisionVertexBuffer)}var z;if(!d||!S.length)return;const N=y.useProgram("collisionCircle"),Z=new h.aR;Z.resize(4*E),Z._trim();let G=0;for(const Q of S)for(let it=0;it=0&&(Q[W.associatedIconIndex]={shiftedAnchor:Jt,angle:Le})}else Wt(W.numGlyphs,J)}if(E){X.clear();const it=y.icon.placedSymbolArray;for(let W=0;Wy.style.map.terrain.getElevation(Ct,Tn,Co):null,Es=o.layout.get("text-rotation-alignment")==="map";$(Ut,Ct.posMatrix,y,d,ts,es,Q,E,Es,J,Ct.toUnwrapped(),G.width,G.height,Mn,Ke)}const mr=Ct.posMatrix,Ar=d&&It||Kl,En=it||Ar?ao:ts,zr=Io,Oi=kt&&o.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ti;Ti=kt?Ut.iconsInText?ju(Jt.kind,de,W,Q,it,Ar,y,mr,En,zr,Mn,Pi,Ri,Ft):Qh(Jt.kind,de,W,Q,it,Ar,y,mr,En,zr,Mn,d,Pi,!0,Ft):Yh(Jt.kind,de,W,Q,it,Ar,y,mr,En,zr,Mn,d,Pi,Ft);const or={program:ae,buffers:te,uniformValues:Ti,atlasTexture:Er,atlasTextureIcon:Mi,atlasInterpolation:Ne,atlasInterpolationIcon:$i,isSDF:kt,hasHalo:Oi};if(ht&&Ut.canOverlap){dt=!0;const Ke=te.segments.get();for(const Es of Ke)Bt.push({segments:new h.a0([Es]),sortKey:Es.sortKey,state:or,terrainData:Ve})}else Bt.push({segments:te.segments,sortKey:0,state:or,terrainData:Ve})}dt&&Bt.sort((Ct,St)=>Ct.sortKey-St.sortKey);for(const Ct of Bt){const St=Ct.state;if(N.activeTexture.set(Z.TEXTURE0),St.atlasTexture.bind(St.atlasInterpolation,Z.CLAMP_TO_EDGE),St.atlasTextureIcon&&(N.activeTexture.set(Z.TEXTURE1),St.atlasTextureIcon&&St.atlasTextureIcon.bind(St.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),St.isSDF){const Ut=St.uniformValues;St.hasHalo&&(Ut.u_is_halo=1,nr(St.buffers,Ct.segments,o,y,St.program,xt,k,z,Ut,Ct.terrainData)),Ut.u_is_halo=0}nr(St.buffers,Ct.segments,o,y,St.program,xt,k,z,St.uniformValues,Ct.terrainData)}}function nr(y,t,o,u,d,_,w,C,S,E){const k=u.context;d.draw(k,k.gl.TRIANGLES,_,w,C,De.disabled,S,E,o.id,y.layoutVertexBuffer,y.indexBuffer,t,o.paint,u.transform.zoom,y.programConfigurations.get(o.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Sl(y,t,o,u,d){if(!o||!u||!u.imageAtlas)return;const _=u.imageAtlas.patternPositions;let w=_[o.to.toString()],C=_[o.from.toString()];if(!w&&C&&(w=C),!C&&w&&(C=w),!w||!C){const S=d.getPaintProperty(t);w=_[S],C=_[S]}w&&C&&y.setConstantPatternPositions(w,C)}function Pl(y,t,o,u,d,_,w){const C=y.context.gl,S="fill-pattern",E=o.paint.get(S),k=E&&E.constantOr(1),z=o.getCrossfadeParameters();let N,Z,G,J,X;w?(Z=k&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",N=C.LINES):(Z=k?"fillPattern":"fill",N=C.TRIANGLES);const Q=E.constantOr(null);for(const it of u){const W=t.getTile(it);if(k&&!W.patternsLoaded())continue;const ot=W.getBucket(o);if(!ot)continue;const ht=ot.programConfigurations.get(o.id),dt=y.useProgram(Z,ht),xt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(it);k&&(y.context.activeTexture.set(C.TEXTURE0),W.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ht.updatePaintBuffers(z)),Sl(ht,S,Q,W,o);const It=xt?it:null,Bt=y.translatePosMatrix(It?It.posMatrix:it.posMatrix,W,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(w){J=ot.indexBuffer2,X=ot.segments2;const Ft=[C.drawingBufferWidth,C.drawingBufferHeight];G=Z==="fillOutlinePattern"&&k?Ru(Bt,y,z,W,Ft):Fu(Bt,Ft)}else J=ot.indexBuffer,X=ot.segments,G=k?ms(Bt,y,z,W):eo(Bt);dt.draw(y.context,N,d,y.stencilModeForClipping(it),_,De.disabled,G,xt,o.id,ot.layoutVertexBuffer,J,X,o.paint,y.transform.zoom,ht)}}function lo(y,t,o,u,d,_,w){const C=y.context,S=C.gl,E="fill-extrusion-pattern",k=o.paint.get(E),z=k.constantOr(1),N=o.getCrossfadeParameters(),Z=o.paint.get("fill-extrusion-opacity"),G=k.constantOr(null);for(const J of u){const X=t.getTile(J),Q=X.getBucket(o);if(!Q)continue;const it=y.style.map.terrain&&y.style.map.terrain.getTerrainData(J),W=Q.programConfigurations.get(o.id),ot=y.useProgram(z?"fillExtrusionPattern":"fillExtrusion",W);z&&(y.context.activeTexture.set(S.TEXTURE0),X.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),W.updatePaintBuffers(N)),Sl(W,E,G,X,o);const ht=y.translatePosMatrix(J.posMatrix,X,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),dt=o.paint.get("fill-extrusion-vertical-gradient"),xt=z?Yo(ht,y,dt,Z,J,N,X):Jo(ht,y,dt,Z);ot.draw(C,C.gl.TRIANGLES,d,_,w,De.backCCW,xt,it,o.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,o.paint,y.transform.zoom,W,y.style.map.terrain&&Q.centroidVertexBuffer)}}function Kn(y,t,o,u,d,_,w){const C=y.context,S=C.gl,E=o.fbo;if(!E)return;const k=y.useProgram("hillshade"),z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(t);C.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,E.colorAttachment.get()),k.draw(C,S.TRIANGLES,d,_,w,De.disabled,((N,Z,G,J)=>{const X=G.paint.get("hillshade-shadow-color"),Q=G.paint.get("hillshade-highlight-color"),it=G.paint.get("hillshade-accent-color");let W=G.paint.get("hillshade-illumination-direction")*(Math.PI/180);G.paint.get("hillshade-illumination-anchor")==="viewport"&&(W-=N.transform.angle);const ot=!N.options.moving;return{u_matrix:J?J.posMatrix:N.transform.calculatePosMatrix(Z.tileID.toUnwrapped(),ot),u_image:0,u_latrange:rr(0,Z.tileID),u_light:[G.paint.get("hillshade-exaggeration"),W],u_shadow:X,u_highlight:Q,u_accent:it}})(y,o,u,z?t:null),z,u.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function la(y,t,o,u,d,_){const w=y.context,C=w.gl,S=t.dem;if(S&&S.data){const E=S.dim,k=S.stride,z=S.getPixels();if(w.activeTexture.set(C.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||y.getTileTexture(k),t.demTexture){const Z=t.demTexture;Z.update(z,{premultiply:!1}),Z.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else t.demTexture=new le(w,z,C.RGBA,{premultiply:!1}),t.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);w.activeTexture.set(C.TEXTURE0);let N=t.fbo;if(!N){const Z=new le(w,{width:E,height:E,data:null},C.RGBA);Z.bind(C.LINEAR,C.CLAMP_TO_EDGE),N=t.fbo=w.createFramebuffer(E,E,!0,!1),N.colorAttachment.set(Z.texture)}w.bindFramebuffer.set(N.framebuffer),w.viewport.set([0,0,E,E]),y.useProgram("hillshadePrepare").draw(w,C.TRIANGLES,u,d,_,De.disabled,((Z,G)=>{const J=G.stride,X=h.H();return h.aP(X,0,h.X,-h.X,0,0,1),h.J(X,X,[0,-h.X,0]),{u_matrix:X,u_image:1,u_dimension:[J,J],u_zoom:Z.overscaledZ,u_unpack:G.getUnpackVector()}})(t.tileID,S),null,o.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ha(y,t,o,u,d,_){const w=u.paint.get("raster-fade-duration");if(!_&&w>0){const C=B.now(),S=(C-y.timeAdded)/w,E=t?(C-t.timeAdded)/w:-1,k=o.getSource(),z=d.coveringZoomLevel({tileSize:k.tileSize,roundZoom:k.roundZoom}),N=!t||Math.abs(t.tileID.overscaledZ-z)>Math.abs(y.tileID.overscaledZ-z),Z=N&&y.refreshedUponExpiration?1:h.ac(N?S:1-E,0,1);return y.refreshedUponExpiration&&S>=1&&(y.refreshedUponExpiration=!1),t?{opacity:1,mix:1-Z}:{opacity:Z,mix:0}}return{opacity:1,mix:0}}const ho=new h.aM(1,0,0,1),ca=new h.aM(0,1,0,1),pc=new h.aM(0,0,1,1),_s=new h.aM(1,0,1,1),vs=new h.aM(0,1,1,1);function Ml(y,t,o,u){me(y,0,t+o/2,y.transform.width,o,u)}function ua(y,t,o,u){me(y,t-o/2,0,o,y.transform.height,u)}function me(y,t,o,u,d,_){const w=y.context,C=w.gl;C.enable(C.SCISSOR_TEST),C.scissor(t*y.pixelRatio,o*y.pixelRatio,u*y.pixelRatio,d*y.pixelRatio),w.clear({color:_}),C.disable(C.SCISSOR_TEST)}function da(y,t,o){const u=y.context,d=u.gl,_=o.posMatrix,w=y.useProgram("debug"),C=pe.disabled,S=Ze.disabled,E=y.colorModeForRenderPass(),k="$debug",z=y.style.map.terrain&&y.style.map.terrain.getTerrainData(o);u.activeTexture.set(d.TEXTURE0);const N=t.getTileByID(o.key).latestRawTileData,Z=Math.floor((N&&N.byteLength||0)/1024),G=t.getTile(o).tileSize,J=512/Math.min(G,512)*(o.overscaledZ/y.transform.zoom)*.5;let X=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(X+=` => ${o.overscaledZ}`),function(Q,it){Q.initDebugOverlayCanvas();const W=Q.debugOverlayCanvas,ot=Q.context.gl,ht=Q.debugOverlayCanvas.getContext("2d");ht.clearRect(0,0,W.width,W.height),ht.shadowColor="white",ht.shadowBlur=2,ht.lineWidth=1.5,ht.strokeStyle="white",ht.textBaseline="top",ht.font="bold 36px Open Sans, sans-serif",ht.fillText(it,5,5),ht.strokeText(it,5,5),Q.debugOverlayTexture.update(W),Q.debugOverlayTexture.bind(ot.LINEAR,ot.CLAMP_TO_EDGE)}(y,`${X} ${Z}kB`),w.draw(u,d.TRIANGLES,C,S,He.alphaBlended,De.disabled,Sn(_,h.aM.transparent,J),null,k,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),w.draw(u,d.LINE_STRIP,C,S,E,De.disabled,Sn(_,h.aM.red),z,k,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function fc(y,t,o){const u=y.context,d=u.gl,_=y.colorModeForRenderPass(),w=new pe(d.LEQUAL,pe.ReadWrite,y.depthRangeFor3D),C=y.useProgram("terrain"),S=t.getTerrainMesh();u.bindFramebuffer.set(null),u.viewport.set([0,0,y.width,y.height]);for(const E of o){const k=y.renderToTexture.getTexture(E),z=t.getTerrainData(E.tileID);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,k.texture);const N=y.transform.calculatePosMatrix(E.tileID.toUnwrapped()),Z=t.getMeshFrameDelta(y.transform.zoom),G=y.transform.calculateFogMatrix(E.tileID.toUnwrapped()),J=dl(N,Z,G,y.style.sky,y.transform.pitch);C.draw(u,d.TRIANGLES,w,Ze.disabled,_,De.backCCW,J,z,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}}class El{constructor(t,o,u){this.vertexBuffer=t,this.indexBuffer=o,this.segments=u}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class co{constructor(t,o){this.context=new Ku(t),this.transform=o,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Kt.maxUnderzooming+Kt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new pr}resize(t,o,u){if(this.width=Math.floor(t*u),this.height=Math.floor(o*u),this.pixelRatio=u,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const d of this.style._order)this.style._layers[d].resize()}setup(){const t=this.context,o=new h.aW;o.emplaceBack(0,0),o.emplaceBack(h.X,0),o.emplaceBack(0,h.X),o.emplaceBack(h.X,h.X),this.tileExtentBuffer=t.createVertexBuffer(o,Qs.members),this.tileExtentSegments=h.a0.simpleSegment(0,0,4,2);const u=new h.aW;u.emplaceBack(0,0),u.emplaceBack(h.X,0),u.emplaceBack(0,h.X),u.emplaceBack(h.X,h.X),this.debugBuffer=t.createVertexBuffer(u,Qs.members),this.debugSegments=h.a0.simpleSegment(0,0,4,5);const d=new h.$;d.emplaceBack(0,0,0,0),d.emplaceBack(h.X,0,h.X,0),d.emplaceBack(0,h.X,0,h.X),d.emplaceBack(h.X,h.X,h.X,h.X),this.rasterBoundsBuffer=t.createVertexBuffer(d,xn.members),this.rasterBoundsSegments=h.a0.simpleSegment(0,0,4,2);const _=new h.aW;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(_,Qs.members),this.viewportSegments=h.a0.simpleSegment(0,0,4,2);const w=new h.aY;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(w);const C=new h.aX;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(C);const S=this.context.gl;this.stencilClearMode=new Ze({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO)}clearStencil(){const t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const u=h.H();h.aP(u,0,this.width,this.height,0,0,1),h.K(u,u,[o.drawingBufferWidth,o.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,o.TRIANGLES,pe.disabled,this.stencilClearMode,He.disabled,De.disabled,io(u),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,o){if(this.currentStencilSource===t.source||!t.isTileClipped()||!o||!o.length)return;this.currentStencilSource=t.source;const u=this.context,d=u.gl;this.nextStencilID+o.length>256&&this.clearStencil(),u.setColorMode(He.disabled),u.setDepthMode(pe.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of o){const C=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);_.draw(u,d.TRIANGLES,pe.disabled,new Ze({func:d.ALWAYS,mask:0},C,255,d.KEEP,d.KEEP,d.REPLACE),He.disabled,De.disabled,io(w.posMatrix),S,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new Ze({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){const o=this.context.gl;return new Ze({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,u=t.sort((w,C)=>C.overscaledZ-w.overscaledZ),d=u[u.length-1].overscaledZ,_=u[0].overscaledZ-d+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const w={};for(let C=0;C<_;C++)w[C+d]=new Ze({func:o.GEQUAL,mask:255},C+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=_,[w,u]}return[{[d]:Ze.disabled},u]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new He([t.CONSTANT_COLOR,t.ONE],new h.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?He.unblended:He.alphaBlended}depthModeForSublayer(t,o,u){if(!this.opaquePassEnabledForLayer())return pe.disabled;const d=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new pe(u||this.context.gl.LEQUAL,o,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer({u_sky_color:Q.properties.get("sky-color"),u_horizon_color:Q.properties.get("horizon-color"),u_horizon:(it.height/2+it.getHorizon())*W,u_sky_horizon_blend:Q.properties.get("sky-horizon-blend")*it.height/2*W}))(E,S.style.map.transform,S.pixelRatio),Z=new pe(z.LEQUAL,pe.ReadWrite,[0,1]),G=Ze.disabled,J=S.colorModeForRenderPass(),X=S.useProgram("sky");if(!E.mesh){const Q=new h.aW;Q.emplaceBack(-1,-1),Q.emplaceBack(1,-1),Q.emplaceBack(1,1),Q.emplaceBack(-1,1);const it=new h.aX;it.emplaceBack(0,1,2),it.emplaceBack(0,2,3),E.mesh=new El(k.createVertexBuffer(Q,Qs.members),k.createIndexBuffer(it),h.a0.simpleSegment(0,0,Q.length,it.length))}X.draw(k,z.TRIANGLES,Z,G,J,De.disabled,N,void 0,"sky",E.mesh.vertexBuffer,E.mesh.indexBuffer,E.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=o.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const S=this.style._layers[u[this.currentLayer]],E=d[S.source],k=_[S.source];this._renderTileClippingMasks(S,k),this.renderLayer(this,E,S,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerX.source&&!X.isHidden(k)?[E.sourceCaches[X.source]]:[]),Z=N.filter(X=>X.getSource().type==="vector"),G=N.filter(X=>X.getSource().type!=="vector"),J=X=>{(!z||z.getSource().maxzoomJ(X)),z||G.forEach(X=>J(X)),z}(this.style,this.transform.zoom);S&&function(E,k,z){for(let N=0;N0),d&&(h.a$(o,u),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,w){const C=_.context,S=C.gl,E=He.unblended,k=new pe(S.LEQUAL,pe.ReadWrite,[0,1]),z=w.getTerrainMesh(),N=w.sourceCache.getRenderableTiles(),Z=_.useProgram("terrainDepth");C.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),C.clear({color:h.aM.transparent,depth:1});for(const G of N){const J=w.getTerrainData(G.tileID),X={u_matrix:_.transform.calculatePosMatrix(G.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(_.transform.zoom)};Z.draw(C,S.TRIANGLES,k,Ze.disabled,E,De.backCCW,X,J,"terrain",z.vertexBuffer,z.indexBuffer,z.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,w){const C=_.context,S=C.gl,E=He.unblended,k=new pe(S.LEQUAL,pe.ReadWrite,[0,1]),z=w.getTerrainMesh(),N=w.getCoordsTexture(),Z=w.sourceCache.getRenderableTiles(),G=_.useProgram("terrainCoords");C.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),C.clear({color:h.aM.transparent,depth:1}),w.coordsIndex=[];for(const J of Z){const X=w.getTerrainData(J.tileID);C.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,N.texture);const Q={u_matrix:_.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(_.transform.zoom)};G.draw(C,S.TRIANGLES,k,Ze.disabled,E,De.backCCW,Q,X,"terrain",z.vertexBuffer,z.indexBuffer,z.segments),w.coordsIndex.push(J.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(t,o,u,d){if(!u.isHidden(this.transform.zoom)&&(u.type==="background"||u.type==="custom"||(d||[]).length))switch(this.id=u.id,u.type){case"symbol":(function(_,w,C,S,E){if(_.renderPass!=="translucent")return;const k=Ze.disabled,z=_.colorModeForRenderPass();(C._unevaluatedLayout.hasValue("text-variable-anchor")||C._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(N,Z,G,J,X,Q,it,W,ot){const ht=Z.transform,dt=Go(),xt=X==="map",It=Q==="map";for(const Bt of N){const Ft=J.getTile(Bt),Ct=Ft.getBucket(G);if(!Ct||!Ct.text||!Ct.text.segments.get().length)continue;const St=h.ag(Ct.textSizeData,ht.zoom),Ut=ie(Ft,1,Z.transform.zoom),te=wn(Bt.posMatrix,It,xt,Z.transform,Ut),Et=G.layout.get("icon-text-fit")!=="none"&&Ct.hasIconData();if(St){const kt=Math.pow(2,ht.zoom-Ft.tileID.overscaledZ),Jt=Z.style.map.terrain?(ae,de)=>Z.style.map.terrain.getElevation(Bt,ae,de):null,Le=dt.translatePosition(ht,Ft,it,W);Cl(Ct,xt,It,ot,ht,te,Bt.posMatrix,kt,St,Et,dt,Le,Bt.toUnwrapped(),Jt)}}}(S,_,C,w,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),E),C.paint.get("icon-opacity").constantOr(1)!==0&&Hn(_,w,C,S,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),k,z),C.paint.get("text-opacity").constantOr(1)!==0&&Hn(_,w,C,S,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),k,z),w.map.showCollisionBoxes&&(Il(_,w,C,S,!0),Il(_,w,C,S,!1))})(t,o,u,d,this.style.placement.variableOffsets);break;case"circle":(function(_,w,C,S){if(_.renderPass!=="translucent")return;const E=C.paint.get("circle-opacity"),k=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),N=!C.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(k.constantOr(1)===0||z.constantOr(1)===0))return;const Z=_.context,G=Z.gl,J=_.depthModeForSublayer(0,pe.ReadOnly),X=Ze.disabled,Q=_.colorModeForRenderPass(),it=[];for(let W=0;WW.sortKey-ot.sortKey);for(const W of it){const{programConfiguration:ot,program:ht,layoutVertexBuffer:dt,indexBuffer:xt,uniformValues:It,terrainData:Bt}=W.state;ht.draw(Z,G.TRIANGLES,J,X,Q,De.disabled,It,Bt,C.id,dt,xt,W.segments,C.paint,_.transform.zoom,ot)}})(t,o,u,d);break;case"heatmap":(function(_,w,C,S){if(C.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const E=_.context,k=E.gl,z=Ze.disabled,N=new He([k.ONE,k.ONE],h.aM.transparent,[!0,!0,!0,!0]);(function(Z,G,J){const X=Z.gl;Z.activeTexture.set(X.TEXTURE1),Z.viewport.set([0,0,G.width/4,G.height/4]);let Q=J.heatmapFbo;if(Q)X.bindTexture(X.TEXTURE_2D,Q.colorAttachment.get()),Z.bindFramebuffer.set(Q.framebuffer);else{const it=X.createTexture();X.bindTexture(X.TEXTURE_2D,it),X.texParameteri(X.TEXTURE_2D,X.TEXTURE_WRAP_S,X.CLAMP_TO_EDGE),X.texParameteri(X.TEXTURE_2D,X.TEXTURE_WRAP_T,X.CLAMP_TO_EDGE),X.texParameteri(X.TEXTURE_2D,X.TEXTURE_MIN_FILTER,X.LINEAR),X.texParameteri(X.TEXTURE_2D,X.TEXTURE_MAG_FILTER,X.LINEAR),Q=J.heatmapFbo=Z.createFramebuffer(G.width/4,G.height/4,!1,!1),function(W,ot,ht,dt){var xt,It;const Bt=W.gl,Ft=(xt=W.HALF_FLOAT)!==null&&xt!==void 0?xt:Bt.UNSIGNED_BYTE,Ct=(It=W.RGBA16F)!==null&&It!==void 0?It:Bt.RGBA;Bt.texImage2D(Bt.TEXTURE_2D,0,Ct,ot.width/4,ot.height/4,0,Bt.RGBA,Ft,null),dt.colorAttachment.set(ht)}(Z,G,it,Q)}})(E,_,C),E.clear({color:h.aM.transparent});for(let Z=0;Z{const W=h.H();h.aP(W,0,J.width,J.height,0,0,1);const ot=J.context.gl;return{u_matrix:W,u_world:[ot.drawingBufferWidth,ot.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:X.paint.get("heatmap-opacity")}})(E,k),null,k.id,E.viewportBuffer,E.quadTriangleIndexBuffer,E.viewportSegments,k.paint,E.transform.zoom)}(_,C))})(t,o,u,d);break;case"line":(function(_,w,C,S){if(_.renderPass!=="translucent")return;const E=C.paint.get("line-opacity"),k=C.paint.get("line-width");if(E.constantOr(1)===0||k.constantOr(1)===0)return;const z=_.depthModeForSublayer(0,pe.ReadOnly),N=_.colorModeForRenderPass(),Z=C.paint.get("line-dasharray"),G=C.paint.get("line-pattern"),J=G.constantOr(1),X=C.paint.get("line-gradient"),Q=C.getCrossfadeParameters(),it=J?"linePattern":Z?"lineSDF":X?"lineGradient":"line",W=_.context,ot=W.gl;let ht=!0;for(const dt of S){const xt=w.getTile(dt);if(J&&!xt.patternsLoaded())continue;const It=xt.getBucket(C);if(!It)continue;const Bt=It.programConfigurations.get(C.id),Ft=_.context.program.get(),Ct=_.useProgram(it,Bt),St=ht||Ct.program!==Ft,Ut=_.style.map.terrain&&_.style.map.terrain.getTerrainData(dt),te=G.constantOr(null);if(te&&xt.imageAtlas){const Jt=xt.imageAtlas,Le=Jt.patternPositions[te.to.toString()],ae=Jt.patternPositions[te.from.toString()];Le&&ae&&Bt.setConstantPatternPositions(Le,ae)}const Et=Ut?dt:null,kt=J?Hh(_,xt,C,Q,Et):Z?Kh(_,xt,C,Z,Q,Et):X?Qo(_,xt,C,It.lineClipsArray.length,Et):ro(_,xt,C,Et);if(J)W.activeTexture.set(ot.TEXTURE0),xt.imageAtlasTexture.bind(ot.LINEAR,ot.CLAMP_TO_EDGE),Bt.updatePaintBuffers(Q);else if(Z&&(St||_.lineAtlas.dirty))W.activeTexture.set(ot.TEXTURE0),_.lineAtlas.bind(W);else if(X){const Jt=It.gradients[C.id];let Le=Jt.texture;if(C.gradientVersion!==Jt.version){let ae=256;if(C.stepInterpolant){const de=w.getSource().maxzoom,Ve=dt.canonical.z===de?Math.ceil(1<<_.transform.maxZoom-dt.canonical.z):1;ae=h.ac(h.aU(It.maxLineLength/h.X*1024*Ve),256,W.maxTextureSize)}Jt.gradient=h.aV({expression:C.gradientExpression(),evaluationKey:"lineProgress",resolution:ae,image:Jt.gradient||void 0,clips:It.lineClipsArray}),Jt.texture?Jt.texture.update(Jt.gradient):Jt.texture=new le(W,Jt.gradient,ot.RGBA),Jt.version=C.gradientVersion,Le=Jt.texture}W.activeTexture.set(ot.TEXTURE0),Le.bind(C.stepInterpolant?ot.NEAREST:ot.LINEAR,ot.CLAMP_TO_EDGE)}Ct.draw(W,ot.TRIANGLES,z,_.stencilModeForClipping(dt),N,De.disabled,kt,Ut,C.id,It.layoutVertexBuffer,It.indexBuffer,It.segments,C.paint,_.transform.zoom,Bt,It.layoutVertexBuffer2),ht=!1}})(t,o,u,d);break;case"fill":(function(_,w,C,S){const E=C.paint.get("fill-color"),k=C.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const z=_.colorModeForRenderPass(),N=C.paint.get("fill-pattern"),Z=_.opaquePassEnabledForLayer()&&!N.constantOr(1)&&E.constantOr(h.aM.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(_.renderPass===Z){const G=_.depthModeForSublayer(1,_.renderPass==="opaque"?pe.ReadWrite:pe.ReadOnly);Pl(_,w,C,S,G,z,!1)}if(_.renderPass==="translucent"&&C.paint.get("fill-antialias")){const G=_.depthModeForSublayer(C.getPaintProperty("fill-outline-color")?2:0,pe.ReadOnly);Pl(_,w,C,S,G,z,!0)}})(t,o,u,d);break;case"fill-extrusion":(function(_,w,C,S){const E=C.paint.get("fill-extrusion-opacity");if(E!==0&&_.renderPass==="translucent"){const k=new pe(_.context.gl.LEQUAL,pe.ReadWrite,_.depthRangeFor3D);if(E!==1||C.paint.get("fill-extrusion-pattern").constantOr(1))lo(_,w,C,S,k,Ze.disabled,He.disabled),lo(_,w,C,S,k,_.stencilModeFor3D(),_.colorModeForRenderPass());else{const z=_.colorModeForRenderPass();lo(_,w,C,S,k,Ze.disabled,z)}}})(t,o,u,d);break;case"hillshade":(function(_,w,C,S){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent")return;const E=_.context,k=_.depthModeForSublayer(0,pe.ReadOnly),z=_.colorModeForRenderPass(),[N,Z]=_.renderPass==="translucent"?_.stencilConfigForOverlap(S):[{},S];for(const G of Z){const J=w.getTile(G);J.needsHillshadePrepare!==void 0&&J.needsHillshadePrepare&&_.renderPass==="offscreen"?la(_,J,C,k,Ze.disabled,z):_.renderPass==="translucent"&&Kn(_,G,J,C,k,N[G.overscaledZ],z)}E.viewport.set([0,0,_.width,_.height])})(t,o,u,d);break;case"raster":(function(_,w,C,S){if(_.renderPass!=="translucent"||C.paint.get("raster-opacity")===0||!S.length)return;const E=_.context,k=E.gl,z=w.getSource(),N=_.useProgram("raster"),Z=_.colorModeForRenderPass(),[G,J]=z instanceof on?[{},S]:_.stencilConfigForOverlap(S),X=J[J.length-1].overscaledZ,Q=!_.options.moving;for(const it of J){const W=_.depthModeForSublayer(it.overscaledZ-X,C.paint.get("raster-opacity")===1?pe.ReadWrite:pe.ReadOnly,k.LESS),ot=w.getTile(it);ot.registerFadeDuration(C.paint.get("raster-fade-duration"));const ht=w.findLoadedParent(it,0),dt=w.findLoadedSibling(it),xt=ha(ot,ht||dt||null,w,C,_.transform,_.style.map.terrain);let It,Bt;const Ft=C.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;E.activeTexture.set(k.TEXTURE0),ot.texture.bind(Ft,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(k.TEXTURE1),ht?(ht.texture.bind(Ft,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),It=Math.pow(2,ht.tileID.overscaledZ-ot.tileID.overscaledZ),Bt=[ot.tileID.canonical.x*It%1,ot.tileID.canonical.y*It%1]):ot.texture.bind(Ft,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),ot.texture.useMipmap&&E.extTextureFilterAnisotropic&&_.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const Ct=_.style.map.terrain&&_.style.map.terrain.getTerrainData(it),St=Ct?it:null,Ut=St?St.posMatrix:_.transform.calculatePosMatrix(it.toUnwrapped(),Q),te=Vu(Ut,Bt||[0,0],It||1,xt,C);z instanceof on?N.draw(E,k.TRIANGLES,W,Ze.disabled,Z,De.disabled,te,Ct,C.id,z.boundsBuffer,_.quadTriangleIndexBuffer,z.boundsSegments):N.draw(E,k.TRIANGLES,W,G[it.overscaledZ],Z,De.disabled,te,Ct,C.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(t,o,u,d);break;case"background":(function(_,w,C,S){const E=C.paint.get("background-color"),k=C.paint.get("background-opacity");if(k===0)return;const z=_.context,N=z.gl,Z=_.transform,G=Z.tileSize,J=C.paint.get("background-pattern");if(_.isPatternMissing(J))return;const X=!J&&E.a===1&&k===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==X)return;const Q=Ze.disabled,it=_.depthModeForSublayer(0,X==="opaque"?pe.ReadWrite:pe.ReadOnly),W=_.colorModeForRenderPass(),ot=_.useProgram(J?"backgroundPattern":"background"),ht=S||Z.coveringTiles({tileSize:G,terrain:_.style.map.terrain});J&&(z.activeTexture.set(N.TEXTURE0),_.imageManager.bind(_.context));const dt=C.getCrossfadeParameters();for(const xt of ht){const It=S?xt.posMatrix:_.transform.calculatePosMatrix(xt.toUnwrapped()),Bt=J?pl(It,k,_,J,{tileID:xt,tileSize:G},dt):ta(It,k,E),Ft=_.style.map.terrain&&_.style.map.terrain.getTerrainData(xt);ot.draw(z,N.TRIANGLES,it,Q,W,De.disabled,Bt,Ft,C.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(t,0,u,d);break;case"custom":(function(_,w,C){const S=_.context,E=C.implementation;if(_.renderPass==="offscreen"){const k=E.prerender;k&&(_.setCustomLayerDefaults(),S.setColorMode(_.colorModeForRenderPass()),k.call(E,S.gl,_.transform.customLayerMatrix()),S.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),S.setColorMode(_.colorModeForRenderPass()),S.setStencilMode(Ze.disabled);const k=E.renderingMode==="3d"?new pe(_.context.gl.LEQUAL,pe.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,pe.ReadOnly);S.setDepthMode(k),E.render(S.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),S.setDirty(),_.setBaseState(),S.bindFramebuffer.set(null)}})(t,0,u)}}translatePosMatrix(t,o,u,d,_){if(!u[0]&&!u[1])return t;const w=_?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(w){const E=Math.sin(w),k=Math.cos(w);u=[u[0]*k-u[1]*E,u[0]*E+u[1]*k]}const C=[_?u[0]:ie(o,u[0],this.transform.zoom),_?u[1]:ie(o,u[1],this.transform.zoom),0],S=new Float32Array(16);return h.J(S,t,C),S}saveTileTexture(t){const o=this._tileTextures[t.size[0]];o?o.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const o=this.imageManager.getPattern(t.from.toString()),u=this.imageManager.getPattern(t.to.toString());return!o||!u}useProgram(t,o){this.cache=this.cache||{};const u=t+(o?o.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[u]||(this.cache[u]=new Ho(this.context,Cn[t],o,ea[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[u]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new le(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:o}=this.context.gl;return this.width!==t||this.height!==o}}class Tl{constructor(t,o){this.points=t,this.planes=o}static fromInvProjectionMatrix(t,o,u){const d=Math.pow(2,u),_=[[-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(C=>{const S=1/(C=h.af([],C,t))[3]/o*d;return h.b0(C,C,[S,S,1/C[3],S])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const S=function(N,Z){var G=Z[0],J=Z[1],X=Z[2],Q=G*G+J*J+X*X;return Q>0&&(Q=1/Math.sqrt(Q)),N[0]=Z[0]*Q,N[1]=Z[1]*Q,N[2]=Z[2]*Q,N}([],function(N,Z,G){var J=Z[0],X=Z[1],Q=Z[2],it=G[0],W=G[1],ot=G[2];return N[0]=X*ot-Q*W,N[1]=Q*it-J*ot,N[2]=J*W-X*it,N}([],ye([],_[C[0]],_[C[1]]),ye([],_[C[2]],_[C[1]]))),E=-((k=S)[0]*(z=_[C[1]])[0]+k[1]*z[1]+k[2]*z[2]);var k,z;return S.concat(E)});return new Tl(_,w)}}class pa{constructor(t,o){this.min=t,this.max=o,this.center=function(u,d,_){return u[0]=.5*d[0],u[1]=.5*d[1],u[2]=.5*d[2],u}([],function(u,d,_){return u[0]=d[0]+_[0],u[1]=d[1]+_[1],u[2]=d[2]+_[2],u}([],this.min,this.max))}quadrant(t){const o=[t%2==0,t<2],u=ce(this.min),d=ce(this.max);for(let _=0;_=0&&w++;if(w===0)return 0;w!==o.length&&(u=!1)}if(u)return 2;for(let d=0;d<3;d++){let _=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let C=0;Cthis.max[d]-this.min[d])return 0}return 1}}class uo{constructor(t=0,o=0,u=0,d=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=u,this.right=d}interpolate(t,o,u){return o.top!=null&&t.top!=null&&(this.top=h.y.number(t.top,o.top,u)),o.bottom!=null&&t.bottom!=null&&(this.bottom=h.y.number(t.bottom,o.bottom,u)),o.left!=null&&t.left!=null&&(this.left=h.y.number(t.left,o.left,u)),o.right!=null&&t.right!=null&&(this.right=h.y.number(t.right,o.right,u)),this}getCenter(t,o){const u=h.ac((this.left+t-this.right)/2,0,t),d=h.ac((this.top+o-this.bottom)/2,0,o);return new h.P(u,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new uo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const mc=85.051129;class po{constructor(t,o,u,d,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=u??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new uo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new po(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const o=-h.b2(t,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=function(){var u=new h.A(4);return h.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}(),function(u,d,_){var w=d[0],C=d[1],S=d[2],E=d[3],k=Math.sin(_),z=Math.cos(_);u[0]=w*z+S*k,u[1]=C*z+E*k,u[2]=w*-k+S*z,u[3]=C*-k+E*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=h.ac(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.tileZoom=Math.max(0,Math.floor(o)),this.scale=this.zoomScale(o),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,u){this._unmodified=!1,this._edgeInsets.interpolate(t,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new h.b3(0,t)];if(this._renderWorldCopies){const u=this.pointCoordinate(new h.P(0,0)),d=this.pointCoordinate(new h.P(this.width,0)),_=this.pointCoordinate(new h.P(this.width,this.height)),w=this.pointCoordinate(new h.P(0,this.height)),C=Math.floor(Math.min(u.x,d.x,_.x,w.x)),S=Math.floor(Math.max(u.x,d.x,_.x,w.x)),E=1;for(let k=C-E;k<=S+E;k++)k!==0&&o.push(new h.b3(k,t))}return o}coveringTiles(t){var o,u;let d=this.coveringZoomLevel(t);const _=d;if(t.minzoom!==void 0&&dt.maxzoom&&(d=t.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),C=h.Z.fromLngLat(this.center),S=Math.pow(2,d),E=[S*w.x,S*w.y,0],k=[S*C.x,S*C.y,0],z=Tl.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,d);let N=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(N=d);const Z=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,G=W=>({aabb:new pa([W*S,0,0],[(W+1)*S,S,0]),zoom:0,x:0,y:0,wrap:W,fullyVisible:!1}),J=[],X=[],Q=d,it=t.reparseOverscaled?_:d;if(this._renderWorldCopies)for(let W=1;W<=3;W++)J.push(G(-W)),J.push(G(W));for(J.push(G(0));J.length>0;){const W=J.pop(),ot=W.x,ht=W.y;let dt=W.fullyVisible;if(!dt){const Ct=W.aabb.intersects(z);if(Ct===0)continue;dt=Ct===2}const xt=t.terrain?E:k,It=W.aabb.distanceX(xt),Bt=W.aabb.distanceY(xt),Ft=Math.max(Math.abs(It),Math.abs(Bt));if(W.zoom===Q||Ft>Z+(1<=N){const Ct=Q-W.zoom,St=E[0]-.5-(ot<>1),te=W.zoom+1;let Et=W.aabb.quadrant(Ct);if(t.terrain){const kt=new h.S(te,W.wrap,te,St,Ut),Jt=t.terrain.getMinMaxElevation(kt),Le=(o=Jt.minElevation)!==null&&o!==void 0?o:this.elevation,ae=(u=Jt.maxElevation)!==null&&u!==void 0?u:this.elevation;Et=new pa([Et.min[0],Et.min[1],Le],[Et.max[0],Et.max[1],ae])}J.push({aabb:Et,zoom:te,x:St,y:Ut,wrap:W.wrap,fullyVisible:dt})}}return X.sort((W,ot)=>W.distanceSq-ot.distanceSq).map(W=>W.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const o=h.ac(t.lat,-85.051129,mc);return new h.P(h.O(t.lng)*this.worldSize,h.Q(o)*this.worldSize)}unproject(t){return new h.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const o=this.elevation,u=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,d=this.pointLocation(this.centerPoint,t),_=t.getElevationForLngLatZoom(d,this.tileZoom);if(!(this.elevation-_))return;const w=u+o-_,C=Math.cos(this._pitch)*this.cameraToCenterDistance/w/h.b4(1,d.lat),S=this.scaleZoom(C/this.tileSize);this._elevation=_,this._center=d,this.zoom=S}setLocationAtPoint(t,o){const u=this.pointCoordinate(o),d=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(t),w=new h.Z(_.x-(u.x-d.x),_.y-(u.y-d.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,o){return o?this.coordinatePoint(this.locationCoordinate(t),o.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,o){return this.coordinateLocation(this.pointCoordinate(t,o))}locationCoordinate(t){return h.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,o){if(o){const N=o.pointCoordinate(t);if(N!=null)return N}const u=[t.x,t.y,0,1],d=[t.x,t.y,1,1];h.af(u,u,this.pixelMatrixInverse),h.af(d,d,this.pixelMatrixInverse);const _=u[3],w=d[3],C=u[1]/_,S=d[1]/w,E=u[2]/_,k=d[2]/w,z=E===k?0:(0-E)/(k-E);return new h.Z(h.y.number(u[0]/_,d[0]/w,z)/this.worldSize,h.y.number(C,S,z)/this.worldSize)}coordinatePoint(t,o=0,u=this.pixelMatrix){const d=[t.x*this.worldSize,t.y*this.worldSize,o,1];return h.af(d,d,u),new h.P(d[0]/d[3],d[1]/d[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ft().extend(this.pointLocation(new h.P(0,t))).extend(this.pointLocation(new h.P(this.width,t))).extend(this.pointLocation(new h.P(this.width,this.height))).extend(this.pointLocation(new h.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ft([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,mc])}calculateTileMatrix(t){const o=t.canonical,u=this.worldSize/this.zoomScale(o.z),d=o.x+Math.pow(2,o.z)*t.wrap,_=h.an(new Float64Array(16));return h.J(_,_,[d*u,o.y*u,0]),h.K(_,_,[u/h.X,u/h.X,1]),_}calculatePosMatrix(t,o=!1){const u=t.key,d=o?this._alignedPosMatrixCache:this._posMatrixCache;if(d[u])return d[u];const _=this.calculateTileMatrix(t);return h.L(_,o?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),d[u]=new Float32Array(_),d[u]}calculateFogMatrix(t){const o=t.key,u=this._fogMatrixCache;if(u[o])return u[o];const d=this.calculateTileMatrix(t);return h.L(d,this.fogMatrix,d),u[o]=new Float32Array(d),u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,o){o=h.ac(+o,this.minZoom,this.maxZoom);const u={center:new h.N(t.lng,t.lat),zoom:o};let d=this.lngRange;if(!this._renderWorldCopies&&d===null){const W=179.9999999999;d=[-W,W]}const _=this.tileSize*this.zoomScale(u.zoom);let w=0,C=_,S=0,E=_,k=0,z=0;const{x:N,y:Z}=this.size;if(this.latRange){const W=this.latRange;w=h.Q(W[1])*_,C=h.Q(W[0])*_,C-wC&&(Q=C-W)}if(d){const W=(S+E)/2;let ot=G;this._renderWorldCopies&&(ot=h.b2(G,W-_/2,W+_/2));const ht=N/2;ot-htE&&(X=E-ht)}if(X!==void 0||Q!==void 0){const W=new h.P(X??G,Q??J);u.center=this.unproject.call({worldSize:_},W).wrap()}return u}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:o,zoom:u}=this.getConstrained(this.center,this.zoom);this.center=o,this.zoom=u,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.point.x,u=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.b4(1,this.center.lat)*this.worldSize;let d=h.an(new Float64Array(16));h.K(d,d,[this.width/2,-this.height/2,1]),h.J(d,d,[1,-1,0]),this.labelPlaneMatrix=d,d=h.an(new Float64Array(16)),h.K(d,d,[1,-1,1]),h.J(d,d,[-1,-1,0]),h.K(d,d,[2/this.width,2/this.height,1]),this.glCoordMatrix=d;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),C=_-w*this._pixelPerMeter/Math.cos(this._pitch),S=w<0?C:_,E=Math.PI/2+this._pitch,k=this._fov*(.5+t.y/this.height),z=Math.sin(k)*S/Math.sin(h.ac(Math.PI-E-k,.01,Math.PI-.01)),N=this.getHorizon(),Z=2*Math.atan(N/this.cameraToCenterDistance)*(.5+t.y/(2*N)),G=Math.sin(Z)*S/Math.sin(h.ac(Math.PI-E-Z,.01,Math.PI-.01)),J=Math.min(z,G);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*J+S),this.nearZ=this.height/50,d=new Float64Array(16),h.b5(d,this._fov,this.width/this.height,this.nearZ,this.farZ),d[8]=2*-t.x/this.width,d[9]=2*t.y/this.height,this.projectionMatrix=h.ae(d),h.K(d,d,[1,-1,1]),h.J(d,d,[0,0,-this.cameraToCenterDistance]),h.b6(d,d,this._pitch),h.ad(d,d,this.angle),h.J(d,d,[-o,-u,0]),this.mercatorMatrix=h.K([],d,[this.worldSize,this.worldSize,this.worldSize]),h.K(d,d,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.L(new Float64Array(16),this.labelPlaneMatrix,d),h.J(d,d,[0,0,-this.elevation]),this.modelViewProjectionMatrix=d,this.invModelViewProjectionMatrix=h.as([],d),this.fogMatrix=new Float64Array(16),h.b5(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,h.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),h.b6(this.fogMatrix,this.fogMatrix,this._pitch),h.ad(this.fogMatrix,this.fogMatrix,this.angle),h.J(this.fogMatrix,this.fogMatrix,[-o,-u,0]),h.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=h.L(new Float64Array(16),this.labelPlaneMatrix,d);const X=this.width%2/2,Q=this.height%2/2,it=Math.cos(this.angle),W=Math.sin(this.angle),ot=o-Math.round(o)+it*X+W*Q,ht=u-Math.round(u)+it*Q+W*X,dt=new Float64Array(d);if(h.J(dt,dt,[ot>.5?ot-1:ot,ht>.5?ht-1:ht,0]),this.alignedModelViewProjectionMatrix=dt,d=h.as(new Float64Array(16),this.pixelMatrix),!d)throw new Error("failed to invert matrix");this.pixelMatrixInverse=d,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new h.P(0,0)),o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.af(o,o,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,t))}getCameraQueryGeometry(t){const o=this.getCameraPoint();if(t.length===1)return[t[0],o];{let u=o.x,d=o.y,_=o.x,w=o.y;for(const C of t)u=Math.min(u,C.x),d=Math.min(d,C.y),_=Math.max(_,C.x),w=Math.max(w,C.y);return[new h.P(u,d),new h.P(_,d),new h.P(_,w),new h.P(u,w),new h.P(u,d)]}}lngLatToCameraDepth(t,o){const u=this.locationCoordinate(t),d=[u.x*this.worldSize,u.y*this.worldSize,o,1];return h.af(d,d,this.modelViewProjectionMatrix),d[2]/d[3]}}function fo(y,t){let o,u=!1,d=null,_=null;const w=()=>{d=null,u&&(y.apply(_,o),d=setTimeout(w,t),u=!1)};return(...C)=>(u=!0,_=this,o=C,d||w(),d)}class mo{constructor(t){this._getCurrentHash=()=>{const o=window.location.hash.replace("#","");if(this._hashName){let u;return o.split("&").map(d=>d.split("=")).forEach(d=>{d[0]===this._hashName&&(u=d)}),(u&&u[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const o=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,o)},this._removeHash=()=>{const o=this._getCurrentHash();if(o.length===0)return;const u=o.join("/");let d=u;d.split("&").length>0&&(d=d.split("&")[0]),this._hashName&&(d=`${this._hashName}=${u}`);let _=window.location.hash.replace(d,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let w=window.location.href.replace(/(#.+)?$/,_);w=w.replace("&&","&"),window.history.replaceState(window.history.state,null,w)},this._updateHash=fo(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const o=this._map.getCenter(),u=Math.round(100*this._map.getZoom())/100,d=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,d),w=Math.round(o.lng*_)/_,C=Math.round(o.lat*_)/_,S=this._map.getBearing(),E=this._map.getPitch();let k="";if(k+=t?`/${w}/${C}/${u}`:`${u}/${C}/${w}`,(S||E)&&(k+="/"+Math.round(10*S)/10),E&&(k+=`/${Math.round(E)}`),this._hashName){const z=this._hashName;let N=!1;const Z=window.location.hash.slice(1).split("&").map(G=>{const J=G.split("=")[0];return J===z?(N=!0,`${J}=${k}`):G}).filter(G=>G);return N||Z.push(`${z}=${k}`),`#${Z.join("&")}`}return`#${k}`}}const xs={linearity:.3,easing:h.b7(0,0,.3,1)},Al=h.e({deceleration:2500,maxSpeed:1400},xs),gc=h.e({deceleration:20,maxSpeed:1400},xs),fa=h.e({deceleration:1e3,maxSpeed:360},xs),ma=h.e({deceleration:1e3,maxSpeed:90},xs);class zl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:B.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=B.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)o.zoom+=_.zoomDelta||0,o.bearing+=_.bearingDelta||0,o.pitch+=_.pitchDelta||0,_.panDelta&&o.pan._add(_.panDelta),_.around&&(o.around=_.around),_.pinchAround&&(o.pinchAround=_.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const _=bs(o.pan.mag(),u,h.e({},Al,t||{}));d.offset=o.pan.mult(_.amount/o.pan.mag()),d.center=this._map.transform.center,ga(d,_)}if(o.zoom){const _=bs(o.zoom,u,gc);d.zoom=this._map.transform.zoom+_.amount,ga(d,_)}if(o.bearing){const _=bs(o.bearing,u,fa);d.bearing=this._map.transform.bearing+h.ac(_.amount,-179,179),ga(d,_)}if(o.pitch){const _=bs(o.pitch,u,ma);d.pitch=this._map.transform.pitch+_.amount,ga(d,_)}if(d.zoom||d.bearing){const _=o.pinchAround===void 0?o.around:o.pinchAround;d.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),h.e(d,{noMoveStart:!0})}}function ga(y,t){(!y.duration||y.durationo.unproject(S)),C=_.reduce((S,E,k,z)=>S.add(E.div(z.length)),new h.P(0,0));super(t,{points:_,point:C,lngLats:w,lngLat:o.unproject(C),originalEvent:u}),this._defaultPrevented=!1}}class go extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,u){super(t,{originalEvent:u}),this._defaultPrevented=!1}}class kl{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new go(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new sr(t.type,this._map,t))}mouseup(t){this._map.fire(new sr(t.type,this._map,t))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new sr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new sr(t.type,this._map,t))}mouseover(t){this._map.fire(new sr(t.type,this._map,t))}mouseout(t){this._map.fire(new sr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ws(t.type,this._map,t))}touchmove(t){this._map.fire(new ws(t.type,this._map,t))}touchend(t){this._map.fire(new ws(t.type,this._map,t))}touchcancel(t){this._map.fire(new ws(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yc{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new sr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new sr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new sr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Is{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(h.P.convert(t),this._map.terrain)}}class yo{constructor(t,o){this._map=t,this._tr=new Is(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(U.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const u=o;if(this._lastPos.equals(u)||!this._box&&u.dist(this._startPos)_.fitScreenCoordinates(u,d,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new h.k(t,{originalEvent:o}))}}function _o(y,t){if(y.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${t.length}`);const o={};for(let u=0;uthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),u.length===this.numTouches&&(this.centroid=function(d){const _=new h.P(0,0);for(const w of d)_._add(w);return _.div(d.length)}(o),this.touches=_o(u,o)))}touchmove(t,o,u){if(this.aborted||!this.centroid)return;const d=_o(u,o);for(const _ in this.touches){const w=d[_];(!w||w.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(t,o,u){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class ya{constructor(t){this.singleTap=new Ju(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,o,u){this.singleTap.touchstart(t,o,u)}touchmove(t,o,u){this.singleTap.touchmove(t,o,u)}touchend(t,o,u){const d=this.singleTap.touchend(t,o,u);if(d){const _=t.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(d)<30;if(_&&w||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class ti{constructor(t){this._tr=new Is(t),this._zoomIn=new ya({numTouches:1,numTaps:2}),this._zoomOut=new ya({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,u){this._zoomIn.touchstart(t,o,u),this._zoomOut.touchstart(t,o,u)}touchmove(t,o,u){this._zoomIn.touchmove(t,o,u),this._zoomOut.touchmove(t,o,u)}touchend(t,o,u){const d=this._zoomIn.touchend(t,o,u),_=this._zoomOut.touchend(t,o,u),w=this._tr;return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(d)},{originalEvent:t})}):_?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(_)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const o=this._moveFunction(...t);if(o.bearingDelta||o.pitchDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(t,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=o.length?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,o){if(!this.isEnabled())return;const u=this._lastPoint;if(!u)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const d=o.length?o[0]:o;return!this._moved&&d.dist(u){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=t=>{t.preventDefault()}},Jn=({enable:y,clickTolerance:t,bearingDegreesPerPixelMoved:o=.8})=>{const u=new vo({checkCorrectEvent:d=>U.mouseButton(d)===0&&d.ctrlKey||U.mouseButton(d)===2});return new Cr({clickTolerance:t,move:(d,_)=>({bearingDelta:(_.x-d.x)*o}),moveStateManager:u,enable:y,assignEvents:va})},Cs=({enable:y,clickTolerance:t,pitchDegreesPerPixelMoved:o=-.5})=>{const u=new vo({checkCorrectEvent:d=>U.mouseButton(d)===0&&d.ctrlKey||U.mouseButton(d)===2});return new Cr({clickTolerance:t,move:(d,_)=>({pitchDelta:(_.y-d.y)*o}),moveStateManager:u,enable:y,assignEvents:va})};class Dl{constructor(t,o){this._clickTolerance=t.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,o,u){return this._calculateTransform(t,o,u)}touchmove(t,o,u){if(this._active){if(!this._shouldBePrevented(u.length))return t.preventDefault(),this._calculateTransform(t,o,u);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,o,u){this._calculateTransform(t,o,u),this._active&&this._shouldBePrevented(u.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,u){u.length>0&&(this._active=!0);const d=_o(u,o),_=new h.P(0,0),w=new h.P(0,0);let C=0;for(const E in d){const k=d[E],z=this._touches[E];z&&(_._add(k),w._add(k.sub(z)),C++,d[E]=k)}if(this._touches=d,this._shouldBePrevented(C)||!w.mag())return;const S=w.div(C);return this._sum._add(S),this._sum.mag()Math.abs(y.x)}class Rl extends xa{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,o,u){super.touchstart(t,o,u),this._currentTouchCount=u.length}_start(t){this._lastPoints=t,ba(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,u){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const d=t[0].sub(this._lastPoints[0]),_=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(d,_,u.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(d.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(t,o,u){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,_=o.mag()>=2;if(!d&&!_)return;if(!d||!_)return this._firstMove===void 0&&(this._firstMove=u),u-this._firstMove<100&&void 0;const w=t.y>0==o.y>0;return ba(t)&&ba(o)&&w}}const _c={panStep:100,bearingStep:15,pitchStep:10};class Ol{constructor(t){this._tr=new Is(t);const o=_c;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,u=0,d=0,_=0,w=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?u=-1:(t.preventDefault(),_=-1);break;case 39:t.shiftKey?u=1:(t.preventDefault(),_=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),w=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(u=0,d=0),{cameraAnimation:C=>{const S=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:vc,zoom:o?Math.round(S.zoom)+o*(t.shiftKey?2:1):S.zoom,bearing:S.bearing+u*this._bearingStep,pitch:S.pitch+d*this._pitchStep,offset:[-_*this._panStep,-w*this._panStep],center:S.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function vc(y){return y*(2-y)}const Vl=4.000244140625;class Nl{constructor(t,o){this._onTimeout=u=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(u)},this._map=t,this._tr=new Is(t),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const u=B.now(),d=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Vl==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=U.mousePos(this._map.getCanvas(),t),u=this._tr;this._around=o.y>u.transform.height/2-u.transform.getHorizon()?h.N.convert(this._aroundCenter?u.center:u.unproject(o)):h.N.convert(u.center),this._aroundPoint=u.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const S=this._type==="wheel"&&Math.abs(this._delta)>Vl?this._wheelZoomRate:this._defaultZoomRate;let E=2/(1+Math.exp(-Math.abs(this._delta*S)));this._delta<0&&E!==0&&(E=1/E);const k=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(k*E))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const o=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,u=this._startZoom,d=this._easing;let _,w=!1;const C=B.now()-this._lastWheelEventTime;if(this._type==="wheel"&&u&&d&&C){const S=Math.min(C/200,1),E=d(S);_=h.y.number(u,o,E),S<1?this._frameId||(this._frameId=!0):w=!0}else _=o,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:_-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=h.b8;if(this._prevEase){const u=this._prevEase,d=(B.now()-u.start)/u.duration,_=u.easing(d+.01)-u.easing(d),w=.27/Math.sqrt(_*_+1e-4)*.01,C=Math.sqrt(.0729-w*w);o=h.b7(w,C,.25,1)}return this._prevEase={start:B.now(),duration:t,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ss{constructor(t,o){this._clickZoom=t,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class xc{constructor(t){this._tr=new Is(t),this.reset()}reset(){this._active=!1}dblclick(t,o){return t.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sr{constructor(){this._tap=new ya({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,o,u){if(!this._swipePoint)if(this._tapTime){const d=o[0],_=t.timeStamp-this._tapTime<500,w=this._tapPoint.dist(d)<30;_&&w?u.length>0&&(this._swipePoint=d,this._swipeTouch=u[0].identifier):this.reset()}else this._tap.touchstart(t,o,u)}touchmove(t,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const d=o[0],_=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(t,o,u)}touchend(t,o,u){if(this._tapTime)this._swipePoint&&u.length===0&&this.reset();else{const d=this._tap.touchend(t,o,u);d&&(this._tapTime=t.timeStamp,this._tapPoint=d)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pr{constructor(t,o,u){this._el=t,this._mousePan=o,this._touchPan=u}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class jl{constructor(t,o,u){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Mr{constructor(t,o,u,d){this._el=t,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Yn{constructor(t,o){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=o,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",t);let o=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(o=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const u=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),d=document.createElement("div");d.className="maplibregl-desktop-message",d.textContent=o,this._container.appendChild(d);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=u,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(U.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,o){this._enabled&&(this._map.fire(new h.k("cooperativegestureprevented",{gestureType:t,originalEvent:o})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const wa=y=>y.zoom||y.drag||y.pitch||y.rotate;class Yu extends h.k{}function Ul(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Qu{constructor(t,o){this.handleWindowEvent=d=>{this.handleEvent(d,`${d.type}Window`)},this.handleEvent=(d,_)=>{if(d.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=d.type==="renderFrame"?void 0:d,C={needsRenderFrame:!1},S={},E={},k=d.touches,z=k?this._getMapTouches(k):void 0,N=z?U.touchPos(this._map.getCanvas(),z):U.mousePos(this._map.getCanvas(),d);for(const{handlerName:J,handler:X,allowed:Q}of this._handlers){if(!X.isEnabled())continue;let it;this._blockedByActive(E,Q,J)?X.reset():X[_||d.type]&&(it=X[_||d.type](d,N,z),this.mergeHandlerResult(C,S,it,J,w),it&&it.needsRenderFrame&&this._triggerRenderFrame()),(it||X.isActive())&&(E[J]=X)}const Z={};for(const J in this._previousActiveHandlers)E[J]||(Z[J]=w);this._previousActiveHandlers=E,(Object.keys(Z).length||Ul(C))&&(this._changes.push([C,S,Z]),this._triggerRenderFrame()),(Object.keys(E).length||Ul(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:G}=C;G&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],G(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zl(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,_,w]of this._listeners)U.addEventListener(d,_,d===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[t,o,u]of this._listeners)U.removeEventListener(t,o,t===document?this.handleWindowEvent:this.handleEvent,u)}_addDefaultHandlers(t){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new kl(o,t));const d=o.boxZoom=new yo(o,t);this._add("boxZoom",d),t.interactive&&t.boxZoom&&d.enable();const _=o.cooperativeGestures=new Yn(o,t.cooperativeGestures);this._add("cooperativeGestures",_),t.cooperativeGestures&&_.enable();const w=new ti(o),C=new xc(o);o.doubleClickZoom=new Ss(C,w),this._add("tapZoom",w),this._add("clickZoom",C),t.interactive&&t.doubleClickZoom&&o.doubleClickZoom.enable();const S=new Sr;this._add("tapDragZoom",S);const E=o.touchPitch=new Rl(o);this._add("touchPitch",E),t.interactive&&t.touchPitch&&o.touchPitch.enable(t.touchPitch);const k=Jn(t),z=Cs(t);o.dragRotate=new jl(t,k,z),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",z,["mouseRotate"]),t.interactive&&t.dragRotate&&o.dragRotate.enable();const N=(({enable:it,clickTolerance:W})=>{const ot=new vo({checkCorrectEvent:ht=>U.mouseButton(ht)===0&&!ht.ctrlKey});return new Cr({clickTolerance:W,move:(ht,dt)=>({around:dt,panDelta:dt.sub(ht)}),activateOnStart:!0,moveStateManager:ot,enable:it,assignEvents:va})})(t),Z=new Dl(t,o);o.dragPan=new Pr(u,N,Z),this._add("mousePan",N),this._add("touchPan",Z,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&o.dragPan.enable(t.dragPan);const G=new Pn,J=new Bl;o.touchZoomRotate=new Mr(u,J,G,S),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&o.touchZoomRotate.enable(t.touchZoomRotate);const X=o.scrollZoom=new Nl(o,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),t.interactive&&t.scrollZoom&&o.scrollZoom.enable(t.scrollZoom);const Q=o.keyboard=new Ol(o);this._add("keyboard",Q),t.interactive&&t.keyboard&&o.keyboard.enable(),this._add("blockableMapEvent",new yc(o))}_add(t,o,u){this._handlers.push({handlerName:t,handler:o,allowed:u}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!wa(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,o,u){for(const d in t)if(d!==u&&(!o||o.indexOf(d)<0))return!0;return!1}_getMapTouches(t){const o=[];for(const u of t)this._el.contains(u.target)&&o.push(u);return o}mergeHandlerResult(t,o,u,d,_){if(!u)return;h.e(t,u);const w={handlerName:d,originalEvent:u.originalEvent||_};u.zoomDelta!==void 0&&(o.zoom=w),u.panDelta!==void 0&&(o.drag=w),u.pitchDelta!==void 0&&(o.pitch=w),u.bearingDelta!==void 0&&(o.rotate=w)}_applyChanges(){const t={},o={},u={};for(const[d,_,w]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new h.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),h.e(o,_),h.e(u,w);this._updateMapTransform(t,o,u),this._changes=[]}_updateMapTransform(t,o,u){const d=this._map,_=d._getTransformForUpdate(),w=d.terrain;if(!(Ul(t)||w&&this._terrainMovement))return this._fireEvents(o,u,!0);let{panDelta:C,zoomDelta:S,bearingDelta:E,pitchDelta:k,around:z,pinchAround:N}=t;N!==void 0&&(z=N),d._stop(!0),z=z||d.transform.centerPoint;const Z=_.pointLocation(C?z.sub(C):z);E&&(_.bearing+=E),k&&(_.pitch+=k),S&&(_.zoom+=S),w?this._terrainMovement||!o.drag&&!o.zoom?o.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(C)):_.setLocationAtPoint(Z,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(Z,z)):_.setLocationAtPoint(Z,z),d._applyUpdatedTransform(_),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,u,!0)}_fireEvents(t,o,u){const d=wa(this._eventsInProgress),_=wa(t),w={};for(const z in t){const{originalEvent:N}=t[z];this._eventsInProgress[z]||(w[`${z}start`]=N),this._eventsInProgress[z]=t[z]}!d&&_&&this._fireEvent("movestart",_.originalEvent);for(const z in w)this._fireEvent(z,w[z]);_&&this._fireEvent("move",_.originalEvent);for(const z in t){const{originalEvent:N}=t[z];this._fireEvent(z,N)}const C={};let S;for(const z in this._eventsInProgress){const{handlerName:N,originalEvent:Z}=this._eventsInProgress[z];this._handlersById[N].isActive()||(delete this._eventsInProgress[z],S=o[N]||Z,C[`${z}end`]=S)}for(const z in C)this._fireEvent(z,C[z]);const E=wa(this._eventsInProgress),k=(d||_)&&!E;if(k&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const z=this._map._getTransformForUpdate();z.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(z)}if(u&&k){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),N=Z=>Z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Yu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class bc extends h.E{constructor(t,o){super(),this._renderFrameCallback=()=>{const u=Math.min((B.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,u){return t=h.P.convert(t).mult(-1),this.panTo(this.transform.center,h.e({offset:t},o),u)}panTo(t,o,u){return this.easeTo(h.e({center:t},o),u)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,u){return this.easeTo(h.e({zoom:t},o),u)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,u){return this.easeTo(h.e({bearing:t},o),u)}resetNorth(t,o){return this.rotateTo(0,h.e({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(h.e({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=h.y.number(_,X,xt)),this._rotating&&(d.bearing=h.y.number(w,E,xt)),this._pitching&&(d.pitch=h.y.number(C,k,xt)),this._padding&&(d.interpolatePadding(S,z,xt),Z=d.centerPoint.add(N)),this.terrain&&!t.freezeElevation&&this._updateElevation(xt),ot)d.setLocationAtPoint(ot,ht);else{const It=d.zoomScale(d.zoom-_),Bt=X>_?Math.min(2,W):Math.max(.5,W),Ft=Math.pow(Bt,1-xt),Ct=d.unproject(Q.add(it.mult(xt*Ft)).mult(It));d.setLocationAtPoint(d.renderWorldCopies?Ct.wrap():Ct,Z)}this._applyUpdatedTransform(d),this._fireMoveEvents(o)},xt=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o,xt)},t),this}_prepareEase(t,o,u={}){this._moving=!0,o||u.moving||this.fire(new h.k("movestart",t)),this._zooming&&!u.zooming&&this.fire(new h.k("zoomstart",t)),this._rotating&&!u.rotating&&this.fire(new h.k("rotatestart",t)),this._pitching&&!u.pitching&&this.fire(new h.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&o!==this._elevationTarget){const u=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(u-(o-(u*t+this._elevationStart))/(1-t)),this._elevationTarget=o}this.transform.elevation=h.y.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const o=t.getCameraPosition(),u=this.terrain.getElevationForLngLatZoom(o.lngLat,t.zoom);if(o.altitudethis._elevateCameraIfInsideTerrain(d)),this.transformCameraUpdate&&o.push(d=>this.transformCameraUpdate(d)),!o.length)return;const u=t.clone();for(const d of o){const _=u.clone(),{center:w,zoom:C,pitch:S,bearing:E,elevation:k}=d(_);w&&(_.center=w),C!==void 0&&(_.zoom=C),S!==void 0&&(_.pitch=S),E!==void 0&&(_.bearing=E),k!==void 0&&(_.elevation=k),u.apply(_)}this.transform.apply(u)}_fireMoveEvents(t){this.fire(new h.k("move",t)),this._zooming&&this.fire(new h.k("zoom",t)),this._rotating&&this.fire(new h.k("rotate",t)),this._pitching&&this.fire(new h.k("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;const u=this._zooming,d=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new h.k("zoomend",t)),d&&this.fire(new h.k("rotateend",t)),_&&this.fire(new h.k("pitchend",t)),this.fire(new h.k("moveend",t))}flyTo(t,o){var u;if(!t.essential&&B.prefersReducedMotion){const kt=h.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(kt,o)}this.stop(),t=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.b8},t);const d=this._getTransformForUpdate(),_=d.zoom,w=d.bearing,C=d.pitch,S=d.padding,E="bearing"in t?this._normalizeBearing(t.bearing,w):w,k="pitch"in t?+t.pitch:C,z="padding"in t?t.padding:d.padding,N=h.P.convert(t.offset);let Z=d.centerPoint.add(N);const G=d.pointLocation(Z),{center:J,zoom:X}=d.getConstrained(h.N.convert(t.center||G),(u=t.zoom)!==null&&u!==void 0?u:_);this._normalizeCenter(J,d);const Q=d.zoomScale(X-_),it=d.project(G),W=d.project(J).sub(it);let ot=t.curve;const ht=Math.max(d.width,d.height),dt=ht/Q,xt=W.mag();if("minZoom"in t){const kt=h.ac(Math.min(t.minZoom,_,X),d.minZoom,d.maxZoom),Jt=ht/d.zoomScale(kt-_);ot=Math.sqrt(Jt/xt*2)}const It=ot*ot;function Bt(kt){const Jt=(dt*dt-ht*ht+(kt?-1:1)*It*It*xt*xt)/(2*(kt?dt:ht)*It*xt);return Math.log(Math.sqrt(Jt*Jt+1)-Jt)}function Ft(kt){return(Math.exp(kt)-Math.exp(-kt))/2}function Ct(kt){return(Math.exp(kt)+Math.exp(-kt))/2}const St=Bt(!1);let Ut=function(kt){return Ct(St)/Ct(St+ot*kt)},te=function(kt){return ht*((Ct(St)*(Ft(Jt=St+ot*kt)/Ct(Jt))-Ft(St))/It)/xt;var Jt},Et=(Bt(!0)-St)/ot;if(Math.abs(xt)<1e-6||!isFinite(Et)){if(Math.abs(ht-dt)<1e-6)return this.easeTo(t,o);const kt=dt0,Ut=Jt=>Math.exp(kt*ot*Jt)}return t.duration="duration"in t?+t.duration:1e3*Et/("screenSpeed"in t?+t.screenSpeed/ot:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=w!==E,this._pitching=k!==C,this._padding=!d.isPaddingEqual(z),this._prepareEase(o,!1),this.terrain&&this._prepareElevation(J),this._ease(kt=>{const Jt=kt*Et,Le=1/Ut(Jt);d.zoom=kt===1?X:_+d.scaleZoom(Le),this._rotating&&(d.bearing=h.y.number(w,E,kt)),this._pitching&&(d.pitch=h.y.number(C,k,kt)),this._padding&&(d.interpolatePadding(S,z,kt),Z=d.centerPoint.add(N)),this.terrain&&!t.freezeElevation&&this._updateElevation(kt);const ae=kt===1?J:d.unproject(it.add(W.mult(te(Jt))).mult(Le));d.setLocationAtPoint(d.renderWorldCopies?ae.wrap():ae,Z),this._applyUpdatedTransform(d),this._fireMoveEvents(o)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){var u;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,o)}return t||(u=this.handlers)===null||u===void 0||u.stop(!1),this}_ease(t,o,u){u.animate===!1||u.duration===0?(t(1),o()):(this._easeStart=B.now(),this._easeOptions=u,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,o){t=h.b2(t,-180,180);const u=Math.abs(t-o);return Math.abs(t-360-o)180?-360:u<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(h.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ps={compact:!0,customAttribution:'MapLibre'};class Wr{constructor(t=Ps){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){U.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,o){const u=this._map._getUIString(`AttributionControl.${o}`);t.title=u,t.setAttribute("aria-label",u)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style.sourceCaches;for(const d in o){const _=o[d];if(_.used||_.usedForTerrain){const w=_.getSource();w.attribution&&t.indexOf(w.attribution)<0&&t.push(w.attribution)}}t=t.filter(d=>String(d).trim()),t.sort((d,_)=>d.length-_.length),t=t.filter((d,_)=>{for(let w=_+1;w=0)return!1;return!0});const u=t.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,t.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Rt{constructor(t={}){this._updateCompact=()=>{const o=this._container.children;if(o.length){const u=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact"):u.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const o=U.create("a","maplibregl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class wc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const d of u)if(d.id===t)return void(d.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ql=h.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ic extends h.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,o){this.sourceCache.update(t,o),this._renderableTilesKeys=[];const u={};for(const d of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o}))u[d.key]=!0,this._renderableTilesKeys.push(d.key),this._tiles[d.key]||(d.posMatrix=new Float64Array(16),h.aP(d.posMatrix,0,h.X,0,h.X,0,1),this._tiles[d.key]=new bn(d,this.tileSize));for(const d in this._tiles)u[d]||delete this._tiles[d]}freeRtt(t){for(const o in this._tiles){const u=this._tiles[o];(!t||u.tileID.equals(t)||u.tileID.isChildOf(t)||t.isChildOf(u.tileID))&&(u.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const o={};for(const u of this._renderableTilesKeys){const d=this._tiles[u].tileID;if(d.canonical.equals(t.canonical)){const _=t.clone();_.posMatrix=new Float64Array(16),h.aP(_.posMatrix,0,h.X,0,h.X,0,1),o[u]=_}else if(d.canonical.isChildOf(t.canonical)){const _=t.clone();_.posMatrix=new Float64Array(16);const w=d.canonical.z-t.canonical.z,C=d.canonical.x-(d.canonical.x>>w<>w<>w;h.aP(_.posMatrix,0,E,0,E,0,1),h.J(_.posMatrix,_.posMatrix,[-C*E,-S*E,0]),o[u]=_}else if(t.canonical.isChildOf(d.canonical)){const _=t.clone();_.posMatrix=new Float64Array(16);const w=t.canonical.z-d.canonical.z,C=t.canonical.x-(t.canonical.x>>w<>w<>w;h.aP(_.posMatrix,0,h.X,0,h.X,0,1),h.J(_.posMatrix,_.posMatrix,[C*E,S*E,0]),h.K(_.posMatrix,_.posMatrix,[1/2**w,1/2**w,0]),o[u]=_}}return o}getSourceTile(t,o){const u=this.sourceCache._source;let d=t.overscaledZ-this.deltaZoom;if(d>u.maxzoom&&(d=u.maxzoom),d=u.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(t.scaledTo(d--).key);return _}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(o=>o.timeAdded>=t)}}class bo{constructor(t,o,u){this.painter=t,this.sourceCache=new Ic(o),this.options=u,this.exaggeration=typeof u.exaggeration=="number"?u.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,o,u,d=h.X){var _;if(!(o>=0&&o=0&&ut.canonical.z&&(t.canonical.z>=d?_=t.canonical.z-d:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=t.canonical.x-(t.canonical.x>>_<<_),C=t.canonical.y-(t.canonical.y>>_<<_),S=h.bb(new Float64Array(16),[1/(h.X<<_),1/(h.X<<_),0]);h.J(S,S,[w*h.X,C*h.X,0]),this._demMatrixCache[t.key]={matrix:S,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:o&&o.dem&&o.dem.dim||1,u_terrain_matrix:u?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:o&&o.dem&&o.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(o&&o.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:o}}getFramebuffer(t){const o=this.painter,u=o.width/devicePixelRatio,d=o.height/devicePixelRatio;return!this._fbo||this._fbo.width===u&&this._fbo.height===d||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new le(o.context,{width:u,height:d,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new le(o.context,{width:u,height:d,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=o.context.createFramebuffer(u,d,!0,!1),this._fbo.depthAttachment.set(o.context.createRenderbuffer(o.context.gl.DEPTH_COMPONENT16,u,d))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const o=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,w=0;_>8<<4|_>>8,o[w+3]=0;const u=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),d=new le(t,u,t.gl.RGBA,{premultiply:!1});return d.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=d,d}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const o=new Uint8Array(4),u=this.painter.context,d=u.gl,_=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),C=Math.round(this.painter.height/devicePixelRatio);u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(_,C-w-1,1,1,d.RGBA,d.UNSIGNED_BYTE,o),u.bindFramebuffer.set(null);const S=o[0]+(o[2]>>4<<8),E=o[1]+((15&o[2])<<8),k=this.coordsIndex[255-o[3]],z=k&&this.sourceCache.getTileByID(k);if(!z)return null;const N=this._coordsTextureSize,Z=(1<t.id!==o),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const Qn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class fe{constructor(t,o){this.painter=t,this.terrain=o,this.pool=new wo(t.context,30,o.sourceCache.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,o){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(u=>!t._layers[u].isHidden(o)),this._coordsDescendingInv={};for(const u in t.sourceCaches){this._coordsDescendingInv[u]={};const d=t.sourceCaches[u].getVisibleCoordinates();for(const _ of d){const w=this.terrain.sourceCache.getTerrainCoords(_);for(const C in w)this._coordsDescendingInv[u][C]||(this._coordsDescendingInv[u][C]=[]),this._coordsDescendingInv[u][C].push(w[C])}}this._coordsDescendingInvStr={};for(const u of t._order){const d=t._layers[u],_=d.source;if(Qn[d.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const w in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][w]=this._coordsDescendingInv[_][w].map(C=>C.key).sort().join()}}for(const u of this._renderableTiles)for(const d in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[d][u.tileID.key];_&&_!==u.rttCoords[d]&&(u.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const o=t.type,u=this.painter,d=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Qn[o]&&(this._prevType&&Qn[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(t.id),!d))return!0;if(Qn[this._prevType]||Qn[o]&&d){this._prevType=o;const _=this._stacks.length-1,w=this._stacks[_]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(fc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[_]){const E=this.pool.getObjectForId(C.rtt[_].id);if(E.stamp===C.rtt[_].stamp){this.pool.useObject(E);continue}}const S=this.pool.getOrCreateFreeObject();this.pool.useObject(S),this.pool.stampObject(S),C.rtt[_]={id:S.id,stamp:S.stamp},u.context.bindFramebuffer.set(S.fbo.framebuffer),u.context.clear({color:h.aM.transparent,stencil:0}),u.currentStencilSource=void 0;for(let E=0;E{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},ed={showCompass:!0,showZoom:!0,visualizePitch:!1};class Sc{constructor(t,o,u=!1){this.mousedown=w=>{this.startMouse(h.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const d=t.dragRotate._mouseRotate.getClickTolerance(),_=t.dragRotate._mousePitch.getClickTolerance();this.element=o,this.mouseRotate=Jn({clickTolerance:d,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:C,bearingDegreesPerPixelMoved:S=.8})=>{const E=new _a;return new Cr({clickTolerance:C,move:(k,z)=>({bearingDelta:(z.x-k.x)*S}),moveStateManager:E,enable:w,assignEvents:Cc})})({clickTolerance:d,enable:!0}),this.map=t,u&&(this.mousePitch=Cs({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:C,pitchDegreesPerPixelMoved:S=-.5})=>{const E=new _a;return new Cr({clickTolerance:C,move:(k,z)=>({pitchDelta:(z.y-k.y)*S}),moveStateManager:E,enable:w,assignEvents:Cc})})({clickTolerance:_,enable:!0})),U.addEventListener(o,"mousedown",this.mousedown),U.addEventListener(o,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(o,"touchcancel",this.reset)}startMouse(t,o){this.mouseRotate.dragStart(t,o),this.mousePitch&&this.mousePitch.dragStart(t,o),U.disableDrag()}startTouch(t,o){this.touchRotate.dragStart(t,o),this.touchPitch&&this.touchPitch.dragStart(t,o),U.disableDrag()}moveMouse(t,o){const u=this.map,{bearingDelta:d}=this.mouseRotate.dragMove(t,o)||{};if(d&&u.setBearing(u.getBearing()+d),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(t,o)||{};_&&u.setPitch(u.getPitch()+_)}}moveTouch(t,o){const u=this.map,{bearingDelta:d}=this.touchRotate.dragMove(t,o)||{};if(d&&u.setBearing(u.getBearing()+d),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(t,o)||{};_&&u.setPitch(u.getPitch()+_)}}off(){const t=this.element;U.removeEventListener(t,"mousedown",this.mousedown),U.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let cn;function Gl(y,t,o){const u=new h.N(y.lng,y.lat);if(y=new h.N(y.lng,y.lat),t){const d=new h.N(y.lng-360,y.lat),_=new h.N(y.lng+360,y.lat),w=o.locationPoint(y).distSqr(t);o.locationPoint(d).distSqr(t)180;){const d=o.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=o.width&&d.y<=o.height)break;y.lng>o.center.lng?y.lng-=360:y.lng+=360}return y.lng!==u.lng&&o.locationPoint(y).y>o.height/2-o.getHorizon()?y:u}const Xl={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Wl(y,t,o){const u=y.classList;for(const d in Xl)u.remove(`maplibregl-${o}-anchor-${d}`);u.add(`maplibregl-${o}-anchor-${t}`)}class Hl extends h.E{constructor(t){if(super(),this._onKeyPress=o=>{const u=o.code,d=o.charCode||o.keyCode;u!=="Space"&&u!=="Enter"&&d!==32&&d!==13||this.togglePopup()},this._onMapClick=o=>{const u=o.originalEvent.target,d=this._element;this._popup&&(u===d||d.contains(u))&&this.togglePopup()},this._update=o=>{var u;if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((o==null?void 0:o.type)==="terrain"||(o==null?void 0:o.type)==="render"&&!d)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Gl(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||o&&o.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${Xl[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${_}`),B.frameAsync(new AbortController).then(()=>{this._updateOpacity(o&&o.type==="moveend")}).catch(()=>{})},this._onMove=o=>{if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=o.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new h.k("dragstart"))),this.fire(new h.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new h.k("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=h.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div");const o=U.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${u}px`),o.setAttributeNS(null,"width",`${d}px`),o.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const _=U.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const C=U.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const S=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Q of S){const it=U.createNS("http://www.w3.org/2000/svg","ellipse");it.setAttributeNS(null,"opacity","0.04"),it.setAttributeNS(null,"cx","10.5"),it.setAttributeNS(null,"cy","5.80029008"),it.setAttributeNS(null,"rx",Q.rx),it.setAttributeNS(null,"ry",Q.ry),C.appendChild(it)}const E=U.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const k=U.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),E.appendChild(k);const z=U.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const N=U.createNS("http://www.w3.org/2000/svg","path");N.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(N);const Z=U.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Z.setAttributeNS(null,"fill","#FFFFFF");const G=U.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const X=U.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#FFFFFF"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962"),G.appendChild(J),G.appendChild(X),w.appendChild(C),w.appendChild(E),w.appendChild(z),w.appendChild(Z),w.appendChild(G),o.appendChild(w),o.setAttributeNS(null,"height",u*this._scale+"px"),o.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(o),this._offset=h.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",o=>{o.preventDefault()}),this._element.addEventListener("mousedown",o=>{o.preventDefault()}),Wl(this._element,this._anchor,"marker"),t&&t.className)for(const o of t.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var o,u;if(!(!((o=this._map)===null||o===void 0)&&o.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const d=this._map,_=d.terrain.depthAtPoint(this._pos),w=d.terrain.getElevationForLngLatZoom(this._lngLat,d.transform.tileZoom);if(d.transform.lngLatToCameraDepth(this._lngLat,w)-_<.006)return void(this._element.style.opacity=this._opacity);const C=-this._offset.y/d.transform._pixelPerMeter,S=Math.sin(d.getPitch()*Math.PI/180)*C,E=d.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),k=d.transform.lngLatToCameraDepth(this._lngLat,w+S)-E>.006;!((u=this._popup)===null||u===void 0)&&u.isOpen()&&k&&this._popup.remove(),this._element.style.opacity=k?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=h.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,o){return t===void 0&&o===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),o!==void 0&&(this._opacityWhenCovered=o),this._map&&this._updateOpacity(!0),this}}const id={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Hr=0,Me=!1;const Ia={maxWidth:100,unit:"metric"};function Ca(y,t,o){const u=o&&o.maxWidth||100,d=y._container.clientHeight/2,_=y.unproject([0,d]),w=y.unproject([u,d]),C=_.distanceTo(w);if(o&&o.unit==="imperial"){const S=3.2808*C;S>5280?Ms(t,u,S/5280,y._getUIString("ScaleControl.Miles")):Ms(t,u,S,y._getUIString("ScaleControl.Feet"))}else o&&o.unit==="nautical"?Ms(t,u,C/1852,y._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ms(t,u,C/1e3,y._getUIString("ScaleControl.Kilometers")):Ms(t,u,C,y._getUIString("ScaleControl.Meters"))}function Ms(y,t,o,u){const d=function(_){const w=Math.pow(10,`${Math.floor(_)}`.length-1);let C=_/w;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(S){const E=Math.pow(10,Math.ceil(-Math.log(S)/Math.LN10));return Math.round(S*E)/E}(C),w*C}(o);y.style.width=t*(d/o)+"px",y.innerHTML=`${d} ${u}`}const Pc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Mc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ec(y){if(y){if(typeof y=="number"){const t=Math.round(Math.abs(y)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,y),"top-left":new h.P(t,t),"top-right":new h.P(-t,t),bottom:new h.P(0,-y),"bottom-left":new h.P(t,-t),"bottom-right":new h.P(-t,-t),left:new h.P(y,0),right:new h.P(-y,0)}}if(y instanceof h.P||Array.isArray(y)){const t=h.P.convert(y);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:h.P.convert(y.center||[0,0]),top:h.P.convert(y.top||[0,0]),"top-left":h.P.convert(y["top-left"]||[0,0]),"top-right":h.P.convert(y["top-right"]||[0,0]),bottom:h.P.convert(y.bottom||[0,0]),"bottom-left":h.P.convert(y["bottom-left"]||[0,0]),"bottom-right":h.P.convert(y["bottom-right"]||[0,0]),left:h.P.convert(y.left||[0,0]),right:h.P.convert(y.right||[0,0])}}return Ec(new h.P(0,0))}const Kr=M;m.AJAXError=h.bg,m.Evented=h.E,m.LngLat=h.N,m.MercatorCoordinate=h.Z,m.Point=h.P,m.addProtocol=h.bh,m.config=h.a,m.removeProtocol=h.bi,m.AttributionControl=Wr,m.BoxZoomHandler=yo,m.CanvasSource=dr,m.CooperativeGesturesHandler=Yn,m.DoubleClickZoomHandler=Ss,m.DragPanHandler=Pr,m.DragRotateHandler=jl,m.EdgeInsets=uo,m.FullscreenControl=class extends h.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var t;let o=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=o==null?void 0:o.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)o=o.shadowRoot.fullscreenElement;o===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:h.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new h.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},m.GeoJSONSource=Xs,m.GeolocateControl=class extends h.E{constructor(y){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new h.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const o=new h.N(t.coords.longitude,t.coords.latitude),u=t.coords.accuracy,d=this._map.getBearing(),_=h.e({bearing:d},this.options.fitBoundsOptions),w=ft.fromLngLat(o,u);this._map.fitBounds(w,_,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const o=new h.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Me)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Hl({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Hl({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new h.k("trackuserlocationend")),this.fire(new h.k("userlocationlostfocus")))})}},this.options=h.e({},id,y)}onAdd(y){return this._map=y,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return h._(this,arguments,void 0,function*(t=!1){if(cn!==void 0&&!t)return cn;if(window.navigator.permissions===void 0)return cn=!!window.navigator.geolocation,cn;try{cn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{cn=!!window.navigator.geolocation}return cn})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Hr=0,Me=!1}_isOutOfMapMaxBounds(y){const t=this._map.getMaxBounds(),o=y.coords;return t&&(o.longitudet.getEast()||o.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const y=this._map.getBounds(),t=y.getSouthEast(),o=y.getNorthEast(),u=t.distanceTo(o),d=Math.ceil(this._accuracy/(u/this._map._container.clientHeight)*2);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}trigger(){if(!this._setup)return h.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Hr--,Me=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new h.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new h.k("trackuserlocationstart")),this.fire(new h.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Hr++,Hr>1?(y={maximumAge:6e5,timeout:0},Me=!0):(y=this.options.positionOptions,Me=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},m.Hash=mo,m.ImageSource=on,m.KeyboardHandler=Ol,m.LngLatBounds=ft,m.LogoControl=Rt,m.Map=class extends bc{constructor(y){h.be.mark(h.bf.create);const t=Object.assign(Object.assign({},Zl),y);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new po(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new wc,this._controls=[],this._mapId=h.a4(),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new h.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new h.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},$l),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Yt.addThrottleControl(()=>this.isMoving()),this._requestManager=new oe(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let o=!1;const u=fo(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{o?u(d):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Qu(this,t),this._hash=t.hash&&new mo(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,h.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Wr(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Rt,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new h.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new h.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new h.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(y,t){if(t===void 0&&(t=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new h.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=y.onAdd(this);this._controls.push(y);const u=this._controlPositions[t];return t.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new h.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(y);return t>-1&&this._controls.splice(t,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,t,o,u){return u==null&&this.terrain&&(u=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,t,o,u)}resize(y){var t;const o=this._containerDimensions(),u=o[0],d=o[1],_=this._getClampedPixelRatio(u,d);if(this._resizeCanvas(u,d,_),this.painter.resize(u,d,_),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const S=this._getClampedPixelRatio(u,d);this._resizeCanvas(u,d,S),this.painter.resize(u,d,S)}this.transform.resize(u,d),(t=this._requestedCameraState)===null||t===void 0||t.resize(u,d);const w=!this._moving;return w&&(this.stop(),this.fire(new h.k("movestart",y)).fire(new h.k("move",y))),this.fire(new h.k("resize",y)),w&&this.fire(new h.k("moveend",y)),this}_getClampedPixelRatio(y,t){const{0:o,1:u}=this._maxCanvasSize,d=this.getPixelRatio(),_=y*d,w=t*d;return Math.min(_>o?o/_:1,w>u?u/w:1)*d}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(ft.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(h.N.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(h.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,t,o){if(y==="mouseenter"||y==="mouseover"){let u=!1;return{layer:t,listener:o,delegates:{mousemove:_=>{const w=this.getLayer(t)?this.queryRenderedFeatures(_.point,{layers:[t]}):[];w.length?u||(u=!0,o.call(this,new sr(y,this,_.originalEvent,{features:w}))):u=!1},mouseout:()=>{u=!1}}}}if(y==="mouseleave"||y==="mouseout"){let u=!1;return{layer:t,listener:o,delegates:{mousemove:w=>{(this.getLayer(t)?this.queryRenderedFeatures(w.point,{layers:[t]}):[]).length?u=!0:u&&(u=!1,o.call(this,new sr(y,this,w.originalEvent)))},mouseout:w=>{u&&(u=!1,o.call(this,new sr(y,this,w.originalEvent)))}}}}{const u=d=>{const _=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];_.length&&(d.features=_,o.call(this,d),delete d.features)};return{layer:t,listener:o,delegates:{[y]:u}}}}on(y,t,o){if(o===void 0)return super.on(y,t);const u=this._createDelegatedListener(y,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(u);for(const d in u.delegates)this.on(d,u.delegates[d]);return this}once(y,t,o){if(o===void 0)return super.once(y,t);const u=this._createDelegatedListener(y,t,o);for(const d in u.delegates)this.once(d,u.delegates[d]);return this}off(y,t,o){return o===void 0?super.off(y,t):(this._delegatedListeners&&this._delegatedListeners[y]&&(u=>{const d=this._delegatedListeners[y];for(let _=0;_this._updateStyle(y,t));const o=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new ul(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,t,o):this.style.loadJSON(y,t,o),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ul(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,t){if(typeof y=="string"){const o=this._requestManager.transformRequest(y,"Style");h.h(o,new AbortController).then(u=>{this._updateDiff(u.data,t)}).catch(u=>{u&&this.fire(new h.j(u))})}else typeof y=="object"&&this._updateDiff(y,t)}_updateDiff(y,t){try{this.style.setState(y,t)&&this._update(!0)}catch(o){h.w(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(y,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(y,t){return this._lazyInitEmptyStyle(),this.style.addSource(y,t),this._update(!0)}isSourceLoaded(y){const t=this.style&&this.style.sourceCaches[y];if(t!==void 0)return t.loaded();this.fire(new h.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const t=this.style.sourceCaches[y.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&t.reload();for(const o in this.style._layers){const u=this.style._layers[o];u.type==="hillshade"&&u.source===y.source&&h.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new bo(this.painter,t,y),this.painter.renderToTexture=new fe(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=o=>{o.dataType==="style"?this.terrain.sourceCache.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(o.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new h.k("terrain",{terrain:y})),this}getTerrain(){var y,t;return(t=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const t in y){const o=y[t]._tiles;for(const u in o){const d=o[u];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,t,o={}){const{pixelRatio:u=1,sdf:d=!1,stretchX:_,stretchY:w,content:C,textFitWidth:S,textFitHeight:E}=o;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||h.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new h.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:k,height:z,data:N}=t,Z=t;return this.style.addImage(y,{data:new h.R({width:k,height:z},new Uint8Array(N)),pixelRatio:u,stretchX:_,stretchY:w,content:C,textFitWidth:S,textFitHeight:E,sdf:d,version:0,userImage:Z}),Z.onAdd&&Z.onAdd(this,y),this}}{const{width:k,height:z,data:N}=B.getImageData(t);this.style.addImage(y,{data:new h.R({width:k,height:z},N),pixelRatio:u,stretchX:_,stretchY:w,content:C,textFitWidth:S,textFitHeight:E,sdf:d,version:0})}}updateImage(y,t){const o=this.style.getImage(y);if(!o)return this.fire(new h.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=t instanceof HTMLImageElement||h.b(t)?B.getImageData(t):t,{width:d,height:_,data:w}=u;if(d===void 0||_===void 0)return this.fire(new h.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(d!==o.data.width||_!==o.data.height)return this.fire(new h.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const C=!(t instanceof HTMLImageElement||h.b(t));return o.data.replace(w,C),this.style.updateImage(y,o),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new h.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return Yt.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,t){return this._lazyInitEmptyStyle(),this.style.addLayer(y,t),this._update(!0)}moveLayer(y,t){return this.style.moveLayer(y,t),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,t,o){return this.style.setLayerZoomRange(y,t,o),this._update(!0)}setFilter(y,t,o={}){return this.style.setFilter(y,t,o),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,t,o,u={}){return this.style.setPaintProperty(y,t,o,u),this._update(!0)}getPaintProperty(y,t){return this.style.getPaintProperty(y,t)}setLayoutProperty(y,t,o,u={}){return this.style.setLayoutProperty(y,t,o,u),this._update(!0)}getLayoutProperty(y,t){return this.style.getLayoutProperty(y,t)}setGlyphs(y,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,t,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,t,o,u=>{u||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,t,o=>{o||this._update(!0)}),this}setLight(y,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(y){return this._lazyInitEmptyStyle(),this.style.setSky(y),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(y,t){return this.style.setFeatureState(y,t),this._update()}removeFeatureState(y,t){return this.style.removeFeatureState(y,t),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,t=0;return this._container&&(y=this._container.clientWidth||400,t=this._container.clientHeight||300),[y,t]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const t=this._canvasContainer=U.create("div","maplibregl-canvas-container",y);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const o=this._containerDimensions(),u=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],u);const d=this._controlContainer=U.create("div","maplibregl-control-container",y),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{_[w]=U.create("div",`maplibregl-ctrl-${w} `,d)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,t,o){this._canvas.width=Math.floor(o*y),this._canvas.height=Math.floor(o*t),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",u=>{t={requestedAttributes:y},u&&(t.statusMessage=u.statusMessage,t.type=u.type)},{once:!0});const o=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!o){const u="Failed to initialize WebGL";throw t?(t.message=u,new Error(JSON.stringify(t))):new Error(u)}this.painter=new co(o,this.transform),ut.testSupport(o)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const d=this.transform.zoom,_=B.now();this.style.zoomHistory.update(d,_);const w=new h.z(d,{now:_,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=w.crossFadingFactor();C===1&&C===this._crossFadingFactor||(o=!0,this._crossFadingFactor=C),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new h.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.be.mark(h.bf.load),this.fire(new h.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const u=this._sourcesDirty||this._styleDirty||this._placementDirty;return u||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.k("idle")),!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,h.be.mark(h.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const o of this._controls)o.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Yt.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),h.be.clearMetrics(),this._removed=!0,this.fire(new h.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,B.frameAsync(this._frameRequest).then(y=>{h.be.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return td}getCameraTargetElevation(){return this.transform.elevation}},m.MapMouseEvent=sr,m.MapTouchEvent=ws,m.MapWheelEvent=go,m.Marker=Hl,m.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const t=this._map.getZoom(),o=t===this._map.getMaxZoom(),u=t===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,o)=>{const u=this._map._getUIString(`NavigationControl.${o}`);t.title=u,t.setAttribute("aria-label",u)},this.options=h.e({},ed,y),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Sc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,t){const o=U.create("button",y,this._container);return o.type="button",o.addEventListener("click",t),o}},m.Popup=class extends h.E{constructor(y){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new h.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var o;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const C of this.options.className.split(" "))this._container.classList.add(C);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Gl(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._trackPointer&&!t)return;const u=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let d=this.options.anchor;const _=Ec(this.options.offset);if(!d){const C=this._container.offsetWidth,S=this._container.offsetHeight;let E;E=u.y+_.bottom.ythis._map.transform.height-S?["bottom"]:[],u.xthis._map.transform.width-C/2&&E.push("right"),d=E.length===0?"bottom":E.join("-")}let w=u.add(_[d]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${Xl[d]} translate(${w.x}px,${w.y}px)`),Wl(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(Pc),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new h.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=h.N.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const t=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=y;u=o.firstChild,u;)t.appendChild(u);return this.setDOMContent(t)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){return this._container&&this._container.classList.add(y),this}removeClassName(y){return this._container&&this._container.classList.remove(y),this}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Mc);y&&y.focus()}},m.RasterDEMTileSource=Xe,m.RasterTileSource=be,m.ScaleControl=class{constructor(y){this._onMove=()=>{Ca(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ca(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ia),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},m.ScrollZoomHandler=Nl,m.Style=ul,m.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},m.TwoFingersTouchPitchHandler=Rl,m.TwoFingersTouchRotateHandler=Pn,m.TwoFingersTouchZoomHandler=Bl,m.TwoFingersTouchZoomRotateHandler=Mr,m.VectorTileSource=Gs,m.VideoSource=fs,m.addSourceType=(y,t)=>h._(void 0,void 0,void 0,function*(){if(Hs(y))throw new Error(`A source type called "${y}" already exists.`);((o,u)=>{Ws[o]=u})(y,t)}),m.clearPrewarmedResources=function(){const y=Yi;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(yn),Yi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},m.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},m.getRTLTextPluginStatus=function(){return $r().getRTLTextPluginStatus()},m.getVersion=function(){return Kr},m.getWorkerCount=function(){return Ur.workerCount},m.getWorkerUrl=function(){return h.a.WORKER_URL},m.importScriptInWorkers=function(y){return Zs().broadcast("IS",y)},m.prewarm=function(){jn().acquire(yn)},m.setMaxParallelImageRequests=function(y){h.a.MAX_PARALLEL_IMAGE_REQUESTS=y},m.setRTLTextPlugin=function(y,t){return $r().setRTLTextPlugin(y,t)},m.setWorkerCount=function(y){Ur.workerCount=y},m.setWorkerUrl=function(y){h.a.WORKER_URL=y}});var f=a;return f})})(Hg);var Yv=Hg.exports;const qm=Jv(Yv);var Ro=Math.pow(2,32),Jc=Math.pow(2,-32),Qv=Math.log(10)/(32*Math.log(2));function t0(x){return new Array(x+1).join("0")}var Hd=function(){function x(s){this.base=s,this.limbDigitsExact=Math.log(Ro)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=t0(this.limbDigits)}return x.init=function(s){return x.baseTbl[s]||(x.baseTbl[s]=new x(s))},x.baseTbl={},x}();function e0(x){return x.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}var Nr=function(){function x(s,a){this.limbList=[],s?this.setValue(s,a):this.setZero()}return x.prototype.clone=function(){return new x().setBig(this)},x.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},x.prototype.setValue=function(s,a){return typeof s=="number"?this.setNumber(s):s instanceof x?this.setBig(s):this.setString(s.toString(),a||10)},x.prototype.setBig=function(s){var a=s.len;this.sign=s.sign,this.fractionLen=s.fractionLen,this.len=a;for(var n=0;n>>0,n-=m,f[h++]=m,++c;for(var M=0;--h>M;)m=f[M],f[M++]=f[h],f[h]=m;for(h+=M+1;a;)m=a%Ro,a=(a-m)/Ro,f[h++]=m;return this.limbList=f,this.fractionLen=c,this.len=h,this},x.prototype.parseFraction=function(s,a,n,c,f,m){for(var h=this.limbList,M=s.length,L=c-1;L;)h[--L]=0;var V=M-((M-n+m-1)%m+1);for(h[c-1]=parseInt(s.substr(V,M-V),a),this.divInt(Math.pow(a,M-V),c),M=V;M>n;)M-=m,h[c-1]=parseInt(s.substr(M,m),a),this.divInt(f,c)},x.prototype.setString=function(s,a){var n=Hd.init(a),c=n.limbBase,f=n.limbDigits,m=n.limbDigitsExact,h=this.limbList,M=-1,L;for(this.sign=1;;){switch(L=s.charAt(++M),L){case"-":this.sign=-1;case"+":case"0":continue}break}var V=(s.indexOf(".",M)+1||s.length+1)-1;if(VM){var ut=M+(V-M+f-1)%f+1;for(++this.len,h[U]=parseInt(s.substr(M,ut-M),a),M=ut;Ma&&!s[n-1];)--n;this.len=n},x.prototype.trimLeast=function(){for(var s=this.limbList,a=this.fractionLen,n=0;n>>16),L|=V<<16,M=(a[c]&f)+L>>>0,a[c++]=M,V=V/65536>>>0,V+=(L^(M-L^L)&~(M^L))>>>31;return V&&(a[c]=V),V},x.prototype.mulBig=function(s,a){if(this.isZero()||s.isZero())return a.setZero();var n=s.limbList,c=s.len,f=a.limbList,m=this.len+c;for(a.len=m;m--;)f[m]=0;this.mulInt(n[0],f,0,0,0);for(var h=1;hut&&(f=ut);V>>0,B=B-U&&1,m[L++]=U;var vt=L;for(f>>0,B=B-U&&1,m[vt++]=U;return B&&(m[vt++]=B),a.len=vt,a.trimLeast(),a},x.prototype.subBig=function(s,a){var n=this;a.sign=this.sign,n.absDeltaFrom(s)<0&&(n=s,s=this,a.sign=-this.sign);var c=n.fractionLen,f=c-s.fractionLen,m=a.limbList,h=n.limbList,M=s.limbList,L=n.len,V=s.len,B=L,U=0,ut=0,vt=0,Tt=0,Vt;if(f>=0){for(;UL&&(f=L),vt=U}else{for(f=-f,c+=f,B+=f;ut>>0,Tt=-(Tt<0),m[ut++]=Vt;f+=L,f>V&&(f=V),vt=ut}for(a.fractionLen=c;vt>>0,Tt=-(Tt<0),m[vt++]=Vt;for(;vt>>0,Tt=-(Tt<0),m[vt++]=Vt;return a.len=vt,a.trimMost(),a.trimLeast(),a},x.prototype.addSub=function(s,a,n){if(n=n||new x,n==this)throw new Error("Addition and subtraction in place is unsupported");return typeof s=="number"&&(s=Na.setNumber(s)),this.sign*s.sign*a<0?this.subBig(s,n):this.addBig(s,n)},x.prototype.add=function(s,a){return this.addSub(s,1,a)},x.prototype.sub=function(s,a){return this.addSub(s,-1,a)},x.prototype.truncate=function(s){var a=this.fractionLen-s;if(a>0){this.fractionLen=s,this.len-=a;for(var n=this.len,c=this.limbList,f=0;f>>16),f=h/s>>>0,h=h-f*s,h=h*65536+(c&65535),m=h/s>>>0,h=h-m*s,n[a]=(f<<16|m)>>>0;return h},x.prototype.fractionToString=function(s,a){var n=Hd.init(s),c=n.pad,f=n.limbBase,m=this.limbList,h=this.fractionLen,M=0,L;if(s&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;M=h)){a.push(".");var V=Na;for(V.limbList=m.slice(M,h),V.len=h-M,M=0;M1;)h=M.divInt(c,M.len).toString(s),f.push(n.substr(h.length)+h);f.push(""+(M.limbList[0]||0)),this.sign<0&&f.push("-"),f.reverse(),this.fractionToString(s,f)}else{var L=this.len,V=this.fractionLen;for(this.sign<0&&f.push("-"),L==V&&f.push("0");L--;)h=m[L].toString(s),L==V-1&&f.push("."),f.push(n.substr(h.length)+h)}return e0(f.join(""))},x}();Nr.prototype.cmp=Nr.prototype.deltaFrom;var Na=new Nr,$m=(1<<27)+1,i0=Math.log(10)/(53*Math.log(2));function r0(x,s,a){var n=x+s,c=n-x,f=n-c;return a[0]=x-f+(s-c),a[1]=n,a}function Kd(x,s){Wa=x*s;var a=x*$m,n=a-(a-x),c=x-n,f=s*$m,m=f-(f-s),h=s-m;return c*h-(Wa-n*m-c*m-n*h)}var Uo=function(){function x(s,a){this.limbList=[],s&&this.setValue(s,a)}return x.prototype.clone=function(){return new x().setBig(this)},x.prototype.setZero=function(){return this.len=0,this},x.prototype.setValue=function(s,a){return typeof s=="number"?this.setNumber(s):s instanceof x?this.setBig(s):this.setString(s.toString(),a||10)},x.prototype.setBig=function(s){var a=s.len;this.len=a;for(var n=0;n0?1:-1)},x.prototype.deltaFrom=function(s){var a=this.len,n=this.getSign(),c=n;if(typeof s!="number"){if(a=s.len,c-=a&&(a=s.limbList[a-1])&&(a>0?1:-1),c||!n)return c;this.addBig(s,-1,Lo[0])}else{if(c-=s&&(s>0?1:-1),c||!n)return c;this.addSmall(-s,Lo[0])}return a=Lo[0].len,a&&Lo[0].limbList[a-1]},x.prototype.addSmall=function(s,a){for(var n=this.limbList,c=a.limbList,f=this.len,m,h,M,L,V=0,B=0;V>1,h=a[m],h>-1&&h<1?c=m+1:f=m;if(m&&(h<=-1||h>=1)&&(h=a[--m]),m-=s-1,m>0){this.len-=m,n=this.len;for(var M=0;Mx.length)&&(s=x.length);for(var a=0,n=Array(s);a=x.length?{done:!0}:{done:!1,value:x[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function up(x){return up=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},up(x)}function Oh(x,s){x.prototype=Object.create(s.prototype),x.prototype.constructor=x,Mh(x,s)}function o0(x){try{return Function.toString.call(x).indexOf("[native code]")!==-1}catch{return typeof x=="function"}}function Qg(){try{var x=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qg=function(){return!!x})()}function Mh(x,s){return Mh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},Mh(x,s)}function a0(x,s){if(typeof x!="object"||!x)return x;var a=x[Symbol.toPrimitive];if(a!==void 0){var n=a.call(x,s);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(x)}function l0(x){var s=a0(x,"string");return typeof s=="symbol"?s:s+""}function h0(x,s){if(x){if(typeof x=="string")return Zm(x,s);var a={}.toString.call(x).slice(8,-1);return a==="Object"&&x.constructor&&(a=x.constructor.name),a==="Map"||a==="Set"?Array.from(x):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Zm(x,s):void 0}}function il(x){var s=typeof Map=="function"?new Map:void 0;return il=function(a){if(a===null||!o0(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(a))return s.get(a);s.set(a,n)}function n(){return hu(a,arguments,up(this).constructor)}return n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Mh(n,a)},il(x)}var Ae=function(){function x(a,n){this.lo=0,this.hi=0,this.lo=a,this.hi=n}var s=x.prototype;return s.isEmpty=function(){return this.lo>this.hi},s.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},s.center=function(){return .5*(this.lo+this.hi)},s.length=function(){return this.hi-this.lo},s.contains=function(n){return this.lo<=n&&n<=this.hi},s.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},s.interiorContains=function(n){return this.lothis.hi?new x(this.lo,n):this},s.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},s.expanded=function(n){return this.isEmpty()?this:new x(this.lo-n,this.hi+n)},s.approxEqual=function(n,c){return c===void 0&&(c=1e-15),this.isEmpty()?n.length()<=2*c:n.isEmpty()?this.length()<=2*c:Math.abs(n.lo-this.lo)<=c&&Math.abs(n.hi-this.hi)<=c},s.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},s.trunc=function(n){n===void 0&&(n=15);var c=+("1e"+n),f=function(h){return Math.round(h*c)/c};return new x(f(this.lo),f(this.hi))},s.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},x.empty=function(){return new x(1,0)},x.fromPoint=function(n){return new x(n,n)},x}(),Se=function(){function x(a,n){a===void 0&&(a=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=a,this.y=n}var s=x.prototype;return s.add=function(n){return new x(this.x+n.x,this.y+n.y)},s.sub=function(n){return new x(this.x-n.x,this.y-n.y)},s.mul=function(n){return new x(this.x*n,this.y*n)},s.ortho=function(){return new x(-this.y,this.x)},s.dot=function(n){return this.x*n.x+this.y*n.y},s.cross=function(n){return this.x*n.y-this.y*n.x},s.norm=function(){return Math.hypot(this.x,this.y)},s.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},s.trunc=function(n){n===void 0&&(n=15);var c=+("1e"+n),f=function(h){return Math.round(h*c)/c};return new x(f(this.x),f(this.y))},s.equals=function(n){return this.x===n.x&&this.y===n.y},s.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},x}(),oi=function(){function x(a,n){a===void 0&&(a=new Ae(0,0)),n===void 0&&(n=new Ae(0,0)),this.x=a,this.y=n}var s=x.prototype;return s.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},s.isEmpty=function(){return this.x.isEmpty()},s.vertices=function(){return[new Se(this.x.lo,this.y.lo),new Se(this.x.hi,this.y.lo),new Se(this.x.hi,this.y.hi),new Se(this.x.lo,this.y.hi)]},s.vertexIJ=function(n,c){var f=this.x.lo;n==1&&(f=this.x.hi);var m=this.y.lo;return c==1&&(m=this.y.hi),new Se(f,m)},s.lo=function(){return new Se(this.x.lo,this.y.lo)},s.hi=function(){return new Se(this.x.hi,this.y.hi)},s.center=function(){return new Se(this.x.center(),this.y.center())},s.size=function(){return new Se(this.x.length(),this.y.length())},s.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},s.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},s.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},s.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},s.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},s.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},s.addPoint=function(n){return new x(this.x.addPoint(n.x),this.y.addPoint(n.y))},s.addRect=function(n){return new x(this.x.union(n.x),this.y.union(n.y))},s.clampPoint=function(n){return new Se(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},s.expanded=function(n){var c=this.x.expanded(n.x),f=this.y.expanded(n.y);return c.isEmpty()||f.isEmpty()?x.empty():new x(c,f)},s.expandedByMargin=function(n){return this.expanded(new Se(n,n))},s.union=function(n){return new x(this.x.union(n.x),this.y.union(n.y))},s.intersection=function(n){var c=this.x.intersection(n.x),f=this.y.intersection(n.y);return c.isEmpty()||f.isEmpty()?x.empty():new x(c,f)},s.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},s.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},x.fromPoints=function(){for(var n=arguments.length,c=new Array(n),f=0;fn.y?n.x>n.z?x.X_AXIS:x.Z_AXIS:n.y>n.z?x.Y_AXIS:x.Z_AXIS},s.smallestComponent=function(){var n=this.abs();return n.xn.x?1:this.yn.y?1:this.zn.z?1:0},x}();ne.X_AXIS=0;ne.Y_AXIS=1;ne.Z_AXIS=2;var Jd=function(){function x(a,n,c){this.x=a,this.y=n,this.z=c}x.fromVector=function(n){return new x(new Nr(n.x),new Nr(n.y),new Nr(n.z))};var s=x.prototype;return s.vector=function(){return new ne(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},s.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},s.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},s.norm2=function(){return this.dot(this)},s.isUnit=function(){return this.norm2().cmp(new Nr(1))===0},s.abs=function(){var n=this.x.mul(this.x.getSign()),c=this.y.mul(this.y.getSign()),f=this.z.mul(this.z.getSign());return new x(n,c,f)},s.add=function(n){return new x(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},s.sub=function(n){return new x(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},s.mul=function(n){return new x(this.x.mul(n),this.y.mul(n),this.z.mul(n))},s.mulByFloat64=function(n){return this.mul(new Nr(n))},s.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},s.cross=function(n){return new x(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},s.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?ne.X_AXIS:ne.Z_AXIS:n.y.cmp(n.z)>0?ne.Y_AXIS:ne.Z_AXIS},s.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?ne.X_AXIS:ne.Z_AXIS:n.y.cmp(n.z)<0?ne.Y_AXIS:ne.Z_AXIS},s.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},x}(),as=function(s,a){if(isNaN(s)||isNaN(a)||!isFinite(s)||a===0)return NaN;var n=s/a,c=Math.round(n);Math.abs(n-c)===.5&&(c=2*Math.round(n/2));var f=s-c*a;return f||Math.sign(s)*0},Rp=function(s,a){if(isNaN(s)||isNaN(a))return NaN;if(s===a)return a;if(s===0)return a>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),c=new DataView(n);c.setFloat64(0,s,!0);var f=c.getBigUint64(0,!0);return s>0==a>s?f+=1n:f-=1n,c.setBigUint64(0,f,!0),c.getFloat64(0,!0)},c0=function(s){var a=s&-s&0xffffffffffffffffn;if(a===0n)return 64;var n=Math.clz32(Number(a&0xffffffffn));if(n<32)return 31-n;var c=Math.clz32(Number(a>>32n&0xffffffffn));return 63-c},ty=function(s){var a=s&0xffffffffffffffffn;if(a===0n)return 64;var n=Math.clz32(Number(a>>32n&0xffffffffn));if(n<32)return 63-n;var c=Math.clz32(Number(a&0xffffffffn));return 31-c},pp=function(s,a){return s*Math.pow(2,a)},Gm=function(s){return isNaN(s)?NaN:s===0?-1/0:isFinite(s)?(s=Math.abs(s),sVh?Rn:s},ry=function(s,a){return Vp(s)?s:Math.max(0,Math.min(Vh,s+a))},Ah=function(s){return s<0?-1*Li:Op(s)?ey():2*Math.asin(.5*Math.sqrt(s))},Pu=function(){return 1/0},Op=function(s){return s==1/0},Vp=function(s){return s<0||Op(s)},y0=function(s){return s>=0&&s<=Vh||Vp(s)},_0=function(s){return s>=Vh?Pu():s<0?0:Rp(s,10)},v0=function(s){return s<=0?Eh:s>Vh?Rn:Rp(s,-10)},x0=function(s){return 4.5*Qa*s+16*Qa*Qa},b0=function(s){return Qa*s},Ga=function(s,a){return Ch(Ah(s)+Ah(a))},ny=function(s,a){if(a==0)return s;if(s<=a)return 0;var n=s*(1-.25*a),c=a*(1-.25*s);return Math.max(0,n+c-2*Math.sqrt(n*c))},Np=function(s){return Math.sqrt(jp(s))||0},jp=function(s){return s*(1-.25*s)||0},sy=function(s){return 1-.5*s||0},w0=function(s){return Np(s)/sy(s)||0},I0={__proto__:null,fromAngle:Ch,fromSquaredLength:cu,expanded:ry,angle:Ah,infChordAngle:Pu,isInfinity:Op,isSpecial:Vp,isValid:y0,successor:_0,predecessor:v0,maxPointError:x0,maxAngleError:b0,add:Ga,sub:ny,sin:Np,sin2:jp,cos:sy,tan:w0},_i=function(){function x(a,n){this.lo=a,this.hi=n}x.fromEndpoints=function(n,c){var f=new x(n,c);return n===-Math.PI&&c!==Math.PI&&(f.lo=Math.PI),c===-Math.PI&&n!==Math.PI&&(f.hi=Math.PI),f},x.fromPointPair=function(n,c){return n===-Math.PI&&(n=Math.PI),c===-Math.PI&&(c=Math.PI),x.positiveDistance(n,c)<=Math.PI?new x(n,c):new x(c,n)},x.emptyInterval=function(){return new x(Math.PI,-Math.PI)},x.fullInterval=function(){return new x(-Math.PI,Math.PI)};var s=x.prototype;return s.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},s.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},s.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},s.isInverted=function(){return this.lo>this.hi},s.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},s.invert=function(){return new x(this.hi,this.lo)},s.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},s.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},s.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},s.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},s.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},s.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||nthis.lo&&nthis.lo&&n.hithis.lo||n.hithis.lo&&n.hi=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},s.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lothis.lo:n.isInverted()?n.lothis.lo:n.lothis.lo||this.isFull()},x.positiveDistance=function(n,c){var f=c-n;return f>=0?f:c+Math.PI-(n-Math.PI)},s.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:x.fullInterval():new x(this.lo,n.hi):this.fastContains(n.hi)?new x(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:x.positiveDistance(n.hi,this.lo)Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new x(n,n):x.positiveDistance(n,this.lo)=0){if(this.isEmpty())return this;if(this.length()+2*n+2*Qa>=2*Math.PI)return x.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*Qa<=0)return x.emptyInterval()}var c=x.fromEndpoints(as(this.lo-n,2*Math.PI),as(this.hi+n,2*Math.PI));return c.lo<=-Math.PI&&(c.lo=Math.PI),c},s.approxEqual=function(n){return this.isEmpty()?n.length()<=2*Bo:n.isEmpty()?this.length()<=2*Bo:this.isFull()?n.length()>=2*(Math.PI-Bo):n.isFull()?this.length()>=2*(Math.PI-Bo):Math.abs(as(n.lo-this.lo,2*Math.PI))<=Bo&&Math.abs(as(n.hi-this.hi,2*Math.PI))<=Bo&&Math.abs(this.length()-n.length())<=2*Bo},s.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},s.complement=function(){return this.lo===this.hi?x.fullInterval():new x(this.hi,this.lo)},s.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},s.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var c=n.complementCenter();if(this.contains(c))return x.positiveDistance(n.hi,c);var f=0;x.fromEndpoints(n.hi,c).contains(this.hi)&&(f=x.positiveDistance(n.hi,this.hi));var m=0;return x.fromEndpoints(c,n.lo).contains(this.lo)&&(m=x.positiveDistance(this.lo,n.lo)),Math.max(f,m)},s.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var c=x.positiveDistance(n,this.lo),f=x.positiveDistance(this.hi,n);return c>1),a+(h[0]&1),n,c,f^Ha[0]),Rs(x,s+(h[1]>>1),a+(h[1]&1),n,c+1,f^Ha[1]),Rs(x,s+(h[2]>>1),a+(h[2]&1),n,c+2,f^Ha[2]),Rs(x,s+(h[3]>>1),a+(h[3]&1),n,c+3,f^Ha[3])}var P0=3,ly=6,Oe=30,Nh=2*Oe+1,_r=Number(1n<0},Vo=function(s,a,n){var c=yp(s,a,n);return c===hs&&(c=_p(s,a,n)),c},k0=function(s,a,n){var c=a.vector.sub(s.vector),f=c.norm2(),m=n.vector.sub(a.vector),h=m.norm2(),M=s.vector.sub(n.vector),L=M.norm2(),V,B,U;f>=h&&f>=L?(V=M,B=m,U=n.vector):h>=L?(V=c,B=M,U=s.vector):(V=m,B=c,U=a.vector);var ut=-V.cross(B).dot(U),vt=z0*Math.sqrt(V.norm2()*B.norm2());return ut>vt?al:ut<-vt?uu:hs},yp=function(s,a,n){var c=s.vector.cross(a.vector).dot(n.vector);return c>Xm?al:c<-Xm?uu:hs},_p=function(s,a,n){if(s.equals(a)||a.equals(n)||n.equals(s))return hs;var c=k0(s,a,n);return c!==hs?c:D0(s,a,n,!0)},D0=function(s,a,n,c){var f=al,m=s,h=a,M=n;if(m.vector.cmp(h.vector)>0){var L=[h,m];m=L[0],h=L[1],f=-f}if(h.vector.cmp(M.vector)>0){var V=[M,h];h=V[0],M=V[1],f=-f}if(m.vector.cmp(h.vector)>0){var B=[h,m];m=B[0],h=B[1],f=-f}var U=Jd.fromVector(m.vector),ut=Jd.fromVector(h.vector),vt=Jd.fromVector(M.vector),Tt=ut.cross(vt),Vt=U.dot(Tt),jt=Vt.getSign();return jt===hs&&c&&(jt=L0(U,ut,vt,Tt)),f*jt},L0=function(s,a,n,c){var f=c.z.getSign();return f!==0||(f=c.y.getSign(),f!==0)||(f=c.x.getSign(),f!==0)||(f=n.x.mul(s.y).sub(n.y.mul(s.x)).getSign(),f!==0)||(f=n.x.getSign(),f!==0)||(f=-n.y.getSign(),f!==0)||(f=n.z.mul(s.x).sub(n.x.mul(s.z)).getSign(),f!==0)||(f=n.z.getSign(),f!==0)||(f=s.x.mul(a.y).sub(s.y.mul(a.x)).getSign(),f!==0)||(f=-a.x.getSign(),f!==0)||(f=a.y.getSign(),f!==0)||(f=s.x.getSign(),f!==0)?f:al},gt=function(){function x(a,n,c){this.vector=new ne(a,n,c)}x.fromVector=function(n){return new x(n.x,n.y,n.z)},x.fromLatLng=function(n){var c=n.lat,f=n.lng,m=Math.cos(c);return new x(Math.cos(f)*m,Math.sin(f)*m,Math.sin(c))},x.fromCoords=function(n,c,f){return n===0&&c===0&&f===0?this.originPoint():x.fromVector(new ne(n,c,f).normalize())},x.originPoint=function(){return new x(-.00999946643502502,.002592454260932412,.999946643502502)};var s=x.prototype;return s.pointCross=function(n){var c=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return c.x===0&&c.y===0&&c.z===0&&(c=this.vector.ortho()),x.fromVector(c)},x.orderedCCW=function(n,c,f,m){var h=0;return Vo(c,m,n)!==uu&&h++,Vo(f,m,c)!==uu&&h++,Vo(n,m,f)===al&&h++,h>=2},s.distance=function(n){return this.vector.angle(n.vector)},s.equals=function(n){return this.vector.equals(n.vector)},s.approxEqual=function(n,c){return c===void 0&&(c=cy),this.vector.angle(n.vector)<=c},s.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},x.chordAngleBetweenPoints=function(n,c){return Math.min(4,n.vector.sub(c.vector).norm2())},x.regularPoints=function(n,c,f){return this.regularPointsForFrame(qp(n),c,f)},x.regularPointsForFrame=function(n,c,f){for(var m=Math.cos(c),h=Math.sin(c),M=2*Math.PI/f,L=[],V=0;VWm?1:s/Wm},tn=function(s){return s>=.5?1/3*(4*s*s-1):1/3*(1-4*(1-s)*(1-s))},Bn=function(s){return s>=0?.5*Math.sqrt(1+3*s):1-.5*Math.sqrt(1-3*s)},kh=function(s){var a=s.largestComponent();switch(a){case ne.X_AXIS:s.x<0&&(a+=3);break;case ne.Y_AXIS:s.y<0&&(a+=3);break;case ne.Z_AXIS:s.z<0&&(a+=3);break}return a},qo=function(s,a){switch(s){case 0:return[a.y/a.x,a.z/a.x];case 1:return[-a.x/a.y,a.z/a.y];case 2:return[-a.x/a.z,-a.y/a.z];case 3:return[a.z/a.x,a.y/a.x];case 4:return[a.z/a.y,-a.x/a.y];default:return[-a.y/a.z,-a.x/a.z]}},du=function(s){var a=kh(s),n=qo(a,s),c=n[0],f=n[1];return[a,c,f]},On=function(s,a,n){switch(s){case 0:return new ne(1,a,n);case 1:return new ne(-a,1,n);case 2:return new ne(-a,-n,1);case 3:return new ne(-1,-n,-a);case 4:return new ne(n,-1,-a);default:return new ne(n,a,-1)}},B0=function(s,a){switch(s){case 0:if(a.x<=0)return[0,0,!1];break;case 1:if(a.y<=0)return[0,0,!1];break;case 2:if(a.z<=0)return[0,0,!1];break;case 3:if(a.x>=0)return[0,0,!1];break;case 4:if(a.y>=0)return[0,0,!1];break;default:if(a.z>=0)return[0,0,!1];break}var n=qo(s,a.vector),c=n[0],f=n[1];return[c,f,!0]},Ns=function(s,a){switch(s){case 0:return new gt(a.y,a.z,a.x);case 1:return new gt(-a.x,a.z,a.y);case 2:return new gt(-a.x,-a.y,a.z);case 3:return new gt(-a.z,-a.y,-a.x);case 4:return new gt(-a.z,a.x,-a.y);default:return new gt(a.y,a.x,-a.z)}},ru=function(s,a,n){return gt.fromVector(On(s,tn(Os(a)),tn(Os(n))))},Hm=function(s,a){switch(s){case 0:return new ne(a,-1,0);case 1:return new ne(1,a,0);case 2:return new ne(1,0,a);case 3:return new ne(-a,0,1);case 4:return new ne(0,-a,1);default:return new ne(0,-1,-a)}},Km=function(s,a){switch(s){case 0:return new ne(-a,0,1);case 1:return new ne(0,-a,1);case 2:return new ne(0,-1,-a);case 3:return new ne(a,-1,0);case 4:return new ne(1,a,0);default:return new ne(1,0,a)}},F0=[[new gt(0,1,0),new gt(0,0,1),new gt(1,0,0)],[new gt(-1,0,0),new gt(0,0,1),new gt(0,1,0)],[new gt(-1,0,0),new gt(0,-1,0),new gt(0,0,1)],[new gt(0,0,-1),new gt(0,-1,0),new gt(-1,0,0)],[new gt(0,0,-1),new gt(1,0,0),new gt(0,-1,0)],[new gt(0,1,0),new gt(1,0,0),new gt(0,0,-1)]],R0=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],uy=function(s,a){return F0[s][a]},pu=function(s,a,n){return R0[s][a][n]},O0=function(s){return uy(s,0)},V0=function(s){return uy(s,1)},vp=Math.PI/2*Li,Jm=-vp,Ue=function(){function x(a,n){this.lat=a,this.lng=n}x.fromDegrees=function(n,c){return new x(n*dp,c*dp)},x.latitude=function(n){var c=n.vector;return Math.atan2(c.z,Math.sqrt(c.x*c.x+c.y*c.y))},x.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},x.fromPoint=function(n){return new x(this.latitude(n),this.longitude(n))};var s=x.prototype;return s.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},s.normalized=function(){var n=this.lat;n>vp?n=vp:nn?n:s},N0=function(s){for(var a=s,n=arguments.length,c=new Array(n>1?n-1:0),f=1;fa&&(a=M)}return a},j0=function(s){for(var a=s,n=arguments.length,c=new Array(n>1?n-1:0),f=1;f1?a-1:0),c=1;c1?a-1:0),c=1;c>BigInt(Nh))},U0=function(s){return s&~0n>>BigInt(P0)},Ki=function(s){return Oe-(c0(s)>>>1)},Ye=function(s,a){var n=Zo(a);return s&-n|n},$p=function(s){var a=ci(s)<<2n;return s&-a|a},jh=function(s){return(s&Zo(0)-1n)===0n},fu=function(s){return typeof s!="bigint"||BigInt.asUintN(64,s)!=s?!1:Fn(s)<=ly&&(ci(s)&0x1555555555555555n)!=0n},Zp=function(s){return(s&1n)!=0n},ci=function(s){return s&-s},Zo=function(s){return 1n<>2n),n>>=1n,a[1]=a[0]+n,a[2]=a[1]+n,a[3]=a[2]+n,a},dy=function(s,a){var n=[],c=$s(s),f=c.f,m=c.i,h=c.j,M=ur(Ki(s));m&=-M,h&=-M;for(var L=ur(a),V=-L;;V+=L){var B=void 0;if(V<0?B=h+V>=0:V>=M?B=h+V<_r:(B=!0,n.push(Ye(Vs(f,m+V,h-L,h-M>=0),a)),n.push(Ye(Vs(f,m+V,h+M,h+M<_r),a))),n.push(Ye(Vs(f,m-L,h+V,B&&m-M>=0),a)),n.push(Ye(Vs(f,m+M,h+V,B&&m+M<_r),a)),V>=M)break}return n},Re=function(s){return s-(ci(s)-1n)},Fe=function(s){return s+(ci(s)-1n)},jo=function(s,a){return Re(s)<=a&&a<=Fe(s)},py=function(s,a){return Re(a)<=Fe(s)&&Fe(a)>=Re(s)},q0=function(s){var a=s.toString(16).replace(/0+$/,"");return a.length===0?"X":a},$0=function(s){if(s.length>16)return 0n;var a=BigInt("0x"+s);return s.length<16&&(a=a<Oe)return 0n;var n=parseInt(s[0],10);if(n<0||n>5||s[1]!=="/")return 0n;for(var c=ll(n),f=2;f3)return 0n;c=Uh(c)[m]}return c},G0=function(s,a,n){return Ye((BigInt(s)<=0;m--){var h=(1<>m*yr&h)<>m*yr&h)<<2,f=ay[f],c|=BigInt(f>>2)<=0;h--)n+=Number((s>>BigInt(h*2*yr+1)&(1n<>yr+2<>2&(1<>2n)&1n)!=0n&&(m=2),{face:n,si:2*c+m,ti:2*f+m}},Mu=function(s,a,n){var c=ur(n),f=s&-c,m=a&-c;return new oi(new Ae(tn(Ka(f)),tn(Ka(f+c))),new Ae(tn(Ka(m)),tn(Ka(m+c))))},Zh=function(s){var a=Gp(s),n=a.face,c=a.si,f=a.ti;return ru(n,c,f).vector},Xp=function(s){return gt.fromVector(Zh(s).normalize())},W0=function(s){return Ue.fromPoint(gt.fromVector(Zh(s)))},H0=function(s){var a=Ki(s),n=ur(a),c=$s(s),f=c.f,m=c.i,h=c.j;return[Ye(Ja(f,m,h-n),a),Ye(Ja(f,m+n,h),a),Ye(Ja(f,m,h+n),a),Ye(Ja(f,m-n,h),a)]},yy=function(s,a){var n=ur(a+1),c=n<<1,f=$s(s),m=f.f,h=f.i,M=f.j,L=!1,V=!1,B=0,U=0;h&n?(B=c,L=h+c<_r):(B=-c,L=h-c>=0),M&n?(U=c,V=M+c<_r):(U=-c,V=M-c>=0);var ut=[Ye(s,a),Ye(Vs(m,h+B,M,L),a),Ye(Vs(m,h,M+U,V),a)];return(L||V)&&ut.push(Ye(Vs(m,h+B,M+U,L&&V),a)),ut},Wp=function(s){var a=ci(s);return s-a+(a>>2n)},Eu=function(s,a){return s-ci(s)+Zo(a)},_y=function(s){var a=ci(s);return s+a+(a>>2n)},Hp=function(s,a){return s+ci(s)+Zo(a)},xr=function(s){return s+(ci(s)<<1n)},vy=function(s){return s-(ci(s)<<1n)},K0=function(s){var a=xr(s);return a60?[0,!1]:[60-c>>1,!0]},Ip=function(s,a){var n=Re(s);if(n>=Re(a))return a;if(Fe(s)>=a){for(;s=Uh(s)[0],!(Fe(s)=a)break;s=c}return s},Y0=function(s,a){if(a===0n)return s;var n=BigInt(2*(Oe-Ki(s))+1);if(a<0n){var c=-(s>>n);a>n;a>f&&(a=f)}return s+(a<a?1:0},Q0=function(s,a){return s>a?-1:sf&&n.vector.dot(this.aTangent.vector)>f||this.c.vector.dot(this.bTangent.vector)>f&&n.vector.dot(this.bTangent.vector)>f)return this.c=n,this.acb=-c,Vr;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-c,mu;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-c,Vr;if(this.acb===hs&&(this.acb=-_p(this.a,this.b,this.c)),c===hs&&(c=_p(this.a,this.b,n)),c!==this.acb)return this.c=n,this.acb=-c,Vr;var m=-Vo(this.c,n,this.b);if(m!==this.acb)return this.c=n,this.acb=-c,Vr;var h=Vo(this.c,n,this.a);return h!==this.acb?(this.c=n,this.acb=-c,Vr):(this.c=n,this.acb=-c,mn)},x}(),mn=0,mu=1,Vr=2,ex=function(s,a,n,c){var f=jr.newChainEdgeCrosser(s,a,n);return f.chainCrossingSign(c)},xy=function(s,a,n,c){if(s.equals(a)||n.equals(c))return!1;switch(!0){case s.equals(n):return a.equals(c)||gt.orderedCCW(s.referenceDir(),c,a,s);case a.equals(c):return gt.orderedCCW(a.referenceDir(),n,s,a);case s.equals(c):return a.equals(n)||gt.orderedCCW(s.referenceDir(),n,a,s);case a.equals(n):return gt.orderedCCW(a.referenceDir(),c,s,a)}return!1},ix=function(s,a,n){return!gt.orderedCCW(a.referenceDir(),n,s,a)},Pe=function(){function x(a,n){this.lat=a,this.lng=n}x.emptyRect=function(){return new x(Ae.empty(),_i.emptyInterval())},x.fullRect=function(){return new x(x.validRectLatRange,x.validRectLngRange)},x.fromLatLng=function(n){return new x(new Ae(Rr(n.lat),Rr(n.lat)),new _i(Rr(n.lng),Rr(n.lng)))},x.fromCenterSize=function(n,c){var f=new Ue(c.lat/2,c.lng/2);return x.fromLatLng(n).expanded(f)};var s=x.prototype;return s.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},s.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},s.isEmpty=function(){return this.lat.isEmpty()},s.isFull=function(){return this.lat.equals(x.validRectLatRange)&&this.lng.isFull()},s.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},s.vertex=function(n){var c,f;switch(n){case 0:c=this.lat.lo,f=this.lng.lo;break;case 1:c=this.lat.lo,f=this.lng.hi;break;case 2:c=this.lat.hi,f=this.lng.hi;break;default:c=this.lat.hi,f=this.lng.lo;break}return new Ue(c*Li,f*Li)},s.lo=function(){return new Ue(this.lat.lo*Li,this.lng.lo*Li)},s.hi=function(){return new Ue(this.lat.hi*Li,this.lng.hi*Li)},s.center=function(){return new Ue(this.lat.center()*Li,this.lng.center()*Li)},s.size=function(){return new Ue(this.lat.length()*Li,this.lng.length()*Li)},s.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},s.addPoint=function(n){return n.isValid()?new x(this.lat.addPoint(Rr(n.lat)),this.lng.addPoint(Rr(n.lng))):this},s.expanded=function(n){var c=this.lat.expanded(Rr(n.lat)),f=this.lng.expanded(Rr(n.lng));return c.isEmpty()||f.isEmpty()?x.emptyRect():new x(c.intersection(x.validRectLatRange),f)},s.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},s.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new x(this.lat,_i.fullInterval()):this},s.union=function(n){return new x(this.lat.union(n.lat),this.lng.union(n.lng))},s.intersection=function(n){var c=this.lat.intersection(n.lat),f=this.lng.intersection(n.lng);return c.isEmpty()||f.isEmpty()?x.emptyRect():new x(c,f)},s.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},s.capBound=function(){if(this.isEmpty())return js.emptyCap();var n,c;this.lat.hi+this.lat.lo<0?(n=-1,c=Math.PI/2+this.lat.hi):(n=1,c=Math.PI/2-this.lat.lo);var f=js.fromCenterAngle(new gt(0,0,n),c*Li);if(as(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var m=js.fromPoint(gt.fromLatLng(this.center())).addPoint(gt.fromLatLng(this.lo())).addPoint(gt.fromLatLng(this.hi()));if(m.height()=h.z)return!1;var L=M/h.z,V=Math.sqrt(1-L*L),B=Math.atan2(V,L),U=_i.fromPointPair(Math.atan2(s.vector.dot(m),s.vector.dot(h)),Math.atan2(a.vector.dot(m),a.vector.dot(h)));if(U.contains(B)){var ut=h.mul(L).add(m.mul(V));if(c.contains(Math.atan2(ut.y,ut.x)))return!0}if(U.contains(-B)){var vt=h.mul(L).sub(m.mul(V));if(c.contains(Math.atan2(vt.y,vt.x)))return!0}return!1},Qm=function(s,a,n,c){return ex(s,a,gt.fromLatLng(new Ue(n.lo,c)),gt.fromLatLng(new Ue(n.hi,c)))===mn},Kp=function(){function x(a,n){this.dim=a,this.deriv=n}var s=x.prototype;return s.value=function(n){return pp(this.deriv,-this.dim*n)},s.minLevel=function(n){if(n<=0)return Oe;var c=-(Gm(n/this.deriv)>>this.dim-1);return c>Oe&&(c=Oe),c<0&&(c=0),c||0},s.maxLevel=function(n){if(n<=0)return Oe;var c=Gm(this.deriv/n)>>this.dim-1;return c>Oe&&(c=Oe),c<0&&(c=0),c||0},s.closestLevel=function(n){var c=Math.SQRT2;return this.dim===2&&(c=2),this.minLevel(c*n)},x}(),Sp=new Kp(1,2*Math.SQRT2/3),rx=new Kp(1,1.4592137463861061),Pp=new Kp(2,4*Math.PI/6),nx=function(s,a,n){return Ah(Jp(s,a,n,0,!0).dist)},tp=function(s,a,n,c){return Jp(s,a,n,c,!1)},tg=function(s,a,n,c){var f=bp(gt.chordAngleBetweenPoints(s,a),gt.chordAngleBetweenPoints(s,n));if(f>Th){var m=Jp(gt.fromVector(s.vector.mul(-1)),a,n,f,!0);f=m.dist,f=Rn-f}return c=c?{dist:c,less:!1}:{dist:B,less:!0}},ox=function(s,a,n,c,f){var m=s.vector.sub(a.vector).norm2(),h=s.vector.sub(n.vector).norm2(),M=a.vector.sub(n.vector).norm2(),L=4.75*Ge*(m+h+M)+8*Ge*Ge;if(Math.abs(m-h)>=M+L)return{dist:c,less:!1};var V=a.pointCross(n),B=V.vector.norm2(),U=s.vector.dot(V.vector),ut=U*U;if(!f&&ut>B*c)return{dist:c,less:!1};var vt=V.vector.cross(s.vector);if(a.vector.sub(s.vector).dot(vt)>=0||n.vector.sub(s.vector).dot(vt)<=0)return{dist:c,less:!1};var Tt=1-Math.sqrt(vt.norm2()/B),Vt=ut/B+Tt*Tt;return!f&&Vt>=c?{dist:c,less:!1}:{dist:Vt,less:!0}},eg=gt.fromCoords(1,0,0),js=function(){function x(a,n){this.center=a,this.rad=n}x.fromPoint=function(n){return x.fromCenterChordAngle(n,0)},x.fromCenterAngle=function(n,c){return x.fromCenterChordAngle(n,Ch(c))},x.fromCenterChordAngle=function(n,c){return new x(n,c)},x.fromCenterHeight=function(n,c){return x.fromCenterChordAngle(n,cu(2*c))},x.fromCenterArea=function(n,c){return x.fromCenterChordAngle(n,cu(c/Math.PI))},x.fromCap=function(n){return new x(gt.fromVector(n.center.vector),n.rad)},x.emptyCap=function(){return x.fromCenterChordAngle(eg,Eh)},x.fullCap=function(){return x.fromCenterChordAngle(eg,Rn)};var s=x.prototype;return s.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Rn},s.isEmpty=function(){return this.rad<0},s.isFull=function(){return this.rad==Rn},s.centerPoint=function(){return this.center},s.height=function(){return .5*this.rad},s.radius=function(){return Ah(this.rad)},s.area=function(){return 2*Math.PI*Math.max(0,this.height())},s.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=Ga(gt.chordAngleBetweenPoints(this.center,n.center),n.rad)},s.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:Ga(this.rad,n.rad)>=gt.chordAngleBetweenPoints(this.center,n.center)},s.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:Ga(this.rad,n.rad)>gt.chordAngleBetweenPoints(this.center,n.center)},s.intersectsCell=function(n){for(var c=[],f=0;f<4;f++)if(c[f]=n.vertex(f),this.containsPoint(c[f]))return!0;return this._intersects(n,c)},s._intersects=function(n,c){if(this.rad>=Th||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var f=jp(this.rad),m=0;m<4;m++){var h=n.edge(m).vector,M=this.center.vector.dot(h);if(!(M>0)){if(M*M>f*h.norm2())return!1;var L=h.cross(this.center.vector);if(L.dot(c[m].vector)<0&&L.dot(c[m+1&3].vector)>0)return!0}}return!1},s.containsPoint=function(n){return gt.chordAngleBetweenPoints(this.center,n)<=this.rad},s.containsCell=function(n){for(var c=[],f=0;f<4;f++)if(c[f]=n.vertex(f),!this.containsPoint(c[f]))return!1;return!this.complement()._intersects(n,c)},s.interiorContainsPoint=function(n){return this.isFull()||gt.chordAngleBetweenPoints(this.center,n)=Math.PI/2&&(f.hi=Math.PI/2,c=!0),!c){var h=Np(this.rad),M=Math.cos(Ue.latitude(this.center));if(h<=M){var L=Math.asin(h/M);m.lo=as(Ue.longitude(this.center)-L,Math.PI*2),m.hi=as(Ue.longitude(this.center)+L,Math.PI*2)}}return new Pe(f,m)},s.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},s.approxEqual=function(n){var c=1e-14,f=this.rad,m=n.rad;return this.center.approxEqual(n.center)&&Math.abs(f-m)<=c||this.isEmpty()&&m<=c||n.isEmpty()&&f<=c||this.isFull()&&m>=2-c||n.isFull()&&f>=2-c},s.addPoint=function(n){if(this.isEmpty())return new x(n,0);var c=gt.chordAngleBetweenPoints(this.center,n);return c>this.rad&&(this.rad=c),this},s.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var c=Ga(gt.chordAngleBetweenPoints(this.center,n.center),n.rad),f=ry(c,Ge*c);return f>this.rad&&(this.rad=f),this},s.expanded=function(n){return this.isEmpty()?x.emptyCap():x.fromCenterChordAngle(this.center,Ga(this.rad,Ch(n)))},s.toString=function(){return"[Center="+this.center.vector+", Radius="+ol(this.radius())+"]"},x.radiusToHeight=function(n){return n<0?Eh:n>=Math.PI?Th:.5*Ch(n)},s.cellUnionBound=function(){var n=Sp.maxLevel(this.radius())-1;if(n<0){for(var c=[],f=0;f<6;f++)c[f]=ll(f);return c}return yy(qh(this.center),n)},s.centroid=function(){if(this.isEmpty())return new gt(0,0,0);var n=1-.5*this.height();return gt.fromVector(this.center.vector.mul(n*this.area()))},s.union=function(n){var c=this;if(c.rad=M+h)return c;var L=.5*(M+m+h),V=by(.5*(M-m+h),c.center,n.center);return x.fromCenterAngle(V,L)},x}(),Mp=function(s,a,n){var c=a.stableAngle(n),f=n.stableAngle(s),m=s.stableAngle(a),h=.5*(c+f+m);if(h>=3e-4){var M=h-Math.max(c,f,m);if(M<.01*h*h*h*h*h){var L=ax(s,a,n);if(M>1,V=M&1;L===1?(h.uv.x.hi=this.uv.x.hi,h.uv.x.lo=c.x):(h.uv.x.lo=this.uv.x.lo,h.uv.x.hi=c.x),V===1?(h.uv.y.hi=this.uv.y.hi,h.uv.y.lo=c.y):(h.uv.y.lo=this.uv.y.lo,h.uv.y.hi=c.y),f=xr(f),n.push(h)}return n},s.exactArea=function(){var n=this.vertex(0),c=this.vertex(1),f=this.vertex(2),m=this.vertex(3);return Mp(n,c,f)+Mp(n,f,m)},s.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},s.averageArea=function(){return Pp.value(this.level)},s.intersectsCell=function(n){return py(this.id,n.id)},s.containsCell=function(n){return jo(this.id,n.id)},s.cellUnionBound=function(){return this.capBound().cellUnionBound()},s.latitude=function(n,c){var f,m;switch(!0){case(n===0&&c===0):f=this.uv.x.lo,m=this.uv.y.lo;break;case(n===0&&c===1):f=this.uv.x.lo,m=this.uv.y.hi;break;case(n===1&&c===0):f=this.uv.x.hi,m=this.uv.y.lo;break;case(n===1&&c===1):f=this.uv.x.hi,m=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return Ue.latitude(gt.fromVector(On(this.face,f,m)))},s.longitude=function(n,c){var f,m;switch(!0){case(n===0&&c===0):f=this.uv.x.lo,m=this.uv.y.lo;break;case(n===0&&c===1):f=this.uv.x.lo,m=this.uv.y.hi;break;case(n===1&&c===0):f=this.uv.x.hi,m=this.uv.y.lo;break;case(n===1&&c===1):f=this.uv.x.hi,m=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return Ue.longitude(gt.fromVector(On(this.face,f,m)))},s.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,c=this.uv.y.lo+this.uv.y.hi,f,m;O0(this.face).z===0?f=n<0?1:0:f=n>0?1:0,V0(this.face).z===0?m=c<0?1:0:m=c>0?1:0;var h=Ae.fromPoint(this.latitude(f,m)).addPoint(this.latitude(1-f,1-m)),M=_i.emptyInterval().addPoint(this.longitude(f,1-m)).addPoint(this.longitude(1-f,m));return new Pe(h,M).expanded(new Ue(2*Ge,2*Ge)).polarClosure()}var L;switch(this.face){case 0:L=new Pe(new Ae(-Math.PI/4,Math.PI/4),new _i(-Math.PI/4,Math.PI/4));break;case 1:L=new Pe(new Ae(-Math.PI/4,Math.PI/4),new _i(Math.PI/4,3*Math.PI/4));break;case 2:L=new Pe(new Ae(rg,Math.PI/2),_i.fullInterval());break;case 3:L=new Pe(new Ae(-Math.PI/4,Math.PI/4),new _i(3*Math.PI/4,-3*Math.PI/4));break;case 4:L=new Pe(new Ae(-Math.PI/4,Math.PI/4),new _i(-3*Math.PI/4,-Math.PI/4));break;default:L=new Pe(new Ae(-Math.PI/2,-rg),_i.fullInterval())}return L.expanded(new Ue(Ge,0))},s.capBound=function(){for(var n=js.fromPoint(gt.fromVector(On(this.face,this.uv.center().x,this.uv.center().y).normalize())),c=0;c<4;c++)n=n.addPoint(this.vertex(c));return n},s.containsPoint=function(n){var c=B0(this.face,n),f=c[0],m=c[1],h=c[2];return h?this.uv.expandedByMargin(Ge).containsPoint(new Se(f,m)):!1},s.vertexChordDist2=function(n,c,f){var m=this.uv.x.lo,h=this.uv.y.lo;return c&&(m=this.uv.x.hi),f&&(h=this.uv.y.hi),gt.chordAngleBetweenPoints(n,gt.fromCoords(m,h,1))},s.uEdgeIsClosest=function(n,c){var f=this.uv.x.lo,m=this.uv.x.hi,h=this.uv.y.lo;c&&(h=this.uv.y.hi);var M=new ne(h*h+1,-f*h,-f),L=new ne(h*h+1,-m*h,-m);return n.vector.dot(M)>0&&n.vector.dot(L)<0},s.vEdgeIsClosest=function(n,c){var f=this.uv.y.lo,m=this.uv.y.hi,h=this.uv.x.lo;c&&(h=this.uv.x.hi);var M=new ne(-h*f,h*h+1,-f),L=new ne(-h*m,h*h+1,-m);return n.vector.dot(M)>0&&n.vector.dot(L)<0},x.edgeDistance=function(n,c){var f=n*n/(1+c*c),m=1-Math.sqrt(1-f);return cu(f+m*m)},s.distanceInternal=function(n,c){var f=Ns(this.face,n),m=f.x-f.z*this.uv.x.lo,h=f.x-f.z*this.uv.x.hi,M=f.y-f.z*this.uv.y.lo,L=f.y-f.z*this.uv.y.hi,V=!0;return m<0&&(V=!1,this.vEdgeIsClosest(f,!1))?x.edgeDistance(-m,this.uv.x.lo):h>0&&(V=!1,this.vEdgeIsClosest(f,!0))?x.edgeDistance(h,this.uv.x.hi):M<0&&(V=!1,this.uEdgeIsClosest(f,!1))?x.edgeDistance(-M,this.uv.y.lo):L>0&&(V=!1,this.uEdgeIsClosest(f,!0))?x.edgeDistance(L,this.uv.y.hi):V?c?0:Qd(x.edgeDistance(-m,this.uv.x.lo),x.edgeDistance(h,this.uv.x.hi),x.edgeDistance(-M,this.uv.y.lo),x.edgeDistance(L,this.uv.y.hi)):Qd(this.vertexChordDist2(f,!1,!1),this.vertexChordDist2(f,!0,!1),this.vertexChordDist2(f,!1,!0),this.vertexChordDist2(f,!0,!0))},s.distance=function(n){return this.distanceInternal(n,!0)},s.maxDistance=function(n){var c=Ns(this.face,n),f=bp(this.vertexChordDist2(c,!1,!1),this.vertexChordDist2(c,!0,!1),this.vertexChordDist2(c,!1,!0),this.vertexChordDist2(c,!0,!0));return f<=Th?f:Rn-this.distance(gt.fromVector(n.vector.mul(-1)))},s.boundaryDistance=function(n){return this.distanceInternal(n,!1)},s.distanceToEdge=function(n,c){var f=Qd(this.distance(n),this.distance(c));if(f===0)return f;for(var m=jr.newChainEdgeCrosser(n,c,this.vertex(3)),h=0;h<4;h++)if(m.chainCrossingSign(this.vertex(h))!==Vr)return 0;for(var M=0;M<4;M++)f=tp(this.vertex(M),n,c,f).dist;return f},s.maxDistanceToEdge=function(n,c){var f=bp(this.maxDistance(n),this.maxDistance(c));return f<=Th?f:Rn-this.distanceToEdge(gt.fromVector(n.vector.mul(-1)),gt.fromVector(c.vector.mul(-1)))},s.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var c=[],f=[],m=0;m<4;m++)c.push(this.vertex(m)),f.push(n.vertex(m));for(var h=Pu(),M=0;M<4;M++)for(var L=0;L<4;L++)h=tp(c[M],f[L],f[L+1&3],h).dist,h=tp(f[M],c[L],c[L+1&3],h).dist;return h},s.maxDistanceToCell=function(n){var c=new oi(n.uv.y,n.uv.x);if(this.face===x.oppositeFace(n.face)&&this.uv.intersects(c))return Rn;for(var f=[],m=[],h=0;h<4;h++)f.push(this.vertex(h)),m.push(n.vertex(h));for(var M=Eh,L=0;L<4;L++)for(var V=0;V<4;V++)M=tg(f[L],m[V],m[V+1&3],M).dist,M=tg(m[L],f[V],f[V+1&3],M).dist;return M},x}(),rl=function(x){function s(){return x.apply(this,arguments)||this}Oh(s,x),s.fromRange=function(c,f){for(var m=new s,h=Ip(c,f);h!==f;h=Ip(xr(h),f))m.push(h);return m},s.fromUnion=function(){for(var c=new s,f=arguments.length,m=new Array(f),h=0;hV?c[h]<=Fe(f[M])?(m.push(c[h]),h++):(M=f.lowerBound(M+1,f.length,L),c[h]<=Fe(f[M-1])&&M--):V>L?f[M]<=Fe(c[h])?(m.push(f[M]),M++):(h=c.lowerBound(h+1,c.length,V),f[M]<=Fe(c[h-1])&&h--):c[h]0&&Fe(this[c-1])>=Re(f))return!1}return!0},a.isNormalized=function(){for(var c=0;c0&&Fe(this[c-1])>=Re(f)||c>=3&&s.areSiblings(this[c-3],this[c-2],this[c-1],f))return!1}return!0},a.normalize=function(){this.sort(Cp);for(var c=[],f=Gt(this),m;!(m=f()).done;){var h=m.value;if(!(c.length>0&&jo(c[c.length-1],h))){for(var M=c.length-1;M>=0&&jo(h,c[M]);)M--;for(c.length=M+1;c.length>=3&&s.areSiblings(c[c.length-3],c[c.length-2],c[c.length-1],h);)c.length-=3,h=$p(h);c.push(h)}}this.length=0,this.push.apply(this,c)},a.intersectsCellID=function(c){var f=this.lowerBound(0,this.length,c);return f!==this.length&&Re(this[f])<=Fe(c)?!0:f!==0&&Fe(this[f-1])>=Re(c)},a.containsCellID=function(c){var f=this.lowerBound(0,this.length,c);return f!==this.length&&Re(this[f])<=c?!0:f!==0&&Fe(this[f-1])>=c},a.denormalize=function(c,f){for(var m=new s,h=Gt(this),M;!(M=h()).done;){var L=M.value,V=Ki(L),B=V;if(B1&&(B+=(Oe-(B-c))%f,B>Oe&&(B=Oe)),B===V)m.push(L);else for(var U=Hp(L,B),ut=Eu(L,B);ut!==U;ut=xr(ut))m.push(ut)}this.length=0,this.push.apply(this,m)},a.rectBound=function(){for(var c=Pe.emptyRect(),f=Gt(this),m;!(m=f()).done;){var h=m.value;c=c.union(os.fromCellID(h).rectBound())}return c},a.capBound=function(){if(this.length===0)return js.emptyCap();for(var c=new gt(0,0,0),f=Gt(this),m;!(m=f()).done;){var h=m.value,M=Pp.value(Ki(h));c=gt.fromVector(c.vector.add(Xp(h).vector.mul(M)))}c.equals(new gt(0,0,0))?c=gt.fromCoords(1,0,0):c=gt.fromVector(c.vector.normalize());for(var L=js.fromPoint(c),V=Gt(this),B;!(B=V()).done;){var U=B.value;L=L.addCap(os.fromCellID(U).capBound())}return L},a.containsCell=function(c){return this.containsCellID(c.id)},a.intersectsCell=function(c){return this.intersectsCellID(c.id)},a.containsPoint=function(c){return this.containsCell(os.fromPoint(c))},a.cellUnionBound=function(){return this.capBound().cellUnionBound()},a.leafCellsCovered=function(){for(var c=0n,f=Gt(this),m;!(m=f()).done;){var h=m.value;c+=1n<=m)return h;return f},a.cellUnionDifferenceInternal=function(c,f){if(!f.intersectsCellID(c)){this.push(c);return}if(!f.containsCellID(c))for(var m=Gt(Uh(c)),h;!(h=m()).done;){var M=h.value;this.cellUnionDifferenceInternal(M,f)}},a.expandAtLevel=function(c){for(var f=new s,m=Zo(c),h=this.length-1;h>=0;h--){var M=this[h];if(ci(M)0&&jo(M,this[h-1]);)h--;f.push(M),f.push.apply(f,dy(M,c))}f.sort(Cp),this.length=0,this.push.apply(this,f),this.normalize()},a.expandByRadius=function(c,f){for(var m=Oe,h=Gt(this),M;!(M=h()).done;){var L=M.value;m=Math.min(m,Ki(L))}var V=Sp.maxLevel(c);V===0&&c>Sp.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(m+f,V))},a.equals=function(c){if(this.length!==c.length)return!1;for(var f=0;f=Math.PI-2*Ge&&(h=_i.fullInterval());var M=Ae.fromPoint(this.aLL.lat).addPoint(c.lat),L=f.cross(new ne(0,0,1)),V=L.dot(this.a.vector),B=L.dot(n.vector),U=606638e-21*m+683174e-36;if(V*B<0||Math.abs(V)<=U||Math.abs(B)<=U){var ut=Math.min(Math.atan2(Math.sqrt(f.x*f.x+f.y*f.y),Math.abs(f.z))+3*Ge,Math.PI/2),vt=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(ut)),Tt=.5*(vt-M.length())+Ge;V<=U&&B>=-U&&(M.hi=Math.min(ut,M.hi+Tt)),B<=U&&V>=-U&&(M.lo=Math.max(-ut,M.lo-Tt))}this.a=n,this.aLL=c,this.bound=this.bound.union(new Pe(M,h))},s.rectBound=function(){return this.bound.expanded(new Ue(2*Ge,0)).polarClosure()},x}();nl.expandForSubregions=function(x){if(x.isEmpty())return x;var s=Math.max(0,Math.PI-x.lng.length()-2.5*Ge),a=Math.max(x.lat.lo,-x.lat.hi),n=Math.PI/2+x.lat.lo,c=Math.PI/2-x.lat.hi;if(a>=0){if(2*a+s<1354e-18)return Pe.fullRect()}else if(s>=Math.PI/2){if(n+c<1687e-18)return Pe.fullRect()}else if(Math.max(n,c)*s<1765e-18)return Pe.fullRect();var f=9*Ge,m=0;return s<=0&&(m=Math.PI),x.expanded(new Ue(f,m)).polarClosure()};var Vn=function(){function x(a,n){this.v0=a,this.v1=n}var s=x.prototype;return s.cmp=function(n){var c=this.v0.vector.cmp(n.v0.vector);return c!==0?c:this.v1.vector.cmp(n.v1.vector)},s.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},x}(),tl=function(s,a){this.start=s,this.length=a},Tu=function(s,a){this.chainID=s,this.offset=a},hx=function(s,a){this.point=s,this.contained=a},Au=function(s){return new hx(gt.originPoint(),s)},wy=0,cx=1,ux=2,dx=function(s){return s.numEdges()===0&&(s.dimension()!==2||s.numChains()===0)},px=function(s){return s.numEdges()===0&&s.dimension()===2&&s.numChains()>0},xh=function(){function x(){}var s=x.prototype;return s.numEdges=function(){return 0},s.edge=function(n){return new Vn(gt.originPoint(),gt.originPoint())},s.referencePoint=function(){return Au(!1)},s.numChains=function(){return 0},s.chain=function(n){return new tl(0,0)},s.chainEdge=function(n,c){return new Vn(gt.originPoint(),gt.originPoint())},s.chainPosition=function(n){return new Tu(0,0)},s.dimension=function(){return-1},s.isEmpty=function(){return!0},s.isFull=function(){return!1},s.typeTag=function(){return wy},s.privateInterface=function(){},x}(),ng=function(){function x(a,n){this.containsCenter=!1,this.shapeID=a,this.containsCenter=!1,this.edges=new Array(n)}var s=x.prototype;return s.numEdges=function(){return this.edges.length},s.containsEdge=function(n){for(var c=Gt(this.edges),f;!(f=c()).done;){var m=f.value;if(m===n)return!0}return!1},x}(),Iy=function(){function x(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var s=x.prototype;return s.numEdges=function(){return 0},s.containsEdge=function(n){return!1},x}(),fx=function(){function x(a){this.shapes=new Array(a)}var s=x.prototype;return s.numEdges=function(){for(var n=0,c=Gt(this.shapes),f;!(f=c()).done;){var m=f.value;n+=m.numEdges()}return n},s.add=function(n){this.shapes.push(n)},s.findByShapeID=function(n){for(var c=Gt(this.shapes),f;!(f=c()).done;){var m=f.value;if(m.shapeID===n)return m}return new Iy},x}(),ep=function(){function x(){this.shapes=[]}var s=x.prototype;return s.numEdges=function(){return 0},s.add=function(n){},s.findByShapeID=function(n){return new Iy},x}(),Ep=0,Cy=0,ip=function(){function x(a,n){if(this.index=a,this.position=0,this.id=No,this.cell=new ep,n!==void 0)switch(n){case Ep:this.begin();break;case Cy:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var s=x.prototype;return s.clone=function(){var n=new x(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},s.cellID=function(){return this.id},s.indexCell=function(){return this.cell},s.center=function(){return Xp(this.cellID())},s.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},s.next=function(){this.position++,this.refresh()},s.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},s.end=function(){this.position=this.index.cells.length,this.refresh()},s.done=function(){return this.id===No},s.refresh=function(){this.position=n}),this.refresh()},s.locatePoint=function(n){var c=qh(n);return this.seek(c),!!(!this.done()&&Re(this.cellID())<=c||this.prev()&&Fe(this.cellID())>=c)},s.locateCellID=function(n){if(this.seek(Re(n)),!this.done()){if(this.cellID()>=n&&Re(this.cellID())<=n)return $o;if(this.cellID()<=Fe(n))return ku}return this.prev()&&Fe(this.cellID())>=n?$o:Du},x}(),mx=function(){function x(){this.isActive=!1,this.a=this.b=x.trackerOrigin(),this.nextCellID=Eu(ll(0),Oe),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(gt.fromVector(On(0,-1,-1).normalize()))}x.trackerOrigin=function(){return gt.fromVector(On(0,-1,-1).normalize())};var s=x.prototype;return s.focus=function(){return this.b},s.addShape=function(n,c){this.isActive=!0,c&&this.toggleShape(n)},s.moveTo=function(n){this.b=n},s.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new jr(this.a,this.b)},s.testEdge=function(n,c){var f;(f=this.crosser)!=null&&f.edgeOrVertexCrossing(c.v0,c.v1)&&this.toggleShape(n)},s.setNextCellID=function(n){this.nextCellID=Re(n)},s.atCellID=function(n){return Re(n)===this.nextCellID},s.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var c=0;c=n)return c;return this.shapeIDs.length},x}(),zu=1,sg=2,Yp=function(){function x(a,n){this.index=a,this.model=n,this.iter=a.iterator()}var s=x.prototype;return s.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var c=this.iter.indexCell(),f=Gt(c.shapes),m;!(m=f()).done;){var h=m.value;if(this._shapeContains(h,this.iter.center(),n))return!0}return!1},s._shapeContains=function(n,c,f){var m=n.containsCenter,h=n.numEdges();if(h<=0)return m;var M=this.index.shape(n.shapeID);if(M.dimension()!==2){if(this.model!==sg)return!1;for(var L=Gt(n.edges),V;!(V=L()).done;){var B=V.value,U=M.edge(B);if(U.v0.equals(f)||U.v1.equals(f))return!0}return!1}for(var ut=new jr(c,f),vt=Gt(n.edges),Tt;!(Tt=vt()).done;){var Vt=Tt.value,jt=M.edge(Vt),se=ut.crossingSign(jt.v0,jt.v1);if(se!==Vr){if(se===mu){if(this.model!==zu&&(jt.v0.equals(f)||jt.v1.equals(f)))return this.model===sg;xy(ut.a,ut.b,jt.v0,jt.v1)?se=mn:se=Vr}m=m!==(se===mn)}}return m},s.shapeContains=function(n,c){if(!n||n instanceof xh||!this.iter.locatePoint(c))return!1;var f=this.iter.indexCell(),m=f.findByShapeID(this.index.idForShape(n));return m?this._shapeContains(m,this.iter.center(),c):!1},s.shapeVisitorFunc=function(n){return!0},s.visitContainingShapes=function(n,c){if(!this.iter.locatePoint(n))return!0;for(var f=this.iter.indexCell(),m=Gt(f.shapes),h;!(h=m()).done;){var M=h.value;if(this._shapeContains(M,this.iter.center(),n)&&!c(this.index.shape(M.shapeID)))return!1}return!0},s.containingShapes=function(n){var c=[];return this.visitContainingShapes(n,function(f){return c.push(f),!0}),c},x}(),gx=function(){function x(a,n){n===void 0&&(n=new Yp(a,zu)),this.index=a,this.containsQuery=n,this.iter=a.iterator()}var s=x.prototype;return s.capBound=function(){var n=hu(rl,this.cellUnionBound());return n.capBound()},s.rectBound=function(){var n=hu(rl,this.cellUnionBound());return n.rectBound()},s.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var c=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==c){var f=Dh(this.iter.cellID(),c),m=f[0];m===void 0&&(m=-1),m++;for(var h=Ye(c,m),M=Ye(this.iter.cellID(),m);M!=h;M=xr(M))if(!(Fe(M)=m-c&&c>=m-f},a.intersectsOppositeEdges=function(){var c=Math.abs(this.x),f=Math.abs(this.y),m=Math.abs(this.z);return Math.abs(c-f)!==m?Math.abs(c-f)>=m:c>=f?c-m>=f:f-m>=c},a.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?Tp:rp;var c=0,f=0,m=0;return Math.sign(this.x)<0&&(c=1),Math.sign(this.y)<0&&(f=1),Math.sign(this.z)<0&&(m=1),c^f^m?rp:Tp},a.exitPoint=function(c){if(c===rp){var f=this.y>0?1:-1;return new Se(f,(-f*this.x-this.z)/this.y)}var m=this.x<0?1:-1;return new Se((-m*this.y-this.z)/this.x,m)},s}(gt),og=function(s,a,n,c,f,m){var h=1-Gh;if(a.z>0){var M=new Se(a.x/a.z,a.y/a.z);if(Math.max(Math.abs(M.x),Math.abs(M.y))<=h)return[M,0]}var L=n.exitPoint(n.exitAxis()).mul(m),V=new Qr(new gt(L.x,L.y,1)),B=0;return V.vector.sub(s.vector).dot(c.vector)<0?B=2:V.vector.sub(a.vector).dot(f.vector)<0&&(B=1),B>0&&(a.z<=0?B=3:L=new Se(a.x/a.z,a.y/a.z)),[L,B]},ag=function(s,a,n){return a?s.lo>n?[s,!1]:(s.hi>n&&(s.hi=n),[s,!0]):s.hiM.hi){if(n.lo>M.hi)return[n,m,!1];n.hi=M.hi;var B=ag(m,!h,sl(M.hi,s,a,c,f));if(m=B[0],L=B[1],!L)return[n,m,!1]}return[n,m,!0]},Py=function(s,a,n){if(!n.intersects(oi.fromPoints(s,a)))return!1;var c=a.sub(s).ortho(),f=c.x>=0?1:0,m=c.y>=0?1:0,h=c.dot(n.vertexIJ(f,m).sub(s)),M=c.dot(n.vertexIJ(1-f,1-m).sub(s));return h>=0&&M<=0},bx=function(s,a,n){var c=oi.fromPoints(s,a),f=wx(s,a,n,c),m=f[0],h=f[1];return h?m:oi.empty()},wx=function(s,a,n,c){var f=s.x>a.x!=s.y>a.y,m=lg(s.x,a.x,c.x,s.y,a.y,c.y,f,n.x),h=m[0],M=m[1],L=m[2];if(!L)return[c,!1];var V=lg(s.y,a.y,M,s.x,a.x,h,f,n.y),B=V[0],U=V[1],ut=V[2];return ut?[new oi(U,B),!0]:[new oi(h,M),!1]},sl=function(s,a,n,c,f){return Math.abs(a-s)<=Math.abs(n-s)?c+(f-c)*(s-a)/(n-a):f+(c-f)*(s-n)/(a-n)},Ix=function(){function x(a,n,c){this.face=a,this.a=n,this.b=c}var s=x.prototype;return s.clone=function(){return new x(this.face,new Se(this.a.x,this.a.y),new Se(this.b.x,this.b.y))},x}(),Cx=function(s,a){var n=new Ix(0,new Se(0,0),new Se(0,0)),c=du(s.vector),f=c[0],m=c[1],h=c[2],M=du(a.vector),L=M[0],V=M[1],B=M[2];if(n.a.x=m,n.a.y=h,n.b.x=V,n.b.y=B,f===L)return n.face=f,[n];var U=s.pointCross(a),ut=hg(f,s,U,n.a),vt=ut[0],Tt=ut[1],Vt=hg(L,a,gt.fromVector(U.vector.mul(-1)),n.b),jt=Vt[0],se=Vt[1];n.a=Tt,n.b=se;var Yt=[];n.face=vt;for(var oe=n.b,ce=vt;ce!==jt;){var xe=Ns(ce,U),ye=new Qr(xe),Qe=ye.exitAxis();n.b=ye.exitPoint(Qe),Yt.push(n.clone());var ii=On(ce,n.b.x,n.b.y);ce=Sx(ce,n.b,Qe,ye,jt);var pi=Ns(ce,gt.fromVector(ii));n.face=ce,n.a=new Se(pi.x,pi.y)}return n.b=oe,Yt.push(n),Yt},hg=function(s,a,n,c){var f=1-Gh;if(Math.max(Math.abs(c.x),Math.abs(c.y))<=f)return[s,c];var m=Ns(s,n),h=new Qr(m);if(h.intersectsFace()){var M=h.exitPoint(h.exitAxis()),L=On(s,M.x,M.y),V=n.vector.normalize().cross(a.vector);if(L.sub(a.vector).dot(V)>=-_x)return[s,c]}var B=0;Math.abs(c.x)>=Math.abs(c.y)?(c.x>0&&(B=1),s=pu(s,0,B)):(c.y>0&&(B=1),s=pu(s,1,B));var U=qo(s,a.vector);return c.x=U[0],c.y=U[1],c.x=Math.max(-1,Math.min(1,c.x)),c.y=Math.max(-1,Math.min(1,c.y)),[s,c]},Sx=function(s,a,n,c,f){var m=a.x,h=a.y;n==Tp&&(m=a.y,h=a.x);var M=0;m>0&&(M=1);var L=0;return h>0&&(L=1),Math.abs(h)===1&&pu(s,1-n,L)===f&&xx(a.x*c.x,a.y*c.y,-c.z)?f:pu(s,n,M)},Yc=1,cg=function(){function x(a){this.rangeMin=No,this.rangeMax=No,this.it=a.iterator(),this.refresh()}var s=x.prototype;return s.cellID=function(){return this.it.cellID()},s.indexCell=function(){return this.it.indexCell()},s.next=function(){this.it.next(),this.refresh()},s.done=function(){return this.it.done()},s.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||Re(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Fe(this.it.cellID())>1,c&1]},s.entryVertex=function(){var n=this.iLo,c=this.jLo;if(this.orientation&cs){var f=ur(this.level);n+=f,c+=f}return gt.fromVector(ru(Fn(this.id),2*n,2*c).vector.normalize())},s.exitVertex=function(){var n=this.iLo,c=this.jLo,f=ur(this.level);return this.orientation===0||this.orientation===en+cs?n+=f:c+=f,gt.fromVector(ru(Fn(this.id),2*n,2*c).vector.normalize())},s.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var c=ur(this.level);if(n.x.contains(tn(Os(2*this.iLo+c)))||n.y.contains(tn(Os(2*this.jLo+c))))return this.id;var f=n.expandedByMargin(this.padding+1.5*Ge),m=this.iLo,h=this.jLo,M=0,L=0;m=n))break}return c},this.shape=function(n){return a.shapes.get(n)||new xh},this.idForShape=function(n){for(var c=Gt(a.shapes.entries()),f;!(f=c()).done;){var m=f.value,h=m[0],M=m[1];if(M===n)return h}return-1},this.add=function(n){return a.shapes.set(a.nextID,n),a.nextID++,a.status=ug,a.nextID-1},this.remove=function(n){var c=a.idForShape(n);if(a.shapes.has(c)&&(a.shapes.delete(c),!(c>=a.pendingAdditionsPos))){for(var f=n.numEdges(),m=new Ex(c,n.dimension()===2,n.referencePoint().contained,new Array(f)),h=0;h0){var vt=a.shrinkToFit(U,M);if(vt!==U.id){a.skipCellRange(Re(B),Re(vt),f,ut),U=hr.fromCellID(vt,Ua),a.updateEdges(U,h,f,ut),a.skipCellRange(xr(Fe(vt)),xr(Fe(B)),f,ut);return}}a.updateEdges(U,h,f,ut)}},this.shrinkToFit=function(n,c){var f=n.shrinkToFit(c);if(!a.isFirstUpdate()&&f!==n.id){var m=a.iterator();m.locateCellID(f)===$o&&(f=m.cellID())}return f},this.skipCellRange=function(n,c,f,m){if(f.shapeIDs.length!==0)for(var h=rl.fromRange(n,c),M=Gt(h),L;!(L=M()).done;){var V=L.value,B=[];a.updateEdges(hr.fromCellID(V,Ua),B,f,m)}},this.updateEdges=function(n,c,f,m){var h=!1;if(!m){var M=a.iterator(),L=M.locateCellID(n.id);L===Du?m=!0:L===$o&&(a.absorbIndexCell(n,M,c,f),h=!0,m=!0)}if(!m||!a.makeIndexCell(n,c,f)){for(var V=[[[],[]],[[],[]]],B=n.middle(),U=Gt(c),ut;!(ut=U()).done;){var vt=ut.value;if(vt.bound.x.hi<=B.x.lo){var Tt=a.clipVAxis(vt,B.y),Vt=Tt[0],jt=Tt[1];Vt&&V[0][0].push(Vt),jt&&V[0][1].push(jt)}else if(vt.bound.x.lo>=B.x.hi){var se=a.clipVAxis(vt,B.y),Yt=se[0],oe=se[1];Yt&&V[1][0].push(Yt),oe&&V[1][1].push(oe)}else if(vt.bound.y.hi<=B.y.lo){var ce=a.clipUBound(vt,1,B.x.hi);ce&&V[0][0].push(ce);var xe=a.clipUBound(vt,0,B.x.lo);xe&&V[1][0].push(xe)}else if(vt.bound.y.lo>=B.y.hi){var ye=a.clipUBound(vt,1,B.x.hi);ye&&V[0][1].push(ye);var Qe=a.clipUBound(vt,0,B.x.lo);Qe&&V[1][1].push(Qe)}else{var ii=a.clipUBound(vt,1,B.x.hi),pi=a.clipVAxis(ii,B.y),le=pi[0],vi=pi[1];le&&V[0][0].push(le),vi&&V[0][1].push(vi);var qe=a.clipUBound(vt,0,B.x.lo),ri=a.clipVAxis(qe,B.y);le=ri[0],vi=ri[1],le&&V[1][0].push(le),vi&&V[1][1].push(vi)}}for(var xi=0;xi<4;xi++){var rn=n.childIJ(xi),ji=rn[0],gn=rn[1];(V[ji][gn].length>0||f.shapeIDs.length>0)&&a.updateEdges(hr.fromParentIJ(n,ji,gn),V[ji][gn],f,m)}}h&&f.restoreStateBefore(a.pendingAdditionsPos)},this.makeIndexCell=function(n,c,f){if(c.length===0&&f.shapeIDs.length===0)return!0;for(var m=0,h=Gt(c),M;!(M=h()).done;){var L=M.value;if(n.levela.maxEdgesPerCell)return!1}f.isActive&&c.length!==0&&(f.atCellID(n.id)||f.moveTo(n.entryVertex()),f.drawTo(n.center()),a.testAllEdges(c,f));for(var V=f.shapeIDs,B=a.countShapes(c,V),U=new fx(B),ut=0,vt=0,Tt=0;Tt=f||c===1&&n.bound.x.hi<=f)return n;var m=n.faceEdge,h=n.bound.y.clampPoint(sl(f,m.a.x,m.b.x,m.a.y,m.b.y)),M=m.a.x>m.b.x==m.a.y>m.b.y,L=c===1===M?1:0;return a.updateBound(n,c,f,L,h)},this.clipVBound=function(n,c,f){if(c===0&&n.bound.y.lo>=f||c===1&&n.bound.y.hi<=f)return n;var m=n.faceEdge,h=n.bound.x.clampPoint(sl(f,m.a.y,m.b.y,m.a.x,m.b.x)),M=m.a.x>m.b.x==m.a.y>m.b.y,L=c===1===M?1:0;return a.updateBound(n,L,h,c,f)},this.clipVAxis=function(n,c){return n.bound.y.hi<=c.lo?[n,void 0]:n.bound.y.lo>=c.hi?[void 0,n]:[a.clipVBound(n,1,c.hi),a.clipVBound(n,0,c.lo)]},this.absorbIndexCell=function(n,c,f,m){if(m.isActive&&f.length!==0&&a.isShapeBeingRemoved(f[0].faceEdge.shapeID)){m.atCellID(n.id)||m.moveTo(n.entryVertex()),m.drawTo(n.exitVertex()),m.setNextCellID(xr(n.id));for(var h=Gt(f),M;!(M=h()).done;){var L=M.value,V=L.faceEdge;if(!a.isShapeBeingRemoved(V.shapeID))break;V.hasInterior&&m.testEdge(V.shapeID,V.edge)}}m.saveAndClearStateBefore(a.pendingAdditionsPos);var B=[],U=!1,ut=c.indexCell();if(ut)for(var vt=Gt(ut.shapes),Tt;!(Tt=vt()).done;){var Vt=Tt.value,jt=Vt.shapeID,se=a.shape(jt);if(se){var Yt=Vt.numEdges(),oe=new dg(jt,void 0,void 0,se.dimension()===2);oe.hasInterior&&(m.addShape(jt,Vt.containsCenter),!U&&Yt>0&&(m.moveTo(n.center()),m.drawTo(n.entryVertex()),m.setNextCellID(n.id),U=!0));for(var ce=0;cem));)h1&&(m=x.uniqueInts(m)),m},x.uniqueInts=function(n){for(var c=[],f={},m=Gt(n),h;!(h=m()).done;){var M=h.value;f[M]||(f[M]=!0,c.push(M))}return c.sort(function(L,V){return L-V}),c},s.candidatesEdgeMap=function(n,c){var f=new zx;if(this.index.shapes.size===1){var m=this.index.shape(0);return f.set(m,this.candidates(n,c,m)),f}if(this.getCellsForEdge(n,c),this.cells.length===0)return f;for(var h=Gt(this.cells),M;!(M=h()).done;)for(var L=M.value,V=Gt(L.shapes),B;!(B=V()).done;)for(var U=B.value,ut=this.index.shape(U.shapeID),vt=0;vt1&&f.forEach(function(Tt,Vt){f.set(Vt,x.uniqueInts(Tt))}),f},s.getCells=function(n,c,f){var m=vx(n,c,Fn(f.id)),h=m[0],M=m[1],L=m[2];if(L){this.a=h,this.b=M;var V=oi.fromPoints(this.a,this.b);f.bound().intersects(V)&&this.computeCellsIntersected(f,V)}return this.cells.length===0?[]:this.cells},s.getCellsForEdge=function(n,c){this.cells=[];for(var f=Cx(n,c),m=Gt(f),h;!(h=m()).done;){var M=h.value;this.a=M.a,this.b=M.b;var L=oi.fromPoints(this.a,this.b),V=hr.fromCellID(ll(M.face),0),B=V.shrinkToFit(L),U=this.iter.locateCellID(B);U===$o?this.cells.push(this.iter.indexCell()):U===ku&&(jh(B)||(V=hr.fromCellID(B,0)),this.computeCellsIntersected(V,L))}},s.computeCellsIntersected=function(n,c){if(this.iter.seek(Re(n.id)),!(this.iter.done()||this.iter.cellID()>Fe(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var f=n.middle().lo();if(c.x.hi=f.x){this.clipVAxis(c,f.y,1,n);return}var m=this.splitUBound(c,f.x);c.y.hi=f.y?(this.computeCellsIntersected(hr.fromParentIJ(n,0,1),m[0]),this.computeCellsIntersected(hr.fromParentIJ(n,1,1),m[1])):(this.clipVAxis(m[0],f.y,0,n),this.clipVAxis(m[1],f.y,1,n))}},s.clipVAxis=function(n,c,f,m){if(n.y.hi=c)this.computeCellsIntersected(hr.fromParentIJ(m,f,1),n);else{var h=this.splitVBound(n,c);this.computeCellsIntersected(hr.fromParentIJ(m,f,0),h[0]),this.computeCellsIntersected(hr.fromParentIJ(m,f,1),h[1])}},s.splitUBound=function(n,c){var f=n.y.clampPoint(sl(c,this.a.x,this.b.x,this.a.y,this.b.y)),m=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,m,c,f)},s.splitVBound=function(n,c){var f=n.x.clampPoint(sl(c,this.a.y,this.b.y,this.a.x,this.b.x)),m=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,m,0,f,c)},s.splitBound=function(n,c,f,m,h){var M=[oi.fromRect(n),oi.fromRect(n)];return c===1?(M[0].x.lo=m,M[1].x.hi=m):(M[0].x.hi=m,M[1].x.lo=m),f===1?(M[0].y.lo=h,M[1].y.hi=h):(M[0].y.hi=h,M[1].y.lo=h),M},x}(),zx=function(x){function s(){return x.apply(this,arguments)||this}return Oh(s,x),s}(il(Map)),kx=function(s,a,n){var c=1,f=a.distance(n);f!==0&&(c=f/Math.sin(f));var m=1,h=n.distance(s);h!==0&&(m=h/Math.sin(h));var M=1,L=s.distance(a);L!==0&&(M=L/Math.sin(L));var V=new ne(s.x,a.x-s.x,n.x-s.x),B=new ne(s.y,a.y-s.y,n.y-s.y),U=new ne(s.z,a.z-s.z,n.z-s.z),ut=new ne(c,m-c,M-c);return gt.fromVector(new ne(B.cross(U).dot(ut),U.cross(V).dot(ut),V.cross(B).dot(ut)).mul(.5))},fg=new gt(0,0,1),mg=new gt(0,0,-1),Ap=function(){function x(a){this.originInside=!1,this.depth=0,this.bound=Pe.emptyRect(),this.subregionBound=Pe.emptyRect(),this.vertices=a,this.index=new gu,this.initOriginAndBound()}x.fromCell=function(n){var c=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new x(c)},x.fromLoop=function(n){return new x(n.vertices.map(function(c){return gt.fromVector(c.vector)}))},x.emptyLoop=function(){return new x([fg])},x.fullLoop=function(){return new x([mg])};var s=x.prototype;return s.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&ix(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},s.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},s.initBound=function(){if(this.vertices.length===0){this.copyFrom(x.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Pe.emptyRect():this.bound=Pe.fullRect(),this.subregionBound=this.bound;return}for(var n=new nl,c=0;c<=this.vertices.length;c++)n.addPoint(this.vertex(c));var f=n.rectBound();this.containsPoint(new gt(0,0,1))&&(f=new Pe(new Ae(f.lat.lo,Math.PI/2),_i.fullInterval())),f.lng.isFull()&&this.containsPoint(new gt(0,0,-1))&&(f.lat.lo=-Math.PI/2),this.bound=f,this.subregionBound=nl.expandForSubregions(this.bound)},s.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},s.findValidationErrorNoIndex=function(){for(var n=0;n0)for(var M=n.center(),L=new jr(M,c),V=-2,B=Gt(m.edges),U;!(U=B()).done;){var ut=U.value;ut!==V+1&&L.restartAt(this.vertex(ut)),V=ut,h=h!==L.edgeOrVertexChainCrossing(this.vertex(ut+1))}return h},x.regularLoop=function(n,c,f){return x.regularLoopForFrame(qp(n),c,f)},x.regularLoopForFrame=function(n,c,f){return new x(gt.regularPointsForFrame(n,c,f))},s.canonicalFirstVertex=function(){for(var n=0,c=this.vertices.length,f=1;f0;M--){c+=f;var L=ig(this.vertex(c-f),this.vertex(c),this.vertex(c+f)),V=m;m+=L+h,h=V-m+L}var B=2*Math.PI-4*Ge;return Math.max(-B,Math.min(B,f*(m+h)))},s.turningAngleMaxError=function(){var n=11.25*Ge;return n*this.vertices.length},s.isHole=function(){return(this.depth&1)!==0},s.sign=function(){return this.isHole()?-1:1},s.isNormalized=function(){return this.bound.lng.length()=-this.turningAngleMaxError()},s.normalize=function(){this.isNormalized()||this.invert()},s.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?fg:mg;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var c=this.vertices.length-1-n,f=[this.vertices[c],this.vertices[n]];this.vertices[n]=f[0],this.vertices[c]=f[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi=0;M--){var L=h.edges[M];if(this.vertex(L).equals(n))return L===0?[this.vertices.length,!0]:[L,!0];if(this.vertex(L+1).equals(n))return[L+1,!0]}return[c,!1]},s.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var c=this.findVertex(n.vertex(1)),f=c[0],m=c[1];return m?My(this.vertex(f-1),this.vertex(f),this.vertex(f+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},s.surfaceIntegralFloat64=function(n){for(var c=Math.PI-1e-5,f=0,m=this.vertex(0),h=1;h+1c){var M=m;m.equals(this.vertex(0))?m=gt.fromVector(this.vertex(0).pointCross(this.vertex(h)).vector.normalize()):this.vertex(h).vector.angle(this.vertex(0).vector)c){var M=m;m.equals(this.vertex(0))?m=gt.fromVector(this.vertex(0).pointCross(this.vertex(h)).vector.normalize()):this.vertex(h).vector.angle(this.vertex(0).vector)4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n4*Math.PI-c&&this.isNormalized()?0:n},s.centroid=function(){return this.surfaceIntegralPoint(kx)},s.containsNonCrossingBoundary=function(n,c){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var f=this.findVertex(n.vertex(0)),m=f[0],h=f[1];return h?Ty(this.vertex(m-1),this.vertex(m),this.vertex(m+1),n.vertex(1),c):this.containsPoint(n.vertex(0))},x}(),yu=function(s,a){return!s.containsCenter&&a===Ey||s.containsCenter&&a===_u},sp=function(s,a,n){for(var c=new cg(s.index),f=new cg(a.index),m=new yg(s,a,n,!1),h=new yg(a,s,n,!0);!c.done()||!f.done();)if(c.rangeMax0){if(m.hasCrossingRelation(c,f))return!0}else if(M<0){if(h.hasCrossingRelation(f,c))return!0}else{var L=c.it.indexCell().shapes[0],V=f.it.indexCell().shapes[0];if(yu(L,m.aCrossingTarget)&&yu(V,m.bCrossingTarget)||L.numEdges()>0&&V.numEdges()>0&&m.cellCrossesCell(L,V))return!0;c.next(),f.next()}}return!1},gg=0,Ey=1,_u=2,Dx=function(){function x(){this.foundSharedVertex=!1}var s=x.prototype;return s.aCrossingTarget=function(){return Ey},s.bCrossingTarget=function(){return _u},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,!My(n,c,f,m,h)},x}(),Lx=function(){function x(){this.foundSharedVertex=!1}var s=x.prototype;return s.aCrossingTarget=function(){return _u},s.bCrossingTarget=function(){return _u},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,Tx(n,c,f,m,h)},x}(),Bx=function(){function x(a){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=a}var s=x.prototype;return s.aCrossingTarget=function(){return gg},s.bCrossingTarget=function(){return gg},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,Ty(n,c,f,h,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},x}(),Ty=function(s,a,n,c,f){return c.equals(s)||c.equals(n)?c.equals(s)===f:gt.orderedCCW(s,n,c,a)},yg=function(){function x(a,n,c,f){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=a,this.b=n,this.relation=c,this.swapped=f,this.aCrossingTarget=c.aCrossingTarget(),this.bCrossingTarget=c.bCrossingTarget(),this.bQuery=new Ax(n.index),f){var m=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=m[0],this.bCrossingTarget=m[1]}}var s=x.prototype;return s.startEdge=function(n){this.crosser=new jr(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},s.edgeCrossesCell=function(n){for(var c=n.numEdges(),f=0;f0){if(m+=h,m>=f)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(c.seekBeyond(n),!1);this.bCells.push(c.indexCell())}if(c.next(),c.cellID()>n.rangeMax)break}for(var M=Gt(this.bCells),L;!(L=M()).done;){var V=L.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],V.shapes[0]))return!0}return!1},s.hasCrossingRelation=function(n,c){var f=n.it.indexCell().shapes[0];if(f.numEdges()!==0)return this.hasCrossing(n,c)?!0:(n.next(),!1);if(yu(f,this.aCrossingTarget))return c.seekBeyond(n),n.next(),!1;for(;c.cellID()<=n.rangeMax;){var m=c.it.indexCell().shapes[0];if(yu(m,this.bCrossingTarget))return!0;c.next()}return n.next(),!1},x}(),Fx=function(){function x(a){var n=this;if(a===void 0&&(a=[]),this.loops=[],this.index=new gu,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Pe.emptyRect(),this.subregionBound=Pe.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(c){var f=new Array;f.push(null);for(var m=-1;f.length>0;){var h=f.pop();h!=null&&(m=h.depth,n.loops.push(h));for(var M=c.get(h)||[],L=M.length-1;L>=0;L--){var V=M[L];V.depth=m+1,f.push(V)}}},a.length===1&&a[0].isEmpty()){this.initLoopProperties();return}this.loops=a,this.initNested()}x.fromOrientedLoops=function(n){for(var c=new Map,f=Gt(n),m;!(m=f()).done;){var h=m.value;c.set(h,h.containsOrigin())}for(var M=Gt(n),L;!(L=M()).done;){var V=L.value,B=V.turningAngle();Math.abs(B)>V.turningAngleMaxError()?B<0&&V.invert():V.containsOrigin()&&V.invert()}var U=new x(n);if(U.numLoops()>0){for(var ut=U.loop(0),vt=!1,Tt=Gt(U.loops),Vt;!(Vt=Tt()).done;){var jt=Vt.value;jt.containsOrigin()&&(vt=!vt,ut=jt)}c.get(ut)!==vt&&U.invert()}return U};var s=x.prototype;return s.invert=function(){if(this.isEmpty()){Object.assign(this,x.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new x),this.initLoopProperties();return}for(var n=0,c=10,f=c,m=1;mL)&&(this.loop(V).depth++,M.push(this.loop(V)));for(var B=0;Bn&&B<=L&&(this.loop(B).depth--,M.push(this.loop(B)));this.loops=M,this.initLoopProperties()},s.compareLoops=function(n,c){if(n.numVertices()!==c.numVertices())return n.numVertices()-c.numVertices();var f=n.canonicalFirstVertex(),m=f[0],h=f[1],M=c.canonicalFirstVertex(),L=M[0],V=M[1];if(h!==V)return h-V;for(var B=n.numVertices()-1;B>=0;B--,m+=h,L+=V){var U=n.vertex(m).vector.cmp(c.vertex(L).vector);if(U!==0)return U}return 0},x.fromCell=function(n){return new x([Ap.fromCell(n)])},s.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Rx;this.loops.forEach(function(c){n.insertLoop(c,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},s.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=nl.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},s.initLoopProperties=function(){this.numVertices=0,this.bound=Pe.emptyRect(),this.hasHoles=!1;for(var n=Gt(this.loops),c;!(c=n()).done;){var f=c.value;f.isHole()?this.hasHoles=!0:this.bound=this.bound.union(f.rectBound()),this.numVertices+=f.numVertices()}this.subregionBound=nl.expandForSubregions(this.bound),this.initEdgesAndIndex()},s.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var c=Gt(this.loops),f;!(f=c()).done;){var m=f.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=m.vertices.length}this.index=new gu,this.index.add(this)}},x.fullPolygon=function(){var n=Ap.fullLoop(),c=new x;return c.loops=[n],c.numVertices=n.vertices.length,c.bound=Pe.fullRect(),c.subregionBound=Pe.fullRect(),c.initEdgesAndIndex(),c},s.validate=function(){for(var n=0;n1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},s.findLoopNestingError=function(){for(var n=-1,c=0;cn+1)return new Error("loop "+c+": invalid loop depth ("+f+")");n=f}for(var m=0;m=m+1&&L<=M,B=!1;if(h.containsNonCrossingBoundary(this.loops[L],B)!==V){var U=V?"":"not ";return new Error("invalid nesting: loop "+m+" should "+U+"contain loop "+L)}}return null},s.isEmpty=function(){return this.loops.length===0},s.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},s.numLoops=function(){return this.loops.length},s.loop=function(n){return this.loops[n]},s.parent=function(n){var c,f=((c=this.loops[n])==null?void 0:c.depth)||0;if(f===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=f;n--);return[n,!0]},s.lastDescendant=function(n){var c;if(n<0)return this.loops.length-1;var f=((c=this.loops[n])==null?void 0:c.depth)||0;for(n++;nf;n++);return n-1},s.capBound=function(){return this.bound.capBound()},s.rectBound=function(){return this.bound},s.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var c=32;if(this.numVertices0){for(c=0;c=this.cumulativeEdges.length||n=this.loop(c).vertices.length;c++)n-=this.loop(c).vertices.length;return new Vn(this.loop(c).orientedVertex(n),this.loop(c).orientedVertex(n+1))},s.referencePoint=function(){for(var n=!1,c=Gt(this.loops),f;!(f=c()).done;){var m=f.value;n=n!==m.containsOrigin()}return Au(n)},s.numChains=function(){return this.numLoops()},s.chain=function(n){if(this.cumulativeEdges.length>0)return new tl(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var c=0,f=0;f0){for(c=0;c=this.cumulativeEdges.length||n=this.loop(c).vertices.length;c++)n-=this.loop(c).vertices.length;return new Tu(c,n)},s.dimension=function(){return 2},s.typeTag=function(){return cx},s.privateInterface=function(){},s.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var c=Gt(n.loops),f;!(f=c()).done;){var m=f.value;if(!this.anyLoopContains(m))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},s.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var c=Gt(n.loops),f;!(f=c()).done;){var m=f.value;if(this.anyLoopIntersects(m))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},s.compareBoundary=function(n){for(var c=-1,f=0;f=0)return!1}return!0},s.containsNonCrossingBoundary=function(n,c){for(var f=!1,m=Gt(this.loops),h;!(h=m()).done;){var M=h.value,L=M.containsNonCrossingBoundary(n,c);f=f!=L}return f},s.excludesNonCrossingShells=function(n){for(var c=Gt(n.loops),f;!(f=c()).done;){var m=f.value;if(!m.isHole()&&this.containsNonCrossingBoundary(m,!1))return!1}return!0},s.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var c=0;c0&&!f.isHole())&&this.containsNonCrossingBoundary(f,c===0))return!1}return!0},s.anyLoopContains=function(n){for(var c=Gt(this.loops),f;!(f=c()).done;){var m=f.value;if(m.contains(n))return!0}return!1},s.anyLoopIntersects=function(n){for(var c=Gt(this.loops),f;!(f=c()).done;){var m=f.value;if(m.intersects(n))return!0}return!1},s.area=function(){for(var n=0,c=Gt(this.loops),f;!(f=c()).done;){var m=f.value;n+=m.sign()*m.area()}return n},s.centroid=function(){for(var n=new gt(0,0,0).vector,c=Gt(this.loops),f;!(f=c()).done;){var m=f.value,h=m.centroid().vector;m.sign()<0?n=n.sub(h):n=n.add(h)}return gt.fromVector(n)},x}(),Rx=function(x){function s(){return x.apply(this,arguments)||this}Oh(s,x);var a=s.prototype;return a.insertLoop=function(c,f){for(var m=[],h=!1;!h;){m=x.prototype.get.call(this,f)||[],h=!0;for(var M=Gt(m),L;!(L=M()).done;){var V=L.value;if(V.containsNested(c)){f=V,h=!1;break}}}for(var B=x.prototype.get.call(this,c)||[],U=0;UMath.PI/2&&L>0||Bc)break;if(L=B,!(B<=c)){var U=T0(h,V),ut=Math.atan2(U.y,U.x);if(!M.contains(ut))break;var vt=Math.asin(Math.sin(c)/Math.sin(B)),Tt=_i.fromPointPair(ut,ut).expanded(vt);M=M.intersection(Tt)}}return f-1},s.subsampleVertices=function(n){var c=[];if(this.points.length<1)return c;c.push(0);for(var f=Math.max(n,0),m=0;m+11&&m=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))c.terminal=!0;else if(f+this.levelMod>this.maxLevel)return new bh}else(f+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(c.terminal=!0);return c},s.expandChildren=function(n,c,f){f--;for(var m=0,h=_y(c.id),M=Wp(c.id);M!==h;M=xr(M)){var L=os.fromCellID(M);if(f>0){this.region.intersectsCell(L)&&(m+=this.expandChildren(n,L,f));continue}var V=this.newCandidate(L);V instanceof bh||(n.children.push(V),n.numChildren++,V.terminal&&m++)}return m},s.addCandidate=function(n){if(!(n instanceof bh)){if(n.terminal){this.result.push(n.cell.id);return}var c=this.levelMod,f=n.cell.level;f=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((f<1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},s.adjustCellLevels=function(n){if(this.levelMod!==1){for(var c=0,f=Gt(n),m;!(m=f()).done;){var h=m.value,M=Ki(h),L=this.adjustLevel(M);if(L!==M&&(h=Ye(h,L)),!(c>0&&jo(n[c-1],h))){for(;c>0&&jo(h,n[c-1]);)c--;n[c]=h,c++}}n.length=c}},s.initialCandidates=function(n){var c=new zp;c.maxLevel=this.maxLevel,c.levelMod=1,c.maxCells=Math.min(4,this.maxCells);var f=c.fastCovering(n);this.adjustCellLevels(f);for(var m=Gt(f),h;!(h=m()).done;){var M=h.value;this.addCandidate(this.newCandidate(os.fromCellID(M)))}},s.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},s.normalizeCovering=function(n){if(this.maxLevel1)for(var c=0;c0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var h=n.length-this.maxCells;if(!(h<=0||this.isCanonical(n))){if(h*n.length>1e4){var M=new zp,L=M.covering(n);n.length=0,n.push.apply(n,L);return}for(;n.length>this.maxCells;){for(var V=-1,B=-1,U=0;U+1B&&(B=Vt,V=U)}}if(Bthis.minLevel&&(B-=this.levelMod,jt=Ye(jt,B),!!this.containsAllChildren(n,jt));){var Yt=this.replaceCellsWithAncestor(n,jt);n.length=0,n.push.apply(n,Yt)}}}},s.isCanonical=function(n){var c=this.maxLevel;this.levelMod!==1&&(c=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var f=n.length>this.maxCells,m=1,h=0n,M=Gt(n),L;!(L=M()).done;){var V=L.value;if(!fu(V))return!1;var B=Ki(V);if(Bc||this.levelMod>1&&(B-this.minLevel)%this.levelMod!==0)return!1;if(h!==0n){if(Fe(h)>=Re(V))return!1;var U=Dh(V,h),ut=U[0],vt=U[1];if(f&&vt&&ut>=this.minLevel)return!1;var Tt=B-this.levelMod;if(Tt=Re(c)}),m=Ki(c)+this.levelMod,h=Eu(c,m);h!==Hp(c,m);h=xr(h)){if(f===-1||n[f]!==h)return!1;f++}return!0},s.replaceCellsWithAncestor=function(n,c){var f=wp(n.length,function(h){return n[h]>Re(c)}),m=wp(n.length,function(h){return n[h]>Fe(c)});return[].concat(n.slice(0,f),[c],n.slice(m))},x}(),Vx=function(s){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=s},bh=function(){this.cell=os.fromCellID(No),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Nx=function(x){function s(){return x.apply(this,arguments)||this}Oh(s,x);var a=s.prototype;return a.len=function(){return this.length},a.swap=function(c,f){var m=[this[f],this[c]];this[c]=m[0],this[f]=m[1]},a.push=function(){for(var c,f=arguments.length,m=new Array(f),h=0;hf.priority?1:0},s}(il(Array)),fn={__proto__:null,cellid:tx,Cap:js,Cell:os,CellUnion:rl,LatLng:Ue,Loop:Ap,Point:gt,Polygon:Fx,Polyline:Ox,Rect:Pe,RegionCoverer:zp,Coverer:Ay,ShapeIndex:gu};function Bi(){return Bi=Object.assign?Object.assign.bind():function(x){for(var s=1;s{const{x:a,y:n}=x,{x:c,y:f}=s,m=c-a,h=f-n;return Math.sqrt(h*h+m*m)};class qa{constructor({name:s,callback:a,unregister:n,register:c}){this.name=void 0,this.callback=void 0,this.registered=!1,this.register=void 0,this.unregister=void 0,this.name=s,this.register=()=>{this.registered||(this.registered=!0,c(a))},this.unregister=()=>{this.register&&(this.registered=!1,n(a))},this.callback=a}}class zy{constructor(s){this._minPixelDragDistance=void 0,this._minPixelDragDistanceDrawing=void 0,this._minPixelDragDistanceSelecting=void 0,this._lastDrawEvent=void 0,this._coordinatePrecision=void 0,this._heldKeys=new Set,this._listeners=[],this._dragState="not-dragging",this._currentModeCallbacks=void 0,this._minPixelDragDistance=typeof s.minPixelDragDistance=="number"?s.minPixelDragDistance:1,this._minPixelDragDistanceSelecting=typeof s.minPixelDragDistanceSelecting=="number"?s.minPixelDragDistanceSelecting:1,this._minPixelDragDistanceDrawing=typeof s.minPixelDragDistanceDrawing=="number"?s.minPixelDragDistanceDrawing:8,this._coordinatePrecision=typeof s.coordinatePrecision=="number"?s.coordinatePrecision:9}getButton(s){return s.button===-1?"neither":s.button===0?"left":s.button===1?"middle":s.button===2?"right":"neither"}getMapElementXYPosition(s){const a=this.getMapEventElement(),{left:n,top:c}=a.getBoundingClientRect();return{containerX:s.clientX-n,containerY:s.clientY-c}}getDrawEventFromEvent(s){const a=this.getLngLatFromEvent(s);if(!a)return null;const{lng:n,lat:c}=a,{containerX:f,containerY:m}=this.getMapElementXYPosition(s),h=this.getButton(s),M=Array.from(this._heldKeys);return{lng:Us(n,this._coordinatePrecision),lat:Us(c,this._coordinatePrecision),containerX:f,containerY:m,button:h,heldKeys:M}}register(s){this._currentModeCallbacks=s,this._listeners=this.getAdapterListeners(),this._listeners.forEach(a=>{a.register()})}getCoordinatePrecision(){return this._coordinatePrecision}getAdapterListeners(){return[new qa({name:"pointerdown",callback:s=>{if(!this._currentModeCallbacks||!s.isPrimary)return;const a=this.getDrawEventFromEvent(s);a&&(this._dragState="pre-dragging",this._lastDrawEvent=a)},register:s=>{this.getMapEventElement().addEventListener("pointerdown",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointerdown",s)}}),new qa({name:"pointermove",callback:s=>{if(!this._currentModeCallbacks||!s.isPrimary)return;s.preventDefault();const a=this.getDrawEventFromEvent(s);if(a)if(this._dragState==="not-dragging")this._currentModeCallbacks.onMouseMove(a),this._lastDrawEvent=a;else if(this._dragState==="pre-dragging"){if(!this._lastDrawEvent)return;const n={x:this._lastDrawEvent.containerX,y:this._lastDrawEvent.containerY},c={x:a.containerX,y:a.containerY},f=this._currentModeCallbacks.getState(),m=el(n,c);let h=!1;if(h=f==="drawing"?m{this.setDraggability.bind(this)(M)})}else this._dragState==="dragging"&&this._currentModeCallbacks.onDrag(a,n=>{this.setDraggability.bind(this)(n)})},register:s=>{this.getMapEventElement().addEventListener("pointermove",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointermove",s)}}),new qa({name:"contextmenu",callback:s=>{this._currentModeCallbacks&&s.preventDefault()},register:s=>{this.getMapEventElement().addEventListener("contextmenu",s)},unregister:s=>{this.getMapEventElement().removeEventListener("contextmenu",s)}}),new qa({name:"pointerup",callback:s=>{if(!this._currentModeCallbacks||s.target!==this.getMapEventElement()||!s.isPrimary)return;const a=this.getDrawEventFromEvent(s);a&&(this._dragState==="dragging"?this._currentModeCallbacks.onDragEnd(a,n=>{this.setDraggability.bind(this)(n)}):this._dragState!=="not-dragging"&&this._dragState!=="pre-dragging"||this._currentModeCallbacks.onClick(a),this._dragState="not-dragging",this.setDraggability(!0))},register:s=>{this.getMapEventElement().addEventListener("pointerup",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointerup",s)}}),new qa({name:"keyup",callback:s=>{this._currentModeCallbacks&&(this._heldKeys.delete(s.key),this._currentModeCallbacks.onKeyUp({key:s.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>s.preventDefault()}))},register:s=>{this.getMapEventElement().addEventListener("keyup",s)},unregister:s=>{this.getMapEventElement().removeEventListener("keyup",s)}}),new qa({name:"keydown",callback:s=>{this._currentModeCallbacks&&(this._heldKeys.add(s.key),this._currentModeCallbacks.onKeyDown({key:s.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>s.preventDefault()}))},register:s=>{this.getMapEventElement().addEventListener("keydown",s)},unregister:s=>{this.getMapEventElement().removeEventListener("keydown",s)}})]}unregister(){this._listeners.forEach(s=>{s.unregister()}),this.clear()}}class jx extends zy{constructor(s){super(s),this._nextRender=void 0,this._map=void 0,this._container=void 0,this._rendered=!1,this.changedIds={deletion:!1,points:!1,linestrings:!1,polygons:!1,styling:!1},this._map=s.map,this._container=this._map.getContainer()}clearLayers(){this._rendered&&(["point","linestring","polygon"].forEach(s=>{const a=`td-${s.toLowerCase()}`;this._map.removeLayer(a),s==="polygon"&&this._map.removeLayer(a+"-outline"),this._map.removeSource(a)}),this._rendered=!1,this._nextRender&&(cancelAnimationFrame(this._nextRender),this._nextRender=void 0))}_addGeoJSONSource(s,a){this._map.addSource(s,{type:"geojson",data:{type:"FeatureCollection",features:a},tolerance:0})}_addFillLayer(s){return this._map.addLayer({id:s,source:s,type:"fill",paint:{"fill-color":["get","polygonFillColor"],"fill-opacity":["get","polygonFillOpacity"]}})}_addFillOutlineLayer(s,a){const n=this._map.addLayer({id:s+"-outline",source:s,type:"line",paint:{"line-width":["get","polygonOutlineWidth"],"line-color":["get","polygonOutlineColor"]}});return a&&this._map.moveLayer(s,a),n}_addLineLayer(s,a){const n=this._map.addLayer({id:s,source:s,type:"line",paint:{"line-width":["get","lineStringWidth"],"line-color":["get","lineStringColor"]}});return a&&this._map.moveLayer(s,a),n}_addPointLayer(s,a){const n=this._map.addLayer({id:s,source:s,type:"circle",paint:{"circle-stroke-color":["get","pointOutlineColor"],"circle-stroke-width":["get","pointOutlineWidth"],"circle-radius":["get","pointWidth"],"circle-color":["get","pointColor"]}});return a&&this._map.moveLayer(s,a),n}_addLayer(s,a,n){a==="Point"&&this._addPointLayer(s,n),a==="LineString"&&this._addLineLayer(s,n),a==="Polygon"&&(this._addFillLayer(s),this._addFillOutlineLayer(s,n))}_addGeoJSONLayer(s,a){const n=`td-${s.toLowerCase()}`;return this._addGeoJSONSource(n,a),this._addLayer(n,s),n}_setGeoJSONLayerData(s,a){const n=`td-${s.toLowerCase()}`;return this._map.getSource(n).setData({type:"FeatureCollection",features:a}),n}getEmptyGeometries(){return{points:[],linestrings:[],polygons:[]}}updateChangedIds(s){[...s.updated,...s.created].forEach(a=>{a.geometry.type==="Point"?this.changedIds.points=!0:a.geometry.type==="LineString"?this.changedIds.linestrings=!0:a.geometry.type==="Polygon"&&(this.changedIds.polygons=!0)}),s.deletedIds.length>0&&(this.changedIds.deletion=!0),s.created.length===0&&s.updated.length===0&&s.deletedIds.length===0&&(this.changedIds.styling=!0)}getLngLatFromEvent(s){const{left:a,top:n}=this._container.getBoundingClientRect();return this.unproject(s.clientX-a,s.clientY-n)}getMapEventElement(){return this._map.getCanvas()}setDraggability(s){s?(this._map.dragRotate.enable(),this._map.dragPan.enable()):(this._map.dragRotate.disable(),this._map.dragPan.disable())}project(s,a){const{x:n,y:c}=this._map.project({lng:s,lat:a});return{x:n,y:c}}unproject(s,a){const{lng:n,lat:c}=this._map.unproject({x:s,y:a});return{lng:n,lat:c}}setCursor(s){const a=this._map.getCanvas();s==="unset"?a.style.removeProperty("cursor"):a.style.cursor=s}setDoubleClickToZoom(s){s?this._map.doubleClickZoom.enable():this._map.doubleClickZoom.disable()}render(s,a){this.updateChangedIds(s),this._nextRender&&cancelAnimationFrame(this._nextRender),this._nextRender=requestAnimationFrame(()=>{const n=[...s.created,...s.updated,...s.unchanged],c=this.getEmptyGeometries();for(let M=0;M{const{properties:B}=L;if(B.mode!==V)return;const U=a[V](L);L.geometry.type==="Point"?(B.pointColor=U.pointColor,B.pointOutlineColor=U.pointOutlineColor,B.pointOutlineWidth=U.pointOutlineWidth,B.pointWidth=U.pointWidth,c.points.push(L)):L.geometry.type==="LineString"?(B.lineStringColor=U.lineStringColor,B.lineStringWidth=U.lineStringWidth,c.linestrings.push(L)):L.geometry.type==="Polygon"&&(B.polygonFillColor=U.polygonFillColor,B.polygonFillOpacity=U.polygonFillOpacity,B.polygonOutlineColor=U.polygonOutlineColor,B.polygonOutlineWidth=U.polygonOutlineWidth,c.polygons.push(L))})}const{points:f,linestrings:m,polygons:h}=c;if(this._rendered){const M=this.changedIds.deletion||this.changedIds.styling,L=M||this.changedIds.linestrings,V=M||this.changedIds.polygons;let B;(M||this.changedIds.points)&&(B=this._setGeoJSONLayerData("Point",f)),L&&this._setGeoJSONLayerData("LineString",m),V&&this._setGeoJSONLayerData("Polygon",h),B&&this._map.moveLayer(B)}else{const M=this._addGeoJSONLayer("Point",f);this._addGeoJSONLayer("LineString",m),this._addGeoJSONLayer("Polygon",h),this._rendered=!0,M&&this._map.moveLayer(M)}this.changedIds={points:!1,linestrings:!1,polygons:!1,deletion:!1,styling:!1}})}clear(){this._currentModeCallbacks&&(this._currentModeCallbacks.onClear(),this.clearLayers())}getCoordinatePrecision(){return super.getCoordinatePrecision()}unregister(){return super.unregister()}register(s){super.register(s),this._currentModeCallbacks&&this._currentModeCallbacks.onReady&&this._currentModeCallbacks.onReady()}}class Ux extends zy{constructor(s){super(s),this.mapboxglAdapter=void 0,this.mapboxglAdapter=new jx(s)}register(s){this.mapboxglAdapter.register(s)}unregister(){this.mapboxglAdapter.unregister()}getCoordinatePrecision(){return this.mapboxglAdapter.getCoordinatePrecision()}getLngLatFromEvent(s){return this.mapboxglAdapter.getLngLatFromEvent(s)}getMapEventElement(){return this.mapboxglAdapter.getMapEventElement()}setDraggability(s){this.mapboxglAdapter.setDraggability(s)}project(s,a){return this.mapboxglAdapter.project(s,a)}unproject(s,a){return this.mapboxglAdapter.unproject(s,a)}setCursor(s){this.mapboxglAdapter.setCursor(s)}setDoubleClickToZoom(s){this.mapboxglAdapter.setDoubleClickToZoom(s)}render(s,a){this.mapboxglAdapter.render(s,a)}clear(){this.mapboxglAdapter.clear()}}let qx=0;const Fs=typeof navigator<"u"&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():"";Fs.includes("firefox"),Fs.includes("safari")&&!Fs.includes("chrom")&&(Fs.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Fs)),Fs.includes("webkit")&&Fs.includes("edge"),Fs.includes("macintosh");typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope;(function(){let x=!1;try{const s=Object.defineProperty({},"passive",{get:function(){x=!0}});window.addEventListener("_",null,s),window.removeEventListener("_",null,s)}catch{}})();var $x=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},ky=class{constructor(x){this.type=x,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};function vg(){}function Dy(x){for(const s in x)delete x[s]}var Zx=class extends $x{constructor(x){super(),this.eventTarget_=x,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(x,s){if(!x||!s)return;const a=this.listeners_||(this.listeners_={}),n=a[x]||(a[x]=[]);n.includes(s)||n.push(s)}dispatchEvent(x){const s=typeof x=="string",a=s?x:x.type,n=this.listeners_&&this.listeners_[a];if(!n)return;const c=s?new ky(x):x;c.target||(c.target=this.eventTarget_||this);const f=this.dispatching_||(this.dispatching_={}),m=this.pendingRemovals_||(this.pendingRemovals_={});let h;a in f||(f[a]=0,m[a]=0),++f[a];for(let M=0,L=n.length;M0)}removeEventListener(x,s){if(!this.listeners_)return;const a=this.listeners_[x];if(!a)return;const n=a.indexOf(s);n!==-1&&(this.pendingRemovals_&&x in this.pendingRemovals_?(a[n]=vg,++this.pendingRemovals_[x]):(a.splice(n,1),a.length===0&&delete this.listeners_[x]))}},Gx="change";function kp(x,s,a,n,c){if(c){const m=a;a=function(){x.removeEventListener(s,a),m.apply(this,arguments)}}const f={target:x,type:s,listener:a};return x.addEventListener(s,a),f}function xg(x,s,a,n){return kp(x,s,a,n,!0)}function bg(x){x&&x.target&&(x.target.removeEventListener(x.type,x.listener),Dy(x))}var Xx=class extends Zx{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Gx)}getRevision(){return this.revision_}onInternal(x,s){if(Array.isArray(x)){const a=x.length,n=new Array(a);for(let c=0;c1?a:2,s===void 0&&(s=a>2?x.slice():new Array(n));for(let c=0;cQc?f=Qc:f<-Qc&&(f=-Qc),s[c+1]=f}return s},Tg=function(x,s,a){const n=x.length;a=a>1?a:2,s===void 0&&(s=a>2?x.slice():new Array(n));for(let c=0;cL*Math.PI/180,n=a(x[1]),c=a(x[0]),f=a(s[1]),m=f-n,h=a(s[0])-c,M=Math.sin(m/2)*Math.sin(m/2)+Math.cos(n)*Math.cos(f)*Math.sin(h/2)*Math.sin(h/2);return 2*Math.atan2(Math.sqrt(M),Math.sqrt(1-M))*6371e3/1e3}const e1=63710088e-1;function Sh(x){return x%360*Math.PI/180}function i1(x){return x/(e1/1e3)}function Dg(x){return x%(2*Math.PI)*180/Math.PI}const Lg=57.29577951308232,Bg=.017453292519943295,xu=6378137,Oo=(x,s)=>({x:x===0?0:x*Bg*xu,y:s===0?0:Math.log(Math.tan(Math.PI/4+s*Bg/2))*xu}),Dp=(x,s)=>({lng:x===0?0:Lg*(x/xu),lat:s===0?0:(2*Math.atan(Math.exp(s/xu))-Math.PI/2)*Lg});function r1(x,s,a){const n=Sh(x[0]),c=Sh(x[1]),f=Sh(a),m=i1(s),h=Math.asin(Math.sin(c)*Math.cos(m)+Math.cos(c)*Math.sin(m)*Math.cos(f));return[Dg(n+Math.atan2(Math.sin(f)*Math.sin(m)*Math.cos(c),Math.cos(m)-Math.sin(c)*Math.sin(h))),Dg(h)]}function Fg(x){const{center:s,radiusKilometers:a,coordinatePrecision:n}=x,c=x.steps?x.steps:64,f=[];for(let m=0;m0;function c(m){return m<0-s.epsilon||m>1+s.epsilon}function f(m,h,M,L){const V=a[m][h],B=a[m][h+1],U=a[M][L],ut=a[M][L+1],vt=function(jt,se,Yt,oe){if(tu(jt,Yt)||tu(jt,oe)||tu(se,Yt)||tu(oe,Yt))return null;const ce=jt[0],xe=jt[1],ye=se[0],Qe=se[1],ii=Yt[0],pi=Yt[1],le=oe[0],vi=oe[1],qe=(ce-ye)*(pi-vi)-(xe-Qe)*(ii-le);return qe===0?null:[((ce*Qe-xe*ye)*(ii-le)-(ce-ye)*(ii*vi-pi*le))/qe,((ce*Qe-xe*ye)*(pi-vi)-(xe-Qe)*(ii*vi-pi*le))/qe]}(V,B,U,ut);if(vt===null)return;let Tt,Vt;Tt=B[0]!==V[0]?(vt[0]-V[0])/(B[0]-V[0]):(vt[1]-V[1])/(B[1]-V[1]),Vt=ut[0]!==U[0]?(vt[0]-U[0])/(ut[0]-U[0]):(vt[1]-U[1])/(ut[1]-U[1]),c(Tt)||c(Vt)||(vt.toString(),n.push(vt))}}function tu(x,s){return x[0]===s[0]&&x[1]===s[1]}function s1(x,s){return x.length===2&&typeof x[0]=="number"&&typeof x[1]=="number"&&x[0]!==1/0&&x[1]!==1/0&&(n=x[0])>=-180&&n<=180&&(a=x[1])>=-90&&a<=90&&Rg(x[0])<=s&&Rg(x[1])<=s;var a,n}function Rg(x){let s=1,a=0;for(;Math.round(x*s)/s!==x;)s*=10,a++;return a}function Qp(x,s){return x.geometry.type==="Polygon"&&x.geometry.coordinates.length===1&&x.geometry.coordinates[0].length>=4&&x.geometry.coordinates[0].every(c=>s1(c,s))&&(a=x.geometry.coordinates[0][0])[0]===(n=x.geometry.coordinates[0][x.geometry.coordinates[0].length-1])[0]&&a[1]===n[1];var a,n}function Fy(x,s){return Qp(x,s)&&!n1(x)}class o1 extends Xh{constructor(s){var a;super(s),this.mode="circle",this.center=void 0,this.clickCount=0,this.currentCircleId=void 0,this.keyEvents=void 0,this.cursors=void 0,this.startingRadiusKilometers=1e-5;const n={start:"crosshair"};if(this.cursors=s&&s.cursors?Bi({},n,s.cursors):n,(s==null?void 0:s.keyEvents)===null)this.keyEvents={cancel:null,finish:null};else{const c={cancel:"Escape",finish:"Enter"};this.keyEvents=s&&s.keyEvents?Bi({},c,s.keyEvents):c}this.startingRadiusKilometers=(a=s==null?void 0:s.startingRadiusKilometers)!=null?a:1e-5,this.validate=s==null?void 0:s.validation}close(){if(this.currentCircleId===void 0)return;const s=this.currentCircleId;if(this.validate&&s){const a=this.store.getGeometryCopy(s);if(!this.validate({type:"Feature",id:s,geometry:a,properties:{}},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:vr.Finish}))return}this.center=void 0,this.currentCircleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),this.onFinish(s,{mode:this.mode,action:"draw"})}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(s){if(this.clickCount===0){this.center=[s.lng,s.lat];const a=Fg({center:this.center,radiusKilometers:this.startingRadiusKilometers,coordinatePrecision:this.coordinatePrecision}),[n]=this.store.create([{geometry:a.geometry,properties:{mode:this.mode,radiusKilometers:this.startingRadiusKilometers}}]);this.currentCircleId=n,this.clickCount++,this.setDrawing()}else this.clickCount===1&&this.center&&this.currentCircleId!==void 0&&this.updateCircle(s),this.close()}onMouseMove(s){this.updateCircle(s)}onKeyDown(){}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onDragStart(){}onDrag(){}onDragEnd(){}cleanUp(){const s=this.currentCircleId;this.center=void 0,this.currentCircleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted();try{s!==void 0&&this.store.delete([s])}catch{}}styleFeature(s){const a=Bi({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});return s.type==="Feature"&&s.geometry.type==="Polygon"&&s.properties.mode===this.mode&&(a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10),a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&Fy(s,this.coordinatePrecision)}updateCircle(s){if(this.clickCount===1&&this.center&&this.currentCircleId){const a=kg(this.center,[s.lng,s.lat]);let n;if(this.projection==="web-mercator"){const c=function(f,m){const h=1e3*kg(f,m);if(h===0)return 1;const{x:M,y:L}=Oo(f[0],f[1]),{x:V,y:B}=Oo(m[0],m[1]);return Math.sqrt(Math.pow(V-M,2)+Math.pow(B-L,2))/h}(this.center,[s.lng,s.lat]);n=function(f){const{center:m,radiusKilometers:h,coordinatePrecision:M}=f,L=f.steps?f.steps:64,V=1e3*h,[B,U]=m,{x:ut,y:vt}=Oo(B,U),Tt=[];for(let Vt=0;Vt[m.lng,m.lat])]}}}class a1 extends Lu{constructor(s){super(s)}create(s){const{containerX:a,containerY:n}=s;return Ry({unproject:this.unproject,point:{x:a,y:n},pointerDistance:this.pointerDistance})}}class Oy extends Lu{constructor(s){super(s)}measure(s,a){const{x:n,y:c}=this.project(a[0],a[1]);return el({x:n,y:c},{x:s.containerX,y:s.containerY})}}class l1 extends Lu{constructor(s,a,n){super(s),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.getSnappableCoordinateFirstClick=c=>this.getSnappable(c,f=>!!(f.properties&&f.properties.mode===this.mode)),this.getSnappableCoordinate=(c,f)=>this.getSnappable(c,m=>!!(m.properties&&m.properties.mode===this.mode&&m.id!==f)),this.config=s,this.pixelDistance=a,this.clickBoundingBox=n}getSnappable(s,a){const n=this.clickBoundingBox.create(s),c=this.store.search(n,a),f={coord:void 0,minDist:1/0};return c.forEach(m=>{let h;if(m.geometry.type==="Polygon")h=m.geometry.coordinates[0];else{if(m.geometry.type!=="LineString")return;h=m.geometry.coordinates}h.forEach(M=>{const L=this.pixelDistance.measure(s,M);L180?c-=360:c<-180&&(c+=360),c}function nu(x,s){return x[0]===s[0]&&x[1]===s[1]}class h1 extends Lu{constructor(s,a){super(s),this.config=void 0,this.pixelDistance=void 0,this._startEndPoints=[],this.config=s,this.pixelDistance=a}get ids(){return this._startEndPoints.concat()}set ids(s){}create(s,a){if(this.ids.length)throw new Error("Opening and closing points already created");if(s.length<=3)throw new Error("Requires at least 4 coordinates");this._startEndPoints=this.store.create([{geometry:{type:"Point",coordinates:s[0]},properties:{mode:a,[Ag]:!0}},{geometry:{type:"Point",coordinates:s[s.length-2]},properties:{mode:a,[Ag]:!0}}])}delete(){this.ids.length&&(this.store.delete(this.ids),this._startEndPoints=[])}update(s){if(this.ids.length!==2)throw new Error("No closing points to update");this.store.updateGeometry([{id:this.ids[0],geometry:{type:"Point",coordinates:s[0]}},{id:this.ids[1],geometry:{type:"Point",coordinates:s[s.length-3]}}])}isClosingPoint(s){const a=this.store.getGeometryCopy(this.ids[0]),n=this.store.getGeometryCopy(this.ids[1]),c=this.pixelDistance.measure(s,a.coordinates),f=this.pixelDistance.measure(s,n.coordinates);return{isClosing:c0&&!this.mouseMove&&this.onMouseMove(s),this.mouseMove=!1,this.currentCoordinate===0){const a=this.snappingEnabled?this.snapping.getSnappableCoordinateFirstClick(s):void 0;a&&(s.lng=a[0],s.lat=a[1]);const[n]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat]]]},properties:{mode:this.mode}}]);this.currentId=n,this.currentCoordinate++,this.setDrawing()}else if(this.currentCoordinate===1&&this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0;a&&(s.lng=a[0],s.lat=a[1]);const n=this.store.getGeometryCopy(this.currentId);if(nu([s.lng,s.lat],n.coordinates[0][0])||!this.updatePolygonGeometry([n.coordinates[0][0],[s.lng,s.lat],[s.lng,s.lat],n.coordinates[0][0]],vr.Commit))return;this.currentCoordinate++}else if(this.currentCoordinate===2&&this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0;a&&(s.lng=a[0],s.lat=a[1]);const n=this.store.getGeometryCopy(this.currentId).coordinates[0];if(nu([s.lng,s.lat],n[1])||!this.updatePolygonGeometry([n[0],n[1],[s.lng,s.lat],[s.lng,s.lat],n[0]],vr.Commit))return;this.currentCoordinate===2&&this.closingPoints.create(n,"polygon"),this.currentCoordinate++}else if(this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0,n=this.store.getGeometryCopy(this.currentId).coordinates[0],{isClosing:c,isPreviousClosing:f}=this.closingPoints.isClosingPoint(s);if(f||c)this.close();else{if(a&&(s.lng=a[0],s.lat=a[1]),nu([s.lng,s.lat],n[this.currentCoordinate-1]))return;const m=function(h=[[[0,0],[0,1],[1,1],[1,0],[0,0]]]){return{type:"Feature",geometry:{type:"Polygon",coordinates:h},properties:{}}}([[...n.slice(0,-1),[s.lng,s.lat],n[0]]]);if(!this.updatePolygonGeometry(m.geometry.coordinates[0],vr.Commit))return;this.currentCoordinate++,this.closingPoints.ids.length&&this.closingPoints.update(m.geometry.coordinates[0])}}}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onKeyDown(){}onDragStart(){this.setCursor("unset")}onDrag(){}onDragEnd(){this.setCursor(this.cursors.start)}cleanUp(){const s=this.currentId;this.currentId=void 0,this.currentCoordinate=0,this.state==="drawing"&&this.setStarted();try{s!==void 0&&this.store.delete([s]),this.closingPoints.ids.length&&this.closingPoints.delete()}catch{}}styleFeature(s){const a=Bi({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(s.properties.mode===this.mode){if(s.geometry.type==="Polygon")return a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10,a;if(s.geometry.type==="Point")return a.pointWidth=this.getNumericStylingValue(this.styles.closingPointWidth,a.pointWidth,s),a.pointColor=this.getHexColorStylingValue(this.styles.closingPointColor,a.pointColor,s),a.pointOutlineColor=this.getHexColorStylingValue(this.styles.closingPointOutlineColor,a.pointOutlineColor,s),a.pointOutlineWidth=this.getNumericStylingValue(this.styles.closingPointOutlineWidth,2,s),a.zIndex=30,a}return a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&Qp(s,this.coordinatePrecision)}}class u1 extends Xh{constructor(s){super(s),this.mode="rectangle",this.center=void 0,this.clickCount=0,this.currentRectangleId=void 0,this.keyEvents=void 0,this.cursors=void 0;const a={start:"crosshair"};if(this.cursors=s&&s.cursors?Bi({},a,s.cursors):a,(s==null?void 0:s.keyEvents)===null)this.keyEvents={cancel:null,finish:null};else{const n={cancel:"Escape",finish:"Enter"};this.keyEvents=s&&s.keyEvents?Bi({},n,s.keyEvents):n}}updateRectangle(s,a){if(this.clickCount===1&&this.center&&this.currentRectangleId){const n=this.store.getGeometryCopy(this.currentRectangleId).coordinates[0][0],c={type:"Polygon",coordinates:[[n,[s.lng,n[1]],[s.lng,s.lat],[n[0],s.lat],n]]};if(this.validate&&!this.validate({id:this.currentRectangleId,geometry:c},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:a}))return;this.store.updateGeometry([{id:this.currentRectangleId,geometry:c}])}}close(){const s=this.currentRectangleId;this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),s&&this.onFinish(s,{mode:this.mode,action:"draw"})}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(s){if(this.clickCount===0){this.center=[s.lng,s.lat];const[a]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat]]]},properties:{mode:this.mode}}]);this.currentRectangleId=a,this.clickCount++,this.setDrawing()}else this.updateRectangle(s,vr.Finish),this.close()}onMouseMove(s){this.updateRectangle(s,vr.Provisional)}onKeyDown(){}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onDragStart(){}onDrag(){}onDragEnd(){}cleanUp(){const s=this.currentRectangleId;this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),s!==void 0&&this.store.delete([s])}styleFeature(s){const a=Bi({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});return s.type==="Feature"&&s.geometry.type==="Polygon"&&s.properties.mode===this.mode&&(a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10),a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&Fy(s,this.coordinatePrecision)}}function d1(x,s,a,n,c){const f=n(x[0],x[1]),m=n(s[0],s[1]),{lng:h,lat:M}=c((f.x+m.x)/2,(f.y+m.y)/2);return[Us(h,a),Us(M,a)]}function p1(x,s){let a=!1;for(let m=0,h=s.length;m(n=x)[1]!=(f=M[B])[1]>n[1]&&n[0]<(f[0]-c[0])*(n[1]-c[1])/(f[1]-c[1])+c[0]&&(a=!a)}var n,c,f;return a}const f1=(x,s,a)=>{const n=f=>f*f,c=(f,m)=>n(f.x-m.x)+n(f.y-m.y);return Math.sqrt(((f,m,h)=>{const M=c(m,h);if(M===0)return c(f,m);let L=((f.x-m.x)*(h.x-m.x)+(f.y-m.y)*(h.y-m.y))/M;return L=Math.max(0,Math.min(1,L)),c(f,{x:m.x+L*(h.x-m.x),y:m.y+L*(h.y-m.y)})})(x,s,a))};class m1 extends Xh{constructor(...s){super(...s),this.type=Fh.Static,this.mode="static"}start(){}stop(){}onKeyUp(){}onKeyDown(){}onClick(){}onDragStart(){}onDrag(){}onDragEnd(){}onMouseMove(){}cleanUp(){}styleFeature(){return Bi({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0})}}function Vy(x,s,a,n,c){for(;n>a;){if(n-a>600){const M=n-a+1,L=s-a+1,V=Math.log(M),B=.5*Math.exp(2*V/3),U=.5*Math.sqrt(V*B*(M-B)/M)*(L-M/2<0?-1:1);Vy(x,s,Math.max(a,Math.floor(s-L*B/M+U)),Math.min(n,Math.floor(s+(M-L)*B/M+U)),c)}const f=x[s];let m=a,h=n;for(vh(x,a,s),c(x[n],f)>0&&vh(x,a,n);m0;)h--}c(x[a],f)===0?vh(x,a,h):(h++,vh(x,h,n)),h<=s&&(a=h+1),s<=h&&(n=h-1)}}function vh(x,s,a){const n=x[s];x[s]=x[a],x[a]=n}function Za(x,s){wh(x,0,x.children.length,s,x)}function wh(x,s,a,n,c){c||(c=Xa([])),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0;for(let f=s;f=x.minX&&s.maxY>=x.minY}function Xa(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vg(x,s,a,n,c){const f=[s,a];for(;f.length;){if((a=f.pop())-(s=f.pop())<=n)continue;const m=s+Math.ceil((a-s)/n/2)*n;Vy(x,m,s,a,c),f.push(s,m,m,a)}}class v1{constructor(s){this._maxEntries=void 0,this._minEntries=void 0,this.data=void 0,this._maxEntries=Math.max(4,s),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}search(s){let a=this.data;const n=[];if(!iu(s,a))return n;const c=this.toBBox,f=[];for(;a;){for(let m=0;m=0&&f[a].children.length>this._maxEntries;)this._split(f,a),a--;this._adjustParentBBoxes(c,f,a)}_split(s,a){const n=s[a],c=n.children.length,f=this._minEntries;this._chooseSplitAxis(n,f,c);const m=this._chooseSplitIndex(n,f,c),h=Xa(n.children.splice(m,n.children.length-m));h.height=n.height,h.leaf=n.leaf,Za(n,this.toBBox),Za(h,this.toBBox),a?s[a-1].children.push(h):this._splitRoot(n,h)}_splitRoot(s,a){this.data=Xa([s,a]),this.data.height=s.height+1,this.data.leaf=!1,Za(this.data,this.toBBox)}_chooseSplitIndex(s,a,n){let c,f=1/0,m=1/0;for(let h=a;h<=n-a;h++){const M=wh(s,0,h,this.toBBox),L=wh(s,h,n,this.toBBox),V=_1(M,L),B=lp(M)+lp(L);V=a;L--){const V=s.children[L];Ih(h,s.leaf?f(V):V),M+=eu(h)}return M}_adjustParentBBoxes(s,a,n){for(let c=n;c>=0;c--)Ih(a[c],s)}_condense(s){for(let a,n=s.length-1;n>=0;n--)s[n].children.length===0?n>0?(a=s[n-1].children,a.splice(a.indexOf(s[n]),1)):this.clear():Za(s[n],this.toBBox)}}class x1{constructor(s){this.tree=void 0,this.idToNode=void 0,this.nodeToId=void 0,this.tree=new v1(s&&s.maxEntries?s.maxEntries:9),this.idToNode=new Map,this.nodeToId=new Map}setMaps(s,a){this.idToNode.set(s.id,a),this.nodeToId.set(a,s.id)}toBBox(s){const a=[],n=[];let c;if(s.geometry.type==="Polygon")c=s.geometry.coordinates[0];else if(s.geometry.type==="LineString")c=s.geometry.coordinates;else{if(s.geometry.type!=="Point")throw new Error("Not a valid feature to turn into a bounding box");c=[s.geometry.coordinates]}for(let h=0;h{const f=this.toBBox(c);if(this.setMaps(c,f),n.has(String(c.id)))throw new Error(`Duplicate feature ID found ${c.id}`);n.add(String(c.id)),a.push(f)}),this.tree.load(a)}update(s){this.remove(s.id);const a=this.toBBox(s);this.setMaps(s,a),this.tree.insert(a)}remove(s){const a=this.idToNode.get(s);if(!a)throw new Error(`${s} not inserted into the spatial index`);this.tree.remove(a)}clear(){this.tree.clear()}search(s){return this.tree.search(this.toBBox(s)).map(a=>this.nodeToId.get(a))}collides(s){return this.tree.collides(this.toBBox(s))}}const b1={getId:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(x){const s=16*Math.random()|0;return(x=="x"?s:3&s|8).toString(16)}),isValidId:x=>typeof x=="string"&&x.length===36};class w1{constructor(s){this.idStrategy=void 0,this.tracked=void 0,this.spatialIndex=void 0,this.store=void 0,this._onChange=()=>{},this.store={},this.spatialIndex=new x1,this.tracked=!s||s.tracked!==!1,this.idStrategy=s&&s.idStrategy?s.idStrategy:b1}clone(s){return JSON.parse(JSON.stringify(s))}getId(){return this.idStrategy.getId()}has(s){return!!this.store[s]}load(s,a){if(s.length===0)return;const n=this.clone(s);n.forEach(f=>{f.id==null&&(f.id=this.idStrategy.getId()),this.tracked&&(f.properties.createdAt?zg(f.properties.createdAt):f.properties.createdAt=+new Date,f.properties.updatedAt?zg(f.properties.updatedAt):f.properties.updatedAt=+new Date)});const c=[];n.forEach(f=>{const m=f.id;if(a&&!a(f))throw new Error(`Feature is not ${m} valid: ${JSON.stringify(f)}`);if(this.has(m))throw new Error(`Feature already exists with this id: ${m}`);this.store[m]=f,c.push(m)}),this.spatialIndex.load(n),this._onChange(c,"create")}search(s,a){const n=this.spatialIndex.search(s).map(c=>this.store[c]);return this.clone(a?n.filter(a):n)}registerOnChange(s){this._onChange=(a,n)=>{s(a,n)}}getGeometryCopy(s){const a=this.store[s];if(!a)throw new Error(`No feature with this id (${s}), can not get geometry copy`);return this.clone(a.geometry)}getPropertiesCopy(s){const a=this.store[s];if(!a)throw new Error(`No feature with this id (${s}), can not get properties copy`);return this.clone(a.properties)}updateProperty(s){const a=[];s.forEach(({id:n,property:c,value:f})=>{const m=this.store[n];if(!m)throw new Error(`No feature with this (${n}), can not update geometry`);a.push(n),m.properties[c]=f,this.tracked&&(m.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(a,"update")}updateGeometry(s){const a=[];s.forEach(({id:n,geometry:c})=>{a.push(n);const f=this.store[n];if(!f)throw new Error(`No feature with this (${n}), can not update geometry`);f.geometry=this.clone(c),this.spatialIndex.update(f),this.tracked&&(f.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(a,"update")}create(s){const a=[];return s.forEach(({geometry:n,properties:c})=>{let f,m=Bi({},c);this.tracked&&(f=+new Date,c?(m.createdAt=typeof c.createdAt=="number"?c.createdAt:f,m.updatedAt=typeof c.updatedAt=="number"?c.updatedAt:f):m={createdAt:f,updatedAt:f});const h=this.getId(),M={id:h,type:"Feature",geometry:n,properties:m};this.store[h]=M,this.spatialIndex.insert(M),a.push(h)}),this._onChange&&this._onChange([...a],"create"),a}delete(s){s.forEach(a=>{if(!this.store[a])throw new Error("No feature with this id, can not delete");delete this.store[a],this.spatialIndex.remove(a)}),this._onChange&&this._onChange([...s],"delete")}copyAll(){return this.clone(Object.keys(this.store).map(s=>this.store[s]))}clear(){this.store={},this.spatialIndex.clear()}size(){return Object.keys(this.store).length}}function Ng(x,s,a){const n=Lp(x,s);let c=Lp(s,a)-n;return c<0&&(c+=360),180-Math.abs(c-90-90)}class I1 extends Xh{constructor(s){super(s),this.mode="angled-rectangle",this.currentCoordinate=0,this.currentId=void 0,this.keyEvents=void 0,this.pixelDistance=void 0,this.cursors=void 0,this.mouseMove=!1;const a={start:"crosshair",close:"pointer"};if(this.cursors=s&&s.cursors?Bi({},a,s.cursors):a,(s==null?void 0:s.keyEvents)===null)this.keyEvents={cancel:null,finish:null};else{const n={cancel:"Escape",finish:"Enter"};this.keyEvents=s&&s.keyEvents?Bi({},n,s.keyEvents):n}}close(){if(this.currentId===void 0)return;const s=this.currentId;this.currentCoordinate=0,this.currentId=void 0,this.state==="drawing"&&this.setStarted(),this.onFinish(s,{mode:this.mode,action:"draw"})}registerBehaviors(s){this.pixelDistance=new Oy(s)}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onMouseMove(s){if(this.mouseMove=!0,this.setCursor(this.cursors.start),this.currentId===void 0||this.currentCoordinate===0)return;const a=this.store.getGeometryCopy(this.currentId).coordinates[0];let n;if(this.currentCoordinate===1){const c=1/Math.pow(10,this.coordinatePrecision-1),f=Math.max(1e-6,c);n=[a[0],[s.lng,s.lat],[s.lng,s.lat-f],a[0]]}else if(this.currentCoordinate===2){const c=a[0],f=a[1],m=d1(c,f,this.coordinatePrecision,this.project,this.unproject),h=Oo(c[0],c[1]),M=Oo(m[0],m[1]),L=Oo(f[0],f[1]),V=Oo(s.lng,s.lat),B=el(V,h)1e-10?"left":Qe<-1e-10?"right":"left"}(h,L,V)==="right"?-90:90),jt=Og(h,Tt,Vt),se=Og(L,Tt,Vt),Yt=Dp(jt.x,jt.y),oe=Dp(se.x,se.y);n=[a[0],a[1],[oe.lng,oe.lat],[Yt.lng,Yt.lat],a[0]]}n&&this.updatePolygonGeometry(this.currentId,n,vr.Provisional)}updatePolygonGeometry(s,a,n){const c={type:"Polygon",coordinates:[a]};return!(this.validate&&!this.validate({type:"Feature",geometry:c},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:n})||(this.store.updateGeometry([{id:s,geometry:c}]),0))}onClick(s){if(this.currentCoordinate>0&&!this.mouseMove&&this.onMouseMove(s),this.mouseMove=!1,this.currentCoordinate===0){const[a]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat]]]},properties:{mode:this.mode}}]);this.currentId=a,this.currentCoordinate++,this.setDrawing()}else if(this.currentCoordinate===1&&this.currentId){const a=this.store.getGeometryCopy(this.currentId);if(nu([s.lng,s.lat],a.coordinates[0][0])||!this.updatePolygonGeometry(this.currentId,[a.coordinates[0][0],[s.lng,s.lat],[s.lng,s.lat],a.coordinates[0][0]],vr.Commit))return;this.currentCoordinate++}else this.currentCoordinate===2&&this.currentId&&this.close()}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onKeyDown(){}onDragStart(){}onDrag(){}onDragEnd(){}cleanUp(){try{this.currentId&&this.store.delete([this.currentId])}catch{}this.currentId=void 0,this.currentCoordinate=0,this.state==="drawing"&&this.setStarted()}styleFeature(s){const a=Bi({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});return s.properties.mode===this.mode&&s.geometry.type==="Polygon"&&(a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10),a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&Qp(s,this.coordinatePrecision)}}class C1{constructor(s){this._modes=void 0,this._mode=void 0,this._adapter=void 0,this._enabled=!1,this._store=void 0,this._eventListeners=void 0,this._instanceSelectMode=void 0,this._adapter=s.adapter,this._mode=new m1;const a=new Set,n=s.modes.reduce((V,B)=>{if(a.has(B.mode))throw new Error(`There is already a ${B.mode} mode provided`);return a.add(B.mode),V[B.mode]=B,V},{}),c=Object.keys(n);if(c.length===0)throw new Error("No modes provided");c.forEach(V=>{if(n[V].type===Fh.Select){if(this._instanceSelectMode)throw new Error("only one type of select mode can be provided");this._instanceSelectMode=V}}),this._modes=Bi({},n,{static:this._mode}),this._eventListeners={change:[],select:[],deselect:[],finish:[],ready:[]},this._store=new w1({tracked:!!s.tracked,idStrategy:s.idStrategy?s.idStrategy:void 0});const f=V=>{const B=[],U=this._store.copyAll().filter(ut=>!V.includes(ut.id)||(B.push(ut),!1));return{changed:B,unchanged:U}},m=(V,B)=>{this._enabled&&this._eventListeners.finish.forEach(U=>{U(V,B)})},h=(V,B)=>{if(!this._enabled)return;this._eventListeners.change.forEach(vt=>{vt(V,B)});const{changed:U,unchanged:ut}=f(V);B==="create"?this._adapter.render({created:U,deletedIds:[],unchanged:ut,updated:[]},this.getModeStyles()):B==="update"?this._adapter.render({created:[],deletedIds:[],unchanged:ut,updated:U},this.getModeStyles()):B==="delete"?this._adapter.render({created:[],deletedIds:V,unchanged:ut,updated:[]},this.getModeStyles()):B==="styling"&&this._adapter.render({created:[],deletedIds:[],unchanged:ut,updated:[]},this.getModeStyles())},M=V=>{if(!this._enabled)return;this._eventListeners.select.forEach(ut=>{ut(V)});const{changed:B,unchanged:U}=f([V]);this._adapter.render({created:[],deletedIds:[],unchanged:U,updated:B},this.getModeStyles())},L=V=>{if(!this._enabled)return;this._eventListeners.deselect.forEach(ut=>{ut()});const{changed:B,unchanged:U}=f([V]);B&&this._adapter.render({created:[],deletedIds:[],unchanged:U,updated:B},this.getModeStyles())};Object.keys(this._modes).forEach(V=>{this._modes[V].register({mode:V,store:this._store,setCursor:this._adapter.setCursor.bind(this._adapter),project:this._adapter.project.bind(this._adapter),unproject:this._adapter.unproject.bind(this._adapter),setDoubleClickToZoom:this._adapter.setDoubleClickToZoom.bind(this._adapter),onChange:h,onSelect:M,onDeselect:L,onFinish:m,coordinatePrecision:this._adapter.getCoordinatePrecision()})})}checkEnabled(){if(!this._enabled)throw new Error("Terra Draw is not enabled")}getModeStyles(){const s={};return Object.keys(this._modes).forEach(a=>{s[a]=n=>this._instanceSelectMode&&n.properties[Qx]?this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(n):this._modes[a].styleFeature.bind(this._modes[a])(n)}),s}featuresAtLocation({lng:s,lat:a},n){const c=n&&n.pointerDistance!==void 0?n.pointerDistance:30,f=!n||n.ignoreSelectFeatures===void 0||n.ignoreSelectFeatures,m=this._adapter.unproject.bind(this._adapter),h=this._adapter.project.bind(this._adapter),M=h(s,a),L=Ry({unproject:m,point:M,pointerDistance:c});return this._store.search(L).filter(V=>{if(f&&(V.properties[t1]||V.properties.selectionPoint))return!1;if(V.geometry.type==="Point"){const B=V.geometry.coordinates,U=h(B[0],B[1]);return el(M,U){if(a&&typeof a=="object"&&"properties"in a&&typeof a.properties=="object"&&a.properties!==null&&"mode"in a.properties){const n=this._modes[a.properties.mode];return!!n&&n.validateFeature.bind(n)(a)}return!1})}start(){this._enabled=!0,this._adapter.register({onReady:()=>{this._eventListeners.ready.forEach(s=>{s()})},getState:()=>this._mode.state,onClick:s=>{this._mode.onClick(s)},onMouseMove:s=>{this._mode.onMouseMove(s)},onKeyDown:s=>{this._mode.onKeyDown(s)},onKeyUp:s=>{this._mode.onKeyUp(s)},onDragStart:(s,a)=>{this._mode.onDragStart(s,a)},onDrag:(s,a)=>{this._mode.onDrag(s,a)},onDragEnd:(s,a)=>{this._mode.onDragEnd(s,a)},onClear:()=>{this._mode.cleanUp(),this._store.clear()}})}getFeaturesAtLngLat(s,a){const{lng:n,lat:c}=s;return this.featuresAtLocation({lng:n,lat:c},a)}getFeaturesAtPointerEvent(s,a){const n=this._adapter.getLngLatFromEvent.bind(this._adapter)(s);return n===null?[]:this.featuresAtLocation(n,a)}stop(){this._enabled=!1,this._adapter.unregister()}on(s,a){const n=this._eventListeners[s];n.includes(a)||n.push(a)}off(s,a){const n=this._eventListeners[s];n.includes(a)&&n.splice(n.indexOf(a),1)}}var S1=Gv("

max cells:

max level:

");const P1=(x,s)=>{const a=[],n=s.coordinates[0];for(let m=0;mfn.CellUnion.fromUnion(...s.map(a=>P1(x,a))),E1=x=>{const s=C0.angle.degrees;return{type:"FeatureCollection",features:x.map(n=>{const c=fn.Cell.fromCellID(n),f=fn.LatLng.fromPoint(c.vertex(0)),m=fn.LatLng.fromPoint(c.vertex(1)),h=fn.LatLng.fromPoint(c.vertex(2)),M=fn.LatLng.fromPoint(c.vertex(3));return{type:"Feature",geometry:{type:"Polygon",coordinates:[[[s(f.lng),s(f.lat)],[s(m.lng),s(m.lat)],[s(h.lng),s(h.lat)],[s(M.lng),s(M.lat)],[s(f.lng),s(f.lat)]]]},properties:{level:0}}})}};function T1(){let x,s,a;const[n,c]=Nm(30),[f,m]=Nm(200),h=()=>{const L=s.getSnapshot().map(B=>B.geometry).filter(B=>B.type==="Polygon"),V=M1(a,L);x.getSource("covering").setData(E1(V))};qg(()=>{a=new fn.RegionCoverer({maxLevel:n(),maxCells:f()}),s&&h()});const M=()=>{s.clear(),h()};return Fv(()=>{x=new qm.Map({container:"map",style:"https://api.protomaps.com/styles/v3/black.json?key=5b9c1298c2eef269",maplibreLogo:!0}),s=new C1({adapter:new Ux({map:x,maplibregl:qm}),modes:[new u1,new I1,new c1,new o1]}),s.on("finish",()=>{h()}),s.start(),s.setMode("rectangle"),x.on("load",()=>{x.addSource("covering",{type:"geojson",data:{type:"MultiPolygon",coordinates:[]}}),x.addLayer({id:"covering-fill",type:"fill",source:"covering",paint:{"fill-color":"yellow","fill-opacity":.5}}),x.addLayer({id:"covering-stroke",type:"line",source:"covering",paint:{"line-color":"yellow"}})})}),(()=>{var L=S1(),V=L.firstChild,B=V.firstChild,U=B.nextSibling,ut=U.firstChild,vt=ut.nextSibling,Tt=U.nextSibling,Vt=Tt.firstChild,jt=Vt.nextSibling,se=Tt.nextSibling;return B.addEventListener("change",Yt=>{s&&s.setMode(Yt.target.value)}),vt.$$input=Yt=>{m(+Yt.target.value||1)},jt.$$input=Yt=>{c(+Yt.target.value||1)},se.$$click=M,Ph(()=>vt.value=f()),Ph(()=>jt.value=n()),L})()}Xv(["input","click"]);const A1=document.getElementById("root");Zv(()=>qv(T1,{}),A1); diff --git a/index.html b/index.html new file mode 100644 index 0000000..4adb7a9 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + Solid + TS + + + + +
+ +