From 5fbed6cf156aade403bd6f148c95a614f91fdb46 Mon Sep 17 00:00:00 2001 From: Erick Otenyo Date: Thu, 29 Feb 2024 13:28:15 +0300 Subject: [PATCH 1/2] Load js and css resources from local --- capeditor/forms/widgets.py | 22 ++--- .../static/capeditor/css/mapbox-gl-draw.css | 88 +++++++++++++++++++ .../static/capeditor/css/maplibre-gl.css | 1 + .../static/capeditor/fonts/mapbox-gl-draw.css | 88 +++++++++++++++++++ .../static/capeditor/js/mapbox-gl-draw.js | 2 + capeditor/static/capeditor/js/maplibre-gl.js | 44 ++++++++++ capeditor/static/capeditor/js/turf.min.js | 88 +++++++++++++++++++ .../templates/capeditor/cap_alert_page.html | 4 +- .../home/templates/home/cap_alert_detail.html | 6 +- 9 files changed, 327 insertions(+), 16 deletions(-) create mode 100644 capeditor/static/capeditor/css/mapbox-gl-draw.css create mode 100644 capeditor/static/capeditor/css/maplibre-gl.css create mode 100644 capeditor/static/capeditor/fonts/mapbox-gl-draw.css create mode 100644 capeditor/static/capeditor/js/mapbox-gl-draw.js create mode 100644 capeditor/static/capeditor/js/maplibre-gl.js create mode 100644 capeditor/static/capeditor/js/turf.min.js diff --git a/capeditor/forms/widgets.py b/capeditor/forms/widgets.py index e66b776..2c20ec9 100644 --- a/capeditor/forms/widgets.py +++ b/capeditor/forms/widgets.py @@ -58,13 +58,13 @@ def __init__(self, attrs=None): class Media: css = { "all": [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.css", + "capeditor/css/cap_detail_page.css", "capeditor/css/widget/boundary-widget.css", ] } js = [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.js", - "https://unpkg.com/@turf/turf/turf.min.js", + "capeditor/js/maplibre-gl.js", + "capeditor/js/turf.min.js", "capeditor/js/widget/boundary-polygon-widget.js", ] @@ -97,15 +97,15 @@ def __init__(self, attrs=None): class Media: css = { "all": [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.css", - "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.2/mapbox-gl-draw.css", + "capeditor/css/maplibre-gl.css", + "capeditor/css/mapbox-gl-draw.css", "capeditor/css/widget/polygon-widget.css", ] } js = [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.js", - "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.2/mapbox-gl-draw.js", - "https://unpkg.com/@turf/turf/turf.min.js", + "capeditor/js/maplibre-gl.js", + "capeditor/js/mapbox-gl-draw.js", + "capeditor/js/turf.min.js", "capeditor/js/widget/polygon-widget.js", ] @@ -138,13 +138,13 @@ def __init__(self, attrs=None): class Media: css = { "all": [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.css", + "capeditor/css/maplibre-gl.css", "capeditor/css/widget/circle-widget.css", ] } js = [ - "https://unpkg.com/maplibre-gl@2.1.1/dist/maplibre-gl.js", - "https://unpkg.com/@turf/turf/turf.min.js", + "capeditor/js/maplibre-gl.js", + "capeditor/js/turf.min.js", "capeditor/js/widget/circle-widget.js", ] diff --git a/capeditor/static/capeditor/css/mapbox-gl-draw.css b/capeditor/static/capeditor/css/mapbox-gl-draw.css new file mode 100644 index 0000000..0347a27 --- /dev/null +++ b/capeditor/static/capeditor/css/mapbox-gl-draw.css @@ -0,0 +1,88 @@ + +/* Override default control style */ +.mapbox-gl-draw_ctrl-bottom-left, +.mapbox-gl-draw_ctrl-top-left { + margin-left:0; + border-radius:0 4px 4px 0; +} +.mapbox-gl-draw_ctrl-top-right, +.mapbox-gl-draw_ctrl-bottom-right { + margin-right:0; + border-radius:4px 0 0 4px; +} + +.mapbox-gl-draw_ctrl-draw-btn { + border-color:rgba(0,0,0,0.9); + color:rgba(255,255,255,0.5); + width:30px; + height:30px; +} + +.mapbox-gl-draw_ctrl-draw-btn.active, +.mapbox-gl-draw_ctrl-draw-btn.active:hover { + background-color:rgb(0 0 0/5%); +} +.mapbox-gl-draw_ctrl-draw-btn { + background-repeat: no-repeat; + background-position: center; +} + +.mapbox-gl-draw_point { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m10 2c-3.3 0-6 2.7-6 6s6 9 6 9 6-5.7 6-9-2.7-6-6-6zm0 2c2.1 0 3.8 1.7 3.8 3.8 0 1.5-1.8 3.9-2.9 5.2h-1.7c-1.1-1.4-2.9-3.8-2.9-5.2-.1-2.1 1.6-3.8 3.7-3.8z"/>%3C/svg>'); +} +.mapbox-gl-draw_polygon { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m15 12.3v-4.6c.6-.3 1-1 1-1.7 0-1.1-.9-2-2-2-.7 0-1.4.4-1.7 1h-4.6c-.3-.6-1-1-1.7-1-1.1 0-2 .9-2 2 0 .7.4 1.4 1 1.7v4.6c-.6.3-1 1-1 1.7 0 1.1.9 2 2 2 .7 0 1.4-.4 1.7-1h4.6c.3.6 1 1 1.7 1 1.1 0 2-.9 2-2 0-.7-.4-1.4-1-1.7zm-8-.3v-4l1-1h4l1 1v4l-1 1h-4z"/>%3C/svg>'); +} +.mapbox-gl-draw_line { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m13.5 3.5c-1.4 0-2.5 1.1-2.5 2.5 0 .3 0 .6.2.9l-3.8 3.8c-.3-.1-.6-.2-.9-.2-1.4 0-2.5 1.1-2.5 2.5s1.1 2.5 2.5 2.5 2.5-1.1 2.5-2.5c0-.3 0-.6-.2-.9l3.8-3.8c.3.1.6.2.9.2 1.4 0 2.5-1.1 2.5-2.5s-1.1-2.5-2.5-2.5z"/>%3C/svg>'); +} +.mapbox-gl-draw_trash { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M10,3.4 c-0.8,0-1.5,0.5-1.8,1.2H5l-1,1v1h12v-1l-1-1h-3.2C11.5,3.9,10.8,3.4,10,3.4z M5,8v7c0,1,1,2,2,2h6c1,0,2-1,2-2V8h-2v5.5h-1.5V8h-3 v5.5H7V8H5z"/>%3C/svg>'); +} +.mapbox-gl-draw_uncombine { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m12 2c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm4 4c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm-7 1c-1 0-1 1-.5 1.5.3.3 1 1 1 1l-1 1s-.5.5 0 1 1 0 1 0l1-1 1 1c.5.5 1.5.5 1.5-.5v-4zm-5 3c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l4.9 4.9c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-4.9-4.9c-.1-.2-.4-.3-.7-.3z"/>%3C/svg>'); +} +.mapbox-gl-draw_combine { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M12.1,2c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l4.9,4.9c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-4.9-4.9C12.6,2.1,12.3,2,12.1,2z M8,8C7,8,7,9,7.5,9.5c0.3,0.3,1,1,1,1l-1,1c0,0-0.5,0.5,0,1s1,0,1,0l1-1l1,1 C11,13,12,13,12,12V8H8z M4,10c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1c0.4-0.4,0.4-1,0-1.4 l-1-1C4.5,10.1,4.3,10,4,10z M8,14c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-1-1C8.5,14.1,8.3,14,8,14z"/>%3C/svg>'); +} + +.mapboxgl-map.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: pointer; +} +.mapboxgl-map.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mouse-add .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: crosshair; +} +.mapboxgl-map.mouse-move.mode-direct_select .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: grab; + cursor: -moz-grab; + cursor: -webkit-grab; +} +.mapboxgl-map.mode-direct_select.feature-vertex.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mode-direct_select.feature-midpoint.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: cell; +} +.mapboxgl-map.mode-direct_select.feature-feature.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mode-static.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: grab; + cursor: -moz-grab; + cursor: -webkit-grab; +} + +.mapbox-gl-draw_boxselect { + pointer-events: none; + position: absolute; + top: 0; + left: 0; + width: 0; + height: 0; + background: rgba(0,0,0,.1); + border: 2px dotted #fff; + opacity: 0.5; +} diff --git a/capeditor/static/capeditor/css/maplibre-gl.css b/capeditor/static/capeditor/css/maplibre-gl.css new file mode 100644 index 0000000..8e1b9d4 --- /dev/null +++ b/capeditor/static/capeditor/css/maplibre-gl.css @@ -0,0 +1 @@ +.mapboxgl-map,.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.mapboxgl-canvas,.maplibregl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen,.maplibregl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass,.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer,.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active,.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas,.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas,.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}.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right,.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left,.maplibregl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top-right,.maplibregl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-bottom-left,.maplibregl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-bottom-right,.maplibregl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl,.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl,.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top-right .mapboxgl-ctrl,.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-group,.maplibregl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty),.maplibregl-ctrl-group:not(:empty){-moz-box-shadow:0 0 2px rgba(0,0,0,.1);-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty),.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button,.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}.mapboxgl-ctrl-group button+button,.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon,.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon,.maplibregl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button,.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl button::-moz-focus-inner,.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus,.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled,.maplibregl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.mapboxgl-ctrl button:not(:disabled):hover,.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-group button:focus:focus-visible,.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible),.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl-group button:focus:first-child,.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:focus:last-child,.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:focus:only-child,.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E %3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E %3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E %3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E %3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E %3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E %3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E %3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E %3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E %3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E %3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E %3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E %3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E %3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon,.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 width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon,.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 width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{-webkit-animation:maplibregl-spin 2s linear infinite;-moz-animation:maplibregl-spin 2s linear infinite;-o-animation:maplibregl-spin 2s linear infinite;-ms-animation:maplibregl-spin 2s linear infinite;animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon,.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 width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon,.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 width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E %3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E %3C/svg%3E")}}@-webkit-keyframes maplibregl-spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-moz-keyframes maplibregl-spin{0%{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(1turn)}}@-o-keyframes maplibregl-spin{0%{-o-transform:rotate(0deg)}to{-o-transform:rotate(1turn)}}@-ms-keyframes maplibregl-spin{0%{-ms-transform:rotate(0deg)}to{-ms-transform:rotate(1turn)}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo,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 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.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.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.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.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.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.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.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256v-1.103l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843c-.35 0-.666-.142-.894-.373-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493-.56.329-.993.79-1.3 1.382-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19c.166-.076.323-.172.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.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.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.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-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79c-.231-.219-.51-.329-.84-.329-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122c.436.215.916.322 1.44.322a3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.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.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148c-.14.067-.273.15-.4.249a2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333v-1.645zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.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.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact,a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo,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 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.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.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.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.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.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.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.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256v-1.103l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843c-.35 0-.666-.142-.894-.373-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493-.56.329-.993.79-1.3 1.382-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19c.166-.076.323-.172.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.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.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.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-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79c-.231-.219-.51-.329-.84-.329-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122c.436.215.916.322 1.44.322a3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.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.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148c-.14.067-.273.15-.4.249a2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333v-1.645zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.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.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo,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 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.42l-.726 3.663a1.255 1.255 0 01-1.232 1.011h-1.827a1.255 1.255 0 01-1.229-1.509l2.501-12.095a1.255 1.255 0 011.23-1.001h.197a1.255 1.255 0 011.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 011.123-.695h.181a1.255 1.255 0 011.227.991l1.443 6.71a5.11 5.11 0 01.314-.787l.009-.016a4.623 4.623 0 011.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 011.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 011.212.925 1.255 1.255 0 011.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.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 011.255-1.255h1.86A1.255 1.255 0 0154.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 01-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 011.722-.674 2.43 2.43 0 011.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 011.255-1.255h1.744A1.255 1.255 0 0165.812 4.7v3.335a4.76 4.76 0 011.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 011.67 1.743v-.98a1.255 1.255 0 011.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 011.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 01.689 1.004 4.73 4.73 0 01.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.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 01-.947 1.09l.408.952a1.255 1.255 0 01-.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.815 5.815 0 01-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 01-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 01-1.256 1.256h-1.777a1.255 1.255 0 01-1.256-1.256v-1.103l-.032.057a4.778 4.778 0 01-1.86 1.833 5.04 5.04 0 01-2.484.634 4.47 4.47 0 01-1.935-.424 1.252 1.252 0 01-.764.258h-1.71a1.255 1.255 0 01-1.256-1.255V7.687a2.402 2.402 0 01-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 01-1.256 1.255h-1.843c-.35 0-.666-.142-.894-.373-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 01-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 01-1.782 1.884 4.767 4.767 0 01-2.485.67 5.6 5.6 0 01-1.485-.188l.009 2.764a1.255 1.255 0 01-1.255 1.259h-1.729a1.255 1.255 0 01-1.255-1.255v-3.537a1.255 1.255 0 01-1.167.793h-1.679a1.25 1.25 0 01-.77-.263 4.47 4.47 0 01-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 01-1.081-.836 1.255 1.255 0 01-1.254 1.312h-1.81a1.255 1.255 0 01-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 01-1.115.676h-.098a1.255 1.255 0 01-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 00-.668-.428l-.27-.12a3.293 3.293 0 00-1.235-.23c-.757 0-1.415.163-1.974.493-.56.329-.993.79-1.3 1.382-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 001.382 1.381 3.883 3.883 0 001.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 00.934-.19c.166-.076.323-.172.468-.29l.178-.161a2.163 2.163 0 00.397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 00-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 00-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 00-.353-.389.851.851 0 00-.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.626 2.626 0 00.331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 001.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 00-.415.262l-.199.166a3.35 3.35 0 00-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 00-.284.136 1.99 1.99 0 00-.363.254 2.237 2.237 0 00-.46.569l-.082.162a2.56 2.56 0 00-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 00.367.385.937.937 0 00.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-.221a.995.995 0 00-.503.135l-.012.007a.859.859 0 00-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 00.14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 00-.345-.79c-.231-.219-.51-.329-.84-.329-.34 0-.625.11-.855.33a1.053 1.053 0 00-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314l.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 00.316.224l.223.122c.436.215.916.322 1.44.322a3.785 3.785 0 001.875-.477 3.52 3.52 0 001.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 00-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 00-1.527.344l-.086.043-.165.09a3.412 3.412 0 00-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 00-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 00.566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 00.975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 00-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 00-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.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.868.868 0 00-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 00.367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 00-.545.063 2.086 2.086 0 00-.411.148c-.14.067-.273.15-.4.249a2.482 2.482 0 00-.485.499 2.659 2.659 0 00-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 01.466-.636 2.52 2.52 0 01.399-.253 2.19 2.19 0 01.224-.099zm9.784 2.656l.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 00-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 01-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256l-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 00-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333v-1.645zm7.103-5.908v7.553h-1.843V9.242h1.843z' fill='%23000' fill-opacity='.4' fill-rule='evenodd'/%3E%3Cpath d='M19.63 11.151l-.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.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 01-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 011.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 011.234.231 3.341 3.341 0 01.97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 01-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 00-.807-.872 2.098 2.098 0 00-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 01-1.316 1.399 3.51 3.51 0 01-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 01-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z' fill='%23fff'/%3E%3Cpath d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 01-.856-.346 1.165 1.165 0 01-.346-.856 1.053 1.053 0 01.346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 01.345.79 1.159 1.159 0 01-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 01-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 011.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 011.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 01-1.382 1.366 3.785 3.785 0 01-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 00-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 00.807.872 2.1 2.1 0 001.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 011.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 01-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 011.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 00.938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z' fill='%23e1e3e9'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath d='M8.166 16.146l-.002.002a1.54 1.54 0 01-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 00.113.023.286.286 0 00.189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 00.074.047zm-2.52-.548a16.898 16.898 0 01-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 01-1.182 1.315h.15a1.912 1.912 0 011.914 1.914v1.84a1.912 1.912 0 01-1.914 1.914H4.377a1.912 1.912 0 01-1.914-1.914v-1.84a1.912 1.912 0 011.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z' fill='%23000' fill-opacity='.4'/%3E%3Cpath d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 01-.189.07.286.286 0 01-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z' fill='%23e1e3e9'/%3E%3Cpath d='M4.377 15.948a.657.657 0 00-.659.659v1.84a.657.657 0 00.659.659h5.565a.657.657 0 00.659-.659v-1.84a.657.657 0 00-.659-.659zm4.83 1.16H5.114v.838h4.093z' fill='%23fff'/%3E%3C/g%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib,.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact,.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.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}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner,.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner,.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after,.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E")}}.mapboxgl-ctrl-attrib a,.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover,.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-attrib-empty,.maplibregl-attrib-empty{display:none}.mapboxgl-ctrl-scale,.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.mapboxgl-popup,.maplibregl-popup{display:-webkit-flex;display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right,.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{-webkit-flex-direction:column;flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right,.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.mapboxgl-popup-anchor-left,.maplibregl-popup-anchor-left{-webkit-flex-direction:row;flex-direction:row}.mapboxgl-popup-anchor-right,.maplibregl-popup-anchor-right{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.mapboxgl-popup-tip,.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,.maplibregl-popup-anchor-top .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip,.maplibregl-popup-anchor-left .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip,.maplibregl-popup-anchor-right .maplibregl-popup-tip{-webkit-align-self:center;align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button,.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover,.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.mapboxgl-popup-content,.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content,.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content,.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content,.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content,.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer,.maplibregl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *,.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer,.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer,.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.mapboxgl-marker,.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.mapboxgl-user-location-dot,.maplibregl-user-location-dot{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before,.maplibregl-user-location-dot:before{-webkit-animation:maplibregl-user-location-dot-pulse 2s infinite;-moz-animation:maplibregl-user-location-dot-pulse 2s infinite;-ms-animation:maplibregl-user-location-dot-pulse 2s infinite;animation:maplibregl-user-location-dot-pulse 2s infinite;background-color:#1da1f2;border-radius:50%;content:"";height:15px;position:absolute;width:15px}.mapboxgl-user-location-dot:after,.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@-webkit-keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;-webkit-transform:scale(1)}70%{opacity:0;-webkit-transform:scale(3)}to{opacity:0;-webkit-transform:scale(1)}}@-ms-keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;-ms-transform:scale(1)}70%{opacity:0;-ms-transform:scale(3)}to{opacity:0;-ms-transform:scale(1)}}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale,.maplibregl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after,.maplibregl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle,.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active,.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom,.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0} \ No newline at end of file diff --git a/capeditor/static/capeditor/fonts/mapbox-gl-draw.css b/capeditor/static/capeditor/fonts/mapbox-gl-draw.css new file mode 100644 index 0000000..0347a27 --- /dev/null +++ b/capeditor/static/capeditor/fonts/mapbox-gl-draw.css @@ -0,0 +1,88 @@ + +/* Override default control style */ +.mapbox-gl-draw_ctrl-bottom-left, +.mapbox-gl-draw_ctrl-top-left { + margin-left:0; + border-radius:0 4px 4px 0; +} +.mapbox-gl-draw_ctrl-top-right, +.mapbox-gl-draw_ctrl-bottom-right { + margin-right:0; + border-radius:4px 0 0 4px; +} + +.mapbox-gl-draw_ctrl-draw-btn { + border-color:rgba(0,0,0,0.9); + color:rgba(255,255,255,0.5); + width:30px; + height:30px; +} + +.mapbox-gl-draw_ctrl-draw-btn.active, +.mapbox-gl-draw_ctrl-draw-btn.active:hover { + background-color:rgb(0 0 0/5%); +} +.mapbox-gl-draw_ctrl-draw-btn { + background-repeat: no-repeat; + background-position: center; +} + +.mapbox-gl-draw_point { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m10 2c-3.3 0-6 2.7-6 6s6 9 6 9 6-5.7 6-9-2.7-6-6-6zm0 2c2.1 0 3.8 1.7 3.8 3.8 0 1.5-1.8 3.9-2.9 5.2h-1.7c-1.1-1.4-2.9-3.8-2.9-5.2-.1-2.1 1.6-3.8 3.7-3.8z"/>%3C/svg>'); +} +.mapbox-gl-draw_polygon { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m15 12.3v-4.6c.6-.3 1-1 1-1.7 0-1.1-.9-2-2-2-.7 0-1.4.4-1.7 1h-4.6c-.3-.6-1-1-1.7-1-1.1 0-2 .9-2 2 0 .7.4 1.4 1 1.7v4.6c-.6.3-1 1-1 1.7 0 1.1.9 2 2 2 .7 0 1.4-.4 1.7-1h4.6c.3.6 1 1 1.7 1 1.1 0 2-.9 2-2 0-.7-.4-1.4-1-1.7zm-8-.3v-4l1-1h4l1 1v4l-1 1h-4z"/>%3C/svg>'); +} +.mapbox-gl-draw_line { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m13.5 3.5c-1.4 0-2.5 1.1-2.5 2.5 0 .3 0 .6.2.9l-3.8 3.8c-.3-.1-.6-.2-.9-.2-1.4 0-2.5 1.1-2.5 2.5s1.1 2.5 2.5 2.5 2.5-1.1 2.5-2.5c0-.3 0-.6-.2-.9l3.8-3.8c.3.1.6.2.9.2 1.4 0 2.5-1.1 2.5-2.5s-1.1-2.5-2.5-2.5z"/>%3C/svg>'); +} +.mapbox-gl-draw_trash { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M10,3.4 c-0.8,0-1.5,0.5-1.8,1.2H5l-1,1v1h12v-1l-1-1h-3.2C11.5,3.9,10.8,3.4,10,3.4z M5,8v7c0,1,1,2,2,2h6c1,0,2-1,2-2V8h-2v5.5h-1.5V8h-3 v5.5H7V8H5z"/>%3C/svg>'); +} +.mapbox-gl-draw_uncombine { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m12 2c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm4 4c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm-7 1c-1 0-1 1-.5 1.5.3.3 1 1 1 1l-1 1s-.5.5 0 1 1 0 1 0l1-1 1 1c.5.5 1.5.5 1.5-.5v-4zm-5 3c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l4.9 4.9c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-4.9-4.9c-.1-.2-.4-.3-.7-.3z"/>%3C/svg>'); +} +.mapbox-gl-draw_combine { + background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M12.1,2c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l4.9,4.9c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-4.9-4.9C12.6,2.1,12.3,2,12.1,2z M8,8C7,8,7,9,7.5,9.5c0.3,0.3,1,1,1,1l-1,1c0,0-0.5,0.5,0,1s1,0,1,0l1-1l1,1 C11,13,12,13,12,12V8H8z M4,10c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1c0.4-0.4,0.4-1,0-1.4 l-1-1C4.5,10.1,4.3,10,4,10z M8,14c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-1-1C8.5,14.1,8.3,14,8,14z"/>%3C/svg>'); +} + +.mapboxgl-map.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: pointer; +} +.mapboxgl-map.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mouse-add .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: crosshair; +} +.mapboxgl-map.mouse-move.mode-direct_select .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: grab; + cursor: -moz-grab; + cursor: -webkit-grab; +} +.mapboxgl-map.mode-direct_select.feature-vertex.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mode-direct_select.feature-midpoint.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: cell; +} +.mapboxgl-map.mode-direct_select.feature-feature.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: move; +} +.mapboxgl-map.mode-static.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive { + cursor: grab; + cursor: -moz-grab; + cursor: -webkit-grab; +} + +.mapbox-gl-draw_boxselect { + pointer-events: none; + position: absolute; + top: 0; + left: 0; + width: 0; + height: 0; + background: rgba(0,0,0,.1); + border: 2px dotted #fff; + opacity: 0.5; +} diff --git a/capeditor/static/capeditor/js/mapbox-gl-draw.js b/capeditor/static/capeditor/js/mapbox-gl-draw.js new file mode 100644 index 0000000..10e1461 --- /dev/null +++ b/capeditor/static/capeditor/js/mapbox-gl-draw.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).MapboxDraw=e()}(this,(function(){"use strict";var t=function(t,e){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},o={on:function(t,e,o){if(void 0===n[t])throw new Error("Invalid event type: "+t);n[t].push({selector:e,fn:o})},render:function(t){e.store.featureChanged(t)}},r=function(t,r){for(var i=n[t],a=i.length;a--;){var s=i[a];if(s.selector(r)){s.fn.call(o,r)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(o),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){r("drag",t)},click:function(t){r("click",t)},mousemove:function(t){r("mousemove",t)},mousedown:function(t){r("mousedown",t)},mouseup:function(t){r("mouseup",t)},mouseout:function(t){r("mouseout",t)},keydown:function(t){r("keydown",t)},keyup:function(t){r("keyup",t)},touchstart:function(t){r("touchstart",t)},touchmove:function(t){r("touchmove",t)},touchend:function(t){r("touchend",t)},tap:function(t){r("tap",t)}}};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){if(this instanceof t){var n=[null];n.push.apply(n,arguments);var o=Function.bind.apply(e,n);return new o}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:function(){return t[e]}})})),n}var o={},r={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142},i=r;function a(t){var e=0;if(t&&t.length>0){e+=Math.abs(s(t[0]));for(var n=1;n2){for(s=0;s=Math.pow(2,t)?R(t,e):i};R.rack=function(t,e,n){var o=function(o){var i=0;do{if(i++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var a=R(t,e)}while(Object.hasOwnProperty.call(r,a));return r[a]=o,a},r=o.hats={};return o.get=function(t){return o.hats[t]},o.set=function(t,e){return o.hats[t]=e,o},o.bits=t||128,o.base=e||16,o};var D=e(w.exports),k=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||D(),this.type=e.geometry.type};k.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},k.prototype.incomingCoords=function(t){this.setCoordinates(t)},k.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},k.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},k.prototype.setProperty=function(t,e){this.properties[t]=e},k.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:f.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},k.prototype.internal=function(t){var e={id:this.id,meta:v.FEATURE,"meta:type":this.type,active:m.INACTIVE,mode:t};if(this.ctx.options.userProperties)for(var n in this.properties)e["user_"+n]=this.properties[n];return{type:f.FEATURE,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var U=function(t,e){k.call(this,t,e)};(U.prototype=Object.create(k.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},U.prototype.updateCoordinate=function(t,e,n){this.coordinates=3===arguments.length?[e,n]:[t,e],this.changed()},U.prototype.getCoordinate=function(){return this.getCoordinates()};var j=function(t,e){k.call(this,t,e)};(j.prototype=Object.create(k.prototype)).isValid=function(){return this.coordinates.length>1},j.prototype.addCoordinate=function(t,e,n){this.changed();var o=parseInt(t,10);this.coordinates.splice(o,0,[e,n])},j.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},j.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},j.prototype.updateCoordinate=function(t,e,n){var o=parseInt(t,10);this.coordinates[o]=[e,n],this.changed()};var V=function(t,e){k.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(V.prototype=Object.create(k.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},V.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},V.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},V.prototype.addCoordinate=function(t,e,n){this.changed();var o=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[o[0]].splice(o[1],0,[e,n])},V.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];n&&(n.splice(e[1],1),n.length<3&&this.coordinates.splice(e[0],1))},V.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];return JSON.parse(JSON.stringify(n[e[1]]))},V.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},V.prototype.updateCoordinate=function(t,e,n){this.changed();var o=t.split("."),r=parseInt(o[0],10),i=parseInt(o[1],10);void 0===this.coordinates[r]&&(this.coordinates[r]=[]),this.coordinates[r][i]=[e,n]};var B={MultiPoint:U,MultiLineString:j,MultiPolygon:V},G=function(t,e,n,o,r){var i=n.split("."),a=parseInt(i[0],10),s=i[1]?i.slice(1).join("."):null;return t[a][e](s,o,r)},J=function(t,e){if(k.call(this,t,e),delete this.coordinates,this.model=B[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function z(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(J.prototype=Object.create(k.prototype))._coordinatesToFeatures=function(t){var e=this,n=this.model.bind(this);return t.map((function(t){return new n(e.ctx,{id:D(),type:f.FEATURE,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},J.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},J.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},J.prototype.getCoordinate=function(t){return G(this.features,"getCoordinate",t)},J.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===f.POLYGON?t.getCoordinates():t.coordinates}))))},J.prototype.updateCoordinate=function(t,e,n){G(this.features,"updateCoordinate",t,e,n),this.changed()},J.prototype.addCoordinate=function(t,e,n){G(this.features,"addCoordinate",t,e,n),this.changed()},J.prototype.removeCoordinate=function(t){G(this.features,"removeCoordinate",t),this.changed()},J.prototype.getFeatures=function(){return this.features},z.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},z.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,n){return void 0===t[n.feature_id]&&(t[n.feature_id]=!0,e._ctx.store.get(n.feature_id).changed()),t}),{})},z.prototype.getSelected=function(){return this._ctx.store.getSelected()},z.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},z.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},z.prototype.getFeature=function(t){return this._ctx.store.get(t)},z.prototype.select=function(t){return this._ctx.store.select(t)},z.prototype.deselect=function(t){return this._ctx.store.deselect(t)},z.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},z.prototype.addFeature=function(t){return this._ctx.store.add(t)},z.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},z.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},z.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},z.prototype.changeMode=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._ctx.events.changeMode(t,e,n)},z.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},z.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},z.prototype.featuresAt=function(t,e,n){if(void 0===n&&(n="click"),"click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return M[n](t,e,this._ctx)},z.prototype.newFeature=function(t){var e=t.geometry.type;return e===f.POINT?new U(this._ctx,t):e===f.LINE_STRING?new j(this._ctx,t):e===f.POLYGON?new V(this._ctx,t):new J(this._ctx,t)},z.prototype.isInstanceOf=function(t,e){if(t===f.POINT)return e instanceof U;if(t===f.LINE_STRING)return e instanceof j;if(t===f.POLYGON)return e instanceof V;if("MultiFeature"===t)return e instanceof J;throw new Error("Unknown feature class: "+t)},z.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},z.prototype.onSetup=function(){},z.prototype.onDrag=function(){},z.prototype.onClick=function(){},z.prototype.onMouseMove=function(){},z.prototype.onMouseDown=function(){},z.prototype.onMouseUp=function(){},z.prototype.onMouseOut=function(){},z.prototype.onKeyUp=function(){},z.prototype.onKeyDown=function(){},z.prototype.onTouchStart=function(){},z.prototype.onTouchMove=function(){},z.prototype.onTouchEnd=function(){},z.prototype.onTap=function(){},z.prototype.onStop=function(){},z.prototype.onTrash=function(){},z.prototype.onCombineFeature=function(){},z.prototype.onUncombineFeature=function(){},z.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var Y={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},$=Object.keys(Y);function q(t){var e=Object.keys(t);return function(n,o){void 0===o&&(o={});var r={},i=e.reduce((function(e,n){return e[n]=t[n],e}),new z(n));return{start:function(){var e=this;r=i.onSetup(o),$.forEach((function(n){var o,a=Y[n],s=function(){return!1};t[a]&&(s=function(){return!0}),e.on(n,s,(o=a,function(t){return i[o](r,t)}))}))},stop:function(){i.onStop(r)},trash:function(){i.onTrash(r)},combineFeatures:function(){i.onCombineFeatures(r)},uncombineFeatures:function(){i.onUncombineFeatures(r)},render:function(t,e){i.toDisplayFeatures(r,t,e)}}}}function H(t){return[].concat(t).filter((function(t){return void 0!==t}))}function X(){var t=this;if(!(t.ctx.map&&void 0!==t.ctx.map.getSource(l.HOT)))return u();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var n=[],o=[];t.isDirty?o=t.getAllIds():(n=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),o=t.sources.hot.filter((function(e){return e.properties.id&&-1===n.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var r=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===n.indexOf(e)}));var i=r!==t.sources.cold.length||o.length>0;function a(n,o){var r=t.get(n).internal(e);t.ctx.events.currentModeRender(r,(function(e){t.sources[o].push(e)}))}if(n.forEach((function(t){return a(t,"hot")})),o.forEach((function(t){return a(t,"cold")})),i&&t.ctx.map.getSource(l.COLD).setData({type:f.FEATURE_COLLECTION,features:t.sources.cold}),t.ctx.map.getSource(l.HOT).setData({type:f.FEATURE_COLLECTION,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(g.SELECTION_CHANGE,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var s=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(g.DELETE,{features:s})}function u(){t.isDirty=!1,t.clearChangedIds()}u(),t.ctx.map.fire(g.RENDER,{})}function Z(t){var e,n=this;this._features={},this._featureIds=new I,this._selectedFeatureIds=new I,this._selectedCoordinates=[],this._changedFeatureIds=new I,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,X.call(n)})))},this.isDirty=!1}function W(t,e){var n=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===n.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=n}Z.prototype.createRenderBatch=function(){var t=this,e=this.render,n=0;return this.render=function(){n++},function(){t.render=e,n>0&&t.render()}},Z.prototype.setDirty=function(){return this.isDirty=!0,this},Z.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},Z.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},Z.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},Z.prototype.getAllIds=function(){return this._featureIds.values()},Z.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},Z.prototype.delete=function(t,e){var n=this;return void 0===e&&(e={}),H(t).forEach((function(t){n._featureIds.has(t)&&(n._featureIds.delete(t),n._selectedFeatureIds.delete(t),e.silent||-1===n._deletedFeaturesToEmit.indexOf(n._features[t])&&n._deletedFeaturesToEmit.push(n._features[t]),delete n._features[t],n.isDirty=!0)})),W(this,e),this},Z.prototype.get=function(t){return this._features[t]},Z.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},Z.prototype.select=function(t,e){var n=this;return void 0===e&&(e={}),H(t).forEach((function(t){n._selectedFeatureIds.has(t)||(n._selectedFeatureIds.add(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),this},Z.prototype.deselect=function(t,e){var n=this;return void 0===e&&(e={}),H(t).forEach((function(t){n._selectedFeatureIds.has(t)&&(n._selectedFeatureIds.delete(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),W(this,e),this},Z.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},Z.prototype.setSelected=function(t,e){var n=this;return void 0===e&&(e={}),t=H(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!n._selectedFeatureIds.has(t)})),{silent:e.silent}),this},Z.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},Z.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},Z.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},Z.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},Z.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},Z.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},Z.prototype.setFeatureProperty=function(t,e,n){this.get(t).setProperty(e,n),this.featureChanged(t)},Z.prototype.storeMapConfig=function(){var t=this;_.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},Z.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},Z.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var K=function(){for(var t=arguments,e={},n=0;n=48&&t<=57)};function c(o,r,i){void 0===i&&(i={}),s.stop();var u=n[o];if(void 0===u)throw new Error(o+" is not valid");a=o;var c=u(e,r);s=t(c,e),i.silent||e.map.fire(g.MODE_CHANGE,{mode:o}),e.store.setDirty(),e.store.render()}i.keydown=function(t){(t.srcElement||t.target).classList.contains("mapboxgl-canvas")&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?u(t.keyCode)?s.keydown(t):49===t.keyCode&&e.options.controls.point?c(h.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?c(h.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&c(h.DRAW_POLYGON):(t.preventDefault(),s.trash()))},i.keyup=function(t){u(t.keyCode)&&s.keyup(t)},i.zoomend=function(){e.store.changeZoom()},i.data=function(t){if("style"===t.dataType){var n=e.setup,o=e.map,r=e.options,i=e.store;r.styles.some((function(t){return o.getLayer(t.id)}))||(n.addLayers(),i.setDirty(),i.render())}};var l={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){a=e.options.defaultMode,s=t(n[a](e),e)},changeMode:c,actionable:function(t){var n=!1;Object.keys(t).forEach((function(e){if(void 0===l[e])throw new Error("Invalid action type");l[e]!==t[e]&&(n=!0),l[e]=t[e]})),n&&e.map.fire(g.ACTIONABLE,{actions:l})},currentModeName:function(){return a},currentModeRender:function(t,e){return s.render(t,e)},fire:function(t,e){i[t]&&i[t](e)},addEventListeners:function(){e.map.on("mousemove",i.mousemove),e.map.on("mousedown",i.mousedown),e.map.on("mouseup",i.mouseup),e.map.on("data",i.data),e.map.on("touchmove",i.touchmove),e.map.on("touchstart",i.touchstart),e.map.on("touchend",i.touchend),e.container.addEventListener("mouseout",i.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",i.keydown),e.container.addEventListener("keyup",i.keyup))},removeEventListeners:function(){e.map.off("mousemove",i.mousemove),e.map.off("mousedown",i.mousedown),e.map.off("mouseup",i.mouseup),e.map.off("data",i.data),e.map.off("touchmove",i.touchmove),e.map.off("touchstart",i.touchstart),e.map.off("touchend",i.touchend),e.container.removeEventListener("mouseout",i.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",i.keydown),e.container.removeEventListener("keyup",i.keyup))},trash:function(t){s.trash(t)},combineFeatures:function(){s.combineFeatures()},uncombineFeatures:function(){s.uncombineFeatures()},getMode:function(){return a}}}(e),e.ui=function(t){var e={},n=null,o={mode:null,feature:null,mouse:null},r={mode:null,feature:null,mouse:null};function i(t){r=tt(r,t)}function a(){var e,n;if(t.container){var i=[],a=[];et.forEach((function(t){r[t]!==o[t]&&(i.push(t+"-"+o[t]),null!==r[t]&&a.push(t+"-"+r[t]))})),i.length>0&&(e=t.container.classList).remove.apply(e,i),a.length>0&&(n=t.container.classList).add.apply(n,a),o=tt(o,r)}}function s(t,e){void 0===e&&(e={});var o=document.createElement("button");return o.className=c.CONTROL_BUTTON+" "+e.className,o.setAttribute("title",e.title),e.container.appendChild(o),o.addEventListener("click",(function(o){if(o.preventDefault(),o.stopPropagation(),o.target===n)return u(),void e.onDeactivate();l(t),e.onActivate()}),!0),o}function u(){n&&(n.classList.remove(c.ACTIVE_BUTTON),n=null)}function l(t){u();var o=e[t];o&&o&&"trash"!==t&&(o.classList.add(c.ACTIVE_BUTTON),n=o)}return{setActiveButton:l,queueMapClasses:i,updateMapClasses:a,clearMapClasses:function(){i({mode:null,feature:null,mouse:null}),a()},addButtons:function(){var n=t.options.controls,o=document.createElement("div");return o.className=c.CONTROL_GROUP+" "+c.CONTROL_BASE,n?(n[p.LINE]&&(e[p.LINE]=s(p.LINE,{container:o,className:c.CONTROL_BUTTON_LINE,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(h.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),n[p.POLYGON]&&(e[p.POLYGON]=s(p.POLYGON,{container:o,className:c.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(h.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),n[p.POINT]&&(e[p.POINT]=s(p.POINT,{container:o,className:c.CONTROL_BUTTON_POINT,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(h.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),n.trash&&(e.trash=s("trash",{container:o,className:c.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){t.events.trash()}})),n.combine_features&&(e.combine_features=s("combineFeatures",{container:o,className:c.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),n.uncombine_features&&(e.uncombine_features=s("uncombineFeatures",{container:o,className:c.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),o):o},removeButtons:function(){Object.keys(e).forEach((function(t){var n=e[t];n.parentNode&&n.parentNode.removeChild(n),delete e[t]}))}}}(e),e.container=i.getContainer(),e.store=new Z(e),n=e.ui.addButtons(),e.options.boxSelect&&(e.boxZoomInitial=i.boxZoom.isEnabled(),i.boxZoom.disable(),i.dragPan.disable(),i.dragPan.enable()),i.loaded()?r.connect():(i.on("load",r.connect),o=setInterval((function(){i.loaded()&&r.connect()}),16)),e.events.start(),n},addLayers:function(){e.map.addSource(l.COLD,{data:{type:f.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(l.HOT,{data:{type:f.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(l.COLD)&&e.map.removeSource(l.COLD),e.map.getSource(l.HOT)&&e.map.removeSource(l.HOT)}};return e.setup=r,r}var ot=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function rt(t){return function(e){var n=e.featureTarget;return!!n&&(!!n.properties&&n.properties.meta===t)}}function it(t){return!!t.originalEvent&&(!!t.originalEvent.shiftKey&&0===t.originalEvent.button)}function at(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===m.ACTIVE&&t.featureTarget.properties.meta===v.FEATURE))}function st(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===m.INACTIVE&&t.featureTarget.properties.meta===v.FEATURE))}function ut(t){return void 0===t.featureTarget}function ct(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&t.featureTarget.properties.meta===v.FEATURE)}function lt(t){var e=t.featureTarget;return!!e&&(!!e.properties&&e.properties.meta===v.VERTEX)}function dt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function pt(t){return 27===t.keyCode}function ft(t){return 13===t.keyCode}var ht=Object.freeze({__proto__:null,isOfMetaType:rt,isShiftMousedown:it,isActiveFeature:at,isInactiveFeature:st,noTarget:ut,isFeature:ct,isVertex:lt,isShiftDown:dt,isEscapeKey:pt,isEnterKey:ft,isTrue:function(){return!0}}),gt=yt;function yt(t,e){this.x=t,this.y=e}yt.prototype={clone:function(){return new yt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),o=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=o,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),o=Math.sin(t),r=e.x+n*(this.x-e.x)-o*(this.y-e.y),i=e.y+o*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},yt.convert=function(t){return t instanceof yt?t:Array.isArray(t)?new yt(t[0],t[1]):t};var vt=e(gt);function mt(t,e){var n=e.getBoundingClientRect();return new vt(t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0))}function _t(t,e,n,o){return{type:f.FEATURE,properties:{meta:v.VERTEX,parent:t,coord_path:n,active:o?m.ACTIVE:m.INACTIVE},geometry:{type:f.POINT,coordinates:e}}}function bt(t,e,n){var o=e.geometry.coordinates,r=n.geometry.coordinates;if(o[1]>85||o[1]85||r[1]=e&&this._bbox[3]>=n},Jt.prototype.intersect=function(t){return this._valid?(e=t instanceof Jt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]e[3])):null;var e},Jt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Jt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var zt=function(t){if(!t)return[];var e=Lt(Mt(t)),n=[];return e.features.forEach((function(t){t.geometry&&(n=n.concat(Nt(t.geometry.coordinates)))})),n},Yt=Bt,$t=Gt,qt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Ht=Object.keys(qt);function Xt(t){for(var e=$t(),n=zt(t),o=0;on&&(n=u),cr&&(r=c),us&&(s=d)}));var u=e;return n+u.lat>85&&(u.lat=85-n),r+u.lat>90&&(u.lat=90-r),o+u.lat<-85&&(u.lat=-85-o),i+u.lat=270&&(u.lng-=360*Math.ceil(Math.abs(u.lng)/360)),u}function Qt(t,e){var n=Kt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,o=t.getCoordinates(),r=function(t){var e={lng:t[0]+n.lng,lat:t[1]+n.lat};return[e.lng,e.lat]},i=function(t){return t.map((function(t){return r(t)}))};t.type===f.POINT?e=r(o):t.type===f.LINE_STRING||t.type===f.MULTI_POINT?e=o.map(r):t.type===f.POLYGON||t.type===f.MULTI_LINE_STRING?e=o.map(i):t.type===f.MULTI_POLYGON&&(e=o.map((function(t){return t.map((function(t){return i(t)}))}))),t.incomingCoords(e)}))}var te={onSetup:function(t){var e=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(g.UPDATE,{action:y.MOVE,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),n=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),o=!1;if(e.length>1){o=!0;var r=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==r&&(o=!1)}))}var i=n.length>0,a=e.length>0;this.setActionableState({combineFeatures:o,uncombineFeatures:i,trash:a})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new I).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){Tt.enable(this)},onMouseMove:function(t,e){return ct(e)&&t.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};te.onTap=te.onClick=function(t,e){return ut(e)?this.clickAnywhere(t,e):rt(v.VERTEX)(e)?this.clickOnVertex(t,e):ct(e)?this.clickOnFeature(t,e):void 0},te.clickAnywhere=function(t){var e=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(t){return e.doRender(t)}))),Tt.enable(this),this.stopExtendedInteractions(t)},te.clickOnVertex=function(t,e){this.changeMode(h.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:d.MOVE})},te.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},te.clickOnFeature=function(t,e){var n=this;Tt.disable(this),this.stopExtendedInteractions(t);var o=dt(e),r=this.getSelectedIds(),i=e.featureTarget.properties.id,a=this.isSelected(i);if(!o&&a&&this.getFeature(i).type!==f.POINT)return this.changeMode(h.DIRECT_SELECT,{featureId:i});a&&o?(this.deselect(i),this.updateUIClasses({mouse:d.POINTER}),1===r.length&&Tt.enable(this)):!a&&o?(this.select(i),this.updateUIClasses({mouse:d.MOVE})):a||o||(r.forEach((function(t){return n.doRender(t)})),this.setSelected(i),this.updateUIClasses({mouse:d.MOVE})),this.doRender(i)},te.onMouseDown=function(t,e){return at(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&it(e)?this.startBoxSelect(t,e):void 0},te.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=mt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},te.onTouchStart=function(t,e){if(at(e))return this.startOnActiveFeature(t,e)},te.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},te.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:d.ADD}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add(c.BOX_SELECT),this.map.getContainer().appendChild(t.boxSelectElement));var n=mt(e.originalEvent,this.map.getContainer()),o=Math.min(t.boxSelectStartLocation.x,n.x),r=Math.max(t.boxSelectStartLocation.x,n.x),i=Math.min(t.boxSelectStartLocation.y,n.y),a=Math.max(t.boxSelectStartLocation.y,n.y),s="translate("+o+"px, "+i+"px)";t.boxSelectElement.style.transform=s,t.boxSelectElement.style.WebkitTransform=s,t.boxSelectElement.style.width=r-o+"px",t.boxSelectElement.style.height=a-i+"px"},te.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};Qt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},te.onTouchEnd=te.onMouseUp=function(t,e){var n=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var o=[t.boxSelectStartLocation,mt(e.originalEvent,this.map.getContainer())],r=this.featuresAt(null,o,"click"),i=this.getUniqueIds(r).filter((function(t){return!n.isSelected(t)}));i.length&&(this.select(i),i.forEach((function(t){return n.doRender(t)})),this.updateUIClasses({mouse:d.MOVE}))}this.stopExtendedInteractions(t)},te.toDisplayFeatures=function(t,e,n){e.properties.active=this.isSelected(e.properties.id)?m.ACTIVE:m.INACTIVE,n(e),this.fireActionable(),e.properties.active===m.ACTIVE&&e.geometry.type!==f.POINT&&Et(e).forEach(n)},te.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},te.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],n=[],o=t[0].type.replace("Multi",""),r=0;r1){var a=this.newFeature({type:f.FEATURE,properties:n[0].properties,geometry:{type:"Multi"+o,coordinates:e}});this.addFeature(a),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([a.id]),this.map.fire(g.COMBINE_FEATURES,{createdFeatures:[a.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},te.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var n=[],o=[],r=function(r){var i=e[r];t.isInstanceOf("MultiFeature",i)&&(i.getFeatures().forEach((function(e){t.addFeature(e),e.properties=i.properties,n.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(i.id,{silent:!0}),o.push(i.toGeoJSON()))},i=0;i1&&this.map.fire(g.UNCOMBINE_FEATURES,{createdFeatures:n,deletedFeatures:o}),this.fireActionable()}};var ee=rt(v.VERTEX),ne=rt(v.MIDPOINT),oe={fireUpdate:function(){this.map.fire(g.UPDATE,{action:y.CHANGE_COORDINATES,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties,o=t.selectedCoordPaths.indexOf(n.coord_path);dt(e)||-1!==o?dt(e)&&-1===o&&t.selectedCoordPaths.push(n.coord_path):t.selectedCoordPaths=[n.coord_path];var r=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(r)},onMidpoint:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties;t.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),t.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,n){Qt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,n){for(var o=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),r=Kt(o.map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t}}})),n),i=0;i0?this.dragVertex(t,e,n):this.dragFeature(t,e,n),t.dragMoveLocation=e.lngLat}},oe.onClick=function(t,e){return ut(e)?this.clickNoTarget(t,e):at(e)?this.clickActiveFeature(t,e):st(e)?this.clickInactive(t,e):void this.stopDragging(t)},oe.onTap=function(t,e){return ut(e)?this.clickNoTarget(t,e):at(e)?this.clickActiveFeature(t,e):st(e)?this.clickInactive(t,e):void 0},oe.onTouchEnd=oe.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var re={};function ie(t,e){return!!t.lngLat&&(t.lngLat.lng===e[0]&&t.lngLat.lat===e[1])}re.onSetup=function(){var t=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(p.POINT),this.setActionableState({trash:!0}),{point:t}},re.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT)},re.onTap=re.onClick=function(t,e){this.updateUIClasses({mouse:d.MOVE}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(g.CREATE,{features:[t.point.toGeoJSON()]}),this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.point.id]})},re.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},re.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.point.id;if(e.properties.active=o?m.ACTIVE:m.INACTIVE,!o)return n(e)},re.onTrash=re.stopDrawingAndRemove,re.onKeyUp=function(t,e){if(pt(e)||ft(e))return this.stopDrawingAndRemove(t,e)};var ae={onSetup:function(){var t=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.POLYGON,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),Tt.disable(this),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(p.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ie(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:d.ADD}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),lt(e)&&this.updateUIClasses({mouse:d.POINTER})}};ae.onTap=ae.onClick=function(t,e){return lt(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},ae.onKeyUp=function(t,e){pt(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT)):ft(e)&&this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},ae.onStop=function(t){this.updateUIClasses({mouse:d.NONE}),Tt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(g.CREATE,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT,{},{silent:!0})))},ae.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.polygon.id;if(e.properties.active=o?m.ACTIVE:m.INACTIVE,!o)return n(e);if(0!==e.geometry.coordinates.length){var r=e.geometry.coordinates[0].length;if(!(r<3)){if(e.properties.meta=v.FEATURE,n(_t(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),r>3){var i=e.geometry.coordinates[0].length-3;n(_t(t.polygon.id,e.geometry.coordinates[0][i],"0."+i,!1))}if(r<=4){var a=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(n({type:f.FEATURE,properties:e.properties,geometry:{coordinates:a,type:f.LINE_STRING}}),3===r)return}return n(e)}}},ae.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT)};var se={onSetup:function(t){var e,n,o=(t=t||{}).featureId,r="forward";if(o){if(!(e=this.getFeature(o)))throw new Error("Could not find a feature with the provided featureId");var i=t.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");var a=e.coordinates.length-1;if(e.coordinates[a][0]===i[0]&&e.coordinates[a][1]===i[1])n=a+1,e.addCoordinate.apply(e,[n].concat(e.coordinates[a]));else{if(e.coordinates[0][0]!==i[0]||e.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");r="backwards",n=0,e.addCoordinate.apply(e,[n].concat(e.coordinates[0]))}}else e=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.LINE_STRING,coordinates:[]}}),n=0,this.addFeature(e);return this.clearSelectedFeatures(),Tt.disable(this),this.updateUIClasses({mouse:d.ADD}),this.activateUIButton(p.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:n,direction:r}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ie(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&ie(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:d.ADD}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),lt(e)&&this.updateUIClasses({mouse:d.POINTER})}};se.onTap=se.onClick=function(t,e){if(lt(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},se.onKeyUp=function(t,e){ft(e)?this.changeMode(h.SIMPLE_SELECT,{featureIds:[t.line.id]}):pt(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT))},se.onStop=function(t){Tt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(g.CREATE,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT,{},{silent:!0})))},se.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(h.SIMPLE_SELECT)},se.toDisplayFeatures=function(t,e,n){var o=e.properties.id===t.line.id;if(e.properties.active=o?m.ACTIVE:m.INACTIVE,!o)return n(e);e.geometry.coordinates.length<2||(e.properties.meta=v.FEATURE,n(_t(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),n(e))};var ue={simple_select:te,direct_select:oe,draw_point:re,draw_polygon:ae,draw_line_string:se},ce={defaultMode:h.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:ot,modes:ue,controls:{},userProperties:!1},le={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},de={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function pe(t,e){return t.map((function(t){return t.source?t:tt(t,{id:t.id+"."+e,source:"hot"===e?l.HOT:l.COLD})}))}var fe={exports:{}};!function(t,e){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",u="[object Error]",c="[object Function]",l="[object Map]",d="[object Number]",p="[object Object]",f="[object Promise]",h="[object RegExp]",g="[object Set]",y="[object String]",v="[object Symbol]",m="[object WeakMap]",_="[object ArrayBuffer]",b="[object DataView]",E=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,C={};C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C[r]=C[i]=C[_]=C[a]=C[b]=C[s]=C[u]=C[c]=C[l]=C[d]=C[p]=C[h]=C[g]=C[y]=C[m]=!1;var O="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,I=O||S||Function("return this")(),x=e&&!e.nodeType&&e,M=x&&t&&!t.nodeType&&t,L=M&&M.exports===x,N=L&&O.process,A=function(){try{return N&&N.binding&&N.binding("util")}catch(t){}}(),P=A&&A.isTypedArray;function F(t,e){for(var n=-1,o=null==t?0:t.length;++ns))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var l=-1,d=!0,p=2&n?new _t:void 0;for(i.set(t,e),i.set(e,t);++l-1},vt.prototype.set=function(t,e){var n=this.__data__,o=Tt(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this},mt.prototype.clear=function(){this.size=0,this.__data__={hash:new yt,map:new(rt||vt),string:new yt}},mt.prototype.delete=function(t){var e=Nt(this,t).delete(t);return this.size-=e?1:0,e},mt.prototype.get=function(t){return Nt(this,t).get(t)},mt.prototype.has=function(t){return Nt(this,t).has(t)},mt.prototype.set=function(t,e){var n=Nt(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this},_t.prototype.add=_t.prototype.push=function(t){return this.__data__.set(t,n),this},_t.prototype.has=function(t){return this.__data__.has(t)},bt.prototype.clear=function(){this.__data__=new vt,this.size=0},bt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},bt.prototype.get=function(t){return this.__data__.get(t)},bt.prototype.has=function(t){return this.__data__.has(t)},bt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof vt){var o=n.__data__;if(!rt||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new mt(o)}return n.set(t,e),this.size=n.size,this};var Pt=tt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,o=null==t?0:t.length,r=0,i=[];++n-1&&t%1==0&&t-1&&t%1==0&&t<=o}function Gt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Jt(t){return null!=t&&"object"==typeof t}var zt=P?function(t){return function(e){return t(e)}}(P):function(t){return Jt(t)&&Bt(t.length)&&!!C[Ct(t)]};function Yt(t){return null!=(e=t)&&Bt(e.length)&&!Vt(e)?Et(t):xt(t);var e}t.exports=function(t,e){return St(t,e)}}(fe,fe.exports);var he=e(fe.exports);function ge(t,e){return t.length===e.length&&JSON.stringify(t.map((function(t){return t})).sort())===JSON.stringify(e.map((function(t){return t})).sort())}var ye={Polygon:V,LineString:j,Point:U,MultiPolygon:J,MultiLineString:J,MultiPoint:J};var ve=Object.freeze({__proto__:null,CommonSelectors:ht,constrainFeatureMovement:Kt,createMidPoint:bt,createSupplementaryPoints:Et,createVertex:_t,doubleClickZoom:Tt,euclideanDistance:A,featuresAt:M,getFeatureAtAndSetCursors:N,isClick:P,isEventAtCoordinates:ie,isTap:F,mapEventToBoundingBox:S,ModeHandler:t,moveFeatures:Qt,sortFeatures:O,stringSetsAreEqual:ge,StringSet:I,theme:ot,toDenseArray:H}),me=function(t,e){var n={options:t=function(t){void 0===t&&(t={});var e=tt(t);return t.controls||(e.controls={}),!1===t.displayControlsDefault?e.controls=tt(de,t.controls):e.controls=tt(le,t.controls),(e=tt(ce,e)).styles=pe(e.styles,"cold").concat(pe(e.styles,"hot")),e}(t)};e=function(t,e){return e.modes=h,e.getFeatureIdsAt=function(e){return M.click({point:e},null,t).map((function(t){return t.properties.id}))},e.getSelectedIds=function(){return t.store.getSelectedIds()},e.getSelected=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getSelectedIds().map((function(e){return t.store.get(e)})).map((function(t){return t.toGeoJSON()}))}},e.getSelectedPoints=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getSelectedCoordinates().map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t.coordinates}}}))}},e.set=function(n){if(void 0===n.type||n.type!==f.FEATURE_COLLECTION||!Array.isArray(n.features))throw new Error("Invalid FeatureCollection");var o=t.store.createRenderBatch(),r=t.store.getAllIds().slice(),i=e.add(n),a=new I(i);return(r=r.filter((function(t){return!a.has(t)}))).length&&e.delete(r),o(),i},e.add=function(e){var n=JSON.parse(JSON.stringify(It(e))).features.map((function(e){if(e.id=e.id||D(),null===e.geometry)throw new Error("Invalid geometry: null");if(void 0===t.store.get(e.id)||t.store.get(e.id).type!==e.geometry.type){var n=ye[e.geometry.type];if(void 0===n)throw new Error("Invalid geometry type: "+e.geometry.type+".");var o=new n(t,e);t.store.add(o)}else{var r=t.store.get(e.id);r.properties=e.properties,he(r.getCoordinates(),e.geometry.coordinates)||r.incomingCoords(e.geometry.coordinates)}return e.id}));return t.store.render(),n},e.get=function(e){var n=t.store.get(e);if(n)return n.toGeoJSON()},e.getAll=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getAll().map((function(t){return t.toGeoJSON()}))}},e.delete=function(n){return t.store.delete(n,{silent:!0}),e.getMode()!==h.DIRECT_SELECT||t.store.getSelectedIds().length?t.store.render():t.events.changeMode(h.SIMPLE_SELECT,void 0,{silent:!0}),e},e.deleteAll=function(){return t.store.delete(t.store.getAllIds(),{silent:!0}),e.getMode()===h.DIRECT_SELECT?t.events.changeMode(h.SIMPLE_SELECT,void 0,{silent:!0}):t.store.render(),e},e.changeMode=function(n,o){return void 0===o&&(o={}),n===h.SIMPLE_SELECT&&e.getMode()===h.SIMPLE_SELECT?(ge(o.featureIds||[],t.store.getSelectedIds())||(t.store.setSelected(o.featureIds,{silent:!0}),t.store.render()),e):(n===h.DIRECT_SELECT&&e.getMode()===h.DIRECT_SELECT&&o.featureId===t.store.getSelectedIds()[0]||t.events.changeMode(n,o,{silent:!0}),e)},e.getMode=function(){return t.events.getMode()},e.trash=function(){return t.events.trash({silent:!0}),e},e.combineFeatures=function(){return t.events.combineFeatures({silent:!0}),e},e.uncombineFeatures=function(){return t.events.uncombineFeatures({silent:!0}),e},e.setFeatureProperty=function(n,o,r){return t.store.setFeatureProperty(n,o,r),e},e}(n,e),n.api=e;var o=nt(n);return e.onAdd=o.onAdd,e.onRemove=o.onRemove,e.types=p,e.options=t,e};function _e(t){me(t,this)}return _e.modes=ue,_e.constants=E,_e.lib=ve,_e})); +//# sourceMappingURL=mapbox-gl-draw.js.map diff --git a/capeditor/static/capeditor/js/maplibre-gl.js b/capeditor/static/capeditor/js/maplibre-gl.js new file mode 100644 index 0000000..08c0ece --- /dev/null +++ b/capeditor/static/capeditor/js/maplibre-gl.js @@ -0,0 +1,44 @@ +/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v2.1.1/LICENSE.txt */ +(function (global, factory) { +typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : +typeof define === 'function' && define.amd ? define(factory) : +(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory()); +})(this, (function () { 'use strict'; + +/* eslint-disable */ + +var shared, worker, maplibregl; +// define gets called three times: one for each chunk. we rely on the order +// they're imported to know which is which +function define(_, chunk) { + if (!shared) { + shared = chunk; + } else if (!worker) { + worker = chunk; + } else { + var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' + + var sharedChunk = {}; + shared(sharedChunk); + maplibregl = chunk(sharedChunk); + if (typeof window !== 'undefined') { + maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); + } + } +} + + +define(["exports"],(function(t){"use strict";var e=r;function r(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}function n(t,r,n,i){const s=new e(t,r,n,i);return function(t){return s.solve(t)}}r.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};const i=n(.25,.1,.25,1);function s(t,e,r){return Math.min(r,Math.max(e,t))}function a(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function o(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let l=1;function u(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e));}));}function c(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function h(t,e,r){const n={};for(const i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function p(t){return Array.isArray(t)?t.map(p):"object"==typeof t&&t?c(t,p):t}const f={};function d(t){f[t]||("undefined"!=typeof console&&console.warn(t),f[t]=!0);}function y(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function m(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t;}return e}let v,b,w=null;function _(t){if(null==w){const e=t.navigator?t.navigator.userAgent:null;w=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")));}return w}function A(t){return "undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const k={now:performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return {cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const r=window.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(v||(v=document.createElement("a")),v.href=t,v.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==b&&(b=matchMedia("(prefers-reduced-motion: reduce)")),b.matches)}};var S=z;function z(t,e){this.x=t,this.y=e;}z.prototype={clone:function(){return new z(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},z.convert=function(t){return t instanceof z?t:Array.isArray(t)?new z(t[0],t[1]):t};const I={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},M="mapbox-tiles";let C,B,P=500,V=50;function E(){"undefined"==typeof caches||C||(C=caches.open(M));}let F=1/0;const T={supported:!1,testSupport:function(t){!$&&D&&(O?R(t):L=t);}};let L,D,$=!1,O=!1;function R(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,D),t.isContextLost())return;T.supported=!0;}catch(t){}t.deleteTexture(e),$=!0;}"undefined"!=typeof document&&(D=document.createElement("img"),D.onload=function(){L&&R(L),L=null,O=!0;},D.onerror=function(){$=!0,L=null;},D.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const U={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(U);class q extends Error{constructor(t,e,r){super(t),this.status=e,this.url=r,this.name=this.constructor.name,this.message=t;}toString(){return `${this.name}: ${this.message} (${this.status}): ${this.url}`}}const j=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function N(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:j(),signal:r.signal});let i=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return ((r,a,o)=>{if(s)return;const l=Date.now();fetch(n).then((r=>r.ok?((r,a,o)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&o&&function(t,e,r){if(E(),!C)return;const n={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=x(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===B)try{new Response(new ReadableStream),B=!0;}catch(t){B=!1;}B?e(t.body):t.blob().then(e);}(e,(e=>{const r=new Response(e,n);E(),C&&C.then((e=>e.put(function(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}(t.url),r))).catch((t=>d(t.message)));})));}(n,a,o),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")));})).catch((t=>{s||e(new Error(t.message));}));})(r,null,l):e(new q(r.statusText,r.status,t.url)))).catch((t=>{20!==t.code&&e(new Error(t.message));}));})(),{cancel:()=>{s=!0,i||r.abort();}}}const K=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!g()){const r=t.url.substring(0,t.url.indexOf("://"));return (I.REGISTERED_PROTOCOLS[r]||N)(t,e)}}if(!(/^file:/.test(r=t.url)||/^file:/.test(j())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return N(t,e);if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return "json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText));},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"));}else e(new q(r.statusText,r.status,t.url));},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Z=function(t,e){return K(o(t,{type:"arrayBuffer"}),e)};function G(t){const e=window.document.createElement("a");return e.href=t,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let X,Y;X=[],Y=0;const H=function(t,e){if(T.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Y>=I.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0;}};return X.push(r),r}Y++;let r=!1;const n=()=>{if(!r)for(r=!0,Y--;X.length&&Y{n(),t?e(t):r&&function(t,e,r,n){"function"==typeof createImageBitmap?function(t,e){const r=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(r).then((t=>{e(null,t);})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));}));}(t,e):function(t,e,r,n){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=J;}));},i.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(t)],{type:"image/png"});i.cacheControl=r,i.expires=n,i.src=t.byteLength?URL.createObjectURL(s):J;}(t,e,r,n);}(r,e,i,s);}));return {cancel:()=>{i.cancel(),n();}}};function W(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e));}function Q(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}class tt{constructor(t,e={}){o(this,e),this.type=t;}}class et extends tt{constructor(t,e={}){super("error",o({error:t},e));}}class rt{on(t,e){return this._listeners=this._listeners||{},W(t,e,this._listeners),this}off(t,e){return Q(t,e,this._listeners),Q(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},W(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new tt(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)Q(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(o(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof et&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var nt={$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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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:{},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-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":{},within:{}}},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}},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"}}};class it{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);}}function st(t){const e=t.value;return e?[new it(t.key,e,"constants have been deprecated as of v8")]:[]}function at(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function ot(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function lt(t){if(Array.isArray(t))return t.map(lt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=lt(t[r]);return e}return ot(t)}class ut extends Error{constructor(t,e){super(e),this.message=e,this.key=t;}}class ct{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r;}concat(t){return new ct(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return !!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ht={kind:"null"},pt={kind:"number"},ft={kind:"string"},dt={kind:"boolean"},yt={kind:"color"},mt={kind:"object"},gt={kind:"value"},xt={kind:"collator"},vt={kind:"formatted"},bt={kind:"resolvedImage"};function wt(t,e){return {kind:"array",itemType:t,N:e}}function _t(t){if("array"===t.kind){const e=_t(t.itemType);return "number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const At=[ht,pt,ft,dt,yt,vt,mt,wt(gt),bt];function kt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!kt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of At)if(!kt(t,e))return null}return `Expected ${_t(t)} but found ${_t(e)} instead.`}function St(t,e){return e.some((e=>e.kind===t.kind))}function zt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}var It,Mt={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ct(t){return (t=Math.round(t))<0?0:t>255?255:t}function Bt(t){return Ct("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Pt(t){return (e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e;}function Vt(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{It={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in Mt)return Mt[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf("("),i=r.indexOf(")");if(-1!==n&&i+1===r.length){var s=r.substr(0,n),a=r.substr(n+1,i-(n+1)).split(","),o=1;switch(s){case"rgba":if(4!==a.length)return null;o=Pt(a.pop());case"rgb":return 3!==a.length?null:[Bt(a[0]),Bt(a[1]),Bt(a[2]),o];case"hsla":if(4!==a.length)return null;o=Pt(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=Pt(a[1]),c=Pt(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return [Ct(255*Vt(p,h,l+1/3)),Ct(255*Vt(p,h,l)),Ct(255*Vt(p,h,l-1/3)),o];default:return null}}return null};}catch(t){}class Et{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n;}static parse(t){if(!t)return;if(t instanceof Et)return t;if("string"!=typeof t)return;const e=It(t);return e?new Et(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return `rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}Et.black=new Et(0,0,0,1),Et.white=new Et(1,1,1,1),Et.transparent=new Et(0,0,0,0),Et.red=new Et(1,0,0,1);class Ft{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Tt{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;}}class Lt{constructor(t){this.sections=t;}static fromString(t){return new Lt([new Tt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Lt?t:Lt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(r);}return t}}class Dt{constructor(t){this.name=t.name,this.available=t.available;}toString(){return this.name}static fromString(t){return t?new Dt({name:t,available:!1}):null}serialize(){return ["image",this.name]}}function $t(t,e,r,n){return "number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ot(t){if(null===t)return !0;if("string"==typeof t)return !0;if("boolean"==typeof t)return !0;if("number"==typeof t)return !0;if(t instanceof Et)return !0;if(t instanceof Ft)return !0;if(t instanceof Lt)return !0;if(t instanceof Dt)return !0;if(Array.isArray(t)){for(const e of t)if(!Ot(e))return !1;return !0}if("object"==typeof t){for(const e in t)if(!Ot(t[e]))return !1;return !0}return !1}function Rt(t){if(null===t)return ht;if("string"==typeof t)return ft;if("boolean"==typeof t)return dt;if("number"==typeof t)return pt;if(t instanceof Et)return yt;if(t instanceof Ft)return xt;if(t instanceof Lt)return vt;if(t instanceof Dt)return bt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=Rt(e);if(r){if(r===t)continue;r=gt;break}r=t;}return wt(r||gt,e)}return mt}function Ut(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Et||t instanceof Lt||t instanceof Dt?t.toString():JSON.stringify(t)}class qt{constructor(t,e){this.type=t,this.value=e;}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ot(t[1]))return e.error("invalid value");const r=t[1];let n=Rt(r);const i=e.expectedType;return "array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new qt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}serialize(){return "array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Et?["rgba"].concat(this.value.toArray()):this.value instanceof Lt?this.value.serialize():this.value}}class jt{constructor(t){this.name="ExpressionEvaluationError",this.message=t;}toJSON(){return this.message}}const Nt={string:ft,number:pt,boolean:dt,object:mt};class Kt{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Nt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Nt[r],n++;}else i=gt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++;}r=wt(i,s);}else r=Nt[i];const s=[];for(;nt.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n);}}return e.concat(this.args.map((t=>t.serialize())))}}class Zt{constructor(t){this.type=vt,this.sections=t;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,pt),!t))return null;let r=null;if(s["text-font"]&&(r=e.parse(s["text-font"],1,wt(ft)),!r))return null;let a=null;if(s["text-color"]&&(a=e.parse(s["text-color"],1,yt),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a;}else {const s=e.parse(t[r],1,gt);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null});}}return new Zt(n)}evaluate(t){return new Lt(this.sections.map((e=>{const r=e.content.evaluate(t);return Rt(r)===bt?new Tt("",r,null,null,null):new Tt(Ut(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor);}outputDefined(){return !1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r);}return t}}class Gt{constructor(t){this.type=bt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,ft);return r?new Gt(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=Dt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input);}outputDefined(){return !1}serialize(){return ["image",this.input.serialize()]}}const Jt={"to-boolean":dt,"to-color":yt,"to-number":pt,"to-string":ft};class Xt{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=Jt[r],i=[];for(let r=1;r4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:$t(e[0],e[1],e[2],e[3]),!r))return new Et(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new jt(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new jt(`Could not convert ${JSON.stringify(e)} to number.`)}return "formatted"===this.type.kind?Lt.fromString(Ut(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Dt.fromString(Ut(this.args[0].evaluate(t))):Ut(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Zt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Gt(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize());})),t}}const Yt=["Unknown","Point","LineString","Polygon"];class Ht{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?"number"==typeof this.feature.type?Yt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Et.parse(t)),e}}class Wt{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n;}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}serialize(){return [this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=Wt.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new we(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(_t).join(", ")})`:`(${_t(e.type)}...)`;var e;})).join(" | "),n=[];for(let r=1;r=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ne(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*te),Math.round(n*i*te)]}function ie(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function se(t,e){let r=!1;for(let a=0,o=e.length;a(n=t)[1]!=(s=o[e+1])[1]>n[1]&&n[0]<(s[0]-i[0])*(n[1]-i[1])/(s[1]-i[1])+i[0]&&(r=!r);}}var n,i,s;return r}function ae(t,e){for(let r=0;r0&&o<0||a<0&&o>0}function le(t,e,r){for(const u of r)for(let r=0;rr[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i;}ee(e,t);}function de(t,e,r,n){const i=Math.pow(2,n.z)*te,s=[n.x*te,n.y*te],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];fe(n,e,r,i),a.push(n);}return a}function ye(t,e,r,n){const i=Math.pow(2,n.z)*te,s=[n.x*te,n.y*te],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];ee(e,r),t.push(r);}a.push(t);}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)fe(n,e,r,i);}var o;return a}class me{constructor(t,e){this.type=dt,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ot(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!ge(t)&&(e=!1);})),e}function xe(t){if(t instanceof Wt&&"feature-state"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!xe(t)&&(e=!1);})),e}function ve(t,e){if(t instanceof Wt&&e.indexOf(t.name)>=0)return !1;let r=!0;return t.eachChild((t=>{r&&!ve(t,e)&&(r=!1);})),r}class be{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e;}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new be(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return !1}serialize(){return ["var",this.name]}}class we{constructor(t,e=[],r,n=new ct,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r;}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return "assert"===r?new Kt(e,[t]):"coerce"===r?new Xt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert");}if(!(n instanceof qt)&&"resolvedImage"!==n.type.kind&&_e(n)){const t=new Ht;try{n=new qt(n.type,n.evaluate(t));}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new we(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ut(r,t));}checkSubtype(t,e){const r=kt(t,e);return r&&this.error(r),r}}function _e(t){if(t instanceof be)return _e(t.boundExpression);if(t instanceof Wt&&"error"===t.name)return !1;if(t instanceof Qt)return !1;if(t instanceof me)return !1;const e=t instanceof Xt||t instanceof Kt;let r=!0;return t.eachChild((t=>{r=e?r&&_e(t):r&&t instanceof qt;})),!!r&&ge(t)&&ve(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ae(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||ee))throw new jt("Input is not a number.");a=o-1;}return 0}class ke{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e);}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,pt);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u]);}return new ke(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ae(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Se(t,e,r){return t*(1-r)+e*r}var ze=Object.freeze({__proto__:null,number:Se,color:function(t,e,r){return new Et(Se(t.r,e.r,r),Se(t.g,e.g,r),Se(t.b,e.b,r),Se(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>Se(t,e[n],r)))}});const Ie=.95047,Me=1.08883,Ce=4/29,Be=6/29,Pe=3*Be*Be,Ve=Math.PI/180,Ee=180/Math.PI;function Fe(t){return t>.008856451679035631?Math.pow(t,1/3):t/Pe+Ce}function Te(t){return t>Be?t*t*t:Pe*(t-Ce)}function Le(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function De(t){return (t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $e(t){const e=De(t.r),r=De(t.g),n=De(t.b),i=Fe((.4124564*e+.3575761*r+.1804375*n)/Ie),s=Fe((.2126729*e+.7151522*r+.072175*n)/1);return {l:116*s-16,a:500*(i-s),b:200*(s-Fe((.0193339*e+.119192*r+.9503041*n)/Me)),alpha:t.a}}function Oe(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Te(e),r=Ie*Te(r),n=Me*Te(n),new Et(Le(3.2404542*r-1.5371385*e-.4985314*n),Le(-.969266*r+1.8760108*e+.041556*n),Le(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Re(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Ue={forward:$e,reverse:Oe,interpolate:function(t,e,r){return {l:Se(t.l,e.l,r),a:Se(t.a,e.a,r),b:Se(t.b,e.b,r),alpha:Se(t.alpha,e.alpha,r)}}},qe={forward:function(t){const{l:e,a:r,b:n}=$e(t),i=Math.atan2(n,r)*Ee;return {h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ve,r=t.c;return Oe({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return {h:Re(t.h,e.h,r),c:Se(t.c,e.c,r),l:Se(t.l,e.l,r),alpha:Se(t.alpha,e.alpha,r)}}};var je=Object.freeze({__proto__:null,lab:Ue,hcl:qe});class Ne{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e);}static interpolationFactor(t,r,n,i){let s=0;if("exponential"===t.name)s=Ke(r,t.base,n,i);else if("linear"===t.name)s=Ke(r,1,n,i);else if("cubic-bezier"===t.name){const a=t.controlPoints;s=new e(a[0],a[1],a[2],a[3]).solve(Ke(r,1,n,i));}return s}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t};}else {if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,pt),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=yt:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u]);}return "number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Ne(o,r,n,i,a):e.error(`Type ${_t(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Ae(e,n),a=Ne.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return "interpolate"===this.operator?ze[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?qe.reverse(qe.interpolate(qe.forward(o),qe.forward(l),a)):Ue.reverse(Ue.interpolate(Ue.forward(o),Ue.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tkt(n,t.type)));return new Ze(s?gt:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof Dt&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize());})),t}}class Ge{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e;}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result);}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n=r.length)throw new jt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new jt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}serialize(){return ["at",this.index.serialize(),this.input.serialize()]}}class Xe{constructor(t,e){this.type=dt,this.needle=t,this.haystack=e;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);return r&&n?St(r.type,[dt,ft,pt,ht,gt])?new Xe(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!zt(e,["boolean","string","number","null"]))throw new jt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Rt(e))} instead.`);if(!zt(r,["string","array"]))throw new jt(`Expected second argument to be of type array or string, but found ${_t(Rt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}serialize(){return ["in",this.needle.serialize(),this.haystack.serialize()]}}class Ye{constructor(t,e,r){this.type=pt,this.needle=t,this.haystack=e,this.fromIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);if(!r||!n)return null;if(!St(r.type,[dt,ft,pt,ht,gt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new Ye(r,n,i):null}return new Ye(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!zt(e,["boolean","string","number","null"]))throw new jt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Rt(e))} instead.`);if(!zt(r,["string","array"]))throw new jt(`Expected second argument to be of type array or string, but found ${_t(Rt(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return ["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return ["index-of",this.needle.serialize(),this.haystack.serialize()]}}class He{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s;}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,Rt(t)))return null}else r=Rt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length;}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c);}const a=e.parse(t[1],1,gt);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new He(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return (Rt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t);}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class We{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r;}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;ie.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize());})),t}}class Qe{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,pt);if(!r||!n)return null;if(!St(r.type,[wt(gt),ft,gt]))return e.error(`Expected first argument to be of type array or string, but found ${_t(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new Qe(r.type,r,n,i):null}return new Qe(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!zt(e,["string","array"]))throw new jt(`Expected first argument to be of type array or string, but found ${_t(Rt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return ["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return ["slice",this.input.serialize(),this.beginIndex.serialize()]}}function tr(t,e){return "=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function er(t,e,r,n){return 0===n.compare(e,r)}function rr(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=dt,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind;}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,gt);if(!s)return null;if(!tr(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${_t(s.type)}'.`);let a=e.parse(t[2],2,gt);if(!a)return null;if(!tr(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${_t(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${_t(s.type)}' and '${_t(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new Kt(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new Kt(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,xt),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=Rt(s),r=Rt(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new jt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Rt(s),r=Rt(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize());})),e}}}const nr=rr("==",(function(t,e,r){return e===r}),er),ir=rr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !er(0,e,r,n)})),sr=rr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),or=rr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),lr=rr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class ur{constructor(t,e,r,n,i){this.type=ft,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,pt);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,ft),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,ft),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,pt),!a))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,pt),!o)?null:new ur(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class cr{constructor(t){this.type=pt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${_t(r.type)} instead.`):new cr(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new jt(`Expected value to be of type string or array, but found ${_t(Rt(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize());})),t}}const hr={"==":nr,"!=":ir,">":ar,"<":sr,">=":lr,"<=":or,array:Kt,at:Je,boolean:Kt,case:We,coalesce:Ze,collator:Qt,format:Zt,image:Gt,in:Xe,"index-of":Ye,interpolate:Ne,"interpolate-hcl":Ne,"interpolate-lab":Ne,length:cr,let:Ge,literal:qt,match:He,number:Kt,"number-format":ur,object:Kt,slice:Qe,step:ke,string:Kt,"to-boolean":Xt,"to-color":Xt,"to-number":Xt,"to-string":Xt,var:be,within:me};function pr(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=$t(e,r,n,s);if(a)throw new jt(a);return new Et(e/255*s,r/255*s,n/255*s,s)}function fr(t,e){return t in e}function dr(t,e){const r=e[t];return void 0===r?null:r}function yr(t){return {type:t}}function mr(t){return {result:"success",value:t}}function gr(t){return {result:"error",value:t}}function xr(t){return "data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function vr(t){return !!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function br(t){return !!t.expression&&t.expression.interpolated}function wr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function _r(t){return "object"==typeof t&&null!==t&&!Array.isArray(t)}function Ar(t){return t}function kr(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(br(e)?"exponential":"interval");if(r&&((t=at({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],Et.parse(t[1])]))),t.default=Et.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!je[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=Mr;else if("interval"===s)a=Ir;else if("categorical"===s){a=zr,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0];}else {if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Cr;}if(n){const r={},n=[];for(let e=0;et[0])),evaluate:({zoom:r},n)=>Mr({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return {kind:"camera",interpolationType:r,interpolationFactor:Ne.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return {kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Sr(t.default,e.default):a(t,e,i,o,l)}}}function Sr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function zr(t,e,r,n,i){return Sr(typeof r===i?n[r]:void 0,t.default,e.default)}function Ir(t,e,r){if("number"!==wr(r))return Sr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Ae(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Mr(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==wr(r))return Sr(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Ae(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=ze[e.type]||Ar;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=je[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a));}return "function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Cr(t,e,r){return "color"===e.type?r=Et.parse(r):"formatted"===e.type?r=Lt.fromString(r.toString()):"resolvedImage"===e.type?r=Dt.fromString(r.toString()):wr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Sr(r,t.default,e.default)}Wt.register(hr,{error:[{kind:"error"},[ft],(t,[e])=>{throw new jt(e.evaluate(t))}],typeof:[ft,[gt],(t,[e])=>_t(Rt(e.evaluate(t)))],"to-rgba":[wt(pt,4),[yt],(t,[e])=>e.evaluate(t).toArray()],rgb:[yt,[pt,pt,pt],pr],rgba:[yt,[pt,pt,pt,pt],pr],has:{type:dt,overloads:[[[ft],(t,[e])=>fr(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,r])=>fr(e.evaluate(t),r.evaluate(t))]]},get:{type:gt,overloads:[[[ft],(t,[e])=>dr(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,r])=>dr(e.evaluate(t),r.evaluate(t))]]},"feature-state":[gt,[ft],(t,[e])=>dr(e.evaluate(t),t.featureState||{})],properties:[mt,[],t=>t.properties()],"geometry-type":[ft,[],t=>t.geometryType()],id:[gt,[],t=>t.id()],zoom:[pt,[],t=>t.globals.zoom],"heatmap-density":[pt,[],t=>t.globals.heatmapDensity||0],"line-progress":[pt,[],t=>t.globals.lineProgress||0],accumulated:[gt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[pt,yr(pt),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[pt,yr(pt),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:pt,overloads:[[[pt,pt],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[pt],(t,[e])=>-e.evaluate(t)]]},"/":[pt,[pt,pt],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[pt,[pt,pt],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[pt,[pt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))],log2:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[pt,[pt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[pt,[pt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[pt,[pt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[pt,[pt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[pt,[pt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[pt,[pt],(t,[e])=>Math.atan(e.evaluate(t))],min:[pt,yr(pt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[pt,yr(pt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[pt,[pt],(t,[e])=>Math.abs(e.evaluate(t))],round:[pt,[pt],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[pt,[pt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[pt,[pt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[dt,[ft,gt],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[dt,[gt],(t,[e])=>t.id()===e.value],"filter-type-==":[dt,[ft],(t,[e])=>t.geometryType()===e.value],"filter-<":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n{const r=t.id(),n=e.value;return typeof r==typeof n&&r":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[dt,[gt],(t,[e])=>e.value in t.properties()],"filter-has-id":[dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[dt,[wt(ft)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[dt,[wt(gt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[dt,[ft,wt(gt)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[dt,[ft,wt(gt)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[yr(dt),(t,e)=>{for(const r of e)if(!r.evaluate(t))return !1;return !0}]]},any:{type:dt,overloads:[[[dt,dt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[yr(dt),(t,e)=>{for(const r of e)if(r.evaluate(t))return !0;return !1}]]},"!":[dt,[dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[dt,[ft],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return !r||r(e.evaluate(t))}],upcase:[ft,[ft],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ft,[ft],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ft,yr(gt),(t,e)=>e.map((e=>Ut(e.evaluate(t)))).join("")],"resolved-locale":[ft,[xt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Br{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ht,this._defaultValue=e?function(t){return "color"===t.type&&_r(t.default)?new Et(0,0,0,0):"color"===t.type?Et.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null;}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new jt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Pr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in hr}function Vr(t,e){const r=new we(hr,[],e?function(t){const e={color:yt,string:ft,number:pt,enum:ft,boolean:dt,formatted:vt,resolvedImage:bt};return "array"===t.type?wt(e[t.value]||gt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?mr(new Br(n,e)):gr(r.errors)}class Er{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!xe(e.expression);}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class Fr{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!xe(e.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Ne.interpolationFactor(this.interpolationType,t,e,r):0}}function Tr(t,e){const r=Vr(t,e);if("error"===r.result)return r;const n=r.value.expression,i=ge(n);if(!i&&!xr(e))return gr([new ut("","data expressions not supported")]);const s=ve(n,["zoom"]);if(!s&&!vr(e))return gr([new ut("","zoom expressions not supported")]);const a=Dr(n);return a||s?a instanceof ut?gr([a]):a instanceof Ne&&!br(e)?gr([new ut("",'"interpolate" expressions cannot be used with this property')]):mr(a?new Fr(i?"camera":"composite",r.value,a.labels,a instanceof Ne?a.interpolation:void 0):new Er(i?"constant":"source",r.value)):gr([new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Lr{constructor(t,e){this._parameters=t,this._specification=e,at(this,kr(this._parameters,this._specification));}static deserialize(t){return new Lr(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function Dr(t){let e=null;if(t instanceof Ge)e=Dr(t.result);else if(t instanceof Ze){for(const r of t.args)if(e=Dr(r),e)break}else (t instanceof ke||t instanceof Ne)&&t.input instanceof Wt&&"zoom"===t.input.name&&(e=t);return e instanceof ut||t.eachChild((t=>{const r=Dr(t);r instanceof ut?e=r:!e&&r?e=new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new ut("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));})),e}function $r(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let o=[];const l=wr(r);if("object"!==l)return [new it(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=pn;else if(i["*"])c=i["*"];else {if(!n["*"]){o.push(new it(e,r[t],`unknown property "${t}"`));continue}c=pn;}o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:s,styleSpec:a,object:r,objectKey:t},r));}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new it(e,r,`missing required property "${t}"`));return o}function Or(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,s=t.key,a=t.arrayElementValidator||pn;if("array"!==wr(e))return [new it(s,e,`array expected, ${wr(e)} found`)];if(r.length&&e.length!==r.length)return [new it(s,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.lengthn.maximum?[new it(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Ur(t){const e=t.valueSpec,r=ot(t.value.type);let n,i,s,a={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===wr(t.value.stops)&&"array"===wr(t.value.stops[0])&&"object"===wr(t.value.stops[0][0]),c=$r({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return [new it(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Or({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===wr(n)&&0===n.length&&e.push(new it(t.key,n,"array must have at least one stop")),e},default:function(t){return pn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return "identity"===r&&o&&c.push(new it(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new it(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!br(t.valueSpec)&&c.push(new it(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!xr(t.valueSpec)?c.push(new it(t.key,t.value,"property functions not supported")):o&&!vr(t.valueSpec)&&c.push(new it(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new it(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==wr(n))return [new it(o,n,`array expected, ${wr(n)} found`)];if(2!==n.length)return [new it(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==wr(n[0]))return [new it(o,n,`object expected, ${wr(n[0])} found`)];if(void 0===n[0].zoom)return [new it(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return [new it(o,n,"object stop key must have value")];if(s&&s>ot(n[0].zoom))return [new it(o,n[0].zoom,"stop zoom values must appear in ascending order")];ot(n[0].zoom)!==s&&(s=ot(n[0].zoom),i=void 0,a={}),r=r.concat($r({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Rr,value:p}}));}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Pr(lt(n[1]))?r.concat([new it(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(pn({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=wr(t.value),l=ot(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return [new it(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return [new it(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return xr(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new it(t.key,u,n)]}return "categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&lnew it(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return [new it(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!xe(r))return [new it(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!xe(r))return [new it(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ve(r,["zoom","feature-state"]))return [new it(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ge(r))return [new it(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return []}function jr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(ot(r))&&i.push(new it(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(ot(r))&&i.push(new it(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Nr(t){if(!0===t||!1===t)return !0;if(!Array.isArray(t)||0===t.length)return !1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return !1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Nr(e)&&"boolean"!=typeof e)return !1;return !0;default:return !0}}const Kr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Zr(t){if(null==t)return {filter:()=>!0,needGeometry:!1};Nr(t)||(t=Xr(t));const e=Vr(t,Kr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return {filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:Jr(t)}}function Gr(t,e){return te?1:0}function Jr(t){if(!Array.isArray(t))return !1;if("within"===t[0])return !0;for(let e=1;e"===e||"<="===e||">="===e?Yr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Xr))):"all"===e?["all"].concat(t.slice(1).map(Xr)):"none"===e?["all"].concat(t.slice(1).map(Xr).map(Qr)):"in"===e?Hr(t[1],t.slice(2)):"!in"===e?Qr(Hr(t[1],t.slice(2))):"has"===e?Wr(t[1]):"!has"===e?Qr(Wr(t[1])):"within"!==e||t;var r;}function Yr(t,e,r){switch(t){case"$type":return [`filter-type-${r}`,e];case"$id":return [`filter-id-${r}`,e];default:return [`filter-${r}`,t,e]}}function Hr(t,e){if(0===e.length)return !1;switch(t){case"$type":return ["filter-type-in",["literal",e]];case"$id":return ["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Gr)]]:["filter-in-small",t,["literal",e]]}}function Wr(t){switch(t){case"$type":return !0;case"$id":return ["filter-has-id"];default:return ["filter-has",t]}}function Qr(t){return ["!",t]}function tn(t){return Nr(lt(t.value))?qr(at({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):en(t)}function en(t){const e=t.value,r=t.key;if("array"!==wr(e))return [new it(r,e,`array expected, ${wr(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return [new it(r,e,"filter array must have at least 1 element")];switch(s=s.concat(jr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ot(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===ot(e[1])&&s.push(new it(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new it(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=wr(e[1]),"string"!==i&&s.push(new it(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a{t in r&&e.push(new it(n,r[t],`"${t}" is prohibited for ref layers`));})),i.layers.forEach((e=>{ot(e.id)===o&&(t=e);})),t?t.ref?e.push(new it(n,r.ref,"ref cannot reference another ref layer")):a=ot(t.type):e.push(new it(n,r.ref,`ref layer "${o}" not found`));}else if("background"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&ot(t.type);t?"vector"===s&&"raster"===a?e.push(new it(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?e.push(new it(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?e.push(new it(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new it(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new it(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new it(n,r.source,`source "${r.source}" not found`));}else e.push(new it(n,r,'missing required property "source"'));return e=e.concat($r({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>pn({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:tn,layout:t=>$r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>sn(at({layerType:a},t))}}),paint:t=>$r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>nn(at({layerType:a},t))}})}})),e}function on(t){const e=t.value,r=t.key,n=wr(e);return "string"!==n?[new it(r,e,`string expected, ${n} found`)]:[]}const ln={promoteId:function({key:t,value:e}){if("string"===wr(e))return on({key:t,value:e});{const r=[];for(const n in e)r.push(...on({key:`${t}.${n}`,value:e[n]}));return r}}};function un(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return [new it(r,e,'"type" is required')];const s=ot(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=$r({key:r,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ln}),a;case"geojson":if(a=$r({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:ln}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...qr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...qr({key:`${r}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}));}return a;case"video":return $r({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return $r({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return [new it(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return jr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function cn(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=wr(e);if(void 0===e)return s;if("object"!==a)return s=s.concat([new it("light",e,`object expected, ${a} found`)]),s;for(const t in e){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?pn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?pn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new it(t,e[t],`unknown property "${t}"`)]);}return s}const hn={"*":()=>[],array:Or,boolean:function(t){const e=t.value,r=t.key,n=wr(e);return "boolean"!==n?[new it(r,e,`boolean expected, ${n} found`)]:[]},number:Rr,color:function(t){const e=t.key,r=t.value,n=wr(r);return "string"!==n?[new it(e,r,`color expected, ${n} found`)]:null===It(r)?[new it(e,r,`color expected, "${r}" found`)]:[]},constants:st,enum:jr,filter:tn,function:Ur,layer:an,object:$r,source:un,light:cn,string:on,formatted:function(t){return 0===on(t).length?[]:qr(t)},resolvedImage:function(t){return 0===on(t).length?[]:qr(t)}};function pn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&_r(ot(e))?Ur(t):r.expression&&Pr(lt(e))?qr(t):r.type&&hn[r.type]?hn[r.type](t):$r(at({},t,{valueSpec:r.type?n[r.type]:r}))}function fn(t){const e=t.value,r=t.key,n=on(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new it(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new it(r,e,'"glyphs" url must include a "{range}" token'))),n}function dn(t,e=nt){let r=[];return r=r.concat(pn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:fn,"*":()=>[]}})),t.constants&&(r=r.concat(st({key:"constants",value:t.constants,style:t,styleSpec:e}))),yn(r)}function yn(t){return [].concat(t).sort(((t,e)=>t.line-e.line))}function mn(t){return function(...e){return yn(t.apply(this,e))}}dn.source=mn(un),dn.light=mn(cn),dn.layer=mn(an),dn.filter=mn(tn),dn.paintProperty=mn(nn),dn.layoutProperty=mn(sn);const gn=dn,xn=gn.light,vn=gn.paintProperty,bn=gn.layoutProperty;function wn(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new et(new Error(n.message))),r=!0;return r}class _n{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1;}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return (t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t=0)continue;const s=t[r];i[r]=An[n].shallow.indexOf(r)>=0?s:zn(s,e);}t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function In(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Sn(t)||A(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(In);if("object"==typeof t){const e=t.$name||"Object";if(!An[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=An[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=An[e].shallow.indexOf(r)>=0?i:In(i);}return n}throw new Error("can't deserialize object of type "+typeof t)}class Mn{constructor(){this.first=!0;}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Bn(t){for(const e of t)if(En(e.charCodeAt(0)))return !0;return !1}function Pn(t){for(const e of t)if(!Vn(e.charCodeAt(0)))return !1;return !0}function Vn(t){return !(Cn.Arabic(t)||Cn["Arabic Supplement"](t)||Cn["Arabic Extended-A"](t)||Cn["Arabic Presentation Forms-A"](t)||Cn["Arabic Presentation Forms-B"](t))}function En(t){return !(746!==t&&747!==t&&(t<4352||!(Cn["Bopomofo Extended"](t)||Cn.Bopomofo(t)||Cn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Cn["CJK Compatibility Ideographs"](t)||Cn["CJK Compatibility"](t)||Cn["CJK Radicals Supplement"](t)||Cn["CJK Strokes"](t)||!(!Cn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Cn["CJK Unified Ideographs Extension A"](t)||Cn["CJK Unified Ideographs"](t)||Cn["Enclosed CJK Letters and Months"](t)||Cn["Hangul Compatibility Jamo"](t)||Cn["Hangul Jamo Extended-A"](t)||Cn["Hangul Jamo Extended-B"](t)||Cn["Hangul Jamo"](t)||Cn["Hangul Syllables"](t)||Cn.Hiragana(t)||Cn["Ideographic Description Characters"](t)||Cn.Kanbun(t)||Cn["Kangxi Radicals"](t)||Cn["Katakana Phonetic Extensions"](t)||Cn.Katakana(t)&&12540!==t||!(!Cn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Cn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Cn["Unified Canadian Aboriginal Syllabics"](t)||Cn["Unified Canadian Aboriginal Syllabics Extended"](t)||Cn["Vertical Forms"](t)||Cn["Yijing Hexagram Symbols"](t)||Cn["Yi Syllables"](t)||Cn["Yi Radicals"](t))))}function Fn(t){return !(En(t)||function(t){return !!(Cn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Cn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Cn["Letterlike Symbols"](t)||Cn["Number Forms"](t)||Cn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Cn["Control Pictures"](t)&&9251!==t||Cn["Optical Character Recognition"](t)||Cn["Enclosed Alphanumerics"](t)||Cn["Geometric Shapes"](t)||Cn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Cn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Cn["CJK Symbols and Punctuation"](t)||Cn.Katakana(t)||Cn["Private Use Area"](t)||Cn["CJK Compatibility Forms"](t)||Cn["Small Form Variants"](t)||Cn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Tn(t){return t>=1424&&t<=2303||Cn["Arabic Presentation Forms-A"](t)||Cn["Arabic Presentation Forms-B"](t)}function Ln(t,e){return !(!e&&Tn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Cn.Khmer(t))}function Dn(t){for(const e of t)if(Tn(e.charCodeAt(0)))return !0;return !1}const $n="deferred",On="loading",Rn="loaded";let Un=null,qn="unavailable",jn=null;const Nn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(qn="error"),Un&&Un(t);};function Kn(){Zn.fire(new tt("pluginStateChange",{pluginStatus:qn,pluginURL:jn}));}const Zn=new rt,Gn=function(){return qn},Jn=function(){if(qn!==$n||!jn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");qn=On,Kn(),jn&&Z({url:jn},(t=>{t?Nn(t):(qn=Rn,Kn());}));},Xn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>qn===Rn||null!=Xn.applyArabicShaping,isLoading:()=>qn===On,setState(t){qn=t.pluginStatus,jn=t.pluginURL;},isParsed:()=>null!=Xn.applyArabicShaping&&null!=Xn.processBidirectionalText&&null!=Xn.processStyledBidirectionalText,getPluginURL:()=>jn};class Yn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Mn,this.transition={});}isSupportedScript(t){return function(t,e){for(const r of t)if(!Ln(r.charCodeAt(0),e))return !1;return !0}(t,Xn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class Hn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(_r(t))return new Lr(t,e);if(Pr(t)){const r=Tr(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return "string"==typeof t&&"color"===e.type&&(r=Et.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification);}isDataDriven(){return "source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Wn{constructor(t){this.property=t,this.value=new Hn(t,void 0);}transitioned(t,e){return new ti(this.property,this.value,e,o({},t.transition,this.transition),t.now)}untransitioned(){return new ti(this.property,this.value,null,{},0)}}class Qn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);}getValue(t){return p(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Wn(this._values[t].property)),this._values[t].value=new Hn(this._values[t].property,null===e?void 0:p(e));}getTransition(t){return p(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Wn(this._values[t].property)),this._values[t].transition=p(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n);}return t}transitioned(t,e){const r=new ei(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new ei(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class ti{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class ei{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,r){const n=new ii(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class ri{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues);}getValue(t){return p(this._values[t].value)}setValue(t,e){this._values[t]=new Hn(this._values[t].property,null===e?void 0:p(e));}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);}return t}possiblyEvaluate(t,e,r){const n=new ii(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class ni{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r;}isConstant(){return "constant"===this.value.kind}constantOr(t){return "constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class ii{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class si{constructor(t){this.specification=t;}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=ze[this.specification.type];return n?n(t,e,r):t}}class ai{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,r,n){return new ni(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new ni(this,{kind:"constant",value:void 0},t.parameters);const n=ze[this.specification.type];return n?new ni(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return "constant"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class oi extends ai{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new ni(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new ni(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ni(this,{kind:"constant",value:r},e)}return new ni(this,t.expression,e)}evaluate(t,e,r,n,i,s){if("source"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return "composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class li{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Yn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Yn(Math.floor(e.zoom),e)),t.expression.evaluate(new Yn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class ui{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)}interpolate(){return !1}}class ci{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Hn(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Wn(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}}}kn("DataDrivenProperty",ai),kn("DataConstantProperty",si),kn("CrossFadedDataDrivenProperty",oi),kn("CrossFadedProperty",li),kn("ColorRampProperty",ui);const hi="-transition";class pi extends rt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new ri(e.layout)),e.paint)){this._transitionablePaint=new Qn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ii(e.paint);}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return "visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(bn,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);}getPaintProperty(t){return t.endsWith(hi)?this._transitionablePaint.getTransition(t.slice(0,-hi.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(vn,`layers.${this.id}.paint.${t}`,t,e,r))return !1;if(t.endsWith(hi))return this._transitionablePaint.setTransition(t.slice(0,-hi.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return !1}isHidden(t){return !!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),h(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return (!i||!1!==i.validate)&&wn(this,t.call(gn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:nt,style:{glyphs:!0,sprite:!0}}))}is3D(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof ni&&xr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}}const fi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class di{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class yi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0);}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(t){this.reserve(t),this.length=t;}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function mi(t,e=1){let r=0,n=0;return {members:t.map((t=>{const i=fi[t.type].BYTES_PER_ELEMENT,s=r=gi(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:gi(r,Math.max(n,e)),alignment:e}}function gi(t,e){return Math.ceil(t/e)*e}class xi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}xi.prototype.bytesPerElement=4,kn("StructArrayLayout2i4",xi);class vi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}vi.prototype.bytesPerElement=8,kn("StructArrayLayout4i8",vi);class bi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}bi.prototype.bytesPerElement=12,kn("StructArrayLayout2i4i12",bi);class wi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}wi.prototype.bytesPerElement=8,kn("StructArrayLayout2i4ub8",wi);class _i extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}_i.prototype.bytesPerElement=8,kn("StructArrayLayout2f8",_i);class Ai extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}Ai.prototype.bytesPerElement=20,kn("StructArrayLayout10ui20",Ai);class ki extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}ki.prototype.bytesPerElement=24,kn("StructArrayLayout4i4ui4i24",ki);class Si extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}Si.prototype.bytesPerElement=12,kn("StructArrayLayout3f12",Si);class zi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}zi.prototype.bytesPerElement=4,kn("StructArrayLayout1ul4",zi);class Ii extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}Ii.prototype.bytesPerElement=20,kn("StructArrayLayout6i1ul2ui20",Ii);class Mi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Mi.prototype.bytesPerElement=12,kn("StructArrayLayout2i2i2i12",Mi);class Ci extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}Ci.prototype.bytesPerElement=16,kn("StructArrayLayout2f1f2i16",Ci);class Bi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}Bi.prototype.bytesPerElement=12,kn("StructArrayLayout2ub2f12",Bi);class Pi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Pi.prototype.bytesPerElement=6,kn("StructArrayLayout3ui6",Pi);class Vi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}Vi.prototype.bytesPerElement=48,kn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Vi);class Ei extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,z,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,z,I)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,z,I,M){const C=34*t,B=17*t;return this.int16[C+0]=e,this.int16[C+1]=r,this.int16[C+2]=n,this.int16[C+3]=i,this.int16[C+4]=s,this.int16[C+5]=a,this.int16[C+6]=o,this.int16[C+7]=l,this.uint16[C+8]=u,this.uint16[C+9]=c,this.uint16[C+10]=h,this.uint16[C+11]=p,this.uint16[C+12]=f,this.uint16[C+13]=d,this.uint16[C+14]=y,this.uint16[C+15]=m,this.uint16[C+16]=g,this.uint16[C+17]=x,this.uint16[C+18]=v,this.uint16[C+19]=b,this.uint16[C+20]=w,this.uint16[C+21]=_,this.uint16[C+22]=A,this.uint32[B+12]=k,this.float32[B+13]=S,this.float32[B+14]=z,this.float32[B+15]=I,this.float32[B+16]=M,t}}Ei.prototype.bytesPerElement=68,kn("StructArrayLayout8i15ui1ul4f68",Ei);class Fi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Fi.prototype.bytesPerElement=4,kn("StructArrayLayout1f4",Fi);class Ti extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Ti.prototype.bytesPerElement=6,kn("StructArrayLayout3i6",Ti);class Li extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Li.prototype.bytesPerElement=8,kn("StructArrayLayout1ul2ui8",Li);class Di extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Di.prototype.bytesPerElement=4,kn("StructArrayLayout2ui4",Di);class $i extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}$i.prototype.bytesPerElement=2,kn("StructArrayLayout1ui2",$i);class Oi extends yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Oi.prototype.bytesPerElement=16,kn("StructArrayLayout4f16",Oi);class Ri extends di{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 S(this.anchorPointX,this.anchorPointY)}}Ri.prototype.size=20;class Ui extends Ii{get(t){return new Ri(this,t)}}kn("CollisionBoxArray",Ui);class qi extends di{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t;}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}qi.prototype.size=48;class ji extends Vi{get(t){return new qi(this,t)}}kn("PlacedSymbolArray",ji);class Ni extends di{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t;}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Ni.prototype.size=68;class Ki extends Ei{get(t){return new Ni(this,t)}}kn("SymbolInstanceArray",Ki);class Zi extends Fi{getoffsetX(t){return this.float32[1*t+0]}}kn("GlyphOffsetArray",Zi);class Gi extends Ti{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}kn("SymbolLineVertexArray",Gi);class Ji extends di{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]}}Ji.prototype.size=8;class Xi extends Li{get(t){return new Ji(this,t)}}kn("FeatureIndexArray",Xi);class Yi extends xi{}class Hi extends xi{}class Wi extends bi{}class Qi extends wi{}class ts extends _i{}class es extends Ai{}class rs extends ki{}class ns extends Si{}class is extends zi{}class ss extends Mi{}class as extends Bi{}class os extends Pi{}class ls extends Di{}const us=mi([{name:"a_pos",components:2,type:"Int16"}],4),{members:cs}=us;class hs{constructor(t=[]){this.segments=t;}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>hs.MAX_VERTEX_ARRAY_LENGTH&&d(`Max vertices per segment is ${hs.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>hs.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy();}static simpleSegment(t,e,r,n){return new hs([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function ps(t,e){return 256*(t=s(Math.floor(t),0,255))+s(Math.floor(e),0,255)}hs.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,kn("SegmentVector",hs);const fs=mi([{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 ds={exports:{}},ys={exports:{}};ys.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var ms={exports:{}};ms.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var gs=ys.exports,xs=ms.exports;ds.exports=gs,ds.exports.murmur3=gs,ds.exports.murmur2=xs;var vs=ds.exports;class bs{constructor(){this.ids=[],this.positions=[],this.indexed=!1;}add(t,e,r,n){this.ids.push(ws(t)),this.positions.push(e,r,n);}getPositions(t){const e=ws(t);let r=0,n=this.ids.length-1;for(;r>1;this.ids[t]>=e?n=t:r=t+1;}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return _s(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new bs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ws(t){const e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:vs(String(t))}function _s(t,e,r,n){for(;r>1];let s=r-1,a=n+1;for(;;){do{s++;}while(t[s]i);if(s>=a)break;As(t,s,a),As(e,3*s,3*a),As(e,3*s+1,3*a+1),As(e,3*s+2,3*a+2);}a-r`u_${t}`)),this.type=r;}setUniform(t,e,r){t.set(r.constantOr(this.value));}getBinding(t,e,r){return "color"===this.type?new Is(t,e):new Ss(t,e)}}class Ps{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1;}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr;}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i);}getBinding(t,e,r){return "u_pattern"===r.substr(0,9)?new zs(t,e):new Ss(t,e)}}class Vs{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new Yn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i);}_setPaintValue(t,e,r){if("color"===this.type){const n=Cs(r);for(let r=t;r`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s;}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new Yn(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new Yn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s);}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Cs(r),s=Cs(n);for(let r=t;r`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Vs||r instanceof Es)for(let e=0;e!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Ts(n,e,r);this.needsUpload=!1,this._featureMap=new bs,this._bufferOffset=0;}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}function Ds(t,e){return {"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function $s(t,e,r){const n={color:{source:_i,composite:Oi},number:{source:Fi,composite:_i}},i=function(t){return {"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[t]}(t);return i&&i[r]||n[e][r]}kn("ConstantBinder",Bs),kn("CrossFadedConstantBinder",Ps),kn("SourceExpressionBinder",Vs),kn("CrossFadedCompositeBinder",Fs),kn("CompositeExpressionBinder",Es),kn("ProgramConfiguration",Ts,{omit:["_buffers"]}),kn("ProgramConfigurationSet",Ls);var Os=8192;const Rs=Math.pow(2,14)-1,Us=-Rs-1;function qs(t){const e=Os/t.extent,r=t.loadGeometry();for(let t=0;tr.x+1||ar.y+1)&&d("Geometry exceeds allowed extent, reduce your vector tile buffer size");}}return r}function js(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?qs(t):[]}}function Ns(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}class Ks{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Yi,this.indexArray=new os,this.segments=new hs,this.programConfigurations=new Ls(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=js(e,t);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:qs(e),patterns:{},sortKey:c};i.push(h);}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,cs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Os||n<0||n>=Os)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Ns(this.layoutVertexArray,r,n,-1,-1),Ns(this.layoutVertexArray,r,n,1,-1),Ns(this.layoutVertexArray,r,n,1,1),Ns(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);}}function Zs(t,e){for(let r=0;r1){if(Ys(t,e))return !0;for(let n=0;n1?r:r.sub(e)._mult(i)._add(e))}function ta(t,e){let r,n,i,s=!1;for(let a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s);}return s}function ea(t,e){let r=!1;for(let n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r);}return r}function ra(t,e,r){const n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return !1;const s=y(t,e,r[0]);return s!==y(t,e,r[1])||s!==y(t,e,r[2])||s!==y(t,e,r[3])}function na(t,e,r){const n=e.paint.get(t).value;return "constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ia(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function sa(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=S.convert(e)._mult(i);"viewport"===r&&s._rotate(-n);const a=[];for(let e=0;et.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,o=e.data;for(let l=0;l{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a);};if(t.clips)for(let e=0,i=0;e80*r){n=s=t[0],i=a=t[1];for(var d=r;ds&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?1/u:0;}return Pa(p,f,r,n,i,u),f}function Ca(t,e,r,n,i){var s,a;if(i===Qa(t,e,r,n)>0)for(s=e;s=e;s-=n)a=Ya(s,t[s],t[s+1],a);return a&&Na(a,a.next)&&(Ha(a),a=a.next),a}function Ba(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Na(n,n.next)&&0!==ja(n.prev,n,n.next))n=n.next;else {if(Ha(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function Pa(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Oa(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n;}s.nextZ=null,u*=2;}while(a>1)}(i);}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?Ea(t,n,i,s):Va(t))e.push(o.i/r),e.push(t.i/r),e.push(l.i/r),Ha(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?Pa(t=Fa(Ba(t),e,r),e,r,n,i,s,2):2===a&&Ta(t,e,r,n,i,s):Pa(Ba(t),e,r,n,i,s,1);break}}}function Va(t){var e=t.prev,r=t,n=t.next;if(ja(e,r,n)>=0)return !1;for(var i=t.next.next;i!==t.prev;){if(Ua(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&ja(i.prev,i,i.next)>=0)return !1;i=i.next;}return !0}function Ea(t,e,r,n){var i=t.prev,s=t,a=t.next;if(ja(i,s,a)>=0)return !1;for(var o=i.x>s.x?i.x>a.x?i.x:a.x:s.x>a.x?s.x:a.x,l=i.y>s.y?i.y>a.y?i.y:a.y:s.y>a.y?s.y:a.y,u=Oa(i.x=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Ua(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&ja(h.prev,h,h.next)>=0)return !1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Ua(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ja(p.prev,p,p.next)>=0)return !1;p=p.nextZ;}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&Ua(i.x,i.y,s.x,s.y,a.x,a.y,h.x,h.y)&&ja(h.prev,h,h.next)>=0)return !1;h=h.prevZ;}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Ua(i.x,i.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ja(p.prev,p,p.next)>=0)return !1;p=p.nextZ;}return !0}function Fa(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Na(i,s)&&Ka(i,n,n.next,s)&&Ja(i,s)&&Ja(s,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(s.i/r),Ha(n),Ha(n.next),n=t=s),n=n.next;}while(n!==t);return Ba(n)}function Ta(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&qa(a,o)){var l=Xa(a,o);return a=Ba(a,a.next),l=Ba(l,l.next),Pa(a,e,r,n,i,s),void Pa(l,e,r,n,i,s)}o=o.next;}a=a.next;}while(a!==t)}function La(t,e){return t.x-e.x}function Da(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a){if(a=o,o===i){if(s===n.y)return n;if(s===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Ua(sr.x||n.x===r.x&&$a(r,n)))&&(r=n,p=l)),n=n.next;}while(n!==u);return r}(t,e);if(!r)return e;var n=Xa(r,t),i=Ba(r,r.next);return Ba(n,n.next),e===r?i:e}function $a(t,e){return ja(t.prev,t,e.prev)<0&&ja(e.next,t,t.next)<0}function Oa(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ra(t){var e=t,r=t;do{(e.x=0&&(t-a)*(n-o)-(r-a)*(e-o)>=0&&(r-a)*(s-o)-(i-a)*(n-o)>=0}function qa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ka(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(Ja(t,e)&&Ja(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(ja(t.prev,t,e.prev)||ja(t,e.prev,e))||Na(t,e)&&ja(t.prev,t,t.next)>0&&ja(e.prev,e,e.next)>0)}function ja(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Na(t,e){return t.x===e.x&&t.y===e.y}function Ka(t,e,r,n){var i=Ga(ja(t,e,r)),s=Ga(ja(t,e,n)),a=Ga(ja(r,n,t)),o=Ga(ja(r,n,e));return i!==s&&a!==o||!(0!==i||!Za(t,r,e))||!(0!==s||!Za(t,n,e))||!(0!==a||!Za(r,t,n))||!(0!==o||!Za(r,e,n))}function Za(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ga(t){return t>0?1:t<0?-1:0}function Ja(t,e){return ja(t.prev,t,t.next)<0?ja(t,e,t.next)>=0&&ja(t,t.prev,e)>=0:ja(t,e,t.prev)<0||ja(t,t.next,e)<0}function Xa(t,e){var r=new Wa(t.i,t.x,t.y),n=new Wa(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function Ya(t,e,r,n){var i=new Wa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ha(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function Wa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function Qa(t,e,r,n){for(var i=0,s=e,a=r-n;s0&&r.holes.push(n+=t[i-1].length);}return r};var to=Ia.exports;function eo(t,e,r,n,i){ro(t,e,r||0,n||t.length-1,i||io);}function ro(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);ro(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i);}var c=t[e],h=r,p=n;for(no(t,r,e),i(t[n],c)>0&&no(t,r,n);h0;)p--;}0===i(t[r],c)?no(t,r,p):no(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1);}}function no(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function io(t,e){return te?1:0}function so(t,e){const r=t.length;if(r<=1)return [t];const n=[];let i,s;for(let e=0;e1)for(let t=0;tt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Hi,this.indexArray=new os,this.indexArray2=new ls,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new hs,this.segments2=new hs,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=oo("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=js(a,t);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:qs(a),patterns:{},sortKey:h};s.push(p);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=lo("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,za),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy());}addFeature(t,e,r,n,i){for(const t of so(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t>3;}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new mo(s,a));else {if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone());}}return e&&o.push(e),o},xo.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())o&&(o=i),(s+=t.readSVarint())u&&(u=s);else if(7!==r)throw new Error("unknown command "+r)}return [a,l,o,u]},xo.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=xo.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}Ao.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new wo(this._pbf,e,this.extent,this._keys,this._values)};var So=_o;function zo(t,e,r){if(3===t){var n=new So(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}yo.VectorTile=function(t,e){this.layers=t.readFields(zo,{},e);},yo.VectorTileFeature=go,yo.VectorTileLayer=_o;const Io=yo.VectorTileFeature.types,Mo=Math.pow(2,13);function Co(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*Mo)+a,i*Mo*2,s*Mo*2,Math.round(o));}class Bo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Wi,this.indexArray=new os,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new hs,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.features=[],this.hasPattern=oo("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=js(n,t);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:qs(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(lo("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0);}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n,i){for(const r of so(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(Vo(t))continue;let e=0;for(let r=0;r=1){const s=t[r-1];if(!Po(i,s)){n.vertexLength+4>hs.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),r=s.dist(i);e+r>32768&&(e=0),Co(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),Co(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),e+=r,Co(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),Co(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e);const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2;}}}}if(n.vertexLength+e>hs.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Io[t.type])continue;const i=[],s=[],a=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&s.push(i.length/2);for(let e=0;eOs)||t.y===e.y&&(t.y<0||t.y>Os)}function Vo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Os))||t.every((t=>t.y<0))||t.every((t=>t.y>Os))}kn("FillExtrusionBucket",Bo,{omit:["layers","features"]});var Eo={paint:new ci({"fill-extrusion-opacity":new si(nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ai(nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new si(nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new si(nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new oi(nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ai(nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ai(nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new si(nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Fo(t,e){return t.x*e.x+t.y*e.y}function To(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;rt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new Qi,this.layoutVertexArray2=new ts,this.indexArray=new os,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new hs,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=oo("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=js(e,t);if(!this.layers[0]._featureFilter.filter(new Yn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:qs(e),patterns:{},sortKey:c};s.push(h);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=lo("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Oo)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Do),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return {start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),o=s.get("line-cap"),l=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e;}}const A=p&&f;let k=A?r:a?"butt":n;if(A&&"round"===k&&(vi&&(k="bevel"),"bevel"===k&&(v>2&&(k="flipbevel"),v100)m=y.mult(-1);else {const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1));}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c);}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let e=1;e2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e;}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>qo/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,s));}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(qo-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u;}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance();}}kn("LineBucket",jo,{omit:["layers","patternFeatures"]});const No=new ci({"line-cap":new si(nt.layout_line["line-cap"]),"line-join":new ai(nt.layout_line["line-join"]),"line-miter-limit":new si(nt.layout_line["line-miter-limit"]),"line-round-limit":new si(nt.layout_line["line-round-limit"]),"line-sort-key":new ai(nt.layout_line["line-sort-key"])});var Ko={paint:new ci({"line-opacity":new ai(nt.paint_line["line-opacity"]),"line-color":new ai(nt.paint_line["line-color"]),"line-translate":new si(nt.paint_line["line-translate"]),"line-translate-anchor":new si(nt.paint_line["line-translate-anchor"]),"line-width":new ai(nt.paint_line["line-width"]),"line-gap-width":new ai(nt.paint_line["line-gap-width"]),"line-offset":new ai(nt.paint_line["line-offset"]),"line-blur":new ai(nt.paint_line["line-blur"]),"line-dasharray":new li(nt.paint_line["line-dasharray"]),"line-pattern":new oi(nt.paint_line["line-pattern"]),"line-gradient":new ui(nt.paint_line["line-gradient"])}),layout:No};const Zo=new class extends ai{possiblyEvaluate(t,e){return e=new Yn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=o({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(Ko.paint.properties["line-width"].specification);function Go(t,e){return e>0?e+2*t:t}Zo.useIntegerZoom=!0;const Jo=mi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xo=mi([{name:"a_projected_pos",components:3,type:"Float32"}],4);mi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Yo=mi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);mi([{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 Ho=mi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Wo=mi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Qo(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return "uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Xn.applyArabicShaping&&(t=Xn.applyArabicShaping(t)),t}(t.text,e,r);})),t}mi([{name:"triangle",components:3,type:"Uint16"}]),mi([{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"}]),mi([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),mi([{type:"Float32",name:"offsetX"}]),mi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const tl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var el=24,rl=sl,nl=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else {if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u;}return (f?-1:1)*a*Math.pow(2,s-n)},il=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y;};function sl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}sl.Varint=0,sl.Fixed64=1,sl.Bytes=2,sl.Fixed32=5;var al,ol=4294967296,ll=1/ol,ul="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function cl(t){return t.type===sl.Bytes?t.readVarint()+t.pos:t.pos+1}function hl(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function pl(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function fl(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function kl(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Sl(t,e,r){1===t&&r.readMessage(zl,e);}function zl(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:s,left:a,top:o,advance:l}=r.readMessage(Il,{});e.push({id:t,bitmap:new wa({width:i+6,height:s+6},n),metrics:{width:i,height:s,left:a,top:o,advance:l}});}}function Il(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}function Ml(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_l(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=kl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_l(this.buf,this.pos)+_l(this.buf,this.pos+4)*ol;return this.pos+=8,t},readSFixed64:function(){var t=_l(this.buf,this.pos)+kl(this.buf,this.pos+4)*ol;return this.pos+=8,t},readFloat:function(){var t=nl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=nl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return hl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return hl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return hl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return hl(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return hl(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return hl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ul?function(t,e,r){return ul.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==sl.Bytes)return t.push(this.readVarint(e));var r=cl(this);for(t=t||[];this.pos127;);else if(e===sl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===sl.Fixed32)this.pos+=4;else {if(e!==sl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&pl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),il(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),il(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&pl(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,sl.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,fl,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,dl,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,gl,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,yl,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ml,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,xl,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,vl,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,bl,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,wl,e);},writeBytesField:function(t,e){this.writeTag(t,sl.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,sl.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,sl.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,sl.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,sl.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,sl.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,sl.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,sl.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,sl.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,sl.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};class Cl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r;}get tl(){return [this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return [this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return [(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Bl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=Ml(i),o=new _a({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;_a.copy(n.data,o,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data);}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+1,a=i.y+1,l=r.data.width,u=r.data.height;_a.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),_a.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),_a.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),_a.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),_a.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u});}this.image=o,this.iconPositions=r,this.patternPositions=n;}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(s),e[n]=new Cl(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e);}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i});}}kn("ImagePosition",Cl),kn("ImageAtlas",Bl),t.WritingMode=void 0,(al=t.WritingMode||(t.WritingMode={}))[al.none=0]="none",al[al.horizontal=1]="horizontal",al[al.vertical=2]="vertical",al[al.horizontalOnly=3]="horizontalOnly";const Pl=-17;class Vl{constructor(){this.scale=1,this.fontStack="",this.imageName=null;}static forText(t,e){const r=new Vl;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new Vl;return e.imageName=t,e}}class El{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;}static fromFeature(t,e){const r=new El;for(let n=0;n=0&&r>=t&&Tl[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e);}substring(t,e){const r=new El;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Vl.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Fl(e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=El.fromFeature(e,s);let x;p===t.WritingMode.vertical&&g.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:b}=Xn;if(v&&1===g.sections.length){x=[];const t=v(g.toString(),ql(g,c,a,r,i,d,y));for(const e of t){const t=new El;t.text=e,t.sections=g.sections;for(let r=0;r0&&n>_&&(_=n);}else {const t=n[y.fontStack],e=t&&t[g];if(e&&e.rect)A=e.rect,b=e.metrics;else {const t=r[y.fontStack],e=t&&t[g];if(!e)continue;b=e.metrics;}x=(s-y.scale)*el;}z?(e.verticalizable=!0,w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:z,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=S*y.scale+c):(w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:z,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=b.advance*y.scale+c);}0!==w.length&&(y=Math.max(f-c,y),Nl(w,0,w.length-1,g,_)),f=0;const A=a*s+_;b.lineOffset=Math.max(_,l),d+=A,m=Math.max(A,m),++x;}var v;const b=d-Pl,{horizontalAlign:w,verticalAlign:_}=jl(o);((function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-Pl:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c;}))(e.positionedLines,g,w,_,y,m,a,b,s.length),e.top+=-_*b,e.bottom=e.top+b,e.left+=-w*y,e.right=e.left+y;}(_,r,n,i,x,o,l,u,p,c,f,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(w)&&_}const Tl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ll={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Dl(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*el/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function $l(t,e,r,n){const i=Math.pow(t-e,2);return n?t=0;let c=0;for(let r=0;r-r/2;){if(a--,a<0)return !1;o-=t[a].dist(s),s=t[a];}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;on;)u-=l.shift().angleDelta;if(u>i)return !1;a++,o+=e.dist(r);}return !0}function tu(t){let e=0;for(let r=0;ru){const c=(u-l)/s,h=Se(n.x,i.x,c),p=Se(n.y,i.y,c),f=new Wl(h,p,i.angleTo(n),r);return f._round(),!a||Ql(t,f,o,a,e)?f:void 0}l+=s;}}function iu(t,e,r,n,i,s,a,o,l){const u=eu(n,s,a),c=ru(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&g=0&&x=0&&p+u<=c){const r=new Wl(g,x,y,e);r._round(),n&&!Ql(t,r,s,n,i)||f.push(r);}}h+=d;}return o||f.length||a||(f=su(t,h/2,r,n,i,s,a,!0,l)),f}function au(t,e,r,n,i){const s=[];for(let a=0;a=n&&u.x>=n||(a.x>=n?a=new S(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=n&&(u=new S(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=i&&u.y>=i||(a.y>=i?a=new S(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y>=i&&(u=new S(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),l.push(u)))));}}return s}function ou(t,e,r,n){const i=[],s=t.image,a=s.pixelRatio,o=s.paddedRect.w-2,l=s.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=s.stretchX||[[0,o]],p=s.stretchY||[[0,l]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=o-d,g=l-y;let x=0,v=d,b=0,w=y,_=0,A=m,k=0,z=g;if(s.content&&n){const t=s.content;x=lu(h,0,t[0]),b=lu(p,0,t[1]),v=lu(h,t[0],t[2]),w=lu(p,t[1],t[3]),_=t[0]-x,k=t[1]-b,A=t[2]-t[0]-v,z=t[3]-t[1]-w;}const I=(n,i,o,l)=>{const h=cu(n.stretch-x,v,u,t.left),p=hu(n.fixed-_,A,n.stretch,d),f=cu(i.stretch-b,w,c,t.top),m=hu(i.fixed-k,z,i.stretch,y),g=cu(o.stretch-x,v,u,t.left),I=hu(o.fixed-_,A,o.stretch,d),M=cu(l.stretch-b,w,c,t.top),C=hu(l.fixed-k,z,l.stretch,y),B=new S(h,f),P=new S(g,f),V=new S(g,M),E=new S(h,M),F=new S(p/a,m/a),T=new S(I/a,C/a),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),r=[e,-t,t,e];B._matMult(r),P._matMult(r),E._matMult(r),V._matMult(r);}const D=n.stretch+n.fixed,$=i.stretch+i.fixed;return {tl:B,tr:P,bl:E,br:V,tex:{x:s.paddedRect.x+1+D,y:s.paddedRect.y+1+$,w:o.stretch+o.fixed-D,h:l.stretch+l.fixed-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:T,minFontScaleX:A/a/u,minFontScaleY:z/a/c,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const t=uu(h,m,d),e=uu(p,g,y);for(let r=0;r0&&(n=Math.max(10,n),this.circleDiameter=n);}else {let l=s.top*a-o,c=s.bottom*a+o,h=s.left*a-o,p=s.right*a+o;const f=s.collisionPadding;if(f&&(h-=f[0]*a,l-=f[1]*a,p+=f[2]*a,c+=f[3]*a),u){const t=new S(h,l),e=new S(p,l),r=new S(h,c),n=new S(p,c),i=u*Math.PI/180;t._rotate(i),e._rotate(i),r._rotate(i),n._rotate(i),h=Math.min(t.x,e.x,r.x,n.x),p=Math.max(t.x,e.x,r.x,n.x),l=Math.min(t.y,e.y,r.y,n.y),c=Math.max(t.y,e.y,r.y,n.y);}t.emplaceBack(e.x,e.y,h,l,p,c,r,n,i);}this.boxEndIndex=t.length;}}class fu{constructor(t=[],e=du){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this.length++,this._up(this.length-1);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i;}e[t]=n;}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t=0)break;e[t]=s,t=n;}e[t]=i;}}function du(t,e){return te?1:0}function yu(t,e=1,r=!1){let n=1/0,i=1/0,s=-1/0,a=-1/0;const o=t[0];for(let t=0;ts)&&(s=e.x),(!t||e.y>a)&&(a=e.y);}const l=Math.min(s-n,a-i);let u=l/2;const c=new fu([],mu);if(0===l)return new S(n,i);for(let e=n;eh.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new gu(n.p.x-u,n.p.y-u,u,t)),c.push(new gu(n.p.x+u,n.p.y-u,u,t)),c.push(new gu(n.p.x-u,n.p.y+u,u,t)),c.push(new gu(n.p.x+u,n.p.y+u,u,t)),p+=4);}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function mu(t,e){return e.max-t.max}function gu(t,e,r,n){this.p=new S(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;it.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Qs(t,i,o));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}const xu=Number.POSITIVE_INFINITY;function vu(t,e){return e[1]!==xu?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r;}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7;}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e;}return [r,n]}(t,e[0])}function bu(t){switch(t){case"right":case"top-right":case"bottom-right":return "right";case"left":case"top-left":case"bottom-left":return "left"}return "center"}function wu(e,r,n,i,s,a,o,l,u,c,h){let p=a.textMaxSize.evaluate(r,{});void 0===p&&(p=o);const f=e.layers[0].layout,y=f.get("icon-offset").evaluate(r,{},h),m=ku(n.horizontal),g=o/24,x=e.tilePixelRatio*g,v=e.tilePixelRatio*p/24,b=e.tilePixelRatio*l,w=e.tilePixelRatio*f.get("symbol-spacing"),_=f.get("text-padding")*e.tilePixelRatio,A=f.get("icon-padding")*e.tilePixelRatio,k=f.get("text-max-angle")/180*Math.PI,S="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),z="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),I=f.get("symbol-placement"),M=w/2,C=f.get("icon-text-fit");let B;i&&"none"!==C&&(e.allowVerticalPlacement&&n.vertical&&(B=Zl(i,n.vertical,C,f.get("icon-text-fit-padding"),y,g)),m&&(i=Zl(i,m,C,f.get("icon-text-fit-padding"),y,g)));const P=(l,p)=>{p.x<0||p.x>=Os||p.y<0||p.y>=Os||function(e,r,n,i,s,a,o,l,u,c,h,p,f,y,m,g,x,v,b,w,_,A,k,S,z){const I=e.addToLineVertexArray(r,n);let M,C,B,P,V=0,E=0,F=0,T=0,L=-1,D=-1;const $={};let O=vs(""),R=0,U=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[R,U]=l.layout.get("text-offset").evaluate(_,{},S).map((t=>t*el)):(R=l.layout.get("text-radial-offset").evaluate(_,{},S)*el,U=xu),e.allowVerticalPlacement&&i.vertical){const t=l.layout.get("text-rotate").evaluate(_,{},S)+90;B=new pu(u,r,c,h,p,i.vertical,f,y,m,t),o&&(P=new pu(u,r,c,h,p,o,x,v,m,t));}if(s){const n=l.layout.get("icon-rotate").evaluate(_,{}),i="none"!==l.layout.get("icon-text-fit"),a=ou(s,n,k,i),f=o?ou(o,n,k,i):void 0;C=new pu(u,r,c,h,p,s,x,v,!1,n),V=4*a.length;const y=e.iconSizeData;let m=null;"source"===y.kind?(m=[Gl*l.layout.get("icon-size").evaluate(_,{})],m[0]>_u&&d(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===y.kind&&(m=[Gl*A.compositeIconSizes[0].evaluate(_,{},S),Gl*A.compositeIconSizes[1].evaluate(_,{},S)],(m[0]>_u||m[1]>_u)&&d(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,w,b,_,t.WritingMode.none,r,I.lineStartIndex,I.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,f&&(E=4*f.length,e.addSymbols(e.icon,f,m,w,b,_,t.WritingMode.vertical,r,I.lineStartIndex,I.lineLength,-1,S),D=e.icon.placedSymbolArray.length-1);}const q=Object.keys(i.horizontal);for(const n of q){const s=i.horizontal[n];if(!M){O=vs(s.text);const t=l.layout.get("text-rotate").evaluate(_,{},S);M=new pu(u,r,c,h,p,s,f,y,m,t);}const o=1===s.positionedLines.length;if(F+=Au(e,r,s,a,l,m,_,g,I,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,o?q:[n],$,L,A,S),o)break}i.vertical&&(T+=Au(e,r,i.vertical,a,l,m,_,g,I,t.WritingMode.vertical,["vertical"],$,D,A,S));const j=M?M.boxStartIndex:e.collisionBoxArray.length,N=M?M.boxEndIndex:e.collisionBoxArray.length,K=B?B.boxStartIndex:e.collisionBoxArray.length,Z=B?B.boxEndIndex:e.collisionBoxArray.length,G=C?C.boxStartIndex:e.collisionBoxArray.length,J=C?C.boxEndIndex:e.collisionBoxArray.length,X=P?P.boxStartIndex:e.collisionBoxArray.length,Y=P?P.boxEndIndex:e.collisionBoxArray.length;let H=-1;const W=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;H=W(M,H),H=W(B,H),H=W(C,H),H=W(P,H);const Q=H>-1?1:0;Q&&(H*=z/el),e.glyphOffsetArray.length>=Eu.MAX_GLYPHS&&d("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==_.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,_.sortKey),e.symbolInstances.emplaceBack(r.x,r.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical||-1,L,D,O,j,N,K,Z,G,J,X,Y,c,F,T,V,E,Q,0,f,R,U,H);}(e,p,l,n,i,s,B,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,x,_,S,u,b,A,z,y,r,a,c,h,o);};if("line"===I)for(const t of au(r.geometry,0,0,Os,Os)){const r=iu(t,w,k,n.vertical||m,i,24,v,e.overscaling,Os);for(const n of r){const r=m;r&&Su(e,r.text,M,n)||P(t,n);}}else if("line-center"===I){for(const t of r.geometry)if(t.length>1){const e=nu(t,k,n.vertical||m,i,24,v);e&&P(t,e);}}else if("Polygon"===r.type)for(const t of so(r.geometry,0)){const e=yu(t,16);P(t[0],new Wl(e.x,e.y,0));}else if("LineString"===r.type)for(const t of r.geometry)P(t,new Wl(t[0].x,t[0].y,0));else if("Point"===r.type)for(const t of r.geometry)for(const e of t)P([e],new Wl(e.x,e.y,0));}const _u=32640;function Au(t,e,r,n,i,s,a,o,l,u,c,h,p,f,y){const m=function(t,e,r,n,i,s,a,o){const l=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let c=4,h=!0,p=1,f=0;const d=(i||o)&&n.vertical,y=n.metrics.advance*n.scale/2;if(o&&e.verticalizable){const e=(n.scale-1)*el,r=(el-n.metrics.width*n.scale)/2;f=t.lineOffset/2-(n.imageName?-r:e);}if(n.imageName){const t=a[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p;}const m=i?[n.x+y,n.y]:[0,0];let g=i?[0,0]:[n.x+y+r[0],n.y+r[1]-f],x=[0,0];d&&(x=g,g=[0,0]);const v=(n.metrics.left-c)*n.scale-y+g[0],b=(-n.metrics.top-c)*n.scale+g[1],w=v+s.w*n.scale/p,_=b+s.h*n.scale/p,A=new S(v,b),k=new S(w,b),z=new S(v,_),I=new S(w,_);if(d){const t=new S(-y,y-Pl),e=-Math.PI/2,r=12-y,i=new S(22-r,-(n.imageName?r:0)),s=new S(...x);A._rotateAround(e,t)._add(i)._add(s),k._rotateAround(e,t)._add(i)._add(s),z._rotateAround(e,t)._add(i)._add(s),I._rotateAround(e,t)._add(i)._add(s);}if(l){const t=Math.sin(l),e=Math.cos(l),r=[e,-t,t,e];A._matMult(r),k._matMult(r),z._matMult(r),I._matMult(r);}const M=new S(0,0),C=new S(0,0);u.push({tl:A,tr:k,bl:z,br:I,tex:s,writingMode:e.writingMode,glyphOffset:m,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:M,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0});}return u}(0,r,o,i,s,a,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[Gl*i.layout.get("text-size").evaluate(a,{})],x[0]>_u&&d(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[Gl*f.compositeTextSizes[0].evaluate(a,{},y),Gl*f.compositeTextSizes[1].evaluate(a,{},y)],(x[0]>_u||x[1]>_u)&&d(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,s,a,u,e,l.lineStartIndex,l.lineLength,p,y);for(const e of c)h[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function ku(t){for(const e in t)return t[e];return null}function Su(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])t.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=ua([]),this.placementViewportMatrix=ua([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jl(this.zoom,r["text-size"]),this.iconSizeData=Jl(this.zoom,r["icon-size"]);const n=this.layers[0].layout,i=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap="never"!==$u(n,"text-overlap","text-allow-overlap")||"never"!==$u(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!i.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID;}createArrays(){this.text=new Pu(new Ls(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Pu(new Ls(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Zi,this.lineVertexArray=new Gi,this.symbolInstances=new Ki;}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s0)&&("constant"!==a.value.kind||a.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=r.iconDependencies,f=r.glyphDependencies,d=r.availableImages,y=new Yn(this.zoom);for(const{feature:r,id:o,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,g=js(r,e);if(!i._featureFilter.filter(y,g,n))continue;let x,v;if(e||(g.geometry=qs(r)),u){const t=i.getValueAndResolveTokens("text-field",g,n,d),e=Lt.factory(t);Bu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Gn()||this.hasRTLText&&Xn.isParsed())&&(x=Qo(e,i,g));}if(c){const t=i.getValueAndResolveTokens("icon-image",g,n,d);v=t instanceof Dt?t:Dt.fromString(t);}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},n):void 0;if(this.features.push({id:o,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:r.properties,type:zu[r.type],sortKey:b}),v&&(p[v.name]=!0),x){const e=a.evaluate(g,{},n).join(","),r="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of x.sections)if(t.image)p[t.image.name]=!0;else {const n=Bn(x.toString()),i=t.fontStack||e,s=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,s,r,this.allowVerticalPlacement,n);}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++;}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;ut.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r));}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;en[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t);})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}kn("SymbolBucket",Eu,{omit:["layers","collisionBoxArray","features","compareText"]}),Eu.MAX_GLYPHS=65535,Eu.addDynamicAttributes=Cu;const Fu=new ci({"symbol-placement":new si(nt.layout_symbol["symbol-placement"]),"symbol-spacing":new si(nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new si(nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ai(nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new si(nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new si(nt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new si(nt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new si(nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new si(nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new si(nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ai(nt.layout_symbol["icon-size"]),"icon-text-fit":new si(nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new si(nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ai(nt.layout_symbol["icon-image"]),"icon-rotate":new ai(nt.layout_symbol["icon-rotate"]),"icon-padding":new si(nt.layout_symbol["icon-padding"]),"icon-keep-upright":new si(nt.layout_symbol["icon-keep-upright"]),"icon-offset":new ai(nt.layout_symbol["icon-offset"]),"icon-anchor":new ai(nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new si(nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new si(nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new si(nt.layout_symbol["text-rotation-alignment"]),"text-field":new ai(nt.layout_symbol["text-field"]),"text-font":new ai(nt.layout_symbol["text-font"]),"text-size":new ai(nt.layout_symbol["text-size"]),"text-max-width":new ai(nt.layout_symbol["text-max-width"]),"text-line-height":new si(nt.layout_symbol["text-line-height"]),"text-letter-spacing":new ai(nt.layout_symbol["text-letter-spacing"]),"text-justify":new ai(nt.layout_symbol["text-justify"]),"text-radial-offset":new ai(nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new si(nt.layout_symbol["text-variable-anchor"]),"text-anchor":new ai(nt.layout_symbol["text-anchor"]),"text-max-angle":new si(nt.layout_symbol["text-max-angle"]),"text-writing-mode":new si(nt.layout_symbol["text-writing-mode"]),"text-rotate":new ai(nt.layout_symbol["text-rotate"]),"text-padding":new si(nt.layout_symbol["text-padding"]),"text-keep-upright":new si(nt.layout_symbol["text-keep-upright"]),"text-transform":new ai(nt.layout_symbol["text-transform"]),"text-offset":new ai(nt.layout_symbol["text-offset"]),"text-allow-overlap":new si(nt.layout_symbol["text-allow-overlap"]),"text-overlap":new si(nt.layout_symbol["text-overlap"]),"text-ignore-placement":new si(nt.layout_symbol["text-ignore-placement"]),"text-optional":new si(nt.layout_symbol["text-optional"])});var Tu={paint:new ci({"icon-opacity":new ai(nt.paint_symbol["icon-opacity"]),"icon-color":new ai(nt.paint_symbol["icon-color"]),"icon-halo-color":new ai(nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ai(nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ai(nt.paint_symbol["icon-halo-blur"]),"icon-translate":new si(nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new si(nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ai(nt.paint_symbol["text-opacity"]),"text-color":new ai(nt.paint_symbol["text-color"],{runtimeType:yt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ai(nt.paint_symbol["text-halo-color"]),"text-halo-width":new ai(nt.paint_symbol["text-halo-width"]),"text-halo-blur":new ai(nt.paint_symbol["text-halo-blur"]),"text-translate":new si(nt.paint_symbol["text-translate"]),"text-translate-anchor":new si(nt.paint_symbol["text-translate-anchor"])}),layout:Fu};class Lu{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ht,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}kn("FormatSectionOverride",Lu,{omit:["defaultValue"]});class Du extends pi{constructor(t){super(t,Tu);}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e;}else this.layout._values["text-writing-mode"]=["horizontal"];}this._setPaintOverrides();}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Pr(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new Eu(t)}queryRadius(){return 0}queryIntersectsFeature(){return !1}_setPaintOverrides(){for(const t of Tu.paint.overridableProperties){if(!Du.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Lu(e),n=new Br(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new Er("source",n):new Fr("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new ni(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&Du.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Tu.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Lt)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof qt&&Rt(e.value)===vt?s(e.value.sections):e instanceof Zt?s(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}}function $u(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var Ou={paint:new ci({"background-color":new si(nt.paint_background["background-color"]),"background-pattern":new li(nt.paint_background["background-pattern"]),"background-opacity":new si(nt.paint_background["background-opacity"])})},Ru={paint:new ci({"raster-opacity":new si(nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new si(nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new si(nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new si(nt.paint_raster["raster-brightness-max"]),"raster-saturation":new si(nt.paint_raster["raster-saturation"]),"raster-contrast":new si(nt.paint_raster["raster-contrast"]),"raster-resampling":new si(nt.paint_raster["raster-resampling"]),"raster-fade-duration":new si(nt.paint_raster["raster-fade-duration"])})};class Uu extends pi{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);},this.implementation=t;}is3D(){return "3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){}}const qu={circle:class extends pi{constructor(t){super(t,oa);}createBucket(t){return new Ks(t)}queryRadius(t){const e=t;return na("circle-radius",this,e)+na("circle-stroke-width",this,e)+ia(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=sa(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>ya(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:ya(e,o);let r=p;const n=da(pa(),fa(e.x,e.y,0,1),o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=s.cameraToCenterDistance/n[3]),Gs(h,t,r))return !0}return !1}},heatmap:class extends pi{constructor(t){super(t,ga),this._updateColorRamp();}createBucket(t){return new ma(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=Aa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null);}queryRadius(){return 0}queryIntersectsFeature(){return !1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends pi{constructor(t){super(t,ka);}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends pi{constructor(t){super(t,ho);}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"]);}createBucket(t){return new uo(t)}queryRadius(){return ia(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a){return Js(sa(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,a),n)}isTileClipped(){return !0}},"fill-extrusion":class extends pi{constructor(t){super(t,Eo);}createBucket(t){return new Bo(t)}queryRadius(){return ia(this.paint.get("fill-extrusion-translate"))}is3D(){return !0}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=sa(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,a),u=this.paint.get("fill-extrusion-height").evaluate(e,r),c=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e,r,n){const i=[];for(const r of t){const t=fa(r.x,r.y,0,1);da(t,t,e),i.push(new S(t[0]/t[3],t[1]/t[3]));}return i}(l,o),p=function(t,e,r,n){const i=[],s=[],a=n[8]*e,o=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,h=n[9]*r,p=n[10]*r,f=n[11]*r;for(const e of t){const t=[],r=[];for(const i of e){const e=i.x,s=i.y,d=n[0]*e+n[4]*s+n[12],y=n[1]*e+n[5]*s+n[13],m=n[2]*e+n[6]*s+n[14],g=n[3]*e+n[7]*s+n[15],x=m+l,v=g+u,b=d+c,w=y+h,_=m+p,A=g+f,k=new S((d+a)/v,(y+o)/v);k.z=x/v,t.push(k);const z=new S(b/A,w/A);z.z=_/A,r.push(z);}i.push(t),s.push(r);}return [i,s]}(n,c,u,o);return function(t,e,r){let n=1/0;Js(r,e)&&(n=To(r,e[0]));for(let i=0;i=3)for(let e=0;e{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){delete this._channel,this._callback=()=>{};}}const Nu=6371008.8;class Ku{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ku(a(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Nu*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Zu(new Ku(this.lng-r,this.lat-e),new Ku(this.lng+r,this.lat+e))}static convert(t){if(t instanceof Ku)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ku(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ku(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Zu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]));}setNorthEast(t){return this._ne=t instanceof Ku?new Ku(t.lng,t.lat):Ku.convert(t),this}setSouthWest(t){return this._sw=t instanceof Ku?new Ku(t.lng,t.lat):Ku.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof Ku)n=t,i=t;else {if(!(t instanceof Zu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Zu.convert(t)):this.extend(Ku.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new Ku(n.lng,n.lat),this._ne=new Ku(i.lng,i.lat)),this}getCenter(){return new Ku((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 Ku(this.getWest(),this.getNorth())}getSouthEast(){return new Ku(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:e,lat:r}=Ku.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof Zu?t:t?new Zu(t):t}}const Gu=2*Math.PI*Nu;function Ju(t){return Gu*Math.cos(t*Math.PI/180)}function Xu(t){return (180+t)/360}function Yu(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Hu(t,e){return t/Ju(e)}function Wu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Qu{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r;}static fromLngLat(t,e=0){const r=Ku.convert(t);return new Qu(Xu(r.lng),Yu(r.lat),Hu(e,r.lat))}toLngLat(){return new Ku(360*this.x-180,Wu(this.y))}toAltitude(){return this.z*Ju(Wu(this.y))}meterInMercatorCoordinateUnits(){return 1/Gu*(t=Wu(this.y),1/Math.cos(t*Math.PI/180));var t;}}function tc(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class ec{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=ic(0,t,t,e,r);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=tc(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=tc(256*(i+1),256*(s+1),a),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}getTilePoint(t){const e=Math.pow(2,this.z);return new S((t.x*e-this.x)*Os,(t.y*e-this.y)*Os)}toString(){return `${this.z}/${this.x}/${this.y}`}}class rc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=ic(t,e.z,e.z,e.x,e.y);}}class nc{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new ec(r,+n,+i),this.key=ic(e,t,r,n,i);}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new nc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){const r=this.canonical.z-t;return t>this.canonical.z?ic(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):ic(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return !1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new nc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new nc(e,this.wrap,e,r,n),new nc(e,this.wrap,e,r+1,n),new nc(e,this.wrap,e,r,n+1),new nc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return (e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return (256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}getPixels(){return new _a({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:s=a-1;break;case 1:a=s+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3]);}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new yo.VectorTile(new rl(this.rawTileData)).layers,this.sourceLayerCoder=new ac(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},s=Os/t.tileSize/t.scale,a=Zr(i.filter),o=t.queryGeometry,l=t.queryPadding*s,u=hc(o),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=hc(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((e,r,n,i)=>function(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return !0;const s=[new S(e,r),new S(e,i),new S(n,i),new S(n,r)];if(t.length>2)for(const e of s)if(ea(t,e))return !0;for(let e=0;e(p||(p=qs(e)),r.queryIntersectsFeature(o,e,n,p,this.z,t.transform,s,t.pixelPosMatrix))));}return f}loadMatchingFeature(t,e,r,n,i,s,a,l,u,c,h){const p=this.bucketLayerIDs[e];if(s&&!function(t,e){for(let r=0;r=0)return !0;return !1}(s,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){const t=js(d,!0);if(!i.filter(new Yn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Yn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e{const a=e instanceof ii?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function hc(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return {minX:e,minY:r,maxX:n,maxY:i}}function pc(t,e){return e-t}kn("FeatureIndex",uc,{omit:["rawTileData","sourceLayerCoder"]}),function(t){t.create="create",t.load="load",t.fullLoad="fullLoad";}(oc||(oc={})),t.ARRAY_TYPE=la,t.Actor=class{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},u(["receive","process"],this),this.invoker=new ju(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=g()?t:window;}send(t,e,r,n,i=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[s]=r);const a=_(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:zn(e,a)},a),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:n,sourceMapId:this.mapId});}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t();}else g()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e);}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e);}processTask(t,e){if(""===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(In(e.error)):r(null,In(e.data)));}else {let r=!1;const n=_(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?zn(e):null,data:zn(i,n)},n);}:t=>{r=!0;};let s=null;const a=In(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,a,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,i);}else i(new Error(`Could not find function ${e.type}`));!r&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel);}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1);}},t.AlphaImage=wa,t.CanonicalTileID=ec,t.CollisionBoxArray=Ui,t.CollisionCircleLayoutArray=class extends Ci{},t.Color=Et,t.DEMData=sc,t.DataConstantProperty=si,t.DictionaryCoder=ac,t.EXTENT=Os,t.ErrorEvent=et,t.EvaluationParameters=Yn,t.Event=tt,t.Evented=rt,t.FeatureIndex=uc,t.FillBucket=uo,t.FillExtrusionBucket=Bo,t.GeoJSONFeature=lc,t.ImageAtlas=Bl,t.ImagePosition=Cl,t.LineBucket=jo,t.LineStripIndexArray=class extends $i{},t.LngLat=Ku,t.LngLatBounds=Zu,t.MercatorCoordinate=Qu,t.ONE_EM=el,t.OverscaledTileID=nc,t.PosArray=class extends xi{},t.Properties=ci,t.QuadTriangleArray=class extends Pi{},t.RGBAImage=_a,t.RasterBoundsArray=class extends vi{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start);}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.ResourceType=U,t.SegmentVector=hs,t.SymbolBucket=Eu,t.Transitionable=Qn,t.TriangleIndexArray=os,t.Uniform1f=Ss,t.Uniform1i=class extends ks{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t));}},t.Uniform2f=class extends ks{constructor(t,e){super(t,e),this.current=[0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]));}},t.Uniform3f=class extends ks{constructor(t,e){super(t,e),this.current=[0,0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]));}},t.Uniform4f=zs,t.UniformColor=Is,t.UniformMatrix4f=class extends ks{constructor(t,e){super(t,e),this.current=Ms;}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=rc,t.ValidationError=it,t.ZoomHistory=Mn,t.addDynamicAttributes=Cu,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let s=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i);}));}));},t.bezier=n,t.bindAll=u,t.cacheEntryPossiblyAdded=function(t){F++,F>V&&(t.getActor().send("enforceCacheSizeLimit",P),F=0);},t.clamp=s,t.clearTileCache=function(t){const e=caches.delete(M);t&&e.catch(t).then((()=>t()));},t.clipLine=au,t.clone=function(t){var e=new la(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=p,t.collisionCircleLayout=Wo,t.config=I,t.create=function(){var t=new la(16);return la!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Vr,t.createFilter=Zr,t.createLayout=mi,t.createStyleLayer=function(t){return "custom"===t.type?new Uu(t):new qu[t.type](t)},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=i,t.emitValidationErrors=wn,t.enforceCacheSizeLimit=function(t){E(),C&&C.then((e=>{e.keys().then((r=>{for(let n=0;n{}}},t.identity=ua,t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,w=n*l-i*o,_=n*u-s*o,A=i*u-s*l,k=c*y-h*d,S=c*m-p*d,z=c*g-f*d,I=h*m-p*y,M=h*g-f*y,C=p*g-f*m,B=x*C-v*M+b*I+w*z-_*S+A*k;return B?(t[0]=(o*C-l*M+u*I)*(B=1/B),t[1]=(i*M-n*C-s*I)*B,t[2]=(y*A-m*_+g*w)*B,t[3]=(p*_-h*A-f*w)*B,t[4]=(l*z-a*C-u*S)*B,t[5]=(r*C-i*z+s*S)*B,t[6]=(m*b-d*A-g*v)*B,t[7]=(c*A-p*b+f*v)*B,t[8]=(a*M-o*z+u*k)*B,t[9]=(n*z-r*M-s*k)*B,t[10]=(d*_-y*b+g*x)*B,t[11]=(h*b-c*_-f*x)*B,t[12]=(o*S-a*I-l*k)*B,t[13]=(r*I-n*S+i*k)*B,t[14]=(y*v-d*w-m*x)*B,t[15]=(c*w-h*v+p*x)*B,t):null},t.isImageBitmap=A,t.keysDifference=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r},t.lazyLoadRTLTextPlugin=function(){Xn.isLoading()||Xn.isLoaded()||"deferred"!==Gn()||Jn();},t.makeRequest=K,t.mapObject=c,t.mercatorXfromLng=Xu,t.mercatorYfromLat=Yu,t.mercatorZfromAltitude=Hu,t.mul=ha,t.multiply=ca,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.number=Se,t.ortho=function(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(a+s)*u,t[15]=1,t},t.parseCacheControl=x,t.parseGlyphPBF=function(t){return new rl(t).readFields(Sl,[])},t.pbf=rl,t.performSymbolLayout=function(e,r,n,i,s,a,o){e.createArrays(),e.tilePixelRatio=Os/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={layoutIconSize:u["icon-size"].possiblyEvaluate(new Yn(e.zoom+1),o),layoutTextSize:u["text-size"].possiblyEvaluate(new Yn(e.zoom+1),o),textMaxSize:u["text-size"].possiblyEvaluate(new Yn(18))};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.textSizeData;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new Yn(t),o),u["text-size"].possiblyEvaluate(new Yn(r),o)];}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.iconSizeData;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new Yn(t),o),u["icon-size"].possiblyEvaluate(new Yn(r),o)];}const h=l.get("text-line-height")*el,p="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),f=l.get("text-keep-upright"),y=l.get("text-size");for(const a of e.features){const u=l.get("text-font").evaluate(a,{},o).join(","),m=y.evaluate(a,{},o),g=c.layoutTextSize.evaluate(a,{},o),x=c.layoutIconSize.evaluate(a,{},o),v={horizontal:{},vertical:void 0},b=a.text;let w,_=[0,0];if(b){const i=b.toString(),c=l.get("text-letter-spacing").evaluate(a,{},o)*el,d=Pn(i)?c:0,y=l.get("text-anchor").evaluate(a,{},o),x=l.get("text-variable-anchor");if(!x){const t=l.get("text-radial-offset").evaluate(a,{},o);_=t?vu(y,[t*el,xu]):l.get("text-offset").evaluate(a,{},o).map((t=>t*el));}let w=p?"center":l.get("text-justify").evaluate(a,{},o);const A=l.get("symbol-placement"),k="point"===A?l.get("text-max-width").evaluate(a,{},o)*el:0,S=()=>{e.allowVerticalPlacement&&Bn(i)&&(v.vertical=Fl(b,r,n,s,u,k,h,y,"left",d,_,t.WritingMode.vertical,!0,A,g,m));};if(!p&&x){const e="auto"===w?x.map((t=>bu(t))):[w];let i=!1;for(let a=0;athis._layers[e.id])),o=t[0];if("none"===o.visibility)continue;const i=o.source||"";let r=this.familiesBySource[i];r||(r=this.familiesBySource[i]={});const n=o.sourceLayer||"_geojsonTileLayer";let s=r[n];s||(s=r[n]=[]),s.push(t);}}}class r{constructor(t){const o={},i=[];for(const e in t){const r=t[e],n=o[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const o={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(o),n[e]={rect:o,metrics:t.metrics};}}const{w:r,h:n}=e.potpack(i),s=new e.AlphaImage({width:r||1,height:n||1});for(const i in t){const r=t[i];for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const a=o[i][t].rect;e.AlphaImage.copy(n.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},n.bitmap);}}this.image=s,this.positions=o;}}e.register("GlyphAtlas",r);class n{constructor(t){this.tileID=new e.OverscaledTileID(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId;}parse(t,o,i,n,a){this.status="parsing",this.data=t,this.collisionBoxArray=new e.CollisionBoxArray;const l=new e.DictionaryCoder(Object.keys(t.layers).sort()),c=new e.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:i},p=o.familiesBySource[this.source];for(const o in p){const r=t.layers[o];if(!r)continue;1===r.version&&e.warnOnce(`Vector tile source "${this.source}" layer "${o}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=l.encode(o),a=[];for(let e=0;e=t.maxzoom||"none"!==t.visibility&&(s(e,this.zoom,i),(u[t.id]=t.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(e.map((e=>e.id))));}}let f,d,g,m;const y=e.mapObject(h.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(y).length?n.send("getGlyphs",{uid:this.uid,stacks:y},((e,t)=>{f||(f=e,d=t,w.call(this));})):d={};const v=Object.keys(h.iconDependencies);v.length?n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,g=t,w.call(this));})):g={};const x=Object.keys(h.patternDependencies);function w(){if(f)return a(f);if(d&&g&&m){const t=new r(d),o=new e.ImageAtlas(g,m);for(const r in u){const n=u[r];n instanceof e.SymbolBucket?(s(n.layers,this.zoom,i),e.performSymbolLayout(n,d,t.positions,g,o.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):n.hasPattern&&(n instanceof e.LineBucket||n instanceof e.FillBucket||n instanceof e.FillExtrusionBucket)&&(s(n.layers,this.zoom,i),n.addFeatures(h,this.tileID.canonical,o.patternPositions));}this.status="done",a(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:o,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?t.positions:null});}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,m=t,w.call(this));})):m={},w.call(this);}}function s(t,o,i){const r=new e.EvaluationParameters(o);for(const e of t)e.recalculate(r,i);}function a(t,o){const i=e.getArrayBuffer(t.request,((t,i,r,n)=>{t?o(t):i&&o(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(i)),rawData:i,cacheControl:r,expires:n});}));return ()=>{i.cancel(),o();}}class l{constructor(e,t,o,i){this.actor=e,this.layerIndex=t,this.availableImages=o,this.loadVectorData=i||a,this.loading={},this.loaded={};}loadTile(t,o){const i=t.uid;this.loading||(this.loading={});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),s=this.loading[i]=new n(t);s.abort=this.loadVectorData(t,((t,n)=>{if(delete this.loading[i],t||!n)return s.status="done",this.loaded[i]=s,o(t);const a=n.rawData,l={};n.expires&&(l.expires=n.expires),n.cacheControl&&(l.cacheControl=n.cacheControl);const c={};if(r){const e=r.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)));}s.vectorTile=n.vectorTile,s.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,i)=>{if(t||!i)return o(t);o(null,e.extend({rawTileData:a.slice(0)},i,l,c));})),this.loaded=this.loaded||{},this.loaded[i]=s;}));}reloadTile(e,t){const o=this.loaded,i=e.uid,r=this;if(o&&o[i]){const n=o[i];n.showCollisionBoxes=e.showCollisionBoxes;const s=(e,o)=>{const i=n.reloadCallback;i&&(delete n.reloadCallback,n.parse(n.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),t(e,o);};"parsing"===n.status?n.reloadCallback=s:"done"===n.status&&(n.vectorTile?n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s());}}abortTile(e,t){const o=this.loading,i=e.uid;o&&o[i]&&o[i].abort&&(o[i].abort(),delete o[i]),t();}removeTile(e,t){const o=this.loaded,i=e.uid;o&&o[i]&&delete o[i],t();}}class c{constructor(){this.loaded={};}loadTile(t,o){const{uid:i,encoding:r,rawImageData:n}=t,s=e.isImageBitmap(n)?this.getImageData(n):n,a=new e.DEMData(i,s,r);this.loaded=this.loaded||{},this.loaded[i]=a,o(null,a);}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const o=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:o.width,height:o.height},o.data)}removeTile(e){const t=this.loaded,o=e.uid;t&&t[o]&&delete t[o];}}var u=function e(t,o){var i,r=t&&t.type;if("FeatureCollection"===r)for(i=0;i=Math.abs(a)?o-l+a:a-l+o,o=l;}o+i>=0!=!!t&&e.reverse();}const f=e.vectorTile.VectorTileFeature.prototype.toGeoJSON;class d{constructor(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));}loadGeometry(){if(1===this._feature.type){const t=[];for(const o of this._feature.geometry)t.push([new e.pointGeometry(o[0],o[1])]);return t}{const t=[];for(const o of this._feature.geometry){const i=[];for(const t of o)i.push(new e.pointGeometry(t[0],t[1]));t.push(i);}return t}}toGeoJSON(e,t,o){return f.call(this,e,t,o)}}class g{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=t.length,this._features=t;}feature(e){return new d(this._features[e])}}var m={exports:{}},y=e.pointGeometry,v=e.vectorTile.VectorTileFeature,x=w;function w(e,t){this.options=t||{},this.features=e,this.length=e.length;}function S(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096;}w.prototype.feature=function(e){return new S(this.features[e],this.options.extent)},S.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t>31}function D(e,t){for(var o=e.loadGeometry(),i=e.type,r=0,n=0,s=o.length,a=0;a>1;E(e,t,s,i,r,n%2),O(e,t,o,i,s-1,n+1),O(e,t,o,s+1,r,n+1);}function E(e,t,o,i,r,n){for(;r>i;){if(r-i>600){const s=r-i+1,a=o-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);E(e,t,o,Math.max(i,Math.floor(o-a*c/s+u)),Math.min(r,Math.floor(o+(s-a)*c/s+u)),n);}const s=t[2*o+n];let a=i,l=r;for(F(e,t,i,o),t[2*r+n]>s&&F(e,t,i,r);as;)l--;}t[2*i+n]===s?F(e,t,i,l):(l++,F(e,t,l,r)),l<=o&&(i=l+1),o<=l&&(r=l-1);}}function F(e,t,o,i){N(e,o,i),N(t,2*o,2*i),N(t,2*o+1,2*i+1);}function N(e,t,o){const i=e[t];e[t]=e[o],e[o]=i;}function A(e,t,o,i){const r=e-o,n=t-i;return r*r+n*n}const G=e=>e[0],J=e=>e[1];class Z{constructor(e,t=G,o=J,i=64,r=Float64Array){this.nodeSize=i,this.points=e;const n=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new n(e.length),a=this.coords=new r(2*e.length);for(let i=0;i=o&&c<=r&&u>=i&&u<=n&&l.push(e[s]);continue}const d=Math.floor((f+p)/2);c=t[2*d],u=t[2*d+1],c>=o&&c<=r&&u>=i&&u<=n&&l.push(e[d]);const g=(h+1)%2;(0===h?o<=c:i<=u)&&(a.push(f),a.push(d-1),a.push(g)),(0===h?r>=c:n>=u)&&(a.push(d+1),a.push(p),a.push(g));}return l}(this.ids,this.coords,e,t,o,i,this.nodeSize)}within(e,t,o){return function(e,t,o,i,r,n){const s=[0,e.length-1,0],a=[],l=r*r;for(;s.length;){const c=s.pop(),u=s.pop(),h=s.pop();if(u-h<=n){for(let r=h;r<=u;r++)A(t[2*r],t[2*r+1],o,i)<=l&&a.push(e[r]);continue}const p=Math.floor((h+u)/2),f=t[2*p],d=t[2*p+1];A(f,d,o,i)<=l&&a.push(e[p]);const g=(c+1)%2;(0===c?o-r<=f:i-r<=d)&&(s.push(h),s.push(p-1),s.push(g)),(0===c?o+r>=f:i+r>=d)&&(s.push(p+1),s.push(u),s.push(g));}return a}(this.ids,this.coords,e,t,o,this.nodeSize)}}const B={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},j=Math.fround||(Y=new Float32Array(1),e=>(Y[0]=+e,Y[0]));var Y;class V{constructor(e){this.options=K(Object.create(B),e),this.trees=new Array(this.options.maxZoom+1);}load(e){const{log:t,minZoom:o,maxZoom:i,nodeSize:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;let s=[];for(let t=0;t=o;e--){const o=+Date.now();s=this._cluster(s,e),this.trees[e]=new Z(s,Q,ee,r,Float32Array),t&&console.log("z%d: %d clusters in %dms",e,s.length,+Date.now()-o);}return t&&console.timeEnd("total time"),this}getClusters(e,t){let o=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,r=180;else if(o>r){const e=this.getClusters([o,i,180,n],t),s=this.getClusters([-180,i,r,n],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(q(o),U(n),q(r),U(i)),l=[];for(const e of a){const t=s.points[e];l.push(t.numPoints?R(t):this.points[t.index]);}return l}getChildren(e){const t=this._getOriginId(e),o=this._getOriginZoom(e),i="No cluster with the specified id.",r=this.trees[o];if(!r)throw new Error(i);const n=r.points[t];if(!n)throw new Error(i);const s=this.options.radius/(this.options.extent*Math.pow(2,o-1)),a=r.within(n.x,n.y,s),l=[];for(const t of a){const o=r.points[t];o.parentId===e&&l.push(o.numPoints?R(o):this.points[o.index]);}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,o){const i=[];return this._appendLeaves(i,e,t=t||10,o=o||0,0),i}getTile(e,t,o){const i=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:n,radius:s}=this.options,a=s/n,l=(o-a)/r,c=(o+1+a)/r,u={features:[]};return this._addTileFeatures(i.range((t-a)/r,l,(t+1+a)/r,c),i.points,t,o,r,u),0===t&&this._addTileFeatures(i.range(1-a/r,l,1,c),i.points,r,o,r,u),t===r-1&&this._addTileFeatures(i.range(0,l,a/r,c),i.points,-1,o,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const o=this.getChildren(e);if(t++,1!==o.length)break;e=o[0].properties.cluster_id;}return t}_appendLeaves(e,t,o,i,r){const n=this.getChildren(t);for(const t of n){const n=t.properties;if(n&&n.cluster?r+n.point_count<=i?r+=n.point_count:r=this._appendLeaves(e,n.cluster_id,o,i,r):rt&&(h+=o.numPoints||1);}if(h>u&&h>=s){let e=r.x*u,s=r.y*u,a=n&&u>1?this._map(r,!0):null;const p=(i<<5)+(t+1)+this.points.length;for(const o of c){const i=l.points[o];if(i.zoom<=t)continue;i.zoom=t;const c=i.numPoints||1;e+=i.x*c,s+=i.y*c,i.parentId=p,n&&(a||(a=this._map(r,!0)),n(a,this._map(i)));}r.parentId=p,o.push(X(e/h,s/h,p,h,a));}else if(o.push(r),h>1)for(const e of c){const i=l.points[e];i.zoom<=t||(i.zoom=t,o.push(i));}}return o}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?K({},e.properties):e.properties;const o=this.points[e.index].properties,i=this.options.map(o);return t&&i===o?K({},i):i}}function X(e,t,o,i,r){return {x:j(e),y:j(t),zoom:1/0,id:o,parentId:-1,numPoints:i,properties:r}}function W(e,t){const[o,i]=e.geometry.coordinates;return {x:j(q(o)),y:j(U(i)),zoom:1/0,index:t,parentId:-1}}function R(e){return {type:"Feature",id:e.id,properties:$(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),H(e.y)]}};var t;}function $(e){const t=e.numPoints,o=t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?Math.round(t/100)/10+"k":t;return K(K({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:o})}function q(e){return e/360+.5}function U(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function H(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function K(e,t){for(const o in t)e[o]=t[o];return e}function Q(e){return e.x}function ee(e){return e.y}function te(e,t,o,i){for(var r,n=i,s=o-t>>1,a=o-t,l=e[t],c=e[t+1],u=e[o],h=e[o+1],p=t+3;pn)r=p,n=f;else if(f===n){var d=Math.abs(p-s);di&&(r-t>3&&te(e,t,r,i),e[r+2]=n,o-r>3&&te(e,r,o,i));}function oe(e,t,o,i,r,n){var s=r-o,a=n-i;if(0!==s||0!==a){var l=((e-o)*s+(t-i)*a)/(s*s+a*a);l>1?(o=r,i=n):l>0&&(o+=s*l,i+=a*l);}return (s=e-o)*s+(a=t-i)*a}function ie(e,t,o,i){var r={id:void 0===e?null:e,type:t,geometry:o,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,o=e.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)re(e,t);else if("Polygon"===o||"MultiLineString"===o)for(var i=0;i0&&(s+=i?(r*c-l*n)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-n,2))),r=l,n=c;}var u=t.length-3;t[2]=1,te(t,0,u,o),t[u+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size;}function le(e,t,o,i){for(var r=0;r1?1:o}function he(e,t,o,i,r,n,s,a){if(i/=t,n>=(o/=t)&&s=i)return null;for(var l=[],c=0;c=o&&d=i)){var g=[];if("Point"===p||"MultiPoint"===p)pe(h,g,o,i,r);else if("LineString"===p)fe(h,g,o,i,r,!1,a.lineMetrics);else if("MultiLineString"===p)ge(h,g,o,i,r,!1);else if("Polygon"===p)ge(h,g,o,i,r,!0);else if("MultiPolygon"===p)for(var m=0;m=o&&s<=i&&(t.push(e[n]),t.push(e[n+1]),t.push(e[n+2]));}}function fe(e,t,o,i,r,n,s){for(var a,l,c=de(e),u=0===r?ye:ve,h=e.start,p=0;po&&(l=u(c,f,d,m,y,o),s&&(c.start=h+a*l)):v>i?x=o&&(l=u(c,f,d,m,y,o),w=!0),x>i&&v<=i&&(l=u(c,f,d,m,y,i),w=!0),!n&&w&&(s&&(c.end=h+a*l),t.push(c),c=de(e)),s&&(h+=a);}var S=e.length-3;f=e[S],d=e[S+1],g=e[S+2],(v=0===r?f:d)>=o&&v<=i&&me(c,f,d,g),S=c.length-3,n&&S>=3&&(c[S]!==c[0]||c[S+1]!==c[1])&&me(c,c[0],c[1],c[2]),c.length&&t.push(c);}function de(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ge(e,t,o,i,r,n){for(var s=0;ss.maxX&&(s.maxX=u),h>s.maxY&&(s.maxY=h);}return s}function be(e,t,o,i){var r=t.geometry,n=t.type,s=[];if("Point"===n||"MultiPoint"===n)for(var a=0;a0&&t.size<(r?s:i))o.numPoints+=t.length/3;else {for(var a=[],l=0;ls)&&(o.numSimplified++,a.push(t[l]),a.push(t[l+1])),o.numPoints++;r&&function(e,t){for(var o=0,i=0,r=e.length,n=r-2;i0===t)for(i=0,r=e.length;i24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(e,t){var o=[];if("FeatureCollection"===e.type)for(var i=0;i1&&console.time("creation"),p=this.tiles[h]=Me(e,t,o,i,l),this.tileCoords.push({z:t,x:o,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,o,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++;}if(p.source=e,r){if(t===l.maxZoom||t===r)continue;var d=1<1&&console.time("clipping");var g,m,y,v,x,w,S=.5*l.buffer/l.extent,I=.5-S,M=.5+S,b=1+S;g=m=y=v=null,x=he(e,u,o-S,o+M,0,p.minX,p.maxX,l),w=he(e,u,o+I,o+b,0,p.minX,p.maxX,l),e=null,x&&(g=he(x,u,i-S,i+M,1,p.minY,p.maxY,l),m=he(x,u,i+I,i+b,1,p.minY,p.maxY,l),x=null),w&&(y=he(w,u,i-S,i+M,1,p.minY,p.maxY,l),v=he(w,u,i+I,i+b,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*o,2*i),a.push(m||[],t+1,2*o,2*i+1),a.push(y||[],t+1,2*o+1,2*i),a.push(v||[],t+1,2*o+1,2*i+1);}}},_e.prototype.getTile=function(e,t,o){var i=this.options,r=i.extent,n=i.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,o);for(var l,c=e,u=t,h=o;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[Pe(c,u,h)];return l&&l.source?(n>1&&console.log("found parent tile z%d-%d-%d",c,u,h),n>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,e,t,o),n>1&&console.timeEnd("drilling down"),this.tiles[a]?Se(this.tiles[a],r):null):null};class Ce extends l{constructor(e,t,o,i){super(e,t,o,Te),i&&(this.loadGeoJSON=i);}loadData(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=t,this._pendingLoadDataParams=e,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData());}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const t=this._pendingCallback,o=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const i=!!(o&&o.request&&o.request.collectResourceTiming)&&new e.RequestPerformance(o.request);this.loadGeoJSON(o,((r,n)=>{if(r||!n)return t(r);if("object"!=typeof n)return t(new Error(`Input data given to '${o.source}' is not a valid GeoJSON object.`));{u(n,!0);try{if(o.filter){const t=e.createExpression(o.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const i=n.features.filter((e=>t.value.evaluate({zoom:0},e)));n={type:"FeatureCollection",features:i};}this._geoJSONIndex=o.cluster?new V(function({superclusterOptions:t,clusterProperties:o}){if(!o||!t)return t;const i={},r={},n={accumulated:null,zoom:0},s={properties:null},a=Object.keys(o);for(const t of a){const[n,s]=o[t],a=e.createExpression(s),l=e.createExpression("string"==typeof n?[n,["accumulated"],["get",t]]:n);i[t]=a.value,r[t]=l.value;}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(n,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)n.accumulated=e[t],e[t]=r[t].evaluate(n,s);},t}(o)).load(n.features):function(e,t){return new _e(e,t)}(n,o.geojsonVtOptions);}catch(r){return t(r)}this.loaded={};const s={};if(i){const e=i.finish();e&&(s.resourceTiming={},s.resourceTiming[o.source]=JSON.parse(JSON.stringify(e)));}t(null,s);}}));}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData());}reloadTile(e,t){const o=this.loaded;return o&&o[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,o){if(t.request)e.getJSON(t.request,o);else {if("string"!=typeof t.data)return o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return o(null,JSON.parse(t.data))}catch(e){return o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t();}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId));}catch(e){t(e);}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId));}catch(e){t(e);}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset));}catch(e){t(e);}}}class De{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:Ce},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText;};}setReferrer(e,t){this.referrer=t;}setImages(e,t,o){this.availableImages[e]=t;for(const o in this.workerSources[e]){const i=this.workerSources[e][o];for(const e in i)i[e].availableImages=t;}o();}setLayers(e,t,o){this.getLayerIndex(e).replace(t),o();}updateLayers(e,t,o){this.getLayerIndex(e).update(t.layers,t.removedIds),o();}loadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).loadTile(t,o);}loadDEMTile(e,t,o){this.getDEMWorkerSource(e,t.source).loadTile(t,o);}reloadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).reloadTile(t,o);}abortTile(e,t,o){this.getWorkerSource(e,t.type,t.source).abortTile(t,o);}removeTile(e,t,o){this.getWorkerSource(e,t.type,t.source).removeTile(t,o);}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t);}removeSource(e,t,o){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const i=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==i.removeSource?i.removeSource(t,o):o();}loadWorkerSource(e,t,o){try{this.self.importScripts(t.url),o();}catch(e){o(e.toString());}}syncRTLPluginState(t,o,i){try{e.plugin.setState(o);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const o=e.plugin.isParsed();i(o?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),o);}}catch(e){i(e.toString());}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new i),t}getWorkerSource(e,t,o){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][o]){const i={send:(t,o,i)=>{this.actor.send(t,o,i,e);}};this.workerSources[e][t][o]=new this.workerSourceTypes[t](i,this.getLayerIndex(e),this.getAvailableImages(e));}return this.workerSources[e][t][o]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new c),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,o){e.enforceCacheSizeLimit(o);}}return "undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new De(self)),De})); + +define(["./shared"],(function(t){"use strict";var e=i;function i(t){return !function(t){return "undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return !1;var t,e,i=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(i);try{e=new Worker(o),t=!0;}catch(e){t=!1;}return e&&e.terminate(),URL.revokeObjectURL(o),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return !1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===o[e=t&&t.failIfMajorPerformanceCaveat]&&(o[e]=function(t){var e,o=function(t){var e=document.createElement("canvas"),o=Object.create(i.webGLContextAttributes);return o.failIfMajorPerformanceCaveat=t,e.getContext("webgl",o)||e.getContext("experimental-webgl",o)}(t);if(!o)return !1;try{e=o.createShader(o.VERTEX_SHADER);}catch(t){return !1}return !(!e||o.isContextLost())&&(o.shaderSource(e,"void main() {}"),o.compileShader(e),!0===o.getShaderParameter(e,o.COMPILE_STATUS))}(e)),o[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e;}(t)}var o={};function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(let i=0;i{window.removeEventListener("click",s.suppressClickInternal,!0);}),0);}static mousePos(e,i){const o=e.getBoundingClientRect();return new t.pointGeometry(i.clientX-o.left-e.clientLeft,i.clientY-o.top-e.clientTop)}static touchPos(e,i){const o=e.getBoundingClientRect(),a=[];for(let s=0;s-1);l++,s[l]=n,r[l]=c,r[l+1]=f;}for(let n=0,l=0;n{let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[e];if(void 0!==a)return void i(null,{stack:t,id:e,glyph:a});if(a=this._tinySDF(o,t,e),a)return o.glyphs[e]=a,void i(null,{stack:t,id:e,glyph:a});const s=Math.floor(e/256);if(256*s>65535)return void i(new Error("glyphs > 65535 not supported"));if(o.ranges[s])return void i(null,{stack:t,id:e,glyph:a});let r=o.requests[s];r||(r=o.requests[s]=[],v.loadGlyphRange(t,s,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(o.glyphs[+t]=e[+t]);o.ranges[s]=!0;}for(const i of r)i(t,e);delete o.requests[s];}))),r.push(((o,a)=>{o?i(o):a&&i(null,{stack:t,id:e,glyph:a[e]||null});}));}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:o,glyph:a}of e)(t[i]||(t[i]={}))[o]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};i(null,t);}}));}_doesCharSupportLocalGlyph(e){return !!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,o){const a=this.localIdeographFontFamily;if(!a)return;if(!this._doesCharSupportLocalGlyph(o))return;let s=e.tinySDF;if(!s){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),s=e.tinySDF=new v.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:a,fontWeight:t});}return {id:o,bitmap:new t.AlphaImage({width:30,height:30},s.draw(String.fromCharCode(o)).data),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}}v.loadGlyphRange=function(e,i,o,a,s){const r=256*i,n=r+255,l=a.transformRequest(o.replace("{fontstack}",e).replace("{range}",`${r}-${n}`),t.ResourceType.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)s(e);else if(i){const e={};for(const o of t.parseGlyphPBF(i))e[o.id]=o;s(null,e);}}));},v.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:s="normal",fontStyle:r="normal"}){this.buffer=e,this.cutoff=o,this.radius=i;const n=this.size=t+4*e,l=this._createCanvas(n),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${r} ${s} ${t}px ${a}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(n*n),this.gridInner=new Float64Array(n*n),this.f=new Float64Array(n),this.z=new Float64Array(n+1),this.v=new Uint16Array(n);}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:s}=this.ctx.measureText(t),r=Math.floor(i),n=Math.min(this.size-this.buffer,Math.ceil(s-a)),l=Math.min(this.size-this.buffer,Math.ceil(i)+Math.ceil(o)),c=n+2*this.buffer,h=l+2*this.buffer,u=c*h,d=new Uint8ClampedArray(u),_={data:d,width:c,height:h,glyphWidth:n,glyphHeight:l,glyphTop:r,glyphLeft:0,glyphAdvance:e};if(0===n||0===l)return _;const{ctx:m,buffer:p,gridInner:x,gridOuter:v}=this;m.clearRect(p,p,n,l),m.fillText(t,p,p+r+1);const y=m.getImageData(p,p,n,l);v.fill(f,0,u),x.fill(0,0,u);for(let t=0;t0?t*t:0,x[o]=t<0?t*t:0;}}g(v,0,0,c,h,c,this.f,this.v,this.z),g(x,p,p,n,l,c,this.f,this.v,this.z);for(let t=0;t1&&(r=t[++s]);const l=Math.abs(n-r.left),c=Math.abs(n-r.right),h=Math.min(l,c);let u;const d=e/i*(o+1);if(r.isDash){const t=o-Math.abs(d);u=Math.sqrt(h*h+t*t);}else u=o-Math.sqrt(h*h+d*d);this.data[a+n]=Math.max(0,Math.min(255,u+128));}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],o=t[e+1];i.zeroLength?t.splice(e,1):o&&o.isDash===i.isDash&&(o.left=i.left,t.splice(e,1));}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const o=this.width*this.nextRow;let a=0,s=t[a];for(let e=0;e1&&(s=t[++a]);const i=Math.abs(e-s.left),r=Math.abs(e-s.right),n=Math.min(i,r);this.data[o+e]=Math.max(0,Math.min(255,(s.isDash?n:-n)+128));}}addDash(e,i){const o=i?7:0,a=2*o+1;if(this.nextRow+a>this.height)return t.warnOnce("LineAtlas out of space"),null;let s=0;for(let t=0;t{t.send(e,i,o);}),o=o||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove();})),this.actors=[],this.workerPool.release(this.id);}}function I(e,i,o){const a=function(i,a){if(i)return o(i);if(a){const i=t.pick(t.extend(a,e),["tiles","minzoom","maxzoom","attribution","maplibreLogo","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(i.vectorLayers=a.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),o(null,i);}};return e.url?t.getJSON(i.transformRequest(e.url,t.ResourceType.Source),a):t.exported.frame((()=>a(null,e)))}E.Actor=t.Actor;class S{constructor(e,i,o){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=o||24;}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),o=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),a=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),s=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),r=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=o&&e.x=a&&e.y{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new S(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})));}));}loaded(){return this._loaded}onAdd(t){this.map=t,this.load();}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=t.getImage(this.map._requestManager.transformRequest(o,t.ResourceType.Tile),((o,a)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(o)e.state="errored",i(o);else if(a){this.map._refreshExpiredTiles&&e.setExpiryData(a),delete a.cacheControl,delete a.expires;const o=this.map.painter.context,s=o.gl;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new _(o,a,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),o.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,o.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,o.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),i(null);}}));}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e();}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e();}hasTransition(){return !1}}let P;var z=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class D extends t.Evented{constructor(t,e,i,o){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=e;}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),((o,a)=>{this._loaded=!0,o?this.fire(new t.ErrorEvent(o)):a&&(this.image=a,e&&(this.coordinates=e),i&&i(),this._finishLoading());}));}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null;})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})));}onAdd(t){this.map=t,this.load();}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,o=1/0,a=-1/0,s=-1/0;for(const t of e)i=Math.min(i,t.x),o=Math.min(o,t.y),a=Math.max(a,t.x),s=Math.max(s,t.y);const r=Math.max(a-i,s-o),n=Math.max(0,Math.floor(-Math.log(r)/Math.LN2)),l=Math.pow(2,n);return new t.CanonicalTileID(n,Math.floor((i+a)/2*l),Math.floor((o+s)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const o=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(o[2].x,o[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new _(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null));}serialize(){return {type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}}const A={vector:class extends t.Evented{constructor(e,i,o,a){if(super(),this.id=e,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a);}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=I(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new S(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})));}));}loaded(){return this._loaded}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load();}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load();}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(o,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function s(o,a){return delete e.request,e.aborted?i(null):o&&404!==o.status?i(o):(a&&a.resourceTiming&&(e.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&a&&e.setExpiryData(a),e.loadVectorData(a,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}a.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",a,s.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",a,s.bind(this)));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0);}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0);}hasTransition(){return !1}},raster:C,"raster-dem":class extends C{constructor(e,i,o,a){super(e,i,o,a),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox";}serialize(){return {type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function a(t,o){t&&(e.state="errored",i(t)),o&&(e.dem=o,e.needsHillshadePrepare=!0,e.state="loaded",i(null));}e.request=t.getImage(this.map._requestManager.transformRequest(o,t.ResourceType.Tile),function(o,s){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(o)e.state="errored",i(o);else if(s){this.map._refreshExpiredTiles&&e.setExpiryData(s),delete s.cacheControl,delete s.expires;const i=t.isImageBitmap(s)&&(null==P&&(P="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),P)?s:t.exported.getImageData(s,1),o={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",o,a.bind(this)));}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID);}_getNeighboringTiles(e){const i=e.canonical,o=Math.pow(2,i.z),a=(i.x-1+o)%o,s=0===i.x?e.wrap-1:e.wrap,r=(i.x+1+o)%o,n=i.x+1===o?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,r,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,r,i.y-1).key]={backfilled:!1}),i.y+1{if(this._pendingLoads--,this._removed||a&&a.abandoned)return;let s=null;if(a&&a.resourceTiming&&a.resourceTiming[this.id]&&(s=a.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:i.source},null),o)return void this.fire(new t.ErrorEvent(o));const r={dataType:"source",sourceDataType:e};this._collectResourceTiming&&s&&s.length>0&&t.extend(r,{resourceTiming:s}),this.fire(new t.Event("data",r));}));}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const o={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.request=this.actor.send(i,o,((o,a)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):o?e(o):(t.loadVectorData(a,this.map.painter,"reloadTile"===i),e(null)))));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0;}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id});}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id});}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return !1}},video:class extends D{constructor(t,e,i,o){super(t,e,i,o),this.roundZoom=!0,this.type="video",this.options=e;}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint();})),this.map&&this.video.play(),this._finishLoading());}));}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e;}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new _(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}serialize(){return {type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:D,canvas:class extends D{constructor(e,i,o,a){super(e,i,o,a),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){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 t.ErrorEvent(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 e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,o=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _(i,this.canvas,o.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}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}}};function M(e,i){const o=t.create();return t.translate(o,o,[1,1,0]),t.scale(o,o,[.5*e.width,.5*e.height,1]),t.multiply(o,o,e.calculatePosMatrix(i.toUnwrapped()))}function L(t,e,i,o,a,s){const r=function(t,e,i){if(t)for(const o of t){const t=e[o];if(t&&t.source===i&&"fill-extrusion"===t.type)return !0}else for(const t in e){const o=e[t];if(o.source===i&&"fill-extrusion"===o.type)return !0}return !1}(a&&a.layers,e,t.id),n=s.maxPitchScaleFactor(),l=t.tilesIn(o,n,r);l.sort(R);const c=[];for(const o of l)c.push({wrappedTileID:o.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(e,i,t._state,o.queryGeometry,o.cameraQueryGeometry,o.scale,a,s,n,M(t.transform,o.tileID))});const h=function(t){const e={},i={};for(const o of t){const t=o.queryResults,a=o.wrappedTileID,s=i[a]=i[a]||{};for(const i in t){const o=t[i],a=s[i]=s[i]||{},r=e[i]=e[i]||[];for(const t of o)a[t.featureIndex]||(a[t.featureIndex]=!0,r.push(t));}}return e}(c);for(const e in h)h[e].forEach((e=>{const i=e.feature,o=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o;}));return h}function R(t,e){const i=t.tileID,o=e.tileID;return i.overscaledZ-o.overscaledZ||i.canonical.y-o.canonical.y||i.wrap-o.wrap||i.canonical.x-o.canonical.x}class k{constructor(e,i){this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading";}registerFadeDuration(e){const i=e+this.timeAdded;ie.getLayer(t))).filter(Boolean);if(0!==t.length){o.layers=t,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=o;}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!o)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e));}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage);}else this.collisionBoxArray=new t.CollisionBoxArray;}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded";}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,i,o,a,s,r,n,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:a,scale:s,tileSize:this.tileSize,pixelPosMatrix:c,transform:n,params:r,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),s=i?i.sourceLayer:"",r=a._geojsonTileLayer||a[s];if(!r)return;const n=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;it)e=!1;else if(i)if(this.expirationTime{this.remove(t,a);}),i)),this.data[o].push(a),this.order.push(o),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,o=void 0===e?0:this.data[i].indexOf(e),a=this.data[i][o];return this.data[i].splice(o,1),a.timeout&&clearTimeout(a.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}filter(t){const e=[];for(const i in this.data)for(const o of this.data[i])t(o.value)||e.push(o);for(const t of e)this.remove(t.value.tileID,t);}}class F{constructor(){this.state={},this.stateChanges={},this.deletedStates={};}updateState(e,i,o){const a=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][a]=this.stateChanges[e][a]||{},t.extend(this.stateChanges[e][a],o),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==a&&(this.deletedStates[e][t]=null);}else if(this.deletedStates[e]&&null===this.deletedStates[e][a]){this.deletedStates[e][a]={};for(const t in this.state[e][a])o[t]||(this.deletedStates[e][a][t]=null);}else for(const t in o)this.deletedStates[e]&&this.deletedStates[e][a]&&null===this.deletedStates[e][a][t]&&delete this.deletedStates[e][a][t];}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const o=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][o]&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][o])for(i in this.deletedStates[t][o]={},this.stateChanges[t][o])this.deletedStates[t][o][i]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null;}getState(e,i){const o=String(i),a=t.extend({},(this.state[e]||{})[o],(this.stateChanges[e]||{})[o]);if(null===this.deletedStates[e])return {};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return {};for(const e in t)delete a[e];}return a}initializeTileState(t,e){t.setFeatureState(this.state,e);}coalesceChanges(e,i){const o={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const o in this.stateChanges[e])this.state[e][o]||(this.state[e][o]={}),t.extend(this.state[e][o],this.stateChanges[e][o]),i[o]=this.state[e][o];o[e]=i;}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t];}o[e]=o[e]||{},t.extend(o[e],i);}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(o).length)for(const t in e)e[t].setFeatureState(o,i);}}class O extends t.Evented{constructor(e,i,o){super(),this.id=e,this.dispatcher=o,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform));})),this.on("error",(()=>{this._sourceErrored=!0;})),this._source=function(e,i,o,a){const s=new A[i.type](e,i,o,a);if(s.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${s.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],s),s}(e,i,o,this),this._tiles={},this._cache=new B(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new F;}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t);}onRemove(t){this._source&&this._source.onRemove&&this._source.onRemove(t);}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform);}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager);}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(U).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const o=e.tileID,a=i.tileID,s=new t.pointGeometry(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),r=new t.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-a.overscaledZ||r.y-s.y||r.x-s.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(U).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return !!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading");}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)));}_tileLoaded(e,i,o,a){if(a)return e.state="errored",void(404!==a.status?this._source.fire(new t.ErrorEvent(a,{tile:e})):this.update(this.transform));e.timeAdded=t.exported.now(),"expired"===o&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}));}_backfillDEM(t){const e=this.getRenderableIds();for(let o=0;o1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,o),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)));}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,o){for(const a in this._tiles){let s=this._tiles[a];if(o[a]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>i)continue;let r=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(r=t);}let n=r;for(;n.overscaledZ>e;)if(n=n.scaledTo(n.overscaledZ-1),t[n.key]){o[r.key]=r;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),o=this._getLoadedTile(e);if(o)return o}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,o=Math.floor(e*i*5),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+e),t[o.tileID.key]=o;}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t]);}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((t=>this._source.hasTile(t))))):i=[];const o=e.coveringZoomLevel(this._source),a=Math.max(o-O.maxOverzooming,this._source.minzoom),s=Math.max(o+O.maxUnderzooming,this._source.minzoom),r=this._updateRetainedTiles(i,o);if(N(this._source.type)){const e={},i={},n=Object.keys(r);for(const o of n){const s=r[o],n=this._tiles[o];if(!n||n.fadeEndTime&&n.fadeEndTime<=t.exported.now())continue;const l=this.findLoadedParent(s,a);l&&(this._addTile(l.tileID),e[l.tileID.key]=l.tileID),i[o]=s;}this._retainLoadedChildren(i,o,s,r);for(const t in e)r[t]||(this._coveredTiles[t]=!0,r[t]=e[t]);}for(const t in r)this._tiles[t].clearFadeHold();const n=t.keysDifference(this._tiles,r);for(const t of n){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t);}this._updateLoadedParentTileCache();}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t);}_updateRetainedTiles(t,e){const i={},o={},a=Math.max(e-O.maxOverzooming,this._source.minzoom),s=Math.max(e+O.maxUnderzooming,this._source.minzoom),r={};for(const o of t){const t=this._addTile(o);i[o.key]=o,t.hasData()||ethis._source.maxzoom){const t=s.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else {const t=s.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let r=t.wasRequested();for(let e=s.overscaledZ-1;e>=a;--e){const a=s.scaledTo(e);if(o[a.key])break;if(o[a.key]=!0,t=this.getTile(a),!t&&r&&(t=this._addTile(a)),t&&(i[a.key]=a,r=t.wasRequested(),t.hasData()))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,o=this._tiles[t].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}e.push(o.key);const t=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;o=t;}for(const t of e)this._loadedParentTiles[t]=i;}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const o=i;return i||(i=new k(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,o||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t];}),i));}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset();}tilesIn(e,i,o){const a=[],s=this.transform;if(!s)return a;const r=o?s.getCameraQueryGeometry(e):e,n=e.map((t=>s.pointCoordinate(t))),l=r.map((t=>s.pointCoordinate(t))),c=this.getIds();let h=1/0,u=1/0,d=-1/0,_=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),d=Math.max(d,t.x),_=Math.max(_,t.y);for(let e=0;e=0&&f[1].y+p>=0){const t=n.map((t=>r.getTilePoint(t))),e=l.map((t=>r.getTilePoint(t)));a.push({tile:o,tileID:r,queryGeometry:t,cameraQueryGeometry:e,scale:m});}}return a}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return !0;if(N(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.exported.now())return !0}return !1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i);}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i);}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const o=this._tiles[t];o&&o.setDependencies(e,i);}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)));}}function U(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||o-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function N(t){return "raster"===t||"image"===t||"video"===t}O.maxOverzooming=10,O.maxUnderzooming=3;const G="mapboxgl_preloaded_worker_pool";class Z{constructor(){this.active={};}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[G]}numActive(){return Object.keys(this.active).length}}const q=Math.floor(t.exported.hardwareConcurrency/2);let V;function j(){return V||(V=new Z),V}function $(e,i){const o={};for(const t in e)"ref"!==t&&(o[t]=e[t]);return t.refProperties.forEach((t=>{t in i&&(o[t]=i[t]);})),o}function W(t){t=t.slice();const e=Object.create(null);for(let i=0;i0?(a-r)/n:0;return this.points[s].mult(1-l).add(this.points[i].mult(l))}}function ot(t,e){let i=!0;return "always"===t||"never"!==t&&"never"!==e||(i=!1),i}class at{constructor(t,e,i){const o=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||o<0||e>this.height)return [];const n=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=o){if(a)return [{key:null,x1:t,y1:e,x2:i,y2:o}];for(let t=0;t0}hitTestCircle(t,e,i,o,a){const s=t-i,r=t+i,n=e-i,l=e+i;if(r<0||s>this.width||l<0||n>this.height)return !1;const c=[];return this._forEachCell(s,n,r,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:o,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(t,e,i,o,a,s,r,n){const{seenUids:l,hitTest:c,overlapMode:h}=r,u=this.boxCells[a];if(null!==u){const a=this.bboxes;for(const r of u)if(!l.box[r]){l.box[r]=!0;const u=4*r,d=this.boxKeys[r];if(t<=a[u+2]&&e<=a[u+3]&&i>=a[u+0]&&o>=a[u+1]&&(!n||n(d))&&(!c||!ot(h,d.overlapMode))&&(s.push({key:d,x1:a[u],y1:a[u+1],x2:a[u+2],y2:a[u+3]}),c))return !0}}const d=this.circleCells[a];if(null!==d){const a=this.circles;for(const r of d)if(!l.circle[r]){l.circle[r]=!0;const u=3*r,d=this.circleKeys[r];if(this._circleAndRectCollide(a[u],a[u+1],a[u+2],t,e,i,o)&&(!n||n(d))&&(!c||!ot(h,d.overlapMode))){const t=a[u],e=a[u+1],i=a[u+2];if(s.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return !0}}}return !1}_queryCellCircle(t,e,i,o,a,s,r,n){const{circle:l,seenUids:c,overlapMode:h}=r,u=this.boxCells[a];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,o=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!n||n(o))&&!ot(h,o.overlapMode))return s.push(!0),!0}}const d=this.circleCells[a];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,o=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!n||n(o))&&!ot(h,o.overlapMode))return s.push(!0),!0}}}_forEachCell(t,e,i,o,a,s,r,n){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(o);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(a.call(this,t,e,i,o,this.xCellCount*l+d,s,r,n))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,o,a,s){const r=o-t,n=a-e,l=i+s;return l*l>r*r+n*n}_circleAndRectCollide(t,e,i,o,a,s,r){const n=(s-o)/2,l=Math.abs(t-(o+n));if(l>n+i)return !1;const c=(r-a)/2,h=Math.abs(e-(a+c));if(h>c+i)return !1;if(l<=n||h<=c)return !0;const u=l-n,d=h-c;return u*u+d*d<=i*i}}function st(e,i,o,a,s){const r=t.create();return i?(t.scale(r,r,[1/s,1/s,1]),o||t.rotateZ(r,r,a.angle)):t.multiply(r,a.labelPlaneMatrix,e),r}function rt(e,i,o,a,s){if(i){const i=t.clone(e);return t.scale(i,i,[s,s,1]),o||t.rotateZ(i,i,-a.angle),i}return a.glCoordMatrix}function nt(e,i){const o=t.fromValues(e.x,e.y,0,1);xt(o,o,i);const a=o[3];return {point:new t.pointGeometry(o[0]/a,o[1]/a),signedDistanceFromCamera:a}}function lt(t,e){return .5+t/e*.5}function ct(t,e){const i=t[0]/t[3],o=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&o>=-e[1]&&o<=e[1]}function ht(e,i,o,a,s,r,n,l){const c=a?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(c,o.transform.zoom),u=[256/o.width*2+1,256/o.height*2+1],d=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();const _=e.lineVertexArray,m=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,p=o.transform.width/o.transform.height;let f=!1;for(let a=0;aMath.abs(o.x-i.x)*a?{useVertical:!0}:(e===t.WritingMode.vertical?i.yo.x)?{needsFlipping:!0}:null}function _t(e,i,o,a,s,r,n,l,c,h,u,d,_,m){const p=i/24,f=e.lineOffsetX*p,g=e.lineOffsetY*p;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,s=e.lineStartIndex+e.lineLength,h=ut(p,l,f,g,o,u,d,e,c,r,_);if(!h)return {notEnoughRoom:!0};const v=nt(h.first.point,n).point,y=nt(h.last.point,n).point;if(a&&!o){const t=dt(e.writingMode,v,y,m);if(t)return t}x=[h.first];for(let a=e.glyphStartIndex+1;a0?r.point:mt(d,a,i,1,s),l=dt(e.writingMode,i,n,m);if(l)return l}const i=pt(p*l.getoffsetX(e.glyphStartIndex),f,g,o,u,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,r,_);if(!i)return {notEnoughRoom:!0};x=[i];}for(const e of x)t.addDynamicAttributes(h,e.point,e.angle);return {}}function mt(t,e,i,o,a){const s=nt(t.add(t.sub(e)._unit()),a).point,r=i.sub(s);return i.add(r._mult(o/r.mag()))}function pt(e,i,o,a,s,r,n,l,c,h,u,d){const _=a?e-i:e+i;let m=_>0?1:-1,p=0;a&&(m*=-1,p=Math.PI),m<0&&(p+=Math.PI);let f=m>0?l+n:l+n+1,g=s,x=s,v=0,y=0;const b=Math.abs(_),w=[];for(;v+y<=b;){if(f+=m,f=c)return null;if(x=g,w.push(g),g=d[f],void 0===g){const e=new t.pointGeometry(h.getx(f),h.gety(f)),i=nt(e,u);if(i.signedDistanceFromCamera>0)g=d[f]=i.point;else {const i=f-m;g=mt(0===v?r:new t.pointGeometry(h.getx(i),h.gety(i)),e,x,b-v+1,u);}}v+=y,y=x.dist(g);}const T=(b-v)/y,E=g.sub(x),I=E.mult(T)._add(x);I._add(E._unit()._perp()._mult(o*m));const S=p+Math.atan2(g.y-x.y,g.x-x.x);return w.push(I),{point:I,angle:S,path:w}}const ft=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function gt(t,e){for(let i=0;i=1;t--)h.push(r.path[t]);for(let t=1;tnt(t,l)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point));}let f=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t=o.x&&i.x<=a.x&&e.y>=o.y&&i.y<=a.y?[h]:i.xa.x||i.ya.y?[]:t.clipLine([h],o.x,o.y,a.x,a.y);}for(const t of f){s.reset(t,.25*i);let o=0;o=s.length<=.5*i?1:Math.ceil(s.paddedLength/p)+1;for(let t=0;t=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(t,e,i,o){return i>=0&&t=0&&et.collisionGroupID===e};}return this.collisionGroups[t]}}function Pt(e,i,o,a,s){const{horizontalAlign:r,verticalAlign:n}=t.getAnchorAlignment(e),l=-(r-.5)*i,c=-(n-.5)*o,h=t.evaluateVariableOffset(e,a);return new t.pointGeometry(l+h[0]*s,c+h[1]*s)}function zt(e,i,o,a,s,r){const{x1:n,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:d}=e,_=new t.pointGeometry(i,o);return a&&_._rotate(s?r:-r),{x1:n+_.x,y1:c+_.y,x2:l+_.x,y2:h+_.y,anchorPointX:u,anchorPointY:d}}class Dt{constructor(t,e,i,o){this.transform=t.clone(),this.collisionIndex=new yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new Ct(i),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={};}getBucketParts(e,i,o,a){const s=o.getBucket(i),r=o.latestFeatureIndex;if(!s||!r||i.id!==s.layerIds[0])return;const n=o.collisionBoxArray,l=s.layers[0].layout,c=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),h=o.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(o.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),_="map"===l.get("text-rotation-alignment"),m=bt(o,1,this.transform.zoom),p=st(u,d,_,this.transform,m);let f=null;if(d){const e=rt(u,d,_,this.transform,m);f=t.multiply([],this.transform.labelPlaneMatrix,e);}this.retainedQueryData[s.bucketInstanceId]=new St(s.bucketInstanceId,r,s.sourceLayerIndex,s.index,o.tileID);const g={bucket:s,layout:l,posMatrix:u,textLabelPlaneMatrix:p,labelToScreenMatrix:f,scale:c,textPixelRatio:h,holdingForFade:o.holdingForFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(s.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(a)for(const t of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:a,parameters:g});}else e.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:g});}attemptAnchorPlacement(t,e,i,o,a,s,r,n,l,c,h,u,d,_,m){const p=[u.textOffset0,u.textOffset1],f=Pt(t,i,o,p,a),g=this.collisionIndex.placeCollisionBox(zt(e,f.x,f.y,s,r,this.transform.angle),h,n,l,c.predicate);if((!m||0!==this.collisionIndex.placeCollisionBox(zt(m,f.x,f.y,s,r,this.transform.angle),h,n,l,c.predicate).box.length)&&g.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(e=this.prevPlacement.variableOffsets[u.crossTileID].anchor),this.variableOffsets[u.crossTileID]={textOffset:p,width:i,height:o,anchor:t,textBoxScale:a,prevAnchor:e},this.markUsedJustification(d,t,u,_),d.allowVerticalPlacement&&(this.markUsedOrientation(d,_,u),this.placedOrientations[u.crossTileID]=_),{shift:f,placedGlyphBoxes:g}}}placeLayerBucketPart(e,i,o){const{bucket:a,layout:s,posMatrix:r,textLabelPlaneMatrix:n,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:d,collisionGroup:_}=e.parameters,m=s.get("text-optional"),p=s.get("icon-optional"),f=t.getOverlapMode(s,"text-overlap","text-allow-overlap"),g="always"===f,x=t.getOverlapMode(s,"icon-overlap","icon-allow-overlap"),v="always"===x,y="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),E=g&&(v||!a.hasIconData()||p),I=v&&(g||!a.hasTextData()||m);!a.collisionArrays&&u&&a.deserializeCollisionBoxes(u);const S=(e,u)=>{if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Et(!1,!1,!1));let v=!1,T=!1,S=!0,C=null,P={box:null,offscreen:null},z={box:null,offscreen:null},D=null,A=null,M=null,L=0,R=0,k=0;u.textFeatureIndex?L=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),u.verticalTextFeatureIndex&&(R=u.verticalTextFeatureIndex);const B=u.textBox;if(B){const i=i=>{let o=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,o=t,this.markUsedOrientation(a,o,e));}return o},o=(i,o)=>{if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of a.writingModes)if(e===t.WritingMode.vertical?(P=o(),z=P):P=i(),P&&P.box&&P.box.length)break}else P=i();};if(s.get("text-variable-anchor")){let n=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];n.indexOf(t.anchor)>0&&(n=n.filter((e=>e!==t.anchor)),n.unshift(t.anchor));}const l=(t,i,o)=>{const s=t.x2-t.x1,l=t.y2-t.y1,h=e.textBoxScale,u=w&&"never"===x?i:null;let d={box:[],offscreen:!1};const m="never"!==f?2*n.length:n.length;for(let i=0;i=n.length?f:"never",e,a,o,u);if(m&&(d=m.placedGlyphBoxes,d&&d.box&&d.box.length)){v=!0,C=m.shift;break}}return d};o((()=>l(B,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&!(P&&P.box&&P.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),P&&(v=P.box,S=P.offscreen);const h=i(P&&P.box);if(!v&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(a,t.anchor,e,h));}}else {const s=(t,i)=>{const o=this.collisionIndex.placeCollisionBox(t,f,c,r,_.predicate);return o&&o.box&&o.box.length&&(this.markUsedOrientation(a,i,e),this.placedOrientations[e.crossTileID]=i),o};o((()=>s(B,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?s(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(P&&P.box&&P.box.length);}}if(D=P,v=D&&D.box&&D.box.length>0,S=D&&D.offscreen,e.useRuntimeCollisionCircles){const i=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(a.textSizeData,d,i),h=s.get("text-padding");A=this.collisionIndex.placeCollisionCircles(f,i,a.lineVertexArray,a.glyphOffsetArray,c,r,n,l,o,b,_.predicate,e.collisionCircleDiameter,h),v=g||A.circles.length>0&&!A.collisionDetected,S=S&&A.offscreen;}if(u.iconFeatureIndex&&(k=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&C?zt(t,C.x,C.y,y,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,x,c,r,_.predicate)};z&&z.box&&z.box.length&&u.verticalIconBox?(M=t(u.verticalIconBox),T=M.box.length>0):(M=t(u.iconBox),T=M.box.length>0),S=S&&M.offscreen;}const F=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,O=p||0===e.numIconVertices;if(F||O?O?F||(T=T&&v):v=T&&v:T=v=T&&v,v&&D&&D.box&&this.collisionIndex.insertCollisionBox(D.box,f,s.get("text-ignore-placement"),a.bucketInstanceId,z&&z.box&&R?R:L,_.ID),T&&M&&this.collisionIndex.insertCollisionBox(M.box,x,s.get("icon-ignore-placement"),a.bucketInstanceId,k,_.ID),A&&(v&&this.collisionIndex.insertCollisionCircles(A.circles,f,s.get("text-ignore-placement"),a.bucketInstanceId,L,_.ID),o)){const t=a.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new It);for(let t=0;t=0;--e){const i=t[e];S(a.symbolInstances.get(i),a.collisionArrays[i]);}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=s>=0&&t!==s?0:o.crossTileID);}markUsedOrientation(e,i,o){const a=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,s=i===t.WritingMode.vertical?i:0,r=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const t of r)e.text.placedSymbolArray.get(t).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=s);}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const o=e?e.symbolFadeChange(t):1,a=e?e.opacities:{},s=e?e.variableOffsets:{},r=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],s=a[t];s?(this.opacities[t]=new Tt(s,o,e.text,e.icon),i=i||e.text!==s.text.placed||e.icon!==s.icon.placed):(this.opacities[t]=new Tt(null,o,e.text,e.icon,e.skipFade),i=i||e.text||e.icon);}for(const t in a){const e=a[t];if(!this.opacities[t]){const a=new Tt(e,o,!1,!1);a.isHidden()||(this.opacities[t]=a,i=i||e.text.placed||e.icon.placed);}}for(const t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(const t in r)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=r[t]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t);}updateLayerOpacities(t,e){const i={};for(const o of e){const e=o.getBucket(t);e&&o.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,o.collisionBoxArray);}}updateBucketOpacities(e,i,o){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const a=e.layers[0].layout,s=new Tt(null,0,!1,!1,!0),r=a.get("text-allow-overlap"),n=a.get("icon-allow-overlap"),l=a.get("text-variable-anchor"),c="map"===a.get("text-rotation-alignment"),h="map"===a.get("text-pitch-alignment"),u="none"!==a.get("icon-text-fit"),d=new Tt(null,0,r&&(n||!e.hasIconData()||a.get("icon-optional")),n&&(r||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const _=(t,e,i)=>{for(let o=0;o0,g=this.placedOrientations[a.crossTileID],x=g===t.WritingMode.vertical,v=g===t.WritingMode.horizontal||g===t.WritingMode.horizontalOnly;if(r>0||n>0){const t=Ut(p.text);_(e.text,r,x?Nt:t),_(e.text,n,v?Nt:t);const i=p.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||x?1:0);})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const o=this.variableOffsets[a.crossTileID];o&&this.markUsedJustification(e,o.anchor,a,g);const s=this.placedOrientations[a.crossTileID];s&&(this.markUsedJustification(e,"left",a,s),this.markUsedOrientation(e,s,a));}if(f){const t=Ut(p.icon),i=!(u&&a.verticalPlacedIconSymbolIndex&&x);a.placedIconSymbolIndex>=0&&(_(e.icon,a.numIconVertices,i?t:Nt),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=p.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(_(e.icon,a.numVerticalIconVertices,i?Nt:t),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=p.icon.isHidden());}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[o];if(i){let o=new t.pointGeometry(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[m];e?(o=Pt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&o._rotate(h?this.transform.angle:-this.transform.angle)):t=!1;}i.textBox&&At(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||x,o.x,o.y),i.verticalTextBox&&At(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||v,o.x,o.y);}const a=Boolean(!v&&i.verticalIconBox);i.iconBox&&At(e.iconCollisionBox.collisionVertexArray,p.icon.placed,a,u?o.x:0,u?o.y:0),i.verticalIconBox&&At(e.iconCollisionBox.collisionVertexArray,p.icon.placed,!a,u?o.x:0,u?o.y:0);}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId];}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0;}}function At(t,e,i,o,a){t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0);}const Mt=Math.pow(2,25),Lt=Math.pow(2,24),Rt=Math.pow(2,17),kt=Math.pow(2,16),Bt=Math.pow(2,9),Ft=Math.pow(2,8),Ot=Math.pow(2,1);function Ut(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Mt+e*Lt+i*Rt+e*kt+i*Bt+e*Ft+i*Ot+e}const Nt=0;class Gt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];}continuePlacement(t,e,i,o,a){const s=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex{const e=t.exported.now()-a;return !this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=a)&&(!t.maxzoom||t.maxzoom>a)){if(this._inProgressLayer||(this._inProgressLayer=new Gt(t)),this._inProgressLayer.continuePlacement(o[t.source],this.placement,this._showCollisionBoxes,t,s))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(t){return this.placement.commit(t),this.placement}}const qt=512/t.EXTENT/2;class Vt{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;it.overscaledZ)for(const i in a){const s=a[i];s.tileID.isChildOf(t)&&s.findMatches(e.symbolInstances,t,o);}else {const s=a[t.scaledTo(Number(i)).key];s&&s.findMatches(e.symbolInstances,t,o);}}for(let t=0;t{e[t]=!0;}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t];}}const Xt=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),Ht=t.pick(X,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Kt=t.pick(X,["setCenter","setZoom","setBearing","setPitch"]),Yt=function(){const e={},i=t.spec.$version;for(const o in t.spec.$root){const a=t.spec.$root[o];if(a.required){let t=null;t="version"===o?i:"array"===a.type?[]:{},null!=t&&(e[o]=t);}}return e}();class Jt extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new E(j(),this),this.imageManager=new p,this.imageManager.setEventedParent(this),this.glyphManager=new v(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new T(256,512),this.crossTileSymbolIndex=new Wt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const o=this;this._rtlTextPluginCallback=Jt.registerForPluginStateChange((e=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in o.sourceCaches)o.sourceCaches[t].reload();}));})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e);}}));}loadURL(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const o="boolean"!=typeof i.validate||i.validate,a=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(a,((e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,o);}));}loadJSON(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,this._load(e,!1!==i.validate);}));}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Yt,!1);}_load(e,i){if(i&&Xt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);const o=W(this.stylesheet.layers);this._order=o.map((t=>t.id)),this._layers={},this._serializedLayers={};for(let e of o)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"));}_loadSprite(e){this._spriteRequest=function(e,i,o,a){let s,r,n;const l=o>1?"@2x":"";let c=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),((t,e)=>{c=null,n||(n=t,s=e,u());})),h=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),((t,e)=>{h=null,n||(n=t,r=e,u());}));function u(){if(n)a(n);else if(s&&r){const e=t.exported.getImageData(r),i={};for(const o in s){const{width:a,height:r,x:n,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:_}=s[o],m=new t.RGBAImage({width:a,height:r});t.RGBAImage.copy(e,m,{x:n,y:l},{x:0,y:0},{width:a,height:r}),i[o]={data:m,pixelRatio:h,sdf:c,stretchX:u,stretchY:d,content:_};}a(null,i);}}return {cancel(){c&&(c.cancel(),c=null),h&&(h.cancel(),h=null);}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));}));}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const o=e.sourceLayer;if(!o)return;const a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(o))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${o}" does not exist on source "${a.id}" as specified by style layer "${e.id}".`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize());}return e}hasTransitions(){if(this.light&&this.light.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(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];"reload"===e?this._reloadSource(t):"clear"===e&&this._clearSource(t);}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates();}const o={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];o[t]=e.used,e.used=!1;}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0);}for(const e in o){const i=this.sourceCaches[e];o[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}));}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}));}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={};}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e});}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={};}setState(e){if(this._checkLoaded(),Xt(this,t.validateStyle(e)))return !1;(e=t.clone$1(e)).layers=W(e.layers);const i=function(t,e){if(!t)return [{command:X.setStyle,args:[e]}];let i=[];try{if(!a(t.version,e.version))return [{command:X.setStyle,args:[e]}];a(t.center,e.center)||i.push({command:X.setCenter,args:[e.center]}),a(t.zoom,e.zoom)||i.push({command:X.setZoom,args:[e.zoom]}),a(t.bearing,e.bearing)||i.push({command:X.setBearing,args:[e.bearing]}),a(t.pitch,e.pitch)||i.push({command:X.setPitch,args:[e.pitch]}),a(t.sprite,e.sprite)||i.push({command:X.setSprite,args:[e.sprite]}),a(t.glyphs,e.glyphs)||i.push({command:X.setGlyphs,args:[e.glyphs]}),a(t.transition,e.transition)||i.push({command:X.setTransition,args:[e.transition]}),a(t.light,e.light)||i.push({command:X.setLight,args:[e.light]});const o={},s=[];!function(t,e,i,o){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(Object.prototype.hasOwnProperty.call(e,s)||K(s,i,o));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&(Object.prototype.hasOwnProperty.call(t,s)?a(t[s],e[s])||("geojson"===t[s].type&&"geojson"===e[s].type&&J(t,e,s)?i.push({command:X.setGeoJSONSourceData,args:[s,e[s].data]}):Y(s,e,i,o)):H(s,e,i));}(t.sources,e.sources,s,o);const r=[];t.layers&&t.layers.forEach((t=>{o[t.source]?i.push({command:X.removeLayer,args:[t.id]}):r.push(t);})),i=i.concat(s),function(t,e,i){e=e||[];const o=(t=t||[]).map(tt),s=e.map(tt),r=t.reduce(et,{}),n=e.reduce(et,{}),l=o.slice(),c=Object.create(null);let h,u,d,_,m,p,f;for(h=0,u=0;h!(t.command in Kt)));if(0===i.length)return !1;const o=i.filter((t=>!(t.command in Ht)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(", ")}.`);return i.forEach((t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args);})),this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e);}updateImage(t,e){this.imageManager.updateImage(t,e);}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e);}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,o={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,o))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const a=this.sourceCaches[e]=new O(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,(()=>({isSourceLoaded:this.loaded(),source:a.serialize(),sourceId:e}))),a.onAdd(this.map),this._changed=!0;}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.clearTiles(),i.onRemove&&i.onRemove(this.map),this._changed=!0;}setGeoJSONSourceData(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0;}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,o={}){this._checkLoaded();const a=e.id;if(this.getLayer(a))return void this.fire(new t.ErrorEvent(new Error(`Layer "${a}" already exists on this map.`)));let s;if("custom"===e.type){if(Xt(this,t.validateCustomStyleLayer(e)))return;s=t.createStyleLayer(e);}else {if("object"==typeof e.source&&(this.addSource(a,e.source),e=t.clone$1(e),e=t.extend(e,{source:a})),this._validate(t.validateStyle.layer,`layers.${a}`,e,{arrayIndex:-1},o))return;s=t.createStyleLayer(e),this._validateLayer(s),s.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[s.id]=s.serialize();}const r=i?this._order.indexOf(i):this._order.length;if(i&&-1===r)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${a}" before non-existing layer "${i}".`)));else {if(this._order.splice(r,0,a),this._layerOrderChanged=!0,this._layers[a]=s,this._removedLayers[a]&&s.source&&"custom"!==s.type){const t=this._removedLayers[a];delete this._removedLayers[a],t.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause());}this._updateLayer(s),s.onAdd&&s.onAdd(this.map);}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const o=this._order.indexOf(e);this._order.splice(o,1);const a=i?this._order.indexOf(i):this._order.length;i&&-1===a?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(a,0,e),this._layerOrderChanged=!0);}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map);}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,o){this._checkLoaded();const a=this.getLayer(e);a?a.minzoom===i&&a.maxzoom===o||(null!=i&&(a.minzoom=i),null!=o&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)));}setFilter(e,i,o={}){this._checkLoaded();const s=this.getLayer(e);if(s){if(!a(s.filter,i))return null==i?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(t.validateStyle.filter,`layers.${s.id}.filter`,i,null,o)||(s.filter=t.clone$1(i),this._updateLayer(s)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)));}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,o,s={}){this._checkLoaded();const r=this.getLayer(e);r?a(r.getLayoutProperty(i),o)||(r.setLayoutProperty(i,o,s),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)));}getLayoutProperty(e,i){const o=this.getLayer(e);if(o)return o.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)));}setPaintProperty(e,i,o,s={}){this._checkLoaded();const r=this.getLayer(e);r?a(r.getPaintProperty(i),o)||(r.setPaintProperty(i,o,s)&&this._updateLayer(r),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)));}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const o=e.source,a=e.sourceLayer,s=this.sourceCaches[o];if(void 0===s)return void this.fire(new t.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)));const r=s.getSource().type;"geojson"===r&&a?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==r||a?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),s.setFeatureState(a,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}removeFeatureState(e,i){this._checkLoaded();const o=e.source,a=this.sourceCaches[o];if(void 0===a)return void this.fire(new t.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)));const s=a.getSource().type,r="vector"===s?e.sourceLayer:void 0;"vector"!==s||r?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(r,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}getFeatureState(e){this._checkLoaded();const i=e.source,o=e.sourceLayer,a=this.sourceCaches[i];if(void 0!==a)return "vector"!==a.getSource().type||o?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(t=>t.serialize())),layers:this._serializeLayers(this._order)},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0;}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},o=[];for(let a=this._order.length-1;a>=0;a--){const s=this._order[a];if(e(s)){i[s]=a;for(const e of t){const t=e[s];if(t)for(const e of t)o.push(e);}}}o.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const a=[];for(let s=this._order.length-1;s>=0;s--){const r=this._order[s];if(e(r))for(let t=o.length-1;t>=0;t--){const e=o[t].feature;if(i[e.layer.id]{const o=i.featureSortOrder;if(o){const i=o.indexOf(t.featureIndex);return o.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of a)e.push(t);}}for(const e in n)n[e].forEach((o=>{const a=o.feature,s=i[t[e].source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=s;}));return n}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const o=this.sourceCaches[e];return o?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),o=[],a={};for(let t=0;tt.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)));}const o=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);r=r||o;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===o)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Zt(e,this._order,s,i,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),n=!0),r&&this.pauseablePlacement.placement.setStale()),n||r)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source]);}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles();}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const o=this.sourceCaches[e.source];o&&o.setDependencies(e.tileID.key,e.type,e.icons);}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);}getResource(e,i,o){return t.makeRequest(i,o)}}Jt.getSourceType=function(t){return A[t]},Jt.setSourceType=function(t,e){A[t]=e;},Jt.registerForPluginStateChange=t.registerForPluginStateChange;var Qt=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),te={prelude:ee("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),background:ee("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ee("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:ee("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);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,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,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:ee("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:ee("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:ee("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","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:ee("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_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ee("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:ee("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,0,1);}"),fill:ee("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ee("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ee("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:ee("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ee("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);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:ee("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ee("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:ee("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:ee("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;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;v_width2=vec2(outset,inset);}"),lineGradient:ee("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;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;v_width2=vec2(outset,inset);}"),linePattern:ee("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;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;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ee("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;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;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:ee("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:ee("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),symbolSDF:ee("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ee("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,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);}")};function ee(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/attribute ([\w]+) ([\w]+)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=s?s.concat(a):a,n={};return {fragmentSource:t=t.replace(i,((t,e,i,o,a)=>(n[a]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = u_${a};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,o,a)=>{const s="float"===o?"vec2":"vec4",r=a.match(/color/)?"color":s;return n[a]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${s} a_${a};\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:"vec4"===r?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${r}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${s} a_${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:"vec4"===r?`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = unpack_mix_${r}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`})),staticAttributes:o,staticUniforms:r}}class ie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;}bind(t,e,i,o,a,s,r,n){this.context=t;let l=this.boundPaintVertexBuffers.length!==o.length;for(let t=0;!l&&t>16,n>>16],u_pixel_coord_lower:[65535&r,65535&n]}}const re=(e,i,o,a)=>{const s=i.style.light,r=s.properties.get("position"),n=c(r.x,r.y,r.z),l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=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}();"viewport"===s.properties.get("anchor")&&function(t,e){var i=Math.sin(e),o=Math.cos(e);t[0]=o,t[1]=i,t[2]=0,t[3]=-i,t[4]=o,t[5]=0,t[6]=0,t[7]=0,t[8]=1;}(l,-i.transform.angle),function(t,e,i){var o=e[0],a=e[1],s=e[2];t[0]=o*i[0]+a*i[3]+s*i[6],t[1]=o*i[1]+a*i[4]+s*i[7],t[2]=o*i[2]+a*i[5]+s*i[8];}(n,n,l);const h=s.properties.get("color");return {u_matrix:e,u_lightpos:n,u_lightintensity:s.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+o,u_opacity:a}},ne=(e,i,o,a,s,r,n)=>t.extend(re(e,i,o,a),se(r,i,n),{u_height_factor:-Math.pow(2,s.overscaledZ)/n.tileSize/8}),le=t=>({u_matrix:t}),ce=(e,i,o,a)=>t.extend(le(e),se(o,i,a)),he=(t,e)=>({u_matrix:t,u_world:e}),ue=(e,i,o,a,s)=>t.extend(ce(e,i,o,a),{u_world:s}),de=(t,e,i,o)=>{const a=t.transform;let s,r;if("map"===o.paint.get("circle-pitch-alignment")){const t=bt(i,1,a.zoom);s=!0,r=[t,t];}else s=!1,r=a.pixelsToGLUnits;return {u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===o.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:r}},_e=(t,e,i)=>{const o=bt(i,1,e.zoom),a=Math.pow(2,e.zoom-i.tileID.overscaledZ),s=i.tileID.overscaleFactor();return {u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:o,u_extrude_scale:[e.pixelsToGLUnits[0]/(o*a),e.pixelsToGLUnits[1]/(o*a)],u_overscale_factor:s}},me=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),pe=t=>({u_matrix:t}),fe=(t,e,i,o)=>({u_matrix:t,u_extrude_scale:bt(e,1,i),u_intensity:o});function ge(e,i){const o=Math.pow(2,i.canonical.z),a=i.canonical.y;return [new t.MercatorCoordinate(0,a/o).toLngLat().lat,new t.MercatorCoordinate(0,(a+1)/o).toLngLat().lat]}const xe=(t,e,i)=>{const o=t.transform;return {u_matrix:Te(t,e,i),u_ratio:1/bt(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},ve=(e,i,o,a)=>t.extend(xe(e,i,o),{u_image:0,u_image_height:a}),ye=(t,e,i,o)=>{const a=t.transform,s=we(e,a);return {u_matrix:Te(t,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:1/bt(e,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},be=(e,i,o,a,s)=>{const r=e.lineAtlas,n=we(i,e.transform),l="round"===o.layout.get("line-cap"),c=r.getDash(a.from,l),h=r.getDash(a.to,l),u=c.width*s.fromScale,d=h.width*s.toScale;return t.extend(xe(e,i,o),{u_patternscale_a:[n/u,-c.height/2],u_patternscale_b:[n/d,-h.height/2],u_sdfgamma:r.width/(256*Math.min(u,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:h.y,u_mix:s.t})};function we(t,e){return 1/bt(t,1,e.tileZoom)}function Te(t,e,i){return t.translatePosMatrix(e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ee=(t,e,i,o,a)=>{return {u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(r=a.paint.get("raster-saturation"),r>0?1-1/(1.001-r):-r),u_contrast_factor:(s=a.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:Ie(a.paint.get("raster-hue-rotate"))};var s,r;};function Ie(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Se=(t,e,i,o,a,s,r,n,l,c)=>{const h=a.transform;return {u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:r,u_coord_matrix:n,u_is_text:+l,u_pitch_with_map:+o,u_texsize:c,u_texture:0}},Ce=(e,i,o,a,s,r,n,l,c,h,u)=>{const d=s.transform;return t.extend(Se(e,i,o,a,s,r,n,l,c,h),{u_gamma_scale:a?Math.cos(d._pitch)*d.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:+u})},Pe=(e,i,o,a,s,r,n,l,c,h)=>t.extend(Ce(e,i,o,a,s,r,n,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),ze=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),De=(e,i,o,a,s,r)=>t.extend(function(t,e,i,o){const a=i.imageManager.getPattern(t.from.toString()),s=i.imageManager.getPattern(t.to.toString()),{width:r,height:n}=i.imageManager.getPixelSize(),l=Math.pow(2,o.tileID.overscaledZ),c=o.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(o.tileID.canonical.x+o.tileID.wrap*l),u=c*o.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[r,n],u_mix:e.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/bt(o,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(a,r,o,s),{u_matrix:e,u_opacity:i}),Ae={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)})};class Me{constructor(t,e,i){this.context=t;const o=t.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindElementBuffer.set(this.buffer);}updateData(t){const e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}const Le={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Re{constructor(t,e,i,o){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=o,this.context=t;const a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindVertexBuffer.set(this.buffer);}updateData(t){const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);}enableAttributes(t,e){for(let i=0;i0){const i=t.create(),o=x;t.mul(i,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,g.placementViewportMatrix),u.push({circleArray:y,circleOffset:_,transform:o,invTransform:i}),d+=y.length/4,_=d;}v&&h.draw(l,c.LINES,vi.disabled,bi.disabled,e.colorModeForRenderPass(),wi.disabled,_e(x,e.transform,f),o.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer);}if(!n||!u.length)return;const m=e.useProgram("collisionCircle"),p=new t.CollisionCircleLayoutArray;p.resize(4*d),p._trim();let f=0;for(const t of u)for(let e=0;e=0&&(p[f.associatedIconIndex]={shiftedAnchor:I,angle:S});}else gt(f.numGlyphs,_);}if(u){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;et.sortKey-e.sortKey));for(const t of E){const i=t.state;if(_.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(_.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,Di(i.buffers,t.segments,o,e,i.program,w,u,d,a)),a.u_is_halo=0;}Di(i.buffers,t.segments,o,e,i.program,w,u,d,i.uniformValues);}}function Di(t,e,i,o,a,s,r,n,l){const c=o.context;a.draw(c,c.gl.TRIANGLES,s,r,n,wi.disabled,l,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,o.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer);}function Ai(t,e,i,o,a,s,r){const n=t.context.gl,l=i.paint.get("fill-pattern"),c=l&&l.constantOr(1),h=i.getCrossfadeParameters();let u,d,_,m,p;r?(d=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=n.LINES):(d=c?"fillPattern":"fill",u=n.TRIANGLES);for(const f of o){const o=e.getTile(f);if(c&&!o.patternsLoaded())continue;const g=o.getBucket(i);if(!g)continue;const x=g.programConfigurations.get(i.id),v=t.useProgram(d,x);c&&(t.context.activeTexture.set(n.TEXTURE0),o.imageAtlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE),x.updatePaintBuffers(h));const y=l.constantOr(null);if(y&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[y.to.toString()],i=t.patternPositions[y.from.toString()];e&&i&&x.setConstantPatternPositions(e,i);}const b=t.translatePosMatrix(f.posMatrix,o,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(r){m=g.indexBuffer2,p=g.segments2;const e=[n.drawingBufferWidth,n.drawingBufferHeight];_="fillOutlinePattern"===d&&c?ue(b,t,h,o,e):he(b,e);}else m=g.indexBuffer,p=g.segments,_=c?ce(b,t,h,o):le(b);v.draw(t.context,u,a,t.stencilModeForClipping(f),s,wi.disabled,_,i.id,g.layoutVertexBuffer,m,p,i.paint,t.transform.zoom,x);}}function Mi(t,e,i,o,a,s,r){const n=t.context,l=n.gl,c=i.paint.get("fill-extrusion-pattern"),h=c.constantOr(1),u=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity");for(const _ of o){const o=e.getTile(_),m=o.getBucket(i);if(!m)continue;const p=m.programConfigurations.get(i.id),f=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",p);h&&(t.context.activeTexture.set(l.TEXTURE0),o.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),p.updatePaintBuffers(u));const g=c.constantOr(null);if(g&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[g.to.toString()],i=t.patternPositions[g.from.toString()];e&&i&&p.setConstantPatternPositions(e,i);}const x=t.translatePosMatrix(_.posMatrix,o,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),v=i.paint.get("fill-extrusion-vertical-gradient"),y=h?ne(x,t,v,d,_,u,o):re(x,t,v,d);f.draw(n,n.gl.TRIANGLES,a,s,r,wi.backCCW,y,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,t.transform.zoom,p);}}function Li(t,e,i,o,a,s){const r=t.context,n=r.gl,l=e.fbo;if(!l)return;const c=t.useProgram("hillshade");r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.colorAttachment.get());const h=((t,e,i)=>{const o=i.paint.get("hillshade-shadow-color"),a=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let r=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(r-=t.transform.angle);const n=!t.options.moving;return {u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),n),u_image:0,u_latrange:ge(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),r],u_shadow:o,u_highlight:a,u_accent:s}})(t,e,i);c.draw(r,n.TRIANGLES,o,a,s,wi.disabled,h,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}function Ri(e,i,o,a,s,r){const n=e.context,l=n.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,d=c.getPixels();if(n.activeTexture.set(l.TEXTURE1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE);}else i.demTexture=new _(n,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);n.activeTexture.set(l.TEXTURE0);let m=i.fbo;if(!m){const t=new _(n,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),m=i.fbo=n.createFramebuffer(h,h,!0),m.colorAttachment.set(t.texture);}n.bindFramebuffer.set(m.framebuffer),n.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(n,l.TRIANGLES,a,s,r,wi.disabled,((e,i)=>{const o=i.stride,a=t.create();return t.ortho(a,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(a,a,[0,-t.EXTENT,0]),{u_matrix:a,u_image:1,u_dimension:[o,o],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),o.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1;}}function ki(e,i,o,a,s){const r=a.paint.get("raster-fade-duration");if(r>0){const a=t.exported.now(),n=(a-e.timeAdded)/r,l=i?(a-i.timeAdded)/r:-1,c=o.getSource(),h=s.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=u&&e.refreshedUponExpiration?1:t.clamp(u?n:1-l,0,1);return e.refreshedUponExpiration&&n>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return {opacity:1,mix:0}}const Bi=new t.Color(1,0,0,1),Fi=new t.Color(0,1,0,1),Oi=new t.Color(0,0,1,1),Ui=new t.Color(1,0,1,1),Ni=new t.Color(0,1,1,1);function Gi(t,e,i,o){qi(t,0,e+i/2,t.transform.width,i,o);}function Zi(t,e,i,o){qi(t,e-i/2,0,i,t.transform.height,o);}function qi(t,e,i,o,a,s){const r=t.context,n=r.gl;n.enable(n.SCISSOR_TEST),n.scissor(e*t.pixelRatio,i*t.pixelRatio,o*t.pixelRatio,a*t.pixelRatio),r.clear({color:s}),n.disable(n.SCISSOR_TEST);}function Vi(e,i,o){const a=e.context,s=a.gl,r=o.posMatrix,n=e.useProgram("debug"),l=vi.disabled,c=bi.disabled,h=e.colorModeForRenderPass(),u="$debug";a.activeTexture.set(s.TEXTURE0),e.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),n.draw(a,s.LINE_STRIP,l,c,h,wi.disabled,me(r,t.Color.red),u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);const d=i.getTileByID(o.key).latestRawTileData,_=Math.floor((d&&d.byteLength||0)/1024),m=i.getTile(o).tileSize,p=512/Math.min(m,512)*(o.overscaledZ/e.transform.zoom)*.5;let f=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(f+=` => ${o.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,o=t.context.gl,a=t.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(e,5,5),a.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);}(e,`${f} ${_}kb`),n.draw(a,s.TRIANGLES,l,c,gi.alphaBlended,wi.disabled,me(r,t.Color.transparent,p),u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments);}const ji={symbol:function(e,i,o,a,s){if("translucent"!==e.renderPass)return;const r=bi.disabled,n=e.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(e,i,o,a,s,r,n){const l=i.transform,c="map"===s,h="map"===r;for(const s of e){const e=a.getTile(s),r=e.getBucket(o);if(!r||!r.text||!r.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(r.textSizeData,l.zoom),d=bt(e,1,i.transform.zoom),_=st(s.posMatrix,h,c,i.transform,d),m="none"!==o.layout.get("icon-text-fit")&&r.hasIconData();if(u){const i=Math.pow(2,l.zoom-e.tileID.overscaledZ);Ci(r,c,h,n,t.symbolSize,l,_,s.posMatrix,i,u,m);}}}(a,e,o,i,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),s),0!==o.paint.get("icon-opacity").constantOr(1)&&zi(e,i,o,a,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),r,n),0!==o.paint.get("text-opacity").constantOr(1)&&zi(e,i,o,a,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),r,n),i.map.showCollisionBoxes&&(Ei(e,i,o,a,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Ei(e,i,o,a,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1));},circle:function(e,i,o,a){if("translucent"!==e.renderPass)return;const s=o.paint.get("circle-opacity"),r=o.paint.get("circle-stroke-width"),n=o.paint.get("circle-stroke-opacity"),l=!o.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===r.constantOr(1)||0===n.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,vi.ReadOnly),d=bi.disabled,_=e.colorModeForRenderPass(),m=[];for(let s=0;st.sortKey-e.sortKey));for(const t of m){const{programConfiguration:i,program:a,layoutVertexBuffer:s,indexBuffer:r,uniformValues:n}=t.state;a.draw(c,h.TRIANGLES,u,d,_,wi.disabled,n,o.id,s,r,t.segments,o.paint,e.transform.zoom,i);}},heatmap:function(e,i,o,a){if(0!==o.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const s=e.context,r=s.gl,n=bi.disabled,l=new gi([r.ONE,r.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const o=t.gl;t.activeTexture.set(o.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let a=i.heatmapFbo;if(a)o.bindTexture(o.TEXTURE_2D,a.colorAttachment.get()),t.bindFramebuffer.set(a.framebuffer);else {const s=o.createTexture();o.bindTexture(o.TEXTURE_2D,s),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),a=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,o){const a=t.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e.width/4,e.height/4,0,a.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),o.colorAttachment.set(i);}(t,e,s,a);}}(s,e,o),s.clear({color:t.Color.transparent});for(let t=0;t{const s=t.create();t.ortho(s,0,e.width,e.height,0,0,1);const r=e.context.gl;return {u_matrix:s,u_world:[r.drawingBufferWidth,r.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom);}(e,o));},line:function(e,i,o,a){if("translucent"!==e.renderPass)return;const s=o.paint.get("line-opacity"),r=o.paint.get("line-width");if(0===s.constantOr(1)||0===r.constantOr(1))return;const n=e.depthModeForSublayer(0,vi.ReadOnly),l=e.colorModeForRenderPass(),c=o.paint.get("line-dasharray"),h=o.paint.get("line-pattern"),u=h.constantOr(1),d=o.paint.get("line-gradient"),m=o.getCrossfadeParameters(),p=u?"linePattern":c?"lineSDF":d?"lineGradient":"line",f=e.context,g=f.gl;let x=!0;for(const s of a){const a=i.getTile(s);if(u&&!a.patternsLoaded())continue;const r=a.getBucket(o);if(!r)continue;const v=r.programConfigurations.get(o.id),y=e.context.program.get(),b=e.useProgram(p,v),w=x||b.program!==y,T=h.constantOr(null);if(T&&a.imageAtlas){const t=a.imageAtlas,e=t.patternPositions[T.to.toString()],i=t.patternPositions[T.from.toString()];e&&i&&v.setConstantPatternPositions(e,i);}const E=u?ye(e,a,o,m):c?be(e,a,o,c,m):d?ve(e,a,o,r.lineClipsArray.length):xe(e,a,o);if(u)f.activeTexture.set(g.TEXTURE0),a.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),v.updatePaintBuffers(m);else if(c&&(w||e.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(f);else if(d){const a=r.gradients[o.id];let n=a.texture;if(o.gradientVersion!==a.version){let l=256;if(o.stepInterpolant){const o=i.getSource().maxzoom,a=s.canonical.z===o?Math.ceil(1<256&&this.clearStencil(),i.setColorMode(gi.disabled),i.setDepthMode(vi.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++;a.draw(i,o.TRIANGLES,vi.disabled,new bi({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),gi.disabled,wi.disabled,pe(t.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new bi({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new bi({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),o=i[i.length-1].overscaledZ,a=i[0].overscaledZ-o+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const t={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=a[t.source],i=s[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i);}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer{i.source&&!i.isHidden(this.transform.zoom)&&(i.source!==(e&&e.id)&&(e=this.style.sourceCaches[i.source]),(!t||t.getSource().maxzoom0?e.pop():null}isPatternMissing(t){if(!t)return !1;if(!t.from||!t.to)return !0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i}useProgram(t,e){this.cache=this.cache||{};const i=`${t}${e?e.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[i]||(this.cache[i]=new ae(this.context,t,te[t],e,Ae[t],this._showOverdrawInspector)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new _(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy();}}class Wi{constructor(t,e){this.points=t,this.planes=e;}static fromInvProjectionMatrix(e,i,o){const a=Math.pow(2,o),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((i=>t.transformMat4([],i,e))).map((e=>t.scale$1([],e,1/e[3]/i*a))),r=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],o=e[1],a=e[2],s=i*i+o*o+a*a;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}([],function(t,e,i){var o=e[0],a=e[1],s=e[2],r=i[0],n=i[1],l=i[2];return t[0]=a*l-s*n,t[1]=s*r-o*l,t[2]=o*n-a*r,t}([],u([],s[t[0]],s[t[1]]),u([],s[t[2]],s[t[1]]))),i=-((o=e)[0]*(a=s[t[1]])[0]+o[1]*a[1]+o[2]*a[2]);var o,a;return e.concat(i)}));return new Wi(s,r)}}class Xi{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max));}quadrant(t){const e=[t%2==0,t<2],i=l(this.min),o=l(this.max);for(let t=0;t=0&&r++;if(0===r)return 0;r!==i.length&&(o=!1);}if(o)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,o=-Number.MAX_VALUE;for(let a=0;athis.max[t]-this.min[t])return 0}return 1}}class Hi{constructor(t=0,e=0,i=0,o=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=o;}interpolate(e,i,o){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,o)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,o)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,o)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,o)),this}getCenter(e,i){const o=t.clamp((this.left+e-this.right)/2,0,e),a=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Hi(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ki{constructor(e,i,o,a,s){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===s||!!s,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==o?0:o,this._maxPitch=null==a?60:a,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Hi,this._posMatrixCache={},this._alignedPosMatrixCache={};}clone(){const t=new Ki(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}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){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return -this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var o=e[0],a=e[1],s=e[2],r=e[3],n=Math.sin(i),l=Math.cos(i);t[0]=o*l+s*n,t[1]=a*l+r*n,t[2]=o*-n+s*l,t[3]=a*-n+r*l;}(this.rotationMatrix,this.rotationMatrix,this.angle));}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,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 e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,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 padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const o=this.pointCoordinate(new t.pointGeometry(0,0)),a=this.pointCoordinate(new t.pointGeometry(this.width,0)),s=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),r=this.pointCoordinate(new t.pointGeometry(0,this.height)),n=Math.floor(Math.min(o.x,a.x,s.x,r.x)),l=Math.floor(Math.max(o.x,a.x,s.x,r.x)),c=1;for(let o=n-c;o<=l+c;o++)0!==o&&i.push(new t.UnwrappedTileID(o,e));}return i}coveringTiles(e){let i=this.coveringZoomLevel(e);const o=i;if(void 0!==e.minzoom&&ie.maxzoom&&(i=e.maxzoom);const a=t.MercatorCoordinate.fromLngLat(this.center),s=Math.pow(2,i),r=[s*a.x,s*a.y,0],n=Wi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i);let l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=i);const c=t=>({aabb:new Xi([t*s,0,0],[(t+1)*s,s,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),h=[],u=[],_=i,m=e.reparseOverscaled?o:i;if(this._renderWorldCopies)for(let t=1;t<=3;t++)h.push(c(-t)),h.push(c(t));for(h.push(c(0));h.length>0;){const e=h.pop(),i=e.x,o=e.y;let a=e.fullyVisible;if(!a){const t=e.aabb.intersects(n);if(0===t)continue;a=2===t;}const s=e.aabb.distanceX(r),c=e.aabb.distanceY(r),p=Math.max(Math.abs(s),Math.abs(c)),f=3+(1<<_-e.zoom)-2;if(e.zoom===_||p>f&&e.zoom>=l)u.push({tileID:new t.OverscaledTileID(e.zoom===_?m:e.zoom,e.wrap,e.zoom,i,o),distanceSq:d([r[0]-.5-i,r[1]-.5-o])});else for(let t=0;t<4;t++){const s=(i<<1)+t%2,r=(o<<1)+(t>>1);h.push({aabb:e.aabb.quadrant(t),zoom:e.zoom+1,x:s,y:r,wrap:e.wrap,fullyVisible:a});}}return u.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,i){const o=this.pointCoordinate(i),a=this.pointCoordinate(this.centerPoint),s=this.locationCoordinate(e),r=new t.MercatorCoordinate(s.x-(o.x-a.x),s.y-(o.y-a.y));this.center=this.coordinateLocation(r),this._renderWorldCopies&&(this.center=this.center.wrap());}locationPoint(t){return this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t.toLngLat()}pointCoordinate(e){const i=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4(i,i,this.pixelMatrixInverse),t.transformMat4(o,o,this.pixelMatrixInverse);const a=i[3],s=o[3],r=i[1]/a,n=o[1]/s,l=i[2]/a,c=o[2]/s,h=l===c?0:(0-l)/(c-l);return new t.MercatorCoordinate(t.number(i[0]/a,o[0]/s,h)/this.worldSize,t.number(r,n,h)/this.worldSize)}coordinatePoint(e){const i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix),new t.pointGeometry(i[0]/i[3],i[1]/i[3])}getBounds(){return (new t.LngLatBounds).extend(this.pointLocation(new t.pointGeometry(0,0))).extend(this.pointLocation(new t.pointGeometry(this.width,0))).extend(this.pointLocation(new t.pointGeometry(this.width,this.height))).extend(this.pointLocation(new t.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude]);}calculatePosMatrix(e,i=!1){const o=e.key,a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const s=e.canonical,r=this.worldSize/this.zoomScale(s.z),n=s.x+Math.pow(2,s.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[n*r,s.y*r,0]),t.scale(l,l,[r/t.EXTENT,r/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),a[o]=new Float32Array(l),a[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,o,a,s=-90,r=90,n=-180,l=180;const c=this.size,h=this._unmodified;if(this.latRange){const i=this.latRange;s=t.mercatorYfromLat(i[1])*this.worldSize,r=t.mercatorYfromLat(i[0])*this.worldSize,e=r-sr&&(a=r-e);}if(this.lngRange){const t=u.x,e=c.x/2;t-el&&(o=l-e);}void 0===o&&void 0===a||(this.center=this.unproject(new t.pointGeometry(void 0!==o?o:u.x,void 0!==a?a:u.y))),this._unmodified=h,this._constraining=!1;}_calcMatrices(){if(!this.height)return;const e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const i=Math.PI/2+this._pitch,o=this._fov*(.5+e.y/this.height),a=Math.sin(o)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-i-o,.01,Math.PI-.01)),s=this.point,r=s.x,n=s.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*a+this.cameraToCenterDistance),h=this.height/50;let u=new Float64Array(16);t.perspective(u,this._fov,this.width/this.height,h,l),u[8]=2*-e.x/this.width,u[9]=2*e.y/this.height,t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-this.cameraToCenterDistance]),t.rotateX(u,u,this._pitch),t.rotateZ(u,u,this.angle),t.translate(u,u,[-r,-n,0]),this.mercatorMatrix=t.scale([],u,c(this.worldSize,this.worldSize,this.worldSize)),t.scale(u,u,c(1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize)),this.projMatrix=u,this.invProjMatrix=t.invert([],this.projMatrix);const d=this.width%2/2,_=this.height%2/2,m=Math.cos(this.angle),p=Math.sin(this.angle),f=r-Math.round(r)+m*d+p*_,g=n-Math.round(n)+m*_+p*d,x=new Float64Array(u);if(t.translate(x,x,[f>.5?f-1:f,g>.5?g-1:g,0]),this.alignedProjMatrix=x,u=t.create(),t.scale(u,u,[this.width/2,-this.height/2,1]),t.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=t.create(),t.scale(u,u,[1,-1,1]),t.translate(u,u,[-1,-1,0]),t.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),u=t.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={};}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.pointGeometry(0,0)),i=t.fromValues(e.x*this.worldSize,e.y*this.worldSize,0,1);return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return [e[0],i];{let o=i.x,a=i.y,s=i.x,r=i.y;for(const t of e)o=Math.min(o,t.x),a=Math.min(a,t.y),s=Math.max(s,t.x),r=Math.max(r,t.y);return [new t.pointGeometry(o,a),new t.pointGeometry(s,a),new t.pointGeometry(s,r),new t.pointGeometry(o,r),new t.pointGeometry(o,a)]}}}class Yi{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,o=null;const a=()=>{o=null,i&&(t(),o=setTimeout(a,300),i=!1);};return ()=>(i=!0,o||a(),o)}(this._updateHashUnthrottled.bind(this));}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,o=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,o),s=Math.round(e.lng*a)/a,r=Math.round(e.lat*a)/a,n=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${s}/${r}/${i}`:`${i}/${r}/${s}`,(n||l)&&(c+="/"+Math.round(10*n)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const o=i.split("=")[0];return o===t?(e=!0,`${o}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return `#${c}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t);})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t);}catch(t){}}}const Ji={linearity:.3,easing:t.bezier(0,0,.3,1)},Qi=t.extend({deceleration:2500,maxSpeed:1400},Ji),to=t.extend({deceleration:20,maxSpeed:1400},Ji),eo=t.extend({deceleration:1e3,maxSpeed:360},Ji),io=t.extend({deceleration:1e3,maxSpeed:90},Ji);class oo{constructor(t){this._map=t,this.clear();}clear(){this._inertiaBuffer=[];}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e});}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift();}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(i.pan.mag()){const s=so(i.pan.mag(),o,t.extend({},Qi,e||{}));a.offset=i.pan.mult(s.amount/i.pan.mag()),a.center=this._map.transform.center,ao(a,s);}if(i.zoom){const t=so(i.zoom,o,to);a.zoom=this._map.transform.zoom+t.amount,ao(a,t);}if(i.bearing){const e=so(i.bearing,o,eo);a.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),ao(a,e);}if(i.pitch){const t=so(i.pitch,o,io);a.pitch=this._map.transform.pitch+t.amount,ao(a,t);}if(a.zoom||a.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter();}return this.clear(),t.extend(a,{noMoveStart:!0})}}function ao(t,e){(!t.duration||t.durationi.unproject(t))),l=r.reduce(((t,e,i,o)=>t.add(e.div(o.length))),new t.pointGeometry(0,0));super(e,{points:r,point:l,lngLats:n,lngLat:i.unproject(l),originalEvent:o}),this._defaultPrevented=!1;}preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}}class lo extends t.Event{constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1;}preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}}class co{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance;}reset(){delete this._mousedownPos;}wheel(t){return this._firePreventable(new lo(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new ro(t.type,this._map,t))}mouseup(t){this._map.fire(new ro(t.type,this._map,t));}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new ro(t.type,this._map,t));}dblclick(t){return this._firePreventable(new ro(t.type,this._map,t))}mouseover(t){this._map.fire(new ro(t.type,this._map,t));}mouseout(t){this._map.fire(new ro(t.type,this._map,t));}touchstart(t){return this._firePreventable(new no(t.type,this._map,t))}touchmove(t){this._map.fire(new no(t.type,this._map,t));}touchend(t){this._map.fire(new no(t.type,this._map,t));}touchcancel(t){this._map.fire(new no(t.type,this._map,t));}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class ho{constructor(t){this._map=t;}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent;}mousemove(t){this._map.fire(new ro(t.type,this._map,t));}mousedown(){this._delayContextMenu=!0;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ro("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new ro(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class uo{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;}isEnabled(){return !!this._enabled}isActive(){return !!this._active}enable(){this.isEnabled()||(this._enabled=!0);}disable(){this.isEnabled()&&(this._enabled=!1);}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(s.disableDrag(),this._startPos=this._lastPos=e,this._active=!0);}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)t.fitScreenCoordinates(o,a,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e);}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t));}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos;}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function _o(t,e){const i={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=_o(o,i)));}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const o=_o(i,e);for(const t in this.touches){const e=this.touches[t],i=o[t];(!i||i.dist(e)>30)&&(this.aborted=!0);}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class po{constructor(t){this.singleTap=new mo(t),this.numTaps=t.numTaps,this.reset();}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();}touchstart(t,e,i){this.singleTap.touchstart(t,e,i);}touchmove(t,e,i){this.singleTap.touchmove(t,e,i);}touchend(t,e,i){const o=this.singleTap.touchend(t,e,i);if(o){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(o)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class fo{constructor(){this._zoomIn=new po({numTouches:1,numTaps:2}),this._zoomOut=new po({numTouches:2,numTaps:1}),this.reset();}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);}touchend(t,e,i){const o=this._zoomIn.touchend(t,e,i),a=this._zoomOut.touchend(t,e,i);return o?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(o)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{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}}const go={0:1,2:2};class xo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1;}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton;}_correctButton(t,e){return !1}_move(t,e){return {}}mousedown(t,e){if(this._lastPoint)return;const i=s.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i);}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){const i=go[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)0&&(this._active=!0);const a=_o(o,i),s=new t.pointGeometry(0,0),r=new t.pointGeometry(0,0);let n=0;for(const t in a){const e=a[t],i=this._touches[t];i&&(s._add(e),r._add(e.sub(i)),n++,a[t]=e);}if(this._touches=a,nMath.abs(t.x)}class Do extends To{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints;}_start(t){this._lastPoints=t,zo(t[0].sub(t[1]))&&(this._valid=!1);}_move(t,e,i){const o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(o,a,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const o=t.mag()>=2,a=e.mag()>=2;if(!o&&!a)return;if(!o||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const s=t.y>0==e.y>0;return zo(t)&&zo(e)&&s}}const Ao={panStep:100,bearingStep:15,pitchStep:10};class Mo{constructor(){const t=Ao;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1;}reset(){this._active=!1;}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,o=0,a=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,o=0),{cameraAnimation:r=>{const n=r.getZoom();r.easeTo({duration:300,easeId:"keyboardHandler",easing:Lo,zoom:e?Math.round(n)+e*(t.shiftKey?2:1):n,bearing:r.getBearing()+i*this._bearingStep,pitch:r.getPitch()+o*this._pitchStep,offset:[-a*this._panStep,-s*this._panStep],center:r.getCenter()},{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 Lo(t){return t*(2-t)}const Ro=4.000244140625;class ko{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this);}setZoomRate(t){this._defaultZoomRate=t;}setWheelZoomRate(t){this._wheelZoomRate=t;}isEnabled(){return !!this._enabled}isActive(){return !!this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around);}disable(){this.isEnabled()&&(this._enabled=!1);}wheel(e){if(!this.isEnabled())return;let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const o=t.exported.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==i&&i%Ro==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault();}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t);}_start(e){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 i=s.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Ro?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const o="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,o=this._startZoom,a=this._easing;let s,r=!1;if("wheel"===this._type&&o&&a){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),n=a(e);s=t.number(o,i,n),e<1?this._frameId||(this._frameId=!0):r=!0;}else s=i,r=!0;return this._active=!0,r&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!r,zoomDelta:s-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,o=(t.exported.now()-e.start)/e.duration,a=e.easing(o+.01)-e.easing(o),s=.27/Math.sqrt(a*a+1e-4)*.01,r=Math.sqrt(.0729-s*s);i=t.bezier(s,r,.25,1);}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1;}}class Bo{constructor(t,e){this._clickZoom=t,this._tapZoom=e;}enable(){this._clickZoom.enable(),this._tapZoom.enable();}disable(){this._clickZoom.disable(),this._tapZoom.disable();}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Fo{constructor(){this.reset();}reset(){this._active=!1;}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Oo{constructor(){this._tap=new po({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset();}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i));}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const o=e[0],a=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:a/128}}}else this._tap.touchmove(t,e,i);}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp);}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Uo{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class No{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;}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 Go{constructor(t,e,i,o){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=o,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","mapboxgl-touch-zoom-rotate");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-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();}}const Zo=t=>t.zoom||t.drag||t.pitch||t.rotate;class qo extends t.Event{}function Vo(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class jo{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new oo(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)s.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}destroy(){for(const[t,e,i]of this._listeners)s.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new co(e,t));const o=e.boxZoom=new uo(e,t);this._add("boxZoom",o);const a=new fo,s=new Fo;e.doubleClickZoom=new Bo(s,a),this._add("tapZoom",a),this._add("clickZoom",s);const r=new Oo;this._add("tapDragZoom",r);const n=e.touchPitch=new Do;this._add("touchPitch",n);const l=new yo(t),c=new bo(t);e.dragRotate=new No(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const h=new vo(t),u=new wo(t);e.dragPan=new Uo(i,h,u),this._add("mousePan",h),this._add("touchPan",u,["touchZoom","touchRotate"]);const d=new Po,_=new So;e.touchZoomRotate=new Go(i,_,d,r),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]);const m=e.scrollZoom=new ko(e,this);this._add("scrollZoom",m,["mousePan"]);const p=e.keyboard=new Mo;this._add("keyboard",p),this._add("blockableMapEvent",new ho(e));for(const i of ["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i]);}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e;}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[];}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return !0;return !1}isZooming(){return !!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return !!this._eventsInProgress.rotate}isMoving(){return Boolean(Zo(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const o in t)if(o!==i&&(!e||e.indexOf(o)<0))return !0;return !1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`);}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,o={needsRenderFrame:!1},a={},r={},n=t.touches,l=n?this._getMapTouches(n):void 0,c=l?s.touchPos(this._el,l):s.mousePos(this._el,t);for(const{handlerName:s,handler:n,allowed:h}of this._handlers){if(!n.isEnabled())continue;let u;this._blockedByActive(r,h,s)?n.reset():n[e||t.type]&&(u=n[e||t.type](t,c,l),this.mergeHandlerResult(o,a,u,s,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||n.isActive())&&(r[s]=n);}const h={};for(const t in this._previousActiveHandlers)r[t]||(h[t]=i);this._previousActiveHandlers=r,(Object.keys(h).length||Vo(o))&&(this._changes.push([o,a,h]),this._triggerRenderFrame()),(Object.keys(r).length||Vo(o))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=o;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map));}mergeHandlerResult(e,i,o,a,s){if(!o)return;t.extend(e,o);const r={handlerName:a,originalEvent:o.originalEvent||s};void 0!==o.zoomDelta&&(i.zoom=r),void 0!==o.panDelta&&(i.drag=r),void 0!==o.pitchDelta&&(i.pitch=r),void 0!==o.bearingDelta&&(i.rotate=r);}_applyChanges(){const e={},i={},o={};for(const[a,s,r]of this._changes)a.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(a.panDelta)),a.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+a.pitchDelta),void 0!==a.around&&(e.around=a.around),void 0!==a.pinchAround&&(e.pinchAround=a.pinchAround),a.noInertia&&(e.noInertia=a.noInertia),t.extend(i,s),t.extend(o,r);this._updateMapTransform(e,i,o),this._changes=[];}_updateMapTransform(t,e,i){const o=this._map,a=o.transform;if(!Vo(t))return this._fireEvents(e,i,!0);let{panDelta:s,zoomDelta:r,bearingDelta:n,pitchDelta:l,around:c,pinchAround:h}=t;void 0!==h&&(c=h),o._stop(!0),c=c||o.transform.centerPoint;const u=a.pointLocation(s?c.sub(s):c);n&&(a.bearing+=n),l&&(a.pitch+=l),r&&(a.zoom+=r),a.setLocationAtPoint(u,c),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0);}_fireEvents(e,i,o){const a=Zo(this._eventsInProgress),s=Zo(e),r={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(r[`${t}start`]=i),this._eventsInProgress[t]=e[t];}!a&&s&&this._fireEvent("movestart",s.originalEvent);for(const t in r)this._fireEvent(t,r[t]);s&&this._fireEvent("move",s.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i);}const n={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:o}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||o,n[`${t}end`]=l);}for(const t in n)this._fireEvent(t,n[t]);const c=Zo(this._eventsInProgress);if(o&&(a||s)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new qo("renderFrame",{timeStamp:t})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}class $o extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this);}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,o){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),o)}panTo(e,i,o){return this.easeTo(t.extend({center:e},i),o)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,o){return this.easeTo(t.extend({zoom:e},i),o)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,o){return this.easeTo(t.extend({bearing:e},i),o)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=t.number(a,l,e)),this._rotating&&(o.bearing=t.number(s,c,e)),this._pitching&&(o.pitch=t.number(r,h,e)),this._padding&&(o.interpolatePadding(n,u,e),_=o.centerPoint.add(d)),v)o.setLocationAtPoint(v,y);else {const t=o.zoomScale(o.zoom-a),i=l>a?Math.min(2,x):Math.max(.5,x),s=Math.pow(i,1-e),r=o.unproject(f.add(g.mult(e*s)).mult(t));o.setLocationAtPoint(o.renderWorldCopies?r.wrap():r,_);}this._fireMoveEvents(i);}),(t=>{this._afterEase(i,t);}),e),this}_prepareEase(e,i,o={}){this._moving=!0,i||o.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!o.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new t.Event("pitchstart",e));}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e));}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const o=this._zooming,a=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new t.Event("zoomend",e)),a&&this.fire(new t.Event("rotateend",e)),s&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e));}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const o=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const o=this.transform,a=this.getZoom(),s=this.getBearing(),r=this.getPitch(),n=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,c="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:r,u="padding"in e?e.padding:o.padding,d=o.zoomScale(l-a),_=t.pointGeometry.convert(e.offset);let m=o.centerPoint.add(_);const p=o.pointLocation(m),f=t.LngLat.convert(e.center||p);this._normalizeCenter(f);const g=o.project(p),x=o.project(f).sub(g);let v=e.curve;const y=Math.max(o.width,o.height),b=y/d,w=x.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,a,l),o.minZoom,o.maxZoom),s=y/o.zoomScale(i-a);v=Math.sqrt(s/w*2);}const T=v*v;function E(t){const e=(b*b-y*y+(t?-1:1)*T*T*w*w)/(2*(t?b:y)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function I(t){return (Math.exp(t)-Math.exp(-t))/2}function S(t){return (Math.exp(t)+Math.exp(-t))/2}const C=E(0);let P=function(t){return S(C)/S(C+v*t)},z=function(t){return y*((S(C)*(I(e=C+v*t)/S(e))-I(C))/T)/w;var e;},D=(E(1)-C)/v;if(Math.abs(w)<1e-6||!isFinite(D)){if(Math.abs(y-b)<1e-6)return this.easeTo(e,i);const t=be.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==c,this._pitching=h!==r,this._padding=!o.isPaddingEqual(u),this._prepareEase(i,!1),this._ease((e=>{const d=e*D,p=1/P(d);o.zoom=1===e?l:a+o.scaleZoom(p),this._rotating&&(o.bearing=t.number(s,c,e)),this._pitching&&(o.pitch=t.number(r,h,e)),this._padding&&(o.interpolatePadding(n,u,e),m=o.centerPoint.add(_));const v=1===e?f:o.unproject(g.add(x.mult(z(d))).mult(p));o.setLocationAtPoint(o.renderWorldCopies?v.wrap():v,m),this._fireMoveEvents(i);}),(()=>this._afterEase(i)),e),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e);}if(!t){const t=this.handlers;t&&t.stop(!1);}return this}_ease(e,i,o){!1===o.animate||0===o.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const o=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0;}}class Wo{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact"],this);}getDefaultPosition(){return "bottom-right"}onAdd(t){return this._map=t,this._container=s.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=s.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateCompact(),this._updateAttributions(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0;}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i);}_toggleAttribution(){this._container.classList.contains("maplibregl-compact-show")||this._container.classList.contains("mapboxgl-compact-show")?this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show"):this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show");}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||this._updateAttributions();}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id;}const e=this._map.style.sourceCaches;for(const i in e){const o=e[i];if(o.used){const e=o.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution);}}t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let o=i+1;o=0)return !1;return !0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._editLink=null);}_updateCompact(){const t=this.options&&this.options.compact;this._map.getCanvasContainer().offsetWidth<=640||t?!1===t?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||(this._container.removeAttribute("open"),this._container.classList.add("maplibregl-compact","mapboxgl-compact")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"));}}class Xo{constructor(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this);}onAdd(t){this._map=t,this._container=s.create("div","maplibregl-ctrl mapboxgl-ctrl");const e=s.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(void 0),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){s.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact);}getDefaultPosition(){return "bottom-left"}_updateLogo(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none");}_logoRequired(){if(!this._map.style)return;const t=this._map.style.sourceCaches;for(const e in t)if(t[e].getSource().maplibreLogo)return !0;return !1}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact");}}}class Ho{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}const Ko={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Yo={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Jo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Qo{constructor(e,i,o=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new yo({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,o&&(this.mousePitch=new bo({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),s.addEventListener(i,"mousedown",this.mousedown),s.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(i,"touchmove",this.touchmove),s.addEventListener(i,"touchend",this.touchend),s.addEventListener(i,"touchcancel",this.reset);}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),s.disableDrag();}move(t,e){const i=this.map,o=this.mouseRotate.mousemoveWindow(t,e);if(o&&o.bearingDelta&&i.setBearing(i.getBearing()+o.bearingDelta),this.mousePitch){const o=this.mousePitch.mousemoveWindow(t,e);o&&o.pitchDelta&&i.setPitch(i.getPitch()+o.pitchDelta);}}off(){const t=this.element;s.removeEventListener(t,"mousedown",this.mousedown),s.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(t,"touchmove",this.touchmove),s.removeEventListener(t,"touchend",this.touchend),s.removeEventListener(t,"touchcancel",this.reset),this.offTemp();}offTemp(){s.enableDrag(),s.removeEventListener(window,"mousemove",this.mousemove),s.removeEventListener(window,"mouseup",this.mouseup);}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),s.mousePos(this.element,e)),s.addEventListener(window,"mousemove",this.mousemove),s.addEventListener(window,"mouseup",this.mouseup);}mousemove(t){this.move(t,s.mousePos(this.element,t));}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp();}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos));}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos));}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const t=o.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=o.width&&t.y<=o.height)break;e.lng>o.center.lng?e.lng-=360:e.lng+=360;}return e}const ea={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 ia(t,e,i){const o=t.classList;for(const t in ea)o.remove(`maplibregl-${i}-anchor-${t}`,`mapboxgl-${i}-anchor-${t}`);o.add(`maplibregl-${i}-anchor-${e}`,`mapboxgl-${i}-anchor-${e}`);}class oa extends t.Evented{constructor(e,i){if(super(),(e instanceof HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else {this._defaultMarker=!0,this._element=s.create("div"),this._element.setAttribute("aria-label","Map marker");const i=s.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${o}px`),i.setAttributeNS(null,"width",`${a}px`),i.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const r=s.createNS("http://www.w3.org/2000/svg","g");r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");const n=s.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");const l=s.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=s.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e);}const h=s.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=s.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(u);const d=s.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const _=s.createNS("http://www.w3.org/2000/svg","path");_.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"),d.appendChild(_);const m=s.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const p=s.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(8.0, 8.0)");const f=s.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");const g=s.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),p.appendChild(f),p.appendChild(g),n.appendChild(l),n.appendChild(h),n.appendChild(d),n.appendChild(m),n.appendChild(p),i.appendChild(n),i.setAttributeNS(null,"height",o*this._scale+"px"),i.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(i),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14]);}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault();})),this._element.addEventListener("mousedown",(t=>{t.preventDefault();})),ia(this._element,this._anchor,"marker"),this._popup=null;}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,o=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[o,-1*(e-i+o)],"bottom-right":[-o,-1*(e-i+o)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset;}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress);}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup();}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup();}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=ta(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),s.setTransform(this._element,`${ea[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`);}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t;}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")));}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive";}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp));}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const aa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let sa,ra=0,na=!1;const la={maxWidth:100,unit:"metric"};function ca(t,e,i){const o=i&&i.maxWidth||100,a=t._container.clientHeight/2,s=t.unproject([0,a]),r=t.unproject([o,a]),n=s.distanceTo(r);if(i&&"imperial"===i.unit){const i=3.2808*n;i>5280?ha(e,o,i/5280,t._getUIString("ScaleControl.Miles")):ha(e,o,i,t._getUIString("ScaleControl.Feet"));}else i&&"nautical"===i.unit?ha(e,o,n/1852,t._getUIString("ScaleControl.NauticalMiles")):n>=1e3?ha(e,o,n/1e3,t._getUIString("ScaleControl.Kilometers")):ha(e,o,n,t._getUIString("ScaleControl.Meters"));}function ha(t,e,i,o){const a=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(a/i)+"px",t.innerHTML=`${a} ${o}`;}const ua={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},da=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _a(e){if(e){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return {center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-left":new t.pointGeometry(i,i),"top-right":new t.pointGeometry(-i,i),bottom:new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(i,-i),"bottom-right":new t.pointGeometry(-i,-i),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){const i=t.pointGeometry.convert(e);return {center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return {center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0])}}return _a(new t.pointGeometry(0,0))}const ma={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends $o{constructor(e){var i;if(null!=(e=t.extend({},Yo,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ki(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Ho,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},Ko,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this._requestManager=new r(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else {if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container;}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new jo(this,e),this._hash=e.hash&&new Yi("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Wo({customAttribution:e.customAttribution})),this.addControl(new Xo,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet);})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e));})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e));}));}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=e.onAdd(this);this._controls.push(e);const a=this._controlPositions[i];return -1!==i.indexOf("bottom")?a.insertBefore(o,a.firstChild):a.appendChild(o),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}resize(e){const i=this._containerDimensions(),o=i[0],a=i[1];this._resizeCanvas(o,a,this.getPixelRatio()),this.transform.resize(o,a),this.painter.resize(o,a,this.getPixelRatio());const s=!this._moving;return s&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),s&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t);}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation(t.pointGeometry.convert(e))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let o=!1;const a=a=>{const s=this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[];s.length?o||(o=!0,i.call(this,new ro(t,this,a.originalEvent,{features:s}))):o=!1;};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:()=>{o=!1;}}}}if("mouseleave"===t||"mouseout"===t){let o=!1;const a=a=>{(this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,i.call(this,new ro(t,this,a.originalEvent)));},s=e=>{o&&(o=!1,i.call(this,new ro(t,this,e.originalEvent)));};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:s}}}{const o=t=>{const o=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];o.length&&(t.features=o,i.call(this,t),delete t.features);};return {layer:e,listener:i,delegates:{[t]:o}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const o=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o);for(const t in o.delegates)this.on(t,o.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const o=this._createDelegatedListener(t,e,i);for(const t in o.delegates)this.once(t,o.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(o=>{const a=this._delegatedListeners[t];for(let t=0;t{e?this.fire(new t.ErrorEvent(e)):o&&this._updateDiff(o,i);}));}else "object"==typeof e&&this._updateDiff(e,i);}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0);}catch(o){t.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(e,i);}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)));}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return !1}}return !0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:r,content:n}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:c,data:h}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},h),pixelRatio:o,stretchX:s,stretchY:r,content:n,sdf:a,version:0});}else {if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(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:l,height:c,data:h}=i,u=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(h)),pixelRatio:o,stretchX:s,stretchY:r,content:n,sdf:a,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e);}}}updateImage(e,i){const o=this.style.getImage(e);if(!o)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:s,height:r,data:n}=a;if(void 0===s||void 0===r)return this.fire(new t.ErrorEvent(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(s!==o.data.width||r!==o.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));o.data.replace(n,l),this.style.updateImage(e,o);}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t);}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i);}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,o={}){return this.style.setPaintProperty(t,e,i,o),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,o={}){return this.style.setLayoutProperty(t,e,i,o),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");const e=this._canvasContainer=s.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=s.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const o=this._controlContainer=s.create("div","maplibregl-control-container mapboxgl-control-container",t),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{a[t]=s.create("div",`maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`,o);})),this._container.addEventListener("scroll",this._onMapScroll,!1);}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`;}_setupPainter(){const i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);o?(this.painter=new $i(o,this.transform),t.exported$1.testSupport(o)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")));}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}));}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}));}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t);}_render(e){let i,o=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,i),o=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.exported.now();this.style.zoomHistory.update(e,i);const o=new t.EvaluationParameters(e,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=o.crossFadingFactor();1===a&&a===this._crossFadingFactor||(s=!0,this._crossFadingFactor=a),this.style.update(o);}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-o;a.endQueryEXT(a.TIME_ELAPSED_EXT,i),setTimeout((()=>{const o=a.getQueryObjectEXT(i,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:o}));}),50);}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}));}),50);}const r=this._sourcesDirty||this._styleDirty||this._placementDirty;return r||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||r||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),s.remove(this._canvasContainer),s.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),this._removed=!0,this.fire(new t.Event("remove"));}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame((t=>{this._frame=null,this._render(t);})));}_onWindowOnline(){this._update();}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update();}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update());}get showPadding(){return !!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update());}get repaint(){return !!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(t){this._vertices=t,this._update();}_setCacheLimits(e,i){t.setCacheLimits(e,i);}},NavigationControl:class{constructor(e){this.options=t.extend({},Jo,e),this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t});})),this._compassIcon=s.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"));}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString());}_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;}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Qo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map;}_createButton(t,e){const i=s.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i);}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},aa,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this);}onAdd(t){var e;return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==sa?e(sa):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((t=>{sa="denied"!==t.state,e(sa);})):(sa=!!window.navigator.geolocation,e(sa)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ra=0,na=!1;}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish();}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,a=this._map.getBearing(),s=t.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(o),s,{geolocateSource:!0});}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),o=e.distanceTo(i),a=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`;}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===e.code&&na)return;this._setErrorState();}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish();}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;}_setupUI(e){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=s.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),s.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e);}else {const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new oa(this._dotElement),this._circleElement=s.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new oa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")));}));}trigger(){if(!this._setup)return t.warnOnce("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 t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ra--,na=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ra++,ra>1?(t={maximumAge:6e5,timeout:0},na=!0):(t=this.options.positionOptions,na=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null);}},AttributionControl:Wo,ScaleControl:class{constructor(e){this.options=t.extend({},la,e),t.bindAll(["_onMove","setUnit"],this);}getDefaultPosition(){return "bottom-left"}_onMove(){ca(this._map,this._container,this.options);}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0;}setUnit(t){this.options.unit=t,ca(this._map,this._container,this.options);}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange");}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon);}_checkFullscreenSupport(){return !!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=s.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);s.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon);}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t;}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle());}_onClickFullscreen(){this._isFullscreen()?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._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen();}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(ua),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this);}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return !!this._map}remove(){return this._content&&s.remove(this._content),this._container&&(s.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let o;for(i.innerHTML=t;o=i.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t);}removeClassName(t){this._container&&this._container.classList.remove(t);}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose));}_onMouseUp(t){this._update(t.point);}_onMouseMove(t){this._update(t.point);}_onDrag(t){this._update(t.point);}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=s.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=s.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ta(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let i=this.options.anchor;const o=_a(this.options.offset);if(!i){const t=this._container.offsetWidth,a=this._container.offsetHeight;let s;s=e.y+o.bottom.ythis._map.transform.height-a?["bottom"]:[],e.xthis._map.transform.width-t/2&&s.push("right"),i=0===s.length?"bottom":s.join("-");}const a=e.add(o[i]).round();s.setTransform(this._container,`${ea[i]} translate(${a.x}px,${a.y}px)`),ia(this._container,i,"popup");}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(da);t&&t.focus();}_onClose(){this.remove();}},Marker:oa,Style:Jt,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){j().acquire(G);},clearPrewarmedResources:function(){const t=V;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(G),V=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()"));},get workerCount(){return Z.workerCount},set workerCount(t){Z.workerCount=t;},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e;},clearStorage(e){t.clearTileCache(e);},workerUrl:"",addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i;},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e];}};return ma})); + +// + +var maplibregl$1 = maplibregl; + +return maplibregl$1; + +})); +//# sourceMappingURL=maplibre-gl.js.map diff --git a/capeditor/static/capeditor/js/turf.min.js b/capeditor/static/capeditor/js/turf.min.js new file mode 100644 index 0000000..a85d8bd --- /dev/null +++ b/capeditor/static/capeditor/js/turf.min.js @@ -0,0 +1,88 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";var e=6371008.8,n={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*e,kilometers:6371.0088,kilometres:6371.0088,meters:e,metres:e,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:e/1852,radians:1,yards:6967335.223679999},r={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e,yards:1.0936133},i={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function o(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function s(t,e,n){switch(t){case"Point":return a(e).geometry;case"LineString":return h(e).geometry;case"Polygon":return l(e).geometry;case"MultiPoint":return d(e).geometry;case"MultiLineString":return g(e).geometry;case"MultiPolygon":return y(e).geometry;default:throw new Error(t+" is invalid")}}function a(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!C(t[0])||!C(t[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:t},e,n)}function u(t,e,n){return void 0===n&&(n={}),f(t.map((function(t){return a(t,e)})),n)}function l(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function m(t,e){void 0===e&&(e="kilometers");var r=n[e];if(!r)throw new Error(e+" units is invalid");return t*r}function x(t,e){void 0===e&&(e="kilometers");var r=n[e];if(!r)throw new Error(e+" units is invalid");return t/r}function E(t,e){return w(x(t,e))}function b(t){var e=t%360;return e<0&&(e+=360),e}function w(t){return 180*(t%(2*Math.PI))/Math.PI}function I(t){return t%360*Math.PI/180}function N(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return m(x(t,e),n)}function S(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=i[e];if(!r)throw new Error("invalid original units");var o=i[n];if(!o)throw new Error("invalid final units");return t/r*o}function C(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function P(t){return!!t&&t.constructor===Object}function M(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!C(t))throw new Error("bbox must only contain numbers")}))}function L(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var O=Object.freeze({__proto__:null,earthRadius:e,factors:n,unitsFactors:r,areaFactors:i,feature:o,geometry:s,point:a,points:u,polygon:l,polygons:c,lineString:h,lineStrings:p,featureCollection:f,multiLineString:g,multiPoint:d,multiPolygon:y,geometryCollection:v,round:_,radiansToLength:m,lengthToRadians:x,lengthToDegrees:E,bearingToAzimuth:b,radiansToDegrees:w,degreesToRadians:I,convertLength:N,convertArea:S,isNumber:C,isObject:P,validateBBox:M,validateId:L});function R(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,c,h=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,v=0;va||f>u||g>l)return s=o,a=n,u=f,l=g,void(i=0);var d=h([s,o],t.properties);if(!1===e(d,n,r,g,i))return!1;i++,s=o}))&&void 0}}}))}function V(t,e,n){var r=n,i=!1;return U(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function X(t,e){if(!t)throw new Error("geojson is required");z(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Q(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function $(t){if(t.length>1&&C(t[0])&&C(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return $(t[0]);throw new Error("coordinates must only contain numbers")}function tt(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function et(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function nt(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r + * v. 1.2.0 + * https://github.com/RaumZeit/MarchingSquares.js + * + * MarchingSquaresJS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MarchingSquaresJS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * As additional permission under GNU Affero General Public License version 3 + * section 7, third-party projects (personal or commercial) may distribute, + * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the + * requirement that said third-party project for that reason alone becomes + * subject to any requirement of the GNU Affero General Public License version 3. + * Any modifications to MarchingSquaresJS, however, must be shared with the public + * and made available. + * + * In summary this: + * - allows you to use MarchingSquaresJS at no cost + * - allows you to use MarchingSquaresJS for both personal and commercial purposes + * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any + * license as long as this license notice is included + * - enables you to keep the source code of your program that uses MarchingSquaresJS + * undisclosed + * - forces you to share any modifications you have made to MarchingSquaresJS, + * e.g. bug-fixes + * + * You should have received a copy of the GNU Affero General Public License + * along with MarchingSquaresJS. If not, see . + */function ft(t,e,n){n=n||{};for(var r=Object.keys(ht),i=0;i=0&&y>=0&&y=0;h--)if(Math.abs(e[h][0][0]-l)<=r&&Math.abs(e[h][0][1]-c)<=r){for(var p=a.path.length-2;p>=0;--p)e[h].unshift(a.path[p]);u=!0;break}u||(e[n++]=a.path)}var f}))})),e}(function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;o=e?8:0,a|=l>=e?4:0,a|=c>=e?2:0;var p,f,g,d,y=!1;if(5===(a|=h>=e?1:0)||10===a){var v=(u+l+c+h)/4;5===a&&vn;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1);bt(t,e,Math.max(n,Math.floor(e-s*u/o+l)),Math.min(r,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=n,p=r;for(wt(t,n,e),i(t[r],c)>0&&wt(t,n,r);h0;)p--}0===i(t[n],c)?wt(t,n,p):wt(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function wt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function It(t,e){return te?1:0}mt.default=xt;var Nt=Ct,St=Ct;function Ct(t,e){if(!(this instanceof Ct))return new Ct(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Pt(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function Gt(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qt(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,mt(t,o,e,n,i),s.push(e,o,o,n))}function Bt(t){var e={exports:{}};return t(e,e.exports),e.exports}Ct.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!kt(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=Gt(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Mt(n,this.toBBox),Mt(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=Gt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Mt(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,l,c,h,p,f,g,d,y;for(u=l=1/0,r=e;r<=n-e;r++)i=Lt(t,0,r,this.toBBox),o=Lt(t,r,n,this.toBBox),h=i,p=o,f=void 0,g=void 0,d=void 0,y=void 0,f=Math.max(h.minX,p.minX),g=Math.max(h.minY,p.minY),d=Math.min(h.maxX,p.maxX),y=Math.min(h.maxY,p.maxY),s=Math.max(0,d-f)*Math.max(0,y-g),a=At(i)+At(o),s=e;i--)o=t.children[i],Ot(u,t.leaf?s(o):o),l+=Dt(u);return l},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)Ot(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():Mt(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},Nt.default=St;var zt=function(t,e,n){var r=t*e,i=jt*t,o=i-(i-t),s=t-o,a=jt*e,u=a-(a-e),l=e-u,c=s*l-(r-o*u-s*u-o*l);if(n)return n[0]=c,n[1]=r,n;return[c,r]},jt=+(Math.pow(2,27)+1);var Ut=function(t,e){var n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){var n=t+e,r=n-t,i=t-(n-r)+(e-r);if(i)return[i,n];return[n]}(t[0],e[0]);var i,o,s=new Array(n+r),a=0,u=0,l=0,c=Math.abs,h=t[u],p=c(h),f=e[l],g=c(f);p=r?(i=h,(u+=1)=r?(i=h,(u+=1)>1;return["sum(",n(t.slice(0,e)),",",n(t.slice(e)),")"].join("")}function r(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var i=[],o=0;o0){if(s<=0)return a;r=i+s}else{if(!(i<0))return a;if(s>=0)return a;r=-(i+s)}var u=33306690738754716e-32*r;return a>=u||a<=-u?a:o(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],a=n[0]-r[0],u=t[1]-r[1],l=e[1]-r[1],c=n[1]-r[1],h=t[2]-r[2],p=e[2]-r[2],f=n[2]-r[2],g=o*c,d=a*l,y=a*u,v=i*c,_=i*l,m=o*u,x=h*(g-d)+p*(y-v)+f*(_-m),E=7771561172376103e-31*((Math.abs(g)+Math.abs(d))*Math.abs(h)+(Math.abs(y)+Math.abs(v))*Math.abs(p)+(Math.abs(_)+Math.abs(m))*Math.abs(f));return x>E||-x>E?x:s(t,e,n,r)}];function u(t){var e=a[t.length];return e||(e=a[t.length]=i(t.length)),e.apply(void 0,t)}!function(){for(;a.length<=5;)a.push(i(a.length));for(var e=[],n=["slow"],r=0;r<=5;++r)e.push("a"+r),n.push("o"+r);var o=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(r=2;r<=5;++r)o.push("case ",r,":return o",r,"(",e.slice(0,r).join(),");");o.push("}var s=new Array(arguments.length);for(var i=0;i1&&Jt(t[o[l-2]],t[o[l-1]],u)<=0;)l-=1,o.pop();for(o.push(a),l=s.length;l>1&&Jt(t[s[l-2]],t[s[l-1]],u)>=0;)l-=1,s.pop();s.push(a)}n=new Array(s.length+o.length-2);for(var c=0,h=(r=0,o.length);r0;--p)n[c++]=s[p];return n},Jt=Ht[3];var Zt=Qt,Kt=Qt;function Qt(t,e){if(!(this instanceof Qt))return new Qt(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||$t,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)}function $t(t,e){return te?1:0}Qt.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r},_down:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t=0)break;e[t]=a,t=o}e[t]=i}},Zt.default=Kt;var te=function(t,e){for(var n=t[0],r=t[1],i=!1,o=0,s=e.length-1;or!=c>r&&n<(l-a)*(r-u)/(c-u)+a&&(i=!i)}return i},ee=Ht[3],ne=ie,re=ie;function ie(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;for(var r,i=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;or[0]&&(r=s),s[1]i[1]&&(i=s)}var a=[e,n,r,i],u=a.slice();for(o=0;oo||a.push({node:c,dist:h})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=fe(f,e,n),d=fe(f,r,i);if(p.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function le(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=n.search({minX:a,minY:u,maxX:l,maxY:c}),p=0;p0!=ee(r,i,s)>0&&ee(o,s,r)>0!=ee(o,s,i)>0)return!1;return!0}function ce(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function he(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function pe(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function fe(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function ge(t,e,n,r,i,o,s,a){var u,l,c,h,p=n-t,f=r-e,g=s-i,d=a-o,y=t-i,v=e-o,_=p*p+f*f,m=p*g+f*d,x=g*g+d*d,E=p*y+f*v,b=g*y+d*v,w=_*x-m*m,I=w,N=w;0===w?(l=0,I=1,h=b,N=x):(h=_*b-m*E,(l=m*b-x*E)<0?(l=0,h=b,N=x):l>I&&(l=I,h=b+m,N=x)),h<0?(h=0,-E<0?l=0:-E>_?l=I:(l=-E,I=_)):h>N&&(h=N,-E+m<0?l=0:-E+m>_?l=I:(l=-E+m,I=_));var S=(1-(c=0===h?0:h/N))*i+c*s-((1-(u=0===l?0:l/I))*t+u*n),C=(1-c)*o+c*a-((1-u)*e+u*r);return S*S+C*C}function de(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(R(t,(function(t){n.push([t[0],t[1]])})),!n.length)return null;var r=ne(n,e.concavity);return r.length>3?l([r]):null}function ye(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=K(t),i=rt(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(r,s))return!1;"Polygon"===o&&(a=[a]);for(var u=!1,l=0;lt[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}function _e(t,e){var n=[];return F(t,(function(t){var r=!1;if("Point"===t.geometry.type)q(e,(function(e){ye(t,e)&&(r=!0)})),r&&n.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];q(e,(function(e){R(t,(function(t){ye(t,e)&&(r=!0,i.push(t))}))})),r&&n.push(d(i))}})),f(n)}function me(t,e,n){void 0===n&&(n={});var r=K(t),i=K(e),o=I(i[1]-r[1]),s=I(i[0]-r[0]),a=I(r[1]),u=I(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return m(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function xe(t,e){var n=!1;return f(function(t){if(t.length<3)return[];t.sort(be);var e,n,r,i,o,s,a=t.length-1,u=t[a].x,l=t[0].x,c=t[a].y,h=c,p=1e-12;for(;a--;)t[a].yh&&(h=t[a].y);var f,g=l-u,d=h-c,y=g>d?g:d,v=.5*(l+u),_=.5*(h+c),m=[new Ee({__sentinel:!0,x:v-20*y,y:_-y},{__sentinel:!0,x:v,y:_+20*y},{__sentinel:!0,x:v+20*y,y:_-y})],x=[],E=[];a=t.length;for(;a--;){for(E.length=0,f=m.length;f--;)(g=t[a].x-m[f].x)>0&&g*g>m[f].r?(x.push(m[f]),m.splice(f,1)):g*g+(d=t[a].y-m[f].y)*d>m[f].r||(E.push(m[f].a,m[f].b,m[f].b,m[f].c,m[f].c,m[f].a),m.splice(f,1));for(we(E),f=E.length;f;)n=E[--f],e=E[--f],r=t[a],i=n.x-e.x,o=n.y-e.y,s=2*(i*(r.y-n.y)-o*(r.x-n.x)),Math.abs(s)>p&&m.push(new Ee(e,n,r))}Array.prototype.push.apply(x,m),a=x.length;for(;a--;)(x[a].a.__sentinel||x[a].b.__sentinel||x[a].c.__sentinel)&&x.splice(a,1);return x}(t.features.map((function(t){var r={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?r.z=t.properties[e]:3===t.geometry.coordinates.length&&(n=!0,r.z=t.geometry.coordinates[2]),r}))).map((function(t){var e=[t.a.x,t.a.y],r=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},l([[e,r,i,e]],o)})))}ne.default=re;var Ee=function(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,l=o*(t.x+e.x)+s*(t.y+e.y),c=a*(t.x+n.x)+u*(t.y+n.y),h=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*l-s*c)/h,this.y=(o*c-a*l)/h,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i};function be(t,e){return e.x-t.x}function we(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[--s],e=t[--s],r=s;r;)if(o=t[--r],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function Ie(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ne(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}})),e.features=t.features.map((function(t){return Ne(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ce(t);default:throw new Error("unknown GeoJSON type")}}function Ne(t){var e={type:"Feature"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}})),e.properties=Se(t.properties),e.geometry=Ce(t.geometry),e}function Se(t){var e={};return t?(Object.keys(t).forEach((function(n){var r=t[n];"object"==typeof r?null===r?e[n]=null:Array.isArray(r)?e[n]=r.map((function(t){return t})):e[n]=Se(r):e[n]=r})),e):e}function Ce(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Ce(t)})),e):(e.coordinates=Pe(t.coordinates),e)}function Pe(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Pe(t)}))}function Me(t,e){if(void 0===e&&(e={}),!P(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==it(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=Ie(t));var r=[],i=Y(t,(function(t,e){var n=function(t,e){var n,r=t.geometry.coordinates,i=e.geometry.coordinates,o=Le(r[0]),s=Le(r[r.length-1]),a=Le(i[0]),u=Le(i[i.length-1]);if(o===u)n=i.concat(r.slice(1));else if(a===s)n=r.concat(i.slice(1));else if(o===a)n=r.slice(1).reverse().concat(i);else{if(s!==u)return null;n=r.concat(i.reverse().slice(1))}return h(n)}(t,e);return n||(r.push(t),e)}));return i&&r.push(i),r.length?1===r.length?r[0]:g(r.map((function(t){return t.coordinates}))):null}function Le(t){return t[0].toString()+","+t[1].toString()}function Oe(t){return t}function Re(t,e){var n=function(t){if(null==t)return Oe;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=n=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+s;u1)for(var o,a,u=1,l=s(i[0]);ul&&(a=i[0],i[0]=i[u],i[u]=a,l=o);return i})).filter((function(t){return t.length>0}))}}var De=Object.prototype.hasOwnProperty;function Fe(t,e,n,r,i,o){3===arguments.length&&(r=o=Array,i=null);for(var s=new r(t=1<=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o}function h(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o}function p(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)break;c=s[l=l+1&u]}return o}function f(){for(var t=[],e=0,n=s.length;e>7^Be[2]^Be[3])}function je(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=function(){for(var t=Fe(1.4*o.length,E,b,Int32Array,-1,Int32Array),e=new Int32Array(o.length),n=0,r=o.length;n=0){var o=h[n];i===e&&o===r||i===r&&o===e||(++f,p[n]=1)}else c[n]=e,h[n]=r}}function E(t){return ze(o[t])}function b(t,e){return ke(o[t],o[e])}l=c=h=null;var w,I=function(t,e,n,r,i){3===arguments.length&&(r=Array,i=null);for(var o=new r(t=1<=t)throw new Error("full hashset");u=o[a=a+1&s]}return o[a]=r,!0}function l(r){for(var a=e(r)&s,u=o[a],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)break;u=o[a=a+1&s]}return!1}function c(){for(var t=[],e=0,n=o.length;e>1);er&&(r=o),si&&(i=s)}function u(t){t.forEach(a)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return r>=e&&i>=n?[e,n,r,i]:void 0}(t=Xe(t)),r=e>0&&n&&function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=o-r?(n-1)/(o-r):1,u=s-i?(n-1)/(s-i):1;function l(t){return[Math.round((t[0]-r)*a),Math.round((t[1]-i)*u)]}function c(t,e){for(var n,o,s,l,c,h=-1,p=0,f=t.length,g=new Array(f);++h2&&rn(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,nn(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return rn(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function nn(t,e){return t[0]===e[0]&&t[1]===e[1]}function rn(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,c=u-s;return 0===(r-o)*c-(i-s)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=r&&r<=a:a<=r&&r<=o:c>0?s<=i&&i<=u:u<=i&&i<=s)}function on(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(0!==o||0!==s){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return(o=t.x-r)*o+(s=t.y-i)*s}function sn(t,e,n,r,i){for(var o,s=r,a=e+1;as&&(o=a,s=u)}s>r&&(o-e>1&&sn(t,e,o,r,i),i.push(t[o]),n-o>1&&sn(t,o,n,r,i))}function an(t,e){var n=t.length-1,r=[t[0]];return sn(t,0,n,e,r),r.push(t[n]),r}function un(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return t=an(t=n?t:function(t,e){for(var n,r,i,o,s,a=t[0],u=[a],l=1,c=t.length;le&&(u.push(n),a=n);return a!==n&&u.push(n),u}(t,r),r)}function ln(t,e,n){return un(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,n).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function cn(t,e,n){return t.map((function(t){var r=t.map((function(t){return{x:t[0],y:t[1]}}));if(r.length<4)throw new Error("invalid polygon");for(var i=un(r,e,n).map((function(t){return[t.x,t.y]}));!hn(i);)i=un(r,e-=.01*e,n).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function hn(t){return!(t.length<3)&&!(3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var pn=function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;et&&(e.push(r),n=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])},t}();function fn(t,e){void 0===e&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=rt(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new pn({duration:n,points:o,sharpness:r}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},u=0;u=me(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function vn(t,e,n,r){void 0===r&&(r={});var i=K(t),o=I(i[0]),s=I(i[1]),u=I(n),l=x(e,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(u));return a([w(o+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),w(c)],r.properties)}function _n(t,e,n){void 0===n&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s80*n){r=o=t[0],i=s=t[1];for(var g=n;go&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?1/l:0}return Pn(p,f,n,r,i,l),f}function Sn(t,e,n,r,i){var o,s;if(i===Hn(t,e,n,r)>0)for(o=e;o=e;o-=r)s=Vn(o,t[o],t[o+1],s);return s&&Bn(s,s.next)&&(Xn(s),s=s.next),s}function Cn(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Bn(r,r.next)&&0!==qn(r.prev,r,r.next))r=r.next;else{if(Xn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Pn(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Dn(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Ln(t,r,i,o):Mn(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),Xn(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?Pn(t=On(t,e,n),e,n,r,i,o,2):2===s&&Rn(t,e,n,r,i,o):Pn(Cn(t),e,n,r,i,o,1);break}}}function Mn(t){var e=t.prev,n=t,r=t.next;if(qn(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(kn(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&qn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Ln(t,e,n,r){var i=t.prev,o=t,s=t.next;if(qn(i,o,s)>=0)return!1;for(var a=i.xo.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,h=Dn(a,u,e,n,r),p=Dn(l,c,e,n,r),f=t.prevZ,g=t.nextZ;f&&f.z>=h&&g&&g.z<=p;){if(f!==t.prev&&f!==t.next&&kn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&qn(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,g!==t.prev&&g!==t.next&&kn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&qn(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&kn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&qn(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;g&&g.z<=p;){if(g!==t.prev&&g!==t.next&&kn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&qn(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function On(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Bn(i,o)&&zn(i,r,r.next,o)&&jn(i,o)&&jn(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Xn(r),Xn(r.next),r=t=o),r=r.next}while(r!==t);return r}function Rn(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Gn(s,a)){var u=Un(s,a);return s=Cn(s,s.next),u=Cn(u,u.next),Pn(s,e,n,r,i,o),void Pn(u,e,n,r,i,o)}a=a.next}s=s.next}while(s!==t)}function Tn(t,e){return t.x-e.x}function An(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&i!==r.x&&kn(on.x)&&jn(r,t)&&(n=r,p=u),r=r.next;return n}(t,e)){var n=Un(e,t);Cn(n,n.next)}}function Dn(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Fn(t){var e=t,n=t;do{e.x=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function Gn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&zn(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&jn(t,e)&&jn(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}function qn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Bn(t,e){return t.x===e.x&&t.y===e.y}function zn(t,e,n,r){return!!(Bn(t,e)&&Bn(n,r)||Bn(t,r)&&Bn(n,e))||qn(t,e,n)>0!=qn(t,e,r)>0&&qn(n,r,t)>0!=qn(n,r,e)>0}function jn(t,e){return qn(t.prev,t,t.next)<0?qn(t,e,t.next)>=0&&qn(t,t.prev,e)>=0:qn(t,e,t.prev)<0||qn(t,t.next,e)<0}function Un(t,e){var n=new Yn(t.i,t.x,t.y),r=new Yn(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Vn(t,e,n,r){var i=new Yn(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Xn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Yn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Hn(t,e,n,r){for(var i=0,o=e,s=n-r;o0&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),n=wn(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;oi?n:i,r>o?r:o]}(t,r),n.push(i),r})),n})(n,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),f(e)}Nn.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Hn(t,0,o,n));if(i)for(var a=0,u=e.length;a0&&(r+=t[i-1].length,n.holes.push(r))}return n},wn.default=In;var Kn=Bt((function(t,e){function n(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function r(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return n({type:"Point",coordinates:t},e,r)}function i(t,e,r){void 0===r&&(r={});for(var i=0,o=t;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n},e.radiansToLength=c,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return p(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(h(t,e),n)},e.convertArea=function(t,n,r){if(void 0===n&&(n="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[n];if(!i)throw new Error("invalid original units");var o=e.areaFactors[r];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}}));function Qn(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,c,h=0,p=0,f=t.type,g="FeatureCollection"===f,d="Feature"===f,y=g?t.features.length:1,v=0;va||p>u||f>l)return s=o,a=n,u=p,l=f,void(i=0);var g=Kn.lineString([s,o],t.properties);if(!1===e(g,n,r,f,i))return!1;i++,s=o}))&&void 0}}}))}function ir(t,e){if(!t)throw new Error("geojson is required");nr(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2] line1 must only contain 2 coordinates");if(2!==r.length)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],u=n[1][1],l=r[0][0],c=r[0][1],h=r[1][0],p=r[1][1],f=(p-c)*(s-i)-(h-l)*(u-o),g=(h-l)*(o-c)-(p-c)*(i-l),d=(s-i)*(o-c)-(u-o)*(i-l);if(0===f)return null;var y=g/f,v=d/f;return y>=0&&y<=1&&v>=0&&v<=1?a([i+y*(s-i),o+y*(u-o)]):null}function Tr(t,e,n){void 0===n&&(n={});var r=a([1/0,1/0],{dist:1/0}),i=0;return z(t,(function(t){for(var o=Q(t),s=0;s0&&((v=y.features[0]).properties.dist=me(e,v,n),v.properties.location=i+me(u,v,n)),u.properties.dist180?-360:i[0]-o[0]>180?360:0,N(function(t,n,r){var i=r=void 0===r?e:Number(r),o=t[1]*Math.PI/180,s=n[1]*Math.PI/180,a=s-o,u=Math.abs(n[0]-t[0])*Math.PI/180;u>Math.PI&&(u-=2*Math.PI);var l=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),c=Math.abs(l)>1e-11?a/l:Math.cos(o);return Math.sqrt(a*a+c*c*u*u)*i}(i,o),"meters",r.units)}function Dr(t,e,n){if(void 0===n&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=a(t):"Point"===t.type?t=o(t):et(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=h(e):"LineString"===e.type?e=o(e):et(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return U(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=function(t,e,n,r){var i=[n[0]-e[0],n[1]-e[1]],o=Fr([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return kr(t,e,{method:r.method,units:"degrees"});var s=Fr(i,i);if(s<=o)return kr(t,n,{method:r.method,units:"degrees"});var a=o/s,u=[e[0]+a*i[0],e[1]+a*i[1]];return kr(t,u,{method:r.method,units:"degrees"})}(i,e,o,n);s=0&&l<=1&&(p.onLine1=!0),c>=0&&c<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}function qr(t){for(var e=function(t){if("FeatureCollection"!==t.type)return"Feature"!==t.type?f([o(t)]):f([t]);return t}(t),n=xn(e),r=!1,i=0;!r&&i0){e+=Math.abs(Vr(t[0]));for(var n=1;n2){for(s=0;s=c&&p===i.length-1);p++){if(c>e&&0===o.length){if(!(s=e-c))return o.push(i[p]),h(o);a=mn(i[p],i[p-1])-180,u=vn(i[p],s,a,r),o.push(u.geometry.coordinates)}if(c>=n)return(s=n-c)?(a=mn(i[p],i[p-1])-180,u=vn(i[p],s,a,r),o.push(u.geometry.coordinates),h(o)):(o.push(i[p]),h(o));if(c>=e&&o.push(i[p]),p===i.length-1)return h(o);c+=me(i[p],i[p+1],r)}if(ci)return!1}else if(0!==f)return!1;return r?"start"===r?Math.abs(h)>=Math.abs(p)?h>0?a0?u=Math.abs(p)?h>0?a<=o&&o0?u<=s&&s=Math.abs(p)?h>0?a0?u=Math.abs(p)?h>0?a<=o&&o<=l:l<=o&&o<=a:p>0?u<=s&&s<=c:c<=s&&s<=u}function Zr(t,e){var n=rt(t),r=rt(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;ne[0])&&(!(t[2]e[1])&&!(t[3] is required");if("number"!=typeof n)throw new Error(" must be a number");if("number"!=typeof r)throw new Error(" must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return R(t,(function(t){!function(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r=1||u<=0||l>=1||l<=0))){var d=g,y=!o[d];y&&(o[d]=!0),e?i.push(e(g,t,n,c,h,u,s,a,p,f,l,y)):i.push(g)}}function d(t,e){var n,i,o,s,a=r[t][e],u=r[t][e+1];return a[0]p[e.isect].coord?-1:1}));for(u=[];b.length>0;){var C=b.pop(),P=C.isect,M=C.parent,L=C.winding,O=u.length,R=[p[P].coord],T=P;if(p[P].ringAndEdge1Walkable)var A=p[P].ringAndEdge1,D=p[P].nxtIsectAlongRingAndEdge1;else A=p[P].ringAndEdge2,D=p[P].nxtIsectAlongRingAndEdge2;for(;!ci(p[P].coord,p[D].coord);){R.push(p[D].coord);var F=void 0;for(r=0;r1)for(e=0;e=0==e}function li(t){for(var e=0,n=0;n1&&n.push(h(l)),f(n)}function xi(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var n,r=1/0;return F(e,(function(e){var i=Tr(e,t).properties.dist;ic&&f.push(vn(t,e,c,i).geometry.coordinates),h(f,u)}function wi(t){var e=t%360;return e<0&&(e+=360),e}function Ii(t,e){void 0===e&&(e={});var n=rt(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),n.type){case"Polygon":return Ni(n,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var n=rt(t).coordinates,r=e.properties?e.properties:"Feature"===t.type?t.properties:{},i=[];return n.forEach((function(t){i.push(Si(t,r))})),f(i)}(n,e);default:throw new Error("invalid poly")}}function Ni(t,e){return void 0===e&&(e={}),Si(rt(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function Si(t,e){return t.length>1?g(t,e):h(t[0],e)}function Ci(t,e){var n,r,i;void 0===e&&(e={});var o=e.properties,s=null===(n=e.autoComplete)||void 0===n||n,a=null===(r=e.orderCoords)||void 0===r||r;switch(null!==(i=e.mutate)&&void 0!==i&&i||(t=Ie(t)),t.type){case"FeatureCollection":var u=[];return t.features.forEach((function(t){u.push(Q(Pi(t,{},s,a)))})),y(u,o);default:return Pi(t,o,s,a)}}function Pi(t,e,n,r){e=e||("Feature"===t.type?t.properties:{});var i=rt(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=Mi(o)),l([o],e);case"MultiLineString":var a=[],u=0;return o.forEach((function(t){if(n&&(t=Mi(t)),r){var e=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}(Z(h(t)));e>u?(a.unshift(t),u=e):a.push(t)}else a.push(t)})),l(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function Mi(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}function Li(t,e){var n,r,i,o,s,a,u;for(r=1;r<=8;r*=2){for(n=[],o=!(Ri(i=t[t.length-1],e)&r),s=0;se[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function Ti(t,e){for(var n=[],r=0,i=t;r0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&n.push(o))}return n}vi.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=fi*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[fi*Math.atan2(i,r),s]},vi.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;ip&&(d>c&&gc&&du&&(u=y)}var v=[];if(a&&u0&&Math.abs(x-n[m-1][0])>p){var E=parseFloat(n[m-1][0]),b=parseFloat(n[m-1][1]),w=parseFloat(n[m][0]),I=parseFloat(n[m][1]);if(E>-180&&E-180&&n[m-1][0]c&&E<180&&-180===w&&m+1c&&n[m-1][0]<180){_.push([180,n[m][1]]),m++,_.push([n[m][0],n[m][1]]);continue}if(Ec){var N=E;E=w,w=N;var S=b;b=I,I=S}if(E>c&&w=180&&Ec?180:-180,P]),(_=[]).push([n[m-1][0]>c?-180:180,P]),v.push(_)}else _=[],v.push(_);_.push([x,n[m][1]])}else _.push([n[m][0],n[m][1]])}}else{var M=[];v.push(M);for(var L=0;L=0;a--)if(l[a]!=c[a])return!1;for(a=l.length-1;a>=0;a--)if(u=l[a],!n(t[u],o[u],s))return!1;return typeof t==typeof o}(t,o,s))};function r(t){return null==t}function i(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}}));function ki(t,e,n){if(void 0===n&&(n={}),!P(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],s=Mr(),a=Zn(t);return s.load(a),U(e,(function(t){var e=!1;t&&(F(s.search(t),(function(n){if(!1===e){var o=Q(t).sort(),s=Q(n).sort();Fi(o,s)||(0===i?Wr(o[0],n)&&Wr(o[1],n):Tr(n,o[0]).properties.dist<=i&&Tr(n,o[1]).properties.dist<=i)?(e=!0,r=r?Gi(r,t):t):(0===i?Wr(s[0],t)&&Wr(s[1],t):Tr(t,s[0]).properties.dist<=i&&Tr(t,s[1]).properties.dist<=i)&&(r=r?Gi(r,n):n)}})),!1===e&&r&&(o.push(r),r=void 0))})),r&&o.push(r),f(o)}function Gi(t,e){var n=Q(e),r=Q(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return Fi(n[0],i)?s.unshift(n[1]):Fi(n[0],o)?s.push(n[1]):Fi(n[1],i)?s.unshift(n[0]):Fi(n[1],o)&&s.push(n[0]),t}function qi(t){var e=t%360;return e<0&&(e+=360),e}function Bi(t,e,n){var r;return void 0===n&&(n={}),(r=n.final?zi(K(e),K(t)):zi(K(t),K(e)))>180?-(360-r):r}function zi(t,e){var n=I(t[1]),r=I(e[1]),i=I(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(w(Math.atan2(i,o))+360)%360}function ji(t,n,r,i){void 0===i&&(i={});var o=n<0,s=N(Math.abs(n),i.units,"meters");o&&(s=-Math.abs(s));var u=K(t),l=function(t,n,r,i){i=void 0===i?e:Number(i);var o=n/i,s=t[0]*Math.PI/180,a=I(t[1]),u=I(r),l=o*Math.cos(u),c=a+l;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),p=Math.abs(h)>1e-11?l/h:Math.cos(a),f=o*Math.sin(u)/p;return[(180*(s+f)/Math.PI+540)%360-180,180*c/Math.PI]}(u,s,r);return l[0]+=l[0]-u[0]>180?-360:u[0]-l[0]>180?360:0,a(l,i.properties)}function Ui(t,e,n,r,i,o){for(var s=0;s0?Xi(e,a,i)<0||(i=a):n>0&&r<=0&&(Vi(e,a,o)||(o=a)),n=r}return[i,o]}function Vi(t,e,n){return Xi(t,e,n)>0}function Xi(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function Yi(t){for(var e,n,r=Q(t),i=0,o=1;o0}function Hi(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return q(t,(function(t){Hi(t,e)})),t;case"LineString":return Wi(Q(t),e),t;case"Polygon":return Ji(Q(t),e),t;case"MultiLineString":return Q(t).forEach((function(t){Wi(t,e)})),t;case"MultiPolygon":return Q(t).forEach((function(t){Ji(t,e)})),t;case"Point":case"MultiPoint":return t}}function Wi(t,e){Yi(t)===e&&t.reverse()}function Ji(t,e){Yi(t[0])!==e&&t[0].reverse();for(var n=1;n + * v. 1.2.0 + * https://github.com/RaumZeit/MarchingSquares.js + * + * MarchingSquaresJS is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MarchingSquaresJS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * As additional permission under GNU Affero General Public License version 3 + * section 7, third-party projects (personal or commercial) may distribute, + * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the + * requirement that said third-party project for that reason alone becomes + * subject to any requirement of the GNU Affero General Public License version 3. + * Any modifications to MarchingSquaresJS, however, must be shared with the public + * and made available. + * + * In summary this: + * - allows you to use MarchingSquaresJS at no cost + * - allows you to use MarchingSquaresJS for both personal and commercial purposes + * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any + * license as long as this license notice is included + * - enables you to keep the source code of your program that uses MarchingSquaresJS + * undisclosed + * - forces you to share any modifications you have made to MarchingSquaresJS, + * e.g. bug-fixes + * + * You should have received a copy of the GNU Affero General Public License + * along with MarchingSquaresJS. If not, see . + */(t,r),s=[],a=0;as?128:64,l|=hs?32:16,l|=ps?8:4;var g=+(l|=fs?2:1),d=0;if(17===l||18===l||33===l||34===l||38===l||68===l||72===l||98===l||102===l||132===l||136===l||137===l||152===l||153===l){var y=(c+h+p+f)/4;d=y>s?2:y0?(l=156,d=4):l=152:33===l?d>0?(l=139,d=4):l=137:72===l?d>0?(l=99,d=4):l=98:132===l&&(d>0?(l=39,d=4):l=38)}if(0!=l&&170!=l){var v,_,m,x,E,b,w,I;v=_=m=x=E=b=w=I=.5;var N=[];1===l?(m=1-Vo(e,p,f),I=1-Vo(e,c,f),N.push(Go[l])):169===l?(m=Vo(s,f,p),I=Vo(s,f,c),N.push(Go[l])):4===l?(b=1-Vo(e,h,p),x=Vo(e,f,p),N.push(Fo[l])):166===l?(b=Vo(s,p,h),x=1-Vo(s,p,f),N.push(Fo[l])):16===l?(E=Vo(e,p,h),_=Vo(e,c,h),N.push(Do[l])):154===l?(E=1-Vo(s,h,p),_=1-Vo(s,h,c),N.push(Do[l])):64===l?(w=Vo(e,f,c),v=1-Vo(e,h,c),N.push(Bo[l])):106===l?(w=1-Vo(s,c,f),v=Vo(s,c,h),N.push(Bo[l])):168===l?(x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),N.push(ko[l]),N.push(Go[l])):2===l?(x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),N.push(ko[l]),N.push(Go[l])):162===l?(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),N.push(ko[l]),N.push(Go[l])):8===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),N.push(Do[l]),N.push(Fo[l])):138===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(Do[l]),N.push(Fo[l])):32===l?(E=Vo(s,p,h),b=Vo(e,p,h),v=Vo(e,c,h),_=Vo(s,c,h),N.push(Do[l]),N.push(Fo[l])):42===l?(I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h),N.push(qo[l]),N.push(Bo[l])):128===l&&(I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(qo[l]),N.push(Bo[l])),5===l?(b=1-Vo(e,h,p),I=1-Vo(e,c,f),N.push(Fo[l])):165===l?(b=Vo(s,p,h),I=Vo(s,f,c),N.push(Fo[l])):20===l?(x=Vo(e,f,p),_=Vo(e,c,h),N.push(ko[l])):150===l?(x=1-Vo(s,p,f),_=1-Vo(s,h,c),N.push(ko[l])):80===l?(E=Vo(e,p,h),w=Vo(e,f,c),N.push(Do[l])):90===l?(E=1-Vo(s,h,p),w=1-Vo(s,c,f),N.push(Do[l])):65===l?(m=1-Vo(e,p,f),v=1-Vo(e,h,c),N.push(Go[l])):105===l?(m=Vo(s,f,p),v=Vo(s,c,h),N.push(Go[l])):160===l?(E=Vo(s,p,h),b=Vo(e,p,h),I=Vo(e,f,c),w=Vo(s,f,c),N.push(Do[l]),N.push(Fo[l])):10===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),I=1-Vo(s,c,f),w=1-Vo(e,c,f),N.push(Do[l]),N.push(Fo[l])):130===l?(x=1-Vo(e,p,f),m=1-Vo(s,p,f),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(ko[l]),N.push(Go[l])):40===l?(x=Vo(s,f,p),m=Vo(e,f,p),v=Vo(e,c,h),_=Vo(s,c,h),N.push(ko[l]),N.push(Go[l])):101===l?(b=Vo(s,p,h),v=Vo(s,c,h),N.push(Fo[l])):69===l?(b=1-Vo(e,h,p),v=1-Vo(e,h,c),N.push(Fo[l])):149===l?(I=Vo(s,f,c),_=1-Vo(s,h,c),N.push(qo[l])):21===l?(I=1-Vo(e,c,f),_=Vo(e,c,h),N.push(qo[l])):86===l?(x=1-Vo(s,p,f),w=1-Vo(s,c,f),N.push(ko[l])):84===l?(x=Vo(e,f,p),w=Vo(e,f,c),N.push(ko[l])):89===l?(E=1-Vo(s,h,p),m=Vo(s,f,p),N.push(Go[l])):81===l?(E=Vo(e,p,h),m=1-Vo(e,p,f),N.push(Go[l])):96===l?(E=Vo(s,p,h),b=Vo(e,p,h),w=Vo(e,f,c),v=Vo(s,c,h),N.push(Do[l]),N.push(Fo[l])):74===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),w=1-Vo(s,c,f),v=1-Vo(e,h,c),N.push(Do[l]),N.push(Fo[l])):24===l?(E=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),_=Vo(e,c,h),N.push(Do[l]),N.push(Go[l])):146===l?(E=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),_=1-Vo(s,h,c),N.push(Do[l]),N.push(Go[l])):6===l?(b=1-Vo(e,h,p),x=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),N.push(Fo[l]),N.push(ko[l])):164===l?(b=Vo(s,p,h),x=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),N.push(Fo[l]),N.push(ko[l])):129===l?(m=1-Vo(e,p,f),I=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(Go[l]),N.push(qo[l])):41===l?(m=Vo(s,f,p),I=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h),N.push(Go[l]),N.push(qo[l])):66===l?(x=1-Vo(e,p,f),m=1-Vo(s,p,f),w=1-Vo(s,c,f),v=1-Vo(e,h,c),N.push(ko[l]),N.push(Go[l])):104===l?(x=Vo(s,f,p),m=Vo(e,f,p),w=Vo(e,f,c),v=Vo(s,c,h),N.push(Go[l]),N.push(zo[l])):144===l?(E=Vo(e,p,h),I=Vo(e,f,c),w=Vo(s,f,c),_=1-Vo(s,h,c),N.push(Do[l]),N.push(Bo[l])):26===l?(E=1-Vo(s,h,p),I=1-Vo(s,c,f),w=1-Vo(e,c,f),_=Vo(e,c,h),N.push(Do[l]),N.push(Bo[l])):36===l?(b=Vo(s,p,h),x=Vo(e,f,p),v=Vo(e,c,h),_=Vo(s,c,h),N.push(Fo[l]),N.push(ko[l])):134===l?(b=1-Vo(e,h,p),x=1-Vo(s,p,f),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(Fo[l]),N.push(ko[l])):9===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),m=Vo(s,f,p),I=1-Vo(e,c,f),N.push(Do[l]),N.push(Fo[l])):161===l?(E=Vo(s,p,h),b=Vo(e,p,h),m=1-Vo(e,p,f),I=Vo(s,f,c),N.push(Do[l]),N.push(Fo[l])):37===l?(b=Vo(s,p,h),I=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h),N.push(Fo[l]),N.push(qo[l])):133===l?(b=1-Vo(e,h,p),I=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c),N.push(Fo[l]),N.push(qo[l])):148===l?(x=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),_=1-Vo(s,h,c),N.push(ko[l]),N.push(Bo[l])):22===l?(x=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),_=Vo(e,c,h),N.push(ko[l]),N.push(Bo[l])):82===l?(E=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),w=1-Vo(s,c,f),N.push(Do[l]),N.push(Go[l])):88===l?(E=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),w=Vo(e,f,c),N.push(Do[l]),N.push(Go[l])):73===l?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),m=Vo(s,f,p),v=1-Vo(e,h,c),N.push(Do[l]),N.push(Fo[l])):97===l?(E=Vo(s,p,h),b=Vo(e,p,h),m=1-Vo(e,p,f),v=Vo(s,c,h),N.push(Do[l]),N.push(Fo[l])):145===l?(E=Vo(e,p,h),m=1-Vo(e,p,f),I=Vo(s,f,c),_=1-Vo(s,h,c),N.push(Do[l]),N.push(qo[l])):25===l?(E=1-Vo(s,h,p),m=Vo(s,f,p),I=1-Vo(e,c,f),_=Vo(e,c,h),N.push(Do[l]),N.push(qo[l])):70===l?(b=1-Vo(e,h,p),x=1-Vo(s,p,f),w=1-Vo(s,c,f),v=1-Vo(e,h,c),N.push(Fo[l]),N.push(ko[l])):100===l?(b=Vo(s,p,h),x=Vo(e,f,p),w=Vo(e,f,c),v=Vo(s,c,h),N.push(Fo[l]),N.push(ko[l])):34===l?(0===d?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)):(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)),N.push(Do[l]),N.push(Fo[l]),N.push(qo[l]),N.push(Bo[l])):35===l?(4===d?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)):(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)),N.push(Do[l]),N.push(Fo[l]),N.push(Go[l]),N.push(Bo[l])):136===l?(0===d?(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)):(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)),N.push(Do[l]),N.push(Fo[l]),N.push(qo[l]),N.push(Bo[l])):153===l?(0===d?(E=Vo(e,p,h),m=1-Vo(e,p,f),I=1-Vo(e,c,f),_=Vo(e,c,h)):(E=1-Vo(s,h,p),m=Vo(s,f,p),I=Vo(s,f,c),_=1-Vo(s,h,c)),N.push(Do[l]),N.push(Go[l])):102===l?(0===d?(b=1-Vo(e,h,p),x=Vo(e,f,p),w=Vo(e,f,c),v=1-Vo(e,h,c)):(b=Vo(s,p,h),x=1-Vo(s,p,f),w=1-Vo(s,c,f),v=Vo(s,c,h)),N.push(Fo[l]),N.push(Bo[l])):155===l?(4===d?(E=Vo(e,p,h),m=1-Vo(e,p,f),I=1-Vo(e,c,f),_=Vo(e,c,h)):(E=1-Vo(s,h,p),m=Vo(s,f,p),I=Vo(s,f,c),_=1-Vo(s,h,c)),N.push(Do[l]),N.push(qo[l])):103===l?(4===d?(b=1-Vo(e,h,p),x=Vo(e,f,p),w=Vo(e,f,c),v=1-Vo(e,h,c)):(b=Vo(s,p,h),x=1-Vo(s,p,f),w=1-Vo(s,c,f),v=Vo(s,c,h)),N.push(Fo[l]),N.push(ko[l])):152===l?(0===d?(E=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),_=Vo(e,c,h)):(E=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),_=1-Vo(s,h,c)),N.push(Do[l]),N.push(ko[l]),N.push(Go[l])):156===l?(4===d?(E=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),_=Vo(e,c,h)):(E=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),_=1-Vo(s,h,c)),N.push(Do[l]),N.push(Go[l]),N.push(Bo[l])):137===l?(0===d?(E=Vo(s,p,h),b=Vo(e,p,h),m=1-Vo(e,p,f),I=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)):(E=1-Vo(e,h,p),b=1-Vo(s,h,p),m=Vo(s,f,p),I=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)),N.push(Do[l]),N.push(Fo[l]),N.push(Go[l])):139===l?(4===d?(E=Vo(s,p,h),b=Vo(e,p,h),m=1-Vo(e,p,f),I=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)):(E=1-Vo(e,h,p),b=1-Vo(s,h,p),m=Vo(s,f,p),I=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)),N.push(Do[l]),N.push(Fo[l]),N.push(qo[l])):98===l?(0===d?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),w=Vo(e,f,c),v=1-Vo(e,h,c)):(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),w=1-Vo(s,c,f),v=Vo(s,c,h)),N.push(Do[l]),N.push(Fo[l]),N.push(Bo[l])):99===l?(4===d?(E=1-Vo(e,h,p),b=1-Vo(s,h,p),x=Vo(s,f,p),m=Vo(e,f,p),w=Vo(e,f,c),v=1-Vo(e,h,c)):(E=Vo(s,p,h),b=Vo(e,p,h),x=1-Vo(e,p,f),m=1-Vo(s,p,f),w=1-Vo(s,c,f),v=Vo(s,c,h)),N.push(Do[l]),N.push(Fo[l]),N.push(Go[l])):38===l?(0===d?(b=1-Vo(e,h,p),x=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)):(b=Vo(s,p,h),x=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)),N.push(Fo[l]),N.push(qo[l]),N.push(Bo[l])):39===l?(4===d?(b=1-Vo(e,h,p),x=Vo(e,f,p),I=Vo(e,f,c),w=Vo(s,f,c),v=1-Vo(s,h,c),_=1-Vo(e,h,c)):(b=Vo(s,p,h),x=1-Vo(s,p,f),I=1-Vo(s,c,f),w=1-Vo(e,c,f),v=Vo(e,c,h),_=Vo(s,c,h)),N.push(Fo[l]),N.push(ko[l]),N.push(Bo[l])):85===l&&(E=1,b=0,x=1,m=0,I=0,w=1,v=0,_=1),(v<0||v>1||_<0||_>1||E<0||E>1||x<0||x>1||I<0||I>1||w<0||w>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+g+" "+c+","+h+","+p+","+f+" "+d+" "+v+" "+_+" "+E+" "+b+" "+x+" "+m+" "+I+" "+w),o.cells[a][u]={cval:l,cval_real:g,flipped:d,topleft:v,topright:_,righttop:E,rightbottom:b,bottomright:x,bottomleft:m,leftbottom:I,lefttop:w,edges:N}}}}}return o}(t,e,n);return Qi.polygons?(Qi.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],n=0;return t.cells.forEach((function(t,r){t.forEach((function(t,i){if(void 0!==t){var o=Uo[t.cval](t);"object"==typeof o&&Xo(o)?"object"==typeof o[0]&&Xo(o[0])?"object"==typeof o[0][0]&&Xo(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(l)):(Qi.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o0){var a=Ho(t.cells[o][s]),u=null,l=s,c=o;null!==a&&i.push([a.p[0]+l,a.p[1]+c]);do{if(null===(u=Wo(t.cells[c][l],a.x,a.y,a.o)))break;if(i.push([u.p[0]+l,u.p[1]+c]),l+=u.x,a=u,(c+=u.y)<0||c>=n||l<0||l>=r||void 0===t.cells[c][l]){var h=Yo(t,l-=u.x,c-=u.y,u.x,u.y,u.o);if(null===h)break;h.path.forEach((function(t){i.push(t)})),l=h.i,c=h.j,a=h}}while(void 0!==t.cells[c][l]&&t.cells[c][l].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}(l)),"function"==typeof Qi.successCallback&&Qi.successCallback(u),u}var to=64,eo=16,no=[],ro=[],io=[],oo=[],so=[],ao=[],uo=[],lo=[],co=[],ho=[],po=[],fo=[],go=[],yo=[],vo=[],_o=[],mo=[],xo=[],Eo=[],bo=[],wo=[],Io=[],No=[],So=[];uo[85]=ho[85]=-1,lo[85]=po[85]=0,co[85]=fo[85]=1,Eo[85]=Io[85]=1,bo[85]=No[85]=0,wo[85]=So[85]=1,no[85]=oo[85]=0,ro[85]=so[85]=-1,io[85]=vo[85]=0,_o[85]=go[85]=0,mo[85]=yo[85]=1,ao[85]=xo[85]=1,Io[1]=Io[169]=0,No[1]=No[169]=-1,So[1]=So[169]=0,go[1]=go[169]=-1,yo[1]=yo[169]=0,vo[1]=vo[169]=0,ho[4]=ho[166]=0,po[4]=po[166]=-1,fo[4]=fo[166]=1,_o[4]=_o[166]=1,mo[4]=mo[166]=0,xo[4]=xo[166]=0,uo[16]=uo[154]=0,lo[16]=lo[154]=1,co[16]=co[154]=1,oo[16]=oo[154]=1,so[16]=so[154]=0,ao[16]=ao[154]=1,Eo[64]=Eo[106]=0,bo[64]=bo[106]=1,wo[64]=wo[106]=0,no[64]=no[106]=-1,ro[64]=ro[106]=0,io[64]=io[106]=1,Eo[2]=Eo[168]=0,bo[2]=bo[168]=-1,wo[2]=wo[168]=1,Io[2]=Io[168]=0,No[2]=No[168]=-1,So[2]=So[168]=0,go[2]=go[168]=-1,yo[2]=yo[168]=0,vo[2]=vo[168]=0,_o[2]=_o[168]=-1,mo[2]=mo[168]=0,xo[2]=xo[168]=1,uo[8]=uo[162]=0,lo[8]=lo[162]=-1,co[8]=co[162]=0,ho[8]=ho[162]=0,po[8]=po[162]=-1,fo[8]=fo[162]=1,go[8]=go[162]=1,yo[8]=yo[162]=0,vo[8]=vo[162]=1,_o[8]=_o[162]=1,mo[8]=mo[162]=0,xo[8]=xo[162]=0,uo[32]=uo[138]=0,lo[32]=lo[138]=1,co[32]=co[138]=1,ho[32]=ho[138]=0,po[32]=po[138]=1,fo[32]=fo[138]=0,no[32]=no[138]=1,ro[32]=ro[138]=0,io[32]=io[138]=0,oo[32]=oo[138]=1,so[32]=so[138]=0,ao[32]=ao[138]=1,Io[128]=Io[42]=0,No[128]=No[42]=1,So[128]=So[42]=1,Eo[128]=Eo[42]=0,bo[128]=bo[42]=1,wo[128]=wo[42]=0,no[128]=no[42]=-1,ro[128]=ro[42]=0,io[128]=io[42]=1,oo[128]=oo[42]=-1,so[128]=so[42]=0,ao[128]=ao[42]=0,ho[5]=ho[165]=-1,po[5]=po[165]=0,fo[5]=fo[165]=0,Io[5]=Io[165]=1,No[5]=No[165]=0,So[5]=So[165]=0,_o[20]=_o[150]=0,mo[20]=mo[150]=1,xo[20]=xo[150]=1,oo[20]=oo[150]=0,so[20]=so[150]=-1,ao[20]=ao[150]=1,uo[80]=uo[90]=-1,lo[80]=lo[90]=0,co[80]=co[90]=1,Eo[80]=Eo[90]=1,bo[80]=bo[90]=0,wo[80]=wo[90]=1,go[65]=go[105]=0,yo[65]=yo[105]=1,vo[65]=vo[105]=0,no[65]=no[105]=0,ro[65]=ro[105]=-1,io[65]=io[105]=0,uo[160]=uo[10]=-1,lo[160]=lo[10]=0,co[160]=co[10]=1,ho[160]=ho[10]=-1,po[160]=po[10]=0,fo[160]=fo[10]=0,Io[160]=Io[10]=1,No[160]=No[10]=0,So[160]=So[10]=0,Eo[160]=Eo[10]=1,bo[160]=bo[10]=0,wo[160]=wo[10]=1,_o[130]=_o[40]=0,mo[130]=mo[40]=1,xo[130]=xo[40]=1,go[130]=go[40]=0,yo[130]=yo[40]=1,vo[130]=vo[40]=0,no[130]=no[40]=0,ro[130]=ro[40]=-1,io[130]=io[40]=0,oo[130]=oo[40]=0,so[130]=so[40]=-1,ao[130]=ao[40]=1,ho[37]=ho[133]=0,po[37]=po[133]=1,fo[37]=fo[133]=1,Io[37]=Io[133]=0,No[37]=No[133]=1,So[37]=So[133]=0,no[37]=no[133]=-1,ro[37]=ro[133]=0,io[37]=io[133]=0,oo[37]=oo[133]=1,so[37]=so[133]=0,ao[37]=ao[133]=0,_o[148]=_o[22]=-1,mo[148]=mo[22]=0,xo[148]=xo[22]=0,Io[148]=Io[22]=0,No[148]=No[22]=-1,So[148]=So[22]=1,Eo[148]=Eo[22]=0,bo[148]=bo[22]=1,wo[148]=wo[22]=1,oo[148]=oo[22]=-1,so[148]=so[22]=0,ao[148]=ao[22]=1,uo[82]=uo[88]=0,lo[82]=lo[88]=-1,co[82]=co[88]=1,_o[82]=_o[88]=1,mo[82]=mo[88]=0,xo[82]=xo[88]=1,go[82]=go[88]=-1,yo[82]=yo[88]=0,vo[82]=vo[88]=1,Eo[82]=Eo[88]=0,bo[82]=bo[88]=-1,wo[82]=wo[88]=0,uo[73]=uo[97]=0,lo[73]=lo[97]=1,co[73]=co[97]=0,ho[73]=ho[97]=0,po[73]=po[97]=-1,fo[73]=fo[97]=0,go[73]=go[97]=1,yo[73]=yo[97]=0,vo[73]=vo[97]=0,no[73]=no[97]=1,ro[73]=ro[97]=0,io[73]=io[97]=1,uo[145]=uo[25]=0,lo[145]=lo[25]=-1,co[145]=co[25]=0,go[145]=go[25]=1,yo[145]=yo[25]=0,vo[145]=vo[25]=1,Io[145]=Io[25]=0,No[145]=No[25]=1,So[145]=So[25]=1,oo[145]=oo[25]=-1,so[145]=so[25]=0,ao[145]=ao[25]=0,ho[70]=ho[100]=0,po[70]=po[100]=1,fo[70]=fo[100]=0,_o[70]=_o[100]=-1,mo[70]=mo[100]=0,xo[70]=xo[100]=1,Eo[70]=Eo[100]=0,bo[70]=bo[100]=-1,wo[70]=wo[100]=1,no[70]=no[100]=1,ro[70]=ro[100]=0,io[70]=io[100]=0,ho[101]=ho[69]=0,po[101]=po[69]=1,fo[101]=fo[69]=0,no[101]=no[69]=1,ro[101]=ro[69]=0,io[101]=io[69]=0,Io[149]=Io[21]=0,No[149]=No[21]=1,So[149]=So[21]=1,oo[149]=oo[21]=-1,so[149]=so[21]=0,ao[149]=ao[21]=0,_o[86]=_o[84]=-1,mo[86]=mo[84]=0,xo[86]=xo[84]=1,Eo[86]=Eo[84]=0,bo[86]=bo[84]=-1,wo[86]=wo[84]=1,uo[89]=uo[81]=0,lo[89]=lo[81]=-1,co[89]=co[81]=0,go[89]=go[81]=1,yo[89]=yo[81]=0,vo[89]=vo[81]=1,uo[96]=uo[74]=0,lo[96]=lo[74]=1,co[96]=co[74]=0,ho[96]=ho[74]=-1,po[96]=po[74]=0,fo[96]=fo[74]=1,Eo[96]=Eo[74]=1,bo[96]=bo[74]=0,wo[96]=wo[74]=0,no[96]=no[74]=1,ro[96]=ro[74]=0,io[96]=io[74]=1,uo[24]=uo[146]=0,lo[24]=lo[146]=-1,co[24]=co[146]=1,_o[24]=_o[146]=1,mo[24]=mo[146]=0,xo[24]=xo[146]=1,go[24]=go[146]=0,yo[24]=yo[146]=1,vo[24]=vo[146]=1,oo[24]=oo[146]=0,so[24]=so[146]=-1,ao[24]=ao[146]=0,ho[6]=ho[164]=-1,po[6]=po[164]=0,fo[6]=fo[164]=1,_o[6]=_o[164]=-1,mo[6]=mo[164]=0,xo[6]=xo[164]=0,Io[6]=Io[164]=0,No[6]=No[164]=-1,So[6]=So[164]=1,Eo[6]=Eo[164]=1,bo[6]=bo[164]=0,wo[6]=wo[164]=0,go[129]=go[41]=0,yo[129]=yo[41]=1,vo[129]=vo[41]=1,Io[129]=Io[41]=0,No[129]=No[41]=1,So[129]=So[41]=0,no[129]=no[41]=-1,ro[129]=ro[41]=0,io[129]=io[41]=0,oo[129]=oo[41]=0,so[129]=so[41]=-1,ao[129]=ao[41]=0,_o[66]=_o[104]=0,mo[66]=mo[104]=1,xo[66]=xo[104]=0,go[66]=go[104]=-1,yo[66]=yo[104]=0,vo[66]=vo[104]=1,Eo[66]=Eo[104]=0,bo[66]=bo[104]=-1,wo[66]=wo[104]=0,no[66]=no[104]=0,ro[66]=ro[104]=-1,io[66]=io[104]=1,uo[144]=uo[26]=-1,lo[144]=lo[26]=0,co[144]=co[26]=0,Io[144]=Io[26]=1,No[144]=No[26]=0,So[144]=So[26]=1,Eo[144]=Eo[26]=0,bo[144]=bo[26]=1,wo[144]=wo[26]=1,oo[144]=oo[26]=-1,so[144]=so[26]=0,ao[144]=ao[26]=1,ho[36]=ho[134]=0,po[36]=po[134]=1,fo[36]=fo[134]=1,_o[36]=_o[134]=0,mo[36]=mo[134]=1,xo[36]=xo[134]=0,no[36]=no[134]=0,ro[36]=ro[134]=-1,io[36]=io[134]=1,oo[36]=oo[134]=1,so[36]=so[134]=0,ao[36]=ao[134]=0,uo[9]=uo[161]=-1,lo[9]=lo[161]=0,co[9]=co[161]=0,ho[9]=ho[161]=0,po[9]=po[161]=-1,fo[9]=fo[161]=0,go[9]=go[161]=1,yo[9]=yo[161]=0,vo[9]=vo[161]=0,Io[9]=Io[161]=1,No[9]=No[161]=0,So[9]=So[161]=1,uo[136]=0,lo[136]=1,co[136]=1,ho[136]=0,po[136]=1,fo[136]=0,_o[136]=-1,mo[136]=0,xo[136]=1,go[136]=-1,yo[136]=0,vo[136]=0,Io[136]=0,No[136]=-1,So[136]=0,Eo[136]=0,bo[136]=-1,wo[136]=1,no[136]=1,ro[136]=0,io[136]=0,oo[136]=1,so[136]=0,ao[136]=1,uo[34]=0,lo[34]=-1,co[34]=0,ho[34]=0,po[34]=-1,fo[34]=1,_o[34]=1,mo[34]=0,xo[34]=0,go[34]=1,yo[34]=0,vo[34]=1,Io[34]=0,No[34]=1,So[34]=1,Eo[34]=0,bo[34]=1,wo[34]=0,no[34]=-1,ro[34]=0,io[34]=1,oo[34]=-1,so[34]=0,ao[34]=0,uo[35]=0,lo[35]=1,co[35]=1,ho[35]=0,po[35]=-1,fo[35]=1,_o[35]=1,mo[35]=0,xo[35]=0,go[35]=-1,yo[35]=0,vo[35]=0,Io[35]=0,No[35]=-1,So[35]=0,Eo[35]=0,bo[35]=1,wo[35]=0,no[35]=-1,ro[35]=0,io[35]=1,oo[35]=1,so[35]=0,ao[35]=1,uo[153]=0,lo[153]=1,co[153]=1,go[153]=-1,yo[153]=0,vo[153]=0,Io[153]=0,No[153]=-1,So[153]=0,oo[153]=1,so[153]=0,ao[153]=1,ho[102]=0,po[102]=-1,fo[102]=1,_o[102]=1,mo[102]=0,xo[102]=0,Eo[102]=0,bo[102]=1,wo[102]=0,no[102]=-1,ro[102]=0,io[102]=1,uo[155]=0,lo[155]=-1,co[155]=0,go[155]=1,yo[155]=0,vo[155]=1,Io[155]=0,No[155]=1,So[155]=1,oo[155]=-1,so[155]=0,ao[155]=0,ho[103]=0,po[103]=1,fo[103]=0,_o[103]=-1,mo[103]=0,xo[103]=1,Eo[103]=0,bo[103]=-1,wo[103]=1,no[103]=1,ro[103]=0,io[103]=0,uo[152]=0,lo[152]=1,co[152]=1,_o[152]=-1,mo[152]=0,xo[152]=1,go[152]=-1,yo[152]=0,vo[152]=0,Io[152]=0,No[152]=-1,So[152]=0,Eo[152]=0,bo[152]=-1,wo[152]=1,oo[152]=1,so[152]=0,ao[152]=1,uo[156]=0,lo[156]=-1,co[156]=1,_o[156]=1,mo[156]=0,xo[156]=1,go[156]=-1,yo[156]=0,vo[156]=0,Io[156]=0,No[156]=-1,So[156]=0,Eo[156]=0,bo[156]=1,wo[156]=1,oo[156]=-1,so[156]=0,ao[156]=1,uo[137]=0,lo[137]=1,co[137]=1,ho[137]=0,po[137]=1,fo[137]=0,go[137]=-1,yo[137]=0,vo[137]=0,Io[137]=0,No[137]=-1,So[137]=0,no[137]=1,ro[137]=0,io[137]=0,oo[137]=1,so[137]=0,ao[137]=1,uo[139]=0,lo[139]=1,co[139]=1,ho[139]=0,po[139]=-1,fo[139]=0,go[139]=1,yo[139]=0,vo[139]=0,Io[139]=0,No[139]=1,So[139]=0,no[139]=-1,ro[139]=0,io[139]=0,oo[139]=1,so[139]=0,ao[139]=1,uo[98]=0,lo[98]=-1,co[98]=0,ho[98]=0,po[98]=-1,fo[98]=1,_o[98]=1,mo[98]=0,xo[98]=0,go[98]=1,yo[98]=0,vo[98]=1,Eo[98]=0,bo[98]=1,wo[98]=0,no[98]=-1,ro[98]=0,io[98]=1,uo[99]=0,lo[99]=1,co[99]=0,ho[99]=0,po[99]=-1,fo[99]=1,_o[99]=1,mo[99]=0,xo[99]=0,go[99]=-1,yo[99]=0,vo[99]=1,Eo[99]=0,bo[99]=-1,wo[99]=0,no[99]=1,ro[99]=0,io[99]=1,ho[38]=0,po[38]=-1,fo[38]=1,_o[38]=1,mo[38]=0,xo[38]=0,Io[38]=0,No[38]=1,So[38]=1,Eo[38]=0,bo[38]=1,wo[38]=0,no[38]=-1,ro[38]=0,io[38]=1,oo[38]=-1,so[38]=0,ao[38]=0,ho[39]=0,po[39]=1,fo[39]=1,_o[39]=-1,mo[39]=0,xo[39]=0,Io[39]=0,No[39]=-1,So[39]=1,Eo[39]=0,bo[39]=1,wo[39]=0,no[39]=-1,ro[39]=0,io[39]=1,oo[39]=1,so[39]=0,ao[39]=0;var Co=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Po=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},Mo=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},Lo=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},Oo=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},Ro=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},To=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},Ao=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Do=[],Fo=[],ko=[],Go=[],qo=[],Bo=[],zo=[],jo=[];Go[1]=qo[1]=18,Go[169]=qo[169]=18,ko[4]=Fo[4]=12,ko[166]=Fo[166]=12,Do[16]=jo[16]=4,Do[154]=jo[154]=4,Bo[64]=zo[64]=22,Bo[106]=zo[106]=22,ko[2]=Bo[2]=17,Go[2]=qo[2]=18,ko[168]=Bo[168]=17,Go[168]=qo[168]=18,Do[8]=Go[8]=9,Fo[8]=ko[8]=12,Do[162]=Go[162]=9,Fo[162]=ko[162]=12,Do[32]=jo[32]=4,Fo[32]=zo[32]=1,Do[138]=jo[138]=4,Fo[138]=zo[138]=1,qo[128]=jo[128]=21,Bo[128]=zo[128]=22,qo[42]=jo[42]=21,Bo[42]=zo[42]=22,Fo[5]=qo[5]=14,Fo[165]=qo[165]=14,ko[20]=jo[20]=6,ko[150]=jo[150]=6,Do[80]=Bo[80]=11,Do[90]=Bo[90]=11,Go[65]=zo[65]=3,Go[105]=zo[105]=3,Do[160]=Bo[160]=11,Fo[160]=qo[160]=14,Do[10]=Bo[10]=11,Fo[10]=qo[10]=14,ko[130]=jo[130]=6,Go[130]=zo[130]=3,ko[40]=jo[40]=6,Go[40]=zo[40]=3,Fo[101]=zo[101]=1,Fo[69]=zo[69]=1,qo[149]=jo[149]=21,qo[21]=jo[21]=21,ko[86]=Bo[86]=17,ko[84]=Bo[84]=17,Do[89]=Go[89]=9,Do[81]=Go[81]=9,Do[96]=zo[96]=0,Fo[96]=Bo[96]=15,Do[74]=zo[74]=0,Fo[74]=Bo[74]=15,Do[24]=ko[24]=8,Go[24]=jo[24]=7,Do[146]=ko[146]=8,Go[146]=jo[146]=7,Fo[6]=Bo[6]=15,ko[6]=qo[6]=16,Fo[164]=Bo[164]=15,ko[164]=qo[164]=16,Go[129]=jo[129]=7,qo[129]=zo[129]=20,Go[41]=jo[41]=7,qo[41]=zo[41]=20,ko[66]=zo[66]=2,Go[66]=Bo[66]=19,ko[104]=zo[104]=2,Go[104]=Bo[104]=19,Do[144]=qo[144]=10,Bo[144]=jo[144]=23,Do[26]=qo[26]=10,Bo[26]=jo[26]=23,Fo[36]=jo[36]=5,ko[36]=zo[36]=2,Fo[134]=jo[134]=5,ko[134]=zo[134]=2,Do[9]=qo[9]=10,Fo[9]=Go[9]=13,Do[161]=qo[161]=10,Fo[161]=Go[161]=13,Fo[37]=jo[37]=5,qo[37]=zo[37]=20,Fo[133]=jo[133]=5,qo[133]=zo[133]=20,ko[148]=qo[148]=16,Bo[148]=jo[148]=23,ko[22]=qo[22]=16,Bo[22]=jo[22]=23,Do[82]=ko[82]=8,Go[82]=Bo[82]=19,Do[88]=ko[88]=8,Go[88]=Bo[88]=19,Do[73]=zo[73]=0,Fo[73]=Go[73]=13,Do[97]=zo[97]=0,Fo[97]=Go[97]=13,Do[145]=Go[145]=9,qo[145]=jo[145]=21,Do[25]=Go[25]=9,qo[25]=jo[25]=21,Fo[70]=zo[70]=1,ko[70]=Bo[70]=17,Fo[100]=zo[100]=1,ko[100]=Bo[100]=17,Do[34]=Go[34]=9,Fo[34]=ko[34]=12,qo[34]=jo[34]=21,Bo[34]=zo[34]=22,Do[136]=jo[136]=4,Fo[136]=zo[136]=1,ko[136]=Bo[136]=17,Go[136]=qo[136]=18,Do[35]=jo[35]=4,Fo[35]=ko[35]=12,Go[35]=qo[35]=18,Bo[35]=zo[35]=22,Do[153]=jo[153]=4,Go[153]=qo[153]=18,Fo[102]=ko[102]=12,Bo[102]=zo[102]=22,Do[155]=Go[155]=9,qo[155]=jo[155]=23,Fo[103]=zo[103]=1,ko[103]=Bo[103]=17,Do[152]=jo[152]=4,ko[152]=Bo[152]=17,Go[152]=qo[152]=18,Do[156]=ko[156]=8,Go[156]=qo[156]=18,Bo[156]=jo[156]=23,Do[137]=jo[137]=4,Fo[137]=zo[137]=1,Go[137]=qo[137]=18,Do[139]=jo[139]=4,Fo[139]=Go[139]=13,qo[139]=zo[139]=20,Do[98]=Go[98]=9,Fo[98]=ko[98]=12,Bo[98]=zo[98]=22,Do[99]=zo[99]=0,Fo[99]=ko[99]=12,Go[99]=Bo[99]=19,Fo[38]=ko[38]=12,qo[38]=jo[38]=21,Bo[38]=zo[38]=22,Fo[39]=jo[39]=5,ko[39]=qo[39]=16,Bo[39]=zo[39]=22;var Uo=[];function Vo(t,e,n){return(t-e)/(n-e)}function Xo(t){return t.constructor.toString().indexOf("Array")>-1}function Yo(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=r,a=(s=t.cells[l][u]).cval_real,-1===i)if(0===o)if(1&a)c.push([u,l]),r=-1,i=0,o=0;else{if(!(4&a)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+1,l]),r=1,i=0,o=0}else{if(!(1&a)){if(4&a){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+s.bottomleft,l]),r=0,i=1,o=0,h=!0;break}c.push([u,l]),r=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&eo)){if(a&to){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+s.topright,l+1]),r=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),r=1,i=0,o=1}else c.push([u+1,l+1]),r=1,i=0,o=1;else if(-1===r)if(0===o){if(!(a&to)){if(1&a){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+s.lefttop]),r=1,i=0,o=1,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}else{if(!(a&to)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),r=0,i=1,o=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&a)){c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}else{if(!(4&a)){if(a&eo){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}}else if(a=(s=t.cells[l][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])r=0,i=-1,o=1;else{if(!(1&a)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(a&to)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===r){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l+1]&&void 0!==t.cells[l+1][u])r=0,i=1,o=0;else{if(!(a&eo)){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+1,l+1]),r=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u+1])r=1,i=0,o=1;else{if(!(4&a)){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u-1])r=-1,i=0,o=0;else{if(!(a&to)){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:c,i:u,j:l,x:r,y:i,o:o}}function Ho(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&eo?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&eo?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&n?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&to?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&n?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&to?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&to?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&to?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&to?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&eo?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&to?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&eo?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}function Wo(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:switch(r){case 0:i=Fo[l],s=ho[l],a=po[l],u=fo[l];break;default:i=Do[l],s=uo[l],a=lo[l],u=co[l]}break;case 1:switch(r){case 0:i=qo[l],s=Io[l],a=No[l],u=So[l];break;default:i=Bo[l],s=Eo[l],a=bo[l],u=wo[l]}break;default:switch(n){case-1:switch(r){case 0:i=zo[l],s=no[l],a=ro[l],u=io[l];break;default:i=jo[l],s=oo[l],a=so[l],u=ao[l]}break;case 1:switch(r){case 0:i=Go[l],s=go[l],a=yo[l],u=vo[l];break;default:i=ko[l],s=_o[l],a=mo[l],u=xo[l]}}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var n=e+1;n0){var a=r[e-1],u=is(n,a);!1!==u&&(a[1]=u,n[0]=u),s.push(a[0]),e===o.length-2&&(s.push(n[0]),s.push(n[1]))}2===o.length&&(s.push(n[0]),s.push(n[1]))}var l,c,h,p,f,g,d,y})),h(s,t.properties)}function ss(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(r*(n[1]-e[1])-o*i)}function as(t,e){return e.geometry.coordinates[0].every((function(e){return ye(a(e),t)}))}Uo[1]=Uo[169]=Co,Uo[4]=Uo[166]=Po,Uo[16]=Uo[154]=Mo,Uo[64]=Uo[106]=Lo,Uo[168]=Uo[2]=Oo,Uo[162]=Uo[8]=Ro,Uo[138]=Uo[32]=To,Uo[42]=Uo[128]=Ao,Uo[5]=Uo[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Uo[20]=Uo[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Uo[80]=Uo[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Uo[65]=Uo[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Uo[160]=Uo[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Uo[130]=Uo[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Uo[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Uo[101]=Uo[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Uo[149]=Uo[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Uo[86]=Uo[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Uo[89]=Uo[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Uo[96]=Uo[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Uo[24]=Uo[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Uo[6]=Uo[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Uo[129]=Uo[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Uo[66]=Uo[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Uo[144]=Uo[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Uo[36]=Uo[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Uo[9]=Uo[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Uo[37]=Uo[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Uo[148]=Uo[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Uo[82]=Uo[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Uo[73]=Uo[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Uo[145]=Uo[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Uo[70]=Uo[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Uo[34]=function(t){return[Ao(t),Ro(t)]},Uo[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Uo[136]=function(t){return[To(t),Oo(t)]},Uo[153]=function(t){return[Mo(t),Co(t)]},Uo[102]=function(t){return[Po(t),Lo(t)]},Uo[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Uo[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Uo[152]=function(t){return[Mo(t),Oo(t)]},Uo[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Uo[137]=function(t){return[To(t),Co(t)]},Uo[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Uo[98]=function(t){return[Ro(t),Lo(t)]},Uo[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Uo[38]=function(t){return[Po(t),Ao(t)]},Uo[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var us=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,n){var r=e.to,i=n.to;if(r.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(r.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(r.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return r.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?r.coordinates[1]-i.coordinates[1]:i.coordinates[1]-r.coordinates[1];var o=ss(t.coordinates,r.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(r.coordinates[0]-t.coordinates[0],2)+Math.pow(r.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),ls=function(){function t(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return h([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return ss(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),cs=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,n,r){return n.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=r),e}),0),n=(0===e?this.length:e)-1,r=(e+1)%this.length,i=ss(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[r].from.coordinates);return 0===i?this.edges[n].from.coordinates[0]>this.edges[r].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return d(this.edges.map((function(t){return t.from.coordinates})))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=l([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=dn(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var n,r,i=t.getEnvelope();return e.forEach((function(e){var o,s,u,l,c,h,p=e.getEnvelope();if((r&&(n=r.getEnvelope()),s=i,u=(o=p).geometry.coordinates[0].map((function(t){return t[0]})),l=o.geometry.coordinates[0].map((function(t){return t[1]})),c=s.geometry.coordinates[0].map((function(t){return t[0]})),h=s.geometry.coordinates[0].map((function(t){return t[1]})),Math.max.apply(null,u)!==Math.max.apply(null,c)||Math.max.apply(null,l)!==Math.max.apply(null,h)||Math.min.apply(null,u)!==Math.min.apply(null,c)||Math.min.apply(null,l)!==Math.min.apply(null,h))&&as(p,i)){for(var f=t.map((function(t){return t.from.coordinates})),g=void 0,d=function(t){e.some((function(e){return n=t,r=e.from.coordinates,n[0]===r[0]&&n[1]===r[1];var n,r}))||(g=t)},y=0,v=f;y=0;--o){var s=i[o],a=s.symetric,u=void 0,l=void 0;s.label===e&&(u=s),a.label===e&&(l=a),u&&l&&(l&&(r=l),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(n){if(!(n.label>=0)){t.push(n);var r=n;do{r.label=e,r=r.next}while(!n.isEqual(r));e++}})),t},t.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(n){t._computeNextCCWEdges(n,e.label)}))}));var e=[];return this.edges.forEach((function(n){n.ring||e.push(t._findEdgeRing(n))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],n=t,r=function(){var r=0;n.from.getOuterEdges().forEach((function(e){e.label===t.label&&++r})),r>1&&e.push(n.from),n=n.next};do{r()}while(!t.isEqual(n));return e},t.prototype._findEdgeRing=function(t){var e=t,n=new cs;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},t.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()},t}();function ps(t,e){var n=!0;return z(t,(function(t){z(e,(function(e){if(!1===n)return!1;n=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return n=t.coordinates,r=e.coordinates,!(n[0]===r[0]&&n[1]===r[1]);case"LineString":return!fs(e,t);case"Polygon":return!ye(t,e)}break;case"LineString":switch(e.type){case"Point":return!fs(t,e);case"LineString":return!function(t,e){if(Or(t,e).features.length>0)return!0;return!1}(t,e);case"Polygon":return!gs(e,t)}break;case"Polygon":switch(e.type){case"Point":return!ye(e,t);case"LineString":return!gs(t,e);case"Polygon":return!function(t,e){for(var n=0,r=t.coordinates[0];n0)return!0;return!1}(e,t)}}var n,r;return!1}(t.geometry,e.geometry)}))})),n}function fs(t,e){for(var n=0;n0}function ds(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1];return 0==r*s-i*o&&(Math.abs(o)>=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1])}function ys(t,e){return!(t[0]>e[0])&&(!(t[2]e[1])&&!(t[3]0}function Es(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]0?t[1]=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},ws.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},ws.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),r)}return!1},ws.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},ws.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},ws.prototype.removePseudo=function(t){return t};var Cs=ws;function Ps(t,e){var n=!1;return z(t,(function(t){z(e,(function(e){if(!0===n)return!0;n=!ps(t.geometry,e.geometry)}))})),n}var Ms=Bt((function(t){function e(t,e,n,r){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i=0;i=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[r]&&this._addToCluster(r,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n0){for(u=0;u=0);return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;ri&&(n=r):e=this.minPts)return n}},n.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r0;r.length0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;n[u]||(n[u]=!0,r.push(a))}if(r.length0,s=t[Math.floor(Math.random()*i)];o&&s.join("_");for(r.push(s);r.length0,f=[];if(n)i="kmrand"==n?Gs(t,e):"kmpp"==n?qs(t,e):n;else for(var g={};i.length0;){var u=s.pop();if(u===n)return Vs(u);u.closed=!0;for(var l=t.neighbors(u),c=0,h=l.length;c0)){if(o/=p,p<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=r-u,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o0)){if(o/=f,f<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=i-l,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o0||h<1)||(c>0&&(t[0]=[u+c*p,l+c*f]),h<1&&(t[1]=[u+h*p,l+h*f]),!0)}}}}}function ua(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,u=t[0],l=t.left,c=t.right,h=l[0],p=l[1],f=c[0],g=c[1],d=(h+f)/2,y=(p+g)/2;if(g===p){if(d=r)return;if(h>f){if(u){if(u[1]>=i)return}else u=[d,n];o=[d,i]}else{if(u){if(u[1]1)if(h>f){if(u){if(u[1]>=i)return}else u=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)=-La)){var f=u*u+l*l,g=c*c+h*h,d=(h*f-l*g)/p,y=(u*g-c*f)/p,v=fa.pop()||new ga;v.arc=t,v.site=i,v.x=d+s,v.y=(v.cy=y+a)+Math.sqrt(d*d+y*y),t.circle=v;for(var _=null,m=Ca._;m;)if(v.yMa)a=a.L;else{if(!((i=o-Ia(a,s))>Ma)){r>-Ma?(e=a.P,n=a):i>-Ma?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){Sa[t.index]={site:t,halfedges:[]}}(t);var u=ma(t);if(Na.insert(e,u),e||n){if(e===n)return ya(e),n=ma(e.site),Na.insert(u,n),u.edge=n.edge=ia(e.site,u.site),da(e),void da(n);if(n){ya(e),ya(n);var l=e.site,c=l[0],h=l[1],p=t[0]-c,f=t[1]-h,g=n.site,d=g[0]-c,y=g[1]-h,v=2*(p*y-f*d),_=p*p+f*f,m=d*d+y*y,x=[(y*_-f*m)/v+c,(p*m-d*_)/v+h];sa(n.edge,l,g,x),u.edge=ia(l,t,null,x),n.edge=ia(t,g,null,x),da(e),da(n)}else u.edge=ia(e.site,u.site)}}function wa(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],l=u-e;if(!l)return a;var c=a-r,h=1/o-1/l,p=c/l;return h?(-p+Math.sqrt(p*p-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+r:(r+a)/2}function Ia(t,e){var n=t.N;if(n)return wa(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var Na,Sa,Ca,Pa,Ma=1e-6,La=1e-12;function Oa(t,e){return e[1]-t[1]||e[0]-t[0]}function Ra(t,e){var n,r,i,o=t.sort(Oa).pop();for(Pa=[],Sa=new Array(t.length),Na=new $s,Ca=new $s;;)if(i=pa,o&&(!i||o[1]Ma||Math.abs(i[0][1]-i[1][1])>Ma)||delete Pa[o]}(s,a,u,l),function(t,e,n,r){var i,o,s,a,u,l,c,h,p,f,g,d,y=Sa.length,v=!0;for(i=0;iMa||Math.abs(d-p)>Ma)&&(u.splice(a,0,Pa.push(oa(s,f,Math.abs(g-t)Ma?[t,Math.abs(h-t)Ma?[Math.abs(p-r)Ma?[n,Math.abs(h-n)Ma?[Math.abs(p-e)=-270&&(d=-d),g<-180&&g>=-360&&(y=-y),"degrees"===o){var v=d*Math.cos(h)+y*Math.sin(h),_=y*Math.cos(h)-d*Math.sin(h);d=v,y=_}p.push([d+c[0],y+c[1]])}return p.push(p[0]),"degrees"===o?l([p],u):$o(l([p],u),s,{pivot:a})}function Da(t){var e=t*Math.PI/180;return Math.tan(e)}function Fa(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return q(t,(function(t,o,s){var a=e.weight?null==s?void 0:s[e.weight]:void 0;if(!C(a=null==a?1:a))throw new Error("weight value must be a number for feature index "+o);(a=Number(a))>0&&R(t,(function(t){n+=t[0]*a,r+=t[1]*a,i+=a}))})),a([n/i,r/i],e.properties,e)}function ka(t,e,n,r,i){var o=r.tolerance||.001,s=0,u=0,l=0,c=0;if(F(n,(function(e){var n,r=null===(n=e.properties)||void 0===n?void 0:n.weight,i=null==r?1:r;if(!C(i=Number(i)))throw new Error("weight value must be a number");if(i>0){c+=1;var o=i*me(e,t);0===o&&(o=1);var a=i/o;s+=e.geometry.coordinates[0]*a,u+=e.geometry.coordinates[1]*a,l+=a}})),c<1)throw new Error("no features to measure");var h=s/l,p=u/l;return 1===c||0===i||Math.abs(h-e[0])n&&(n=u,r=o,e.push([]));var l=o-r,c=t.coordinates[u][l+1],h=i[0],p=i[1],f=c[0],g=c[1];e[u].push([.75*h+.25*f,.75*p+.25*g]),e[u].push([.25*h+.75*f,.25*p+.75*g])}),!0),e.forEach((function(t){t.push(t[0])}))}function Ba(t,e){var n=0,r=0,i=0;R(t,(function(o,s,a,u,l){u>i&&(i=u,r=s,e.push([[]])),l>n&&(n=l,r=s,e[u].push([]));var c=s-r,h=t.coordinates[u][l][c+1],p=o[0],f=o[1],g=h[0],d=h[1];e[u][l].push([.75*p+.25*g,.75*f+.25*d]),e[u][l].push([.25*p+.75*g,.25*f+.75*d])}),!0),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}function za(t,e,n){void 0===n&&(n=2);var r=K(t),i=K(e),o=r[0]-i[0],s=r[1]-i[1];return 1===n?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function ja(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];F(t,(function(t){a.push(En(t))}));for(var u=[],l=0;l0?1:0}(t[0]))*e,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function Wa(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*e]}Ra.prototype={constructor:Ra,polygons:function(){var t=this.edges;return this.cells.map((function(e){var n=e.halfedges.map((function(n){return ca(e,t[n])}));return n.data=e.site.data,n}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(n,r){if(o=(i=n.halfedges).length)for(var i,o,s,a,u,l,c=n.site,h=-1,p=e[i[o-1]],f=p.left===c?p.right:p.left;++h=a)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[r=s],s=null,i.halfedges.forEach((function(n){var r=o.edges[n],a=r.left;if(a!==i.site&&a||(a=r.right)){var u=t-a[0],l=e-a[1],h=u*u+l*l;h0?t+n[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var n=Math.random();i.push([n*(e.max_radial_length||10)*Math.sin(t),n*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((r=Ka(e.bbox),function(t){return[t[0]+r[0],t[1]+r[1]]})),n.push(l([i]))},i=0;i + * @license MIT + * @preserve + */function fu(t,e){return t>e?1:t0))break;if(null===e.right)break;if(n(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function du(t,e,n,r){var i=new pu(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=gu(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function yu(t,e,n){var r=null,i=null;if(e){var o=n((e=gu(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function vu(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&vu(t.left,o,!1,r,i),t.right&&vu(t.right,o,!0,r,i)}}var _u=function(){function t(t){void 0===t&&(t=fu),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=du(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new pu(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=gu(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=gu(t,e,n)).key)?(null===e.left?r=e.right:(r=gu(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=gu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=gu(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},t.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},t.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},t.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,n=[],r=!1,i=new pu(null,null),o=i;for(;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&Eu(t,e,0,r-1,i),null===this._root)this._root=mu(t,e,0,r),this._size=r;else{var o=function(t,e,n){var r=new pu(null,null),i=r,o=t,s=e;for(;null!==o&&null!==s;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return r.next}(this.toList(),function(t,e){for(var n=new pu(null,null),r=n,i=0;i0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new pu(s,a);return u.left=mu(t,e,n,o),u.right=mu(t,e,o+1,r),u}return null}function xu(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=xu(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=xu(t,i+1,n),s}return null}function Eu(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}Eu(t,e,n,a,i),Eu(t,e,a+1,r,i)}}function bu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wu(t,e){for(var n=0;ne.x?1:t.ye.y?1:0}}]),Iu(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n=0&&u>=0?sl?-1:0:o<0&&u<0?sl?1:0:uo?1:0}}}]),t}(),zu=0,ju=function(){function t(e,n,r,i){bu(this,t),this.id=++zu,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return Iu(t,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(os&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(sa&&s>l)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(sa)return 1;if(io){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var y=u-s,v=i-n,_=l-a,m=o-r;if(y>v&&_m)return-1}return i>o?1:il?1:t.ide.id?1:0}}]),Iu(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:te?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x0&&a.swapEvents(),Bu.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new Bu(i,!0),new Bu(o,!1),[r],[s])}}]),t}(),Uu=function(){function t(e,n,r){if(bu(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=Ru.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(ju.fromRing(o,i,this))}return Iu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return Iu(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return Iu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Hu=function(){function t(e){bu(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Iu(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e1&&void 0!==arguments[1]?arguments[1]:ju.compare;bu(this,t),this.queue=e,this.tree=new _u(n),this.segments=[]}return Iu(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,p=c.length;h0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var w=this._splitSafely(s,b),I=0,N=w.length;IZu)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new Ju(f),x=f.size,E=f.pop();E;){var b=E.key;if(f.size===x){var w=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(w.id," ")+"[".concat(w.leftSE.point.x,", ").concat(w.leftSE.point.y,"] -> ")+"[".concat(w.rightSE.point.x,", ").concat(w.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>Zu)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Ku)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=m.process(b),N=0,S=I.length;N1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;re.x?1:this.ye.y?1:0},ul.prototype.clone=function(){},ul.prototype.copy=function(){return new ul(this)},ul.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},ul.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},ul.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},ul.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+ul.hashCode(this.x))+ul.hashCode(this.y)},ul.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},ul.prototype.interfaces_=function(){return[il,ol,al]},ul.prototype.getClass=function(){return ul},ul.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=nl.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},ll.DimensionalComparator.get=function(){return cl},ll.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},ll.NULL_ORDINATE.get=function(){return nl.NaN},ll.X.get=function(){return 0},ll.Y.get=function(){return 1},ll.Z.get=function(){return 2},Object.defineProperties(ul,ll);var cl=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new el("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};cl.prototype.compare=function(t,e){var n=t,r=e,i=cl.compare(n.x,r.x);if(0!==i)return i;var o=cl.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:cl.compare(n.z,r.z)},cl.prototype.interfaces_=function(){return[sl]},cl.prototype.getClass=function(){return cl},cl.compare=function(t,e){return te?1:nl.isNaN(t)?nl.isNaN(e)?0:-1:nl.isNaN(e)?1:0};var hl=function(){};hl.prototype.create=function(){},hl.prototype.interfaces_=function(){return[]},hl.prototype.getClass=function(){return hl};var pl=function(){},fl={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl},pl.toLocationSymbol=function(t){switch(t){case pl.EXTERIOR:return"e";case pl.BOUNDARY:return"b";case pl.INTERIOR:return"i";case pl.NONE:return"-"}throw new el("Unknown location value: "+t)},fl.INTERIOR.get=function(){return 0},fl.BOUNDARY.get=function(){return 1},fl.EXTERIOR.get=function(){return 2},fl.NONE.get=function(){return-1},Object.defineProperties(pl,fl);var gl=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},dl=function(){},yl={LOG_10:{configurable:!0}};dl.prototype.interfaces_=function(){return[]},dl.prototype.getClass=function(){return dl},dl.log10=function(t){var e=Math.log(t);return nl.isInfinite(e)||nl.isNaN(e)?e:e/dl.LOG_10},dl.min=function(t,e,n,r){var i=t;return en?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return ro?o:r}},dl.wrap=function(t,e){return t<0?e- -t%e:t%e},dl.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=i;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},dl.average=function(t,e){return(t+e)/2},yl.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(dl,yl);var vl=function(t){this.str=t};vl.prototype.append=function(t){this.str+=t},vl.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},vl.prototype.toString=function(t){return this.str};var _l=function(t){this.value=t};_l.prototype.intValue=function(){return this.value},_l.prototype.compareTo=function(t){return this.valuet?1:0},_l.isNaN=function(t){return Number.isNaN(t)};var ml=function(){};ml.isWhitespace=function(t){return t<=32&&t>=0||127===t},ml.toUpperCase=function(t){return t.toUpperCase()};var xl=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var r=arguments[0];t.call(this,t.parse(r))}}else if(2===arguments.length){var i=arguments[0],o=arguments[1];this.init(i,o)}},El={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};xl.prototype.le=function(t){return(this._hi9?(c=!0,h="9"):h="0"+l,s.append(h),n=n.subtract(xl.valueOf(l)).multiply(xl.TEN),c&&n.selfAdd(xl.TEN);var p=!0,f=xl.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},xl.prototype.sqr=function(){return this.multiply(this)},xl.prototype.doubleValue=function(){return this._hi+this._lo},xl.prototype.subtract=function(){if(arguments[0]instanceof xl){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},xl.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},xl.prototype.isZero=function(){return 0===this._hi&&0===this._lo},xl.prototype.selfSubtract=function(){if(arguments[0]instanceof xl){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},xl.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},xl.prototype.min=function(t){return this.le(t)?this:t},xl.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof xl){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null,c=null,h=null;return u=this._hi/n,h=(i=(l=xl.SPLIT*u)-(i=l-u))*(s=(h=xl.SPLIT*n)-(s=h-n))-(c=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,h=u+(l=(this._hi-c-h+this._lo-u*r)/n),this._hi=h,this._lo=u-h+l,this}},xl.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},xl.prototype.divide=function(){if(arguments[0]instanceof xl){var t=arguments[0],e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;n=(o=this._hi/t._hi)-(e=(s=xl.SPLIT*o)-(e=s-o)),u=e*(r=(u=xl.SPLIT*t._hi)-(r=u-t._hi))-(a=o*t._hi)+e*(i=t._hi-r)+n*r+n*i;var l=u=o+(s=(this._hi-a-u+this._lo-o*t._lo)/t._hi),c=o-u+s;return new xl(l,c)}if("number"==typeof arguments[0]){var h=arguments[0];return nl.isNaN(h)?xl.createNaN():xl.copy(this).selfDivide(h,0)}},xl.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},xl.prototype.pow=function(t){if(0===t)return xl.valueOf(1);var e=new xl(this),n=xl.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},xl.prototype.ceil=function(){if(this.isNaN())return xl.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new xl(t,e)},xl.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0},xl.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},xl.prototype.setValue=function(){if(arguments[0]instanceof xl){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},xl.prototype.max=function(t){return this.ge(t)?this:t},xl.prototype.sqrt=function(){if(this.isZero())return xl.valueOf(0);if(this.isNegative())return xl.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=xl.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},xl.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof xl){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null;return o=(i=this._hi+e)-(s=i-this._hi),r=(a=(o=e-s+(this._hi-o))+this._lo)+(i-(n=i+a)),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],l=arguments[1],c=null,h=null,p=null,f=null,g=null,d=null,y=null;f=this._hi+u,h=this._lo+l,g=f-(d=f-this._hi),p=h-(y=h-this._lo);var v=(c=f+(d=(g=u-d+(this._hi-g))+h))+(d=(p=l-y+(this._lo-p))+(d+(f-c))),_=d+(c-v);return this._hi=v,this._lo=_,this}},xl.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof xl){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null;i=(u=xl.SPLIT*this._hi)-this._hi,l=xl.SPLIT*n,i=u-i,o=this._hi-i,s=l-n;var c=(u=this._hi*n)+(l=i*(s=l-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),h=l+(i=u-c);return this._hi=c,this._lo=h,this}},xl.prototype.selfSqr=function(){return this.selfMultiply(this)},xl.prototype.floor=function(){if(this.isNaN())return xl.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new xl(t,e)},xl.prototype.negate=function(){return this.isNaN()?this:new xl(-this._hi,-this._lo)},xl.prototype.clone=function(){},xl.prototype.multiply=function(){if(arguments[0]instanceof xl){var t=arguments[0];return t.isNaN()?xl.createNaN():xl.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return nl.isNaN(e)?xl.createNaN():xl.copy(this).selfMultiply(e,0)}},xl.prototype.isNaN=function(){return nl.isNaN(this._hi)},xl.prototype.intValue=function(){return Math.trunc(this._hi)},xl.prototype.toString=function(){var t=xl.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},xl.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+xl.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+xl.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},xl.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=xl.SPLIT*n)-(i=s-n)),o=(a=xl.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new xl(u,n-u+s)},xl.prototype.toSciNotation=function(){if(this.isZero())return xl.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=xl.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},xl.prototype.abs=function(){return this.isNaN()?xl.NaN:this.isNegative()?this.negate():new xl(this)},xl.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},xl.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo},xl.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},xl.prototype.trunc=function(){return this.isNaN()?xl.NaN:this.isPositive()?this.floor():this.ceil()},xl.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},xl.prototype.interfaces_=function(){return[al,il,ol]},xl.prototype.getClass=function(){return xl},xl.sqr=function(t){return xl.valueOf(t).selfMultiply(t)},xl.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return xl.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new xl(e)}},xl.sqrt=function(t){return xl.valueOf(t).sqrt()},xl.parse=function(t){for(var e=0,n=t.length;ml.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var l=t.charAt(e);if(e++,ml.isDigit(l)){var c=l-"0";o.selfMultiply(xl.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=_l.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var p=o,f=s-a-u;if(0===f)p=o;else if(f>0){var g=xl.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=xl.TEN.pow(-f);p=o.multiply(d)}return r?p.negate():p},xl.createNaN=function(){return new xl(nl.NaN,nl.NaN)},xl.copy=function(t){return new xl(t)},xl.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},xl.stringOfChar=function(t,e){for(var n=new vl,r=0;r0){if(o<=0)return bl.signum(s);r=i+o}else{if(!(i<0))return bl.signum(s);if(o>=0)return bl.signum(s);r=-i-o}var a=bl.DP_SAFE_EPSILON*r;return s>=a||-s>=a?bl.signum(s):2},bl.signum=function(t){return t>0?1:t<0?-1:0},wl.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(bl,wl);var Il=function(){},Nl={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Nl.X.get=function(){return 0},Nl.Y.get=function(){return 1},Nl.Z.get=function(){return 2},Nl.M.get=function(){return 3},Il.prototype.setOrdinate=function(t,e,n){},Il.prototype.size=function(){},Il.prototype.getOrdinate=function(t,e){},Il.prototype.getCoordinate=function(){},Il.prototype.getCoordinateCopy=function(t){},Il.prototype.getDimension=function(){},Il.prototype.getX=function(t){},Il.prototype.clone=function(){},Il.prototype.expandEnvelope=function(t){},Il.prototype.copy=function(){},Il.prototype.getY=function(t){},Il.prototype.toCoordinateArray=function(){},Il.prototype.interfaces_=function(){return[ol]},Il.prototype.getClass=function(){return Il},Object.defineProperties(Il,Nl);var Sl=function(){},Cl=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Sl),Pl=function(){};Pl.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;st._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy)}},Ll.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof Ll){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}},Ll.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0},Ll.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},Ll.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ll.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ll.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ll.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},Ll.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ll.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof Ll){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof ul){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},Ll.prototype.centre=function(){return this.isNull()?null:new ul((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ll.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof ul){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Ll){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},Ll.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+ul.hashCode(this._minx))+ul.hashCode(this._maxx))+ul.hashCode(this._miny))+ul.hashCode(this._maxy)},Ll.prototype.interfaces_=function(){return[il,al]},Ll.prototype.getClass=function(){return Ll},Ll.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(l>u)&&(!(cu)&&!(cn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},Bl.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Bl.prototype.setPrecisionModel=function(t){this._precisionModel=t},Bl.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],n=0;ni?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return ql.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},Bl.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return ql.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},zl.DONT_INTERSECT.get=function(){return 0},zl.DO_INTERSECT.get=function(){return 1},zl.COLLINEAR.get=function(){return 2},zl.NO_INTERSECTION.get=function(){return 0},zl.POINT_INTERSECTION.get=function(){return 1},zl.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Bl,zl);var jl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new Ll(this._inputLines[0][0],this._inputLines[0][1]),n=new Ll(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,Ll.intersects(n,r,e)&&0===Xl.orientationIndex(n,r,e)&&0===Xl.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=Ml.intersection(t,n,r,i)}catch(s){if(!(s instanceof Cl))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new ul(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)1e-4&&Pl.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new ul(t),o=new ul(e),s=new ul(n),a=new ul(r),u=new ul;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=Ll.intersects(e,n,r),s=Ll.intersects(e,n,i),a=Ll.intersects(r,i,e),u=Ll.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.xr.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((o>l?o:l)+(ac?s:c)+(u0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=Xl.orientationIndex(r,i,e),u=Xl.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new ul(r):0===s?this._intPt[0]=new ul(i):0===a?this._intPt[0]=new ul(e):0===u&&(this._intPt[0]=new ul(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=Xl.distancePointLine(t,n,r),s=Xl.distancePointLine(e,n,r);return s0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var Vl=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Vl.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=Ul.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}},Vl.prototype.isPointInPolygon=function(){return this.getLocation()!==pl.EXTERIOR},Vl.prototype.getLocation=function(){return this._isPointOnSegment?pl.BOUNDARY:this._crossingCount%2==1?pl.INTERIOR:pl.EXTERIOR},Vl.prototype.isOnSegment=function(){return this._isPointOnSegment},Vl.prototype.interfaces_=function(){return[]},Vl.prototype.getClass=function(){return Vl},Vl.locatePointInRing=function(){if(arguments[0]instanceof ul&&gl(arguments[1],Il)){for(var t=arguments[0],e=arguments[1],n=new Vl(t),r=new ul,i=new ul,o=1;o1||a<0||a>1)&&(i=!0)}}else i=!0;return i?dl.min(Xl.distancePointLine(t,n,r),Xl.distancePointLine(e,n,r),Xl.distancePointLine(n,t,e),Xl.distancePointLine(r,t,e)):0},Xl.isPointInRing=function(t,e){return Xl.locatePointInRing(t,e)!==pl.EXTERIOR},Xl.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new ul;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;sn.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=Xl.computeOrientation(u,n,l),h=!1;return h=0===c?u.x>l.x:c>0,h},Xl.locatePointInRing=function(t,e){return Vl.locatePointInRing(t,e)},Xl.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},Xl.computeOrientation=function(t,e,n){return Xl.orientationIndex(t,e,n)},Xl.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new el("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},Xl.isOnLine=function(t,e){for(var n=new jl,r=1;r0},ec.prototype.interfaces_=function(){return[Ql]},ec.prototype.getClass=function(){return ec};var nc=function(){};nc.prototype.isInBoundary=function(t){return t>1},nc.prototype.interfaces_=function(){return[Ql]},nc.prototype.getClass=function(){return nc};var rc=function(){};rc.prototype.isInBoundary=function(t){return 1===t},rc.prototype.interfaces_=function(){return[Ql]},rc.prototype.getClass=function(){return rc};var ic=function(){};function oc(t){this.message=t||""}ic.prototype.add=function(){},ic.prototype.addAll=function(){},ic.prototype.isEmpty=function(){},ic.prototype.iterator=function(){},ic.prototype.size=function(){},ic.prototype.toArray=function(){},ic.prototype.remove=function(){},oc.prototype=new Error,oc.prototype.name="IndexOutOfBoundsException";var sc=function(){};sc.prototype.hasNext=function(){},sc.prototype.next=function(){},sc.prototype.remove=function(){};var ac=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(ic);function uc(t){this.message=t||""}uc.prototype=new Error,uc.prototype.name="NoSuchElementException";var lc=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof ic&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,ic]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new cc(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new oc;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e=1){var a=this.get(this.size()-1);if(a.equals2D(o))return null}t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];return this.add(u,l),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var c=arguments[0],h=arguments[1],p=arguments[2];if(p)for(var f=0;f=0;g--)e.add(c[g],h);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof ul){var d=arguments[0],y=arguments[1],v=arguments[2];if(!v){var _=this.size();if(_>0){if(d>0){var m=this.get(d-1);if(m.equals2D(y))return null}if(d<_){var x=this.get(d);if(x.equals2D(y))return null}}}t.prototype.add.call(this,d,y)}}else if(4===arguments.length){var E=arguments[0],b=arguments[1],w=arguments[2],I=arguments[3],N=1;w>I&&(N=-1);for(var S=w;S!==I;S+=N)e.add(E[S],b);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new ul(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(lc),pc=function(){},fc={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};fc.ForwardComparator.get=function(){return gc},fc.BidirectionalComparator.get=function(){return dc},fc.coordArrayType.get=function(){return new Array(0).fill(null)},pc.prototype.interfaces_=function(){return[]},pc.prototype.getClass=function(){return pc},pc.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},pc.ptNotInList=function(t,e){for(var n=0;n=t?e:[]},pc.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e},pc.extract=function(t,e,n){e=dl.clamp(e,0,t.length);var r=(n=dl.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(0===n.length)return 0;var i=pc.compare(n,r);return pc.isEqualReversed(n,r)?0:i},dc.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(0===n.length)return 0;for(var i=pc.increasingDirection(n),o=pc.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u0))return e.value;e=e.right}}return null},Cc.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},Cc.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(wc(t)===Nc(wc(wc(t)))){var n=Sc(wc(wc(t)));1===bc(n)?(Ic(wc(t),0),Ic(n,0),Ic(wc(wc(t)),1),t=wc(wc(t))):(t===Sc(wc(t))&&(t=wc(t),e.rotateLeft(t)),Ic(wc(t),0),Ic(wc(wc(t)),1),e.rotateRight(wc(wc(t))))}else{var r=Nc(wc(wc(t)));1===bc(r)?(Ic(wc(t),0),Ic(r,0),Ic(wc(wc(t)),1),t=wc(wc(t))):(t===Nc(wc(t))&&(t=wc(t),e.rotateRight(t)),Ic(wc(t),0),Ic(wc(wc(t)),1),e.rotateLeft(wc(wc(t))))}this.root_.color=0},Cc.prototype.values=function(){var t=new lc,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=Cc.successor(e));)t.add(e.value);return t},Cc.prototype.entrySet=function(){var t=new xc,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=Cc.successor(e));)t.add(e);return t},Cc.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},Cc.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},Cc.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},Cc.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},Cc.prototype.size=function(){return this.size_};var Pc=function(){};function Mc(){}function Lc(){this.array_=[],arguments[0]instanceof ic&&this.addAll(arguments[0])}Pc.prototype.interfaces_=function(){return[]},Pc.prototype.getClass=function(){return Pc},Mc.prototype=new mc,Lc.prototype=new Mc,Lc.prototype.contains=function(t){for(var e=0,n=this.array_.length;e=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u0)for(var o=i;o0&&r.append(" ");for(var o=0;o0&&r.append(","),r.append(Hc.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Jc.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Jc.createClosedRing(t,e,4):e.getOrdinate(0,Il.X)===e.getOrdinate(n-1,Il.X)&&e.getOrdinate(0,Il.Y)===e.getOrdinate(n-1,Il.Y)?e:Jc.createClosedRing(t,e,n+1)},Jc.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Jc.copy(e,0,r,0,i);for(var o=i;o0&&Jc.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Tc.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return Xl.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Jc.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=e,r=0,i=0;r= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Zc),rh=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Wl.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n0?e.createPoint(n[0]):e.createPoint():t},ah.prototype.interfaces_=function(){return[ih.GeometryEditorOperation]},ah.prototype.getClass=function(){return ah};var uh=function(){};uh.prototype.edit=function(t,e){return t instanceof nh?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Zc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Qc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},uh.prototype.interfaces_=function(){return[ih.GeometryEditorOperation]},uh.prototype.getClass=function(){return uh};var lh=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var t=new vl(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(r=3),r<2?new lh(n):new lh(n,r)}},hh.prototype.interfaces_=function(){return[hl,al]},hh.prototype.getClass=function(){return hh},hh.instance=function(){return hh.instanceObject},ph.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},ph.instanceObject.get=function(){return new hh},Object.defineProperties(hh,ph);var fh=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new lc,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new xc;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(yc),gh=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof yh){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},dh={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};gh.prototype.equals=function(t){if(!(t instanceof gh))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},gh.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new _l(n).compareTo(new _l(r))},gh.prototype.getScale=function(){return this._scale},gh.prototype.isFloating=function(){return this._modelType===gh.FLOATING||this._modelType===gh.FLOATING_SINGLE},gh.prototype.getType=function(){return this._modelType},gh.prototype.toString=function(){var t="UNKNOWN";return this._modelType===gh.FLOATING?t="Floating":this._modelType===gh.FLOATING_SINGLE?t="Floating-Single":this._modelType===gh.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},gh.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];if(nl.isNaN(t))return t;if(this._modelType===gh.FLOATING_SINGLE){return t}return this._modelType===gh.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof ul){var e=arguments[0];if(this._modelType===gh.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},gh.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===gh.FLOATING?t=16:this._modelType===gh.FLOATING_SINGLE?t=6:this._modelType===gh.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},gh.prototype.setScale=function(t){this._scale=Math.abs(t)},gh.prototype.interfaces_=function(){return[al,il]},gh.prototype.getClass=function(){return gh},gh.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},dh.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},dh.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(gh,dh);var yh=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},vh={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};yh.prototype.readResolve=function(){return yh.nameToTypeMap.get(this._name)},yh.prototype.toString=function(){return this._name},yh.prototype.interfaces_=function(){return[al]},yh.prototype.getClass=function(){return yh},vh.serialVersionUID.get=function(){return-552860263173159e4},vh.nameToTypeMap.get=function(){return new fh},Object.defineProperties(yh,vh),gh.Type=yh,gh.FIXED=new yh("FIXED"),gh.FLOATING=new yh("FLOATING"),gh.FLOATING_SINGLE=new yh("FLOATING SINGLE");var _h=function t(){this._precisionModel=new gh,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?gl(arguments[0],hl)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof gh&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},mh={serialVersionUID:{configurable:!0}};_h.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new ul(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new ul(t.getMinX(),t.getMinY()),new ul(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new ul(t.getMinX(),t.getMinY()),new ul(t.getMinX(),t.getMaxY()),new ul(t.getMaxX(),t.getMaxY()),new ul(t.getMaxX(),t.getMinY()),new ul(t.getMinX(),t.getMinY())]),null)},_h.prototype.createLineString=function(t){return t?t instanceof Array?new Zc(this.getCoordinateSequenceFactory().create(t),this):gl(t,Il)?new Zc(t,this):void 0:new Zc(this.getCoordinateSequenceFactory().create([]),this)},_h.prototype.createMultiLineString=function(){if(0===arguments.length)return new Gc(null,this);if(1===arguments.length){var t=arguments[0];return new Gc(t,this)}},_h.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(_h.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof th)return this.createMultiPolygon(_h.toPolygonArray(t));if(a instanceof Zc)return this.createMultiLineString(_h.toLineStringArray(t));if(a instanceof Qc)return this.createMultiPoint(_h.toPointArray(t));ql.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},_h.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},_h.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof ul){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(gl(arguments[0],Il)){var e=arguments[0];return new Qc(e,this)}}},_h.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},_h.prototype.createPolygon=function(){if(0===arguments.length)return new th(null,null,this);if(1===arguments.length){if(gl(arguments[0],Il)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof nh){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return new th(r,i,this)}},_h.prototype.getSRID=function(){return this._SRID},_h.prototype.createGeometryCollection=function(){if(0===arguments.length)return new kc(null,this);if(1===arguments.length){var t=arguments[0];return new kc(t,this)}},_h.prototype.createGeometry=function(t){return new ih(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},_h.prototype.getPrecisionModel=function(){return this._precisionModel},_h.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(gl(arguments[0],Il)){var e=arguments[0];return new nh(e,this)}}},_h.prototype.createMultiPolygon=function(){if(0===arguments.length)return new rh(null,this);if(1===arguments.length){var t=arguments[0];return new rh(t,this)}},_h.prototype.createMultiPoint=function(){var t=this;if(0===arguments.length)return new eh(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];return new eh(e,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(null!==n?this.getCoordinateSequenceFactory().create(n):null)}if(gl(arguments[0],Il)){var r=arguments[0];if(null===r)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),o=0;o=this.size())throw new Error;return this.array_[t]},Mh.prototype.push=function(t){return this.array_.push(t),t},Mh.prototype.pop=function(t){if(0===this.array_.length)throw new Ph;return this.array_.pop()},Mh.prototype.peek=function(){if(0===this.array_.length)throw new Ph;return this.array_[this.array_.length-1]},Mh.prototype.empty=function(){return 0===this.array_.length},Mh.prototype.isEmpty=function(){return this.empty()},Mh.prototype.search=function(t){return this.array_.indexOf(t)},Mh.prototype.size=function(){return this.array_.length},Mh.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===Xl.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},Lh.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=Sh.LEFT;return n[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},Lh.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Lh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}ql.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Sh.LEFT&&(this._orientedDe=this._minDe.getSym())},Lh.prototype.interfaces_=function(){return[]},Lh.prototype.getClass=function(){return Lh};var Oh=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new ul(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(kl),Rh=function(){this.array_=[]};Rh.prototype.addLast=function(t){this.array_.push(t)},Rh.prototype.removeFirst=function(){return this.array_.shift()},Rh.prototype.isEmpty=function(){return 0===this.array_.length};var Th=function(){this._finder=null,this._dirEdgeList=new lc,this._nodes=new lc,this._rightMostCoord=null,this._env=null,this._finder=new Lh};Th.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},Th.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Th.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new Oh("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},Th.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Sh.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Th.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Th.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Sh.RIGHT)>=1&&e.getDepth(Sh.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Th.prototype.computeDepths=function(t){var e=new xc,n=new Rh,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},Th.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},Th.prototype.getEnvelope=function(){if(null===this._env){for(var t=new Ll,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;rthis.location.length){var e=new Array(3).fill(null);e[Sh.ON]=this.location[Sh.ON],e[Sh.LEFT]=pl.NONE,e[Sh.RIGHT]=pl.NONE,this.location=e}for(var n=0;n1&&t.append(pl.toLocationSymbol(this.location[Sh.LEFT])),t.append(pl.toLocationSymbol(this.location[Sh.ON])),this.location.length>1&&t.append(pl.toLocationSymbol(this.location[Sh.RIGHT])),t.toString()},Ah.prototype.setLocations=function(t,e,n){this.location[Sh.ON]=t,this.location[Sh.LEFT]=e,this.location[Sh.RIGHT]=n},Ah.prototype.get=function(t){return t1},Ah.prototype.isAnyNull=function(){for(var t=0;tt._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},Fh.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o=0;a--)this._pts.add(r[a])}},Fh.prototype.isHole=function(){return this._isHole},Fh.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},Fh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Xl.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},Fh.prototype.addHole=function(t){this._holes.add(t)},Fh.prototype.isShell=function(){return null===this._shell},Fh.prototype.getLabel=function(){return this._label},Fh.prototype.getEdges=function(){return this._edges},Fh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Fh.prototype.getShell=function(){return this._shell},Fh.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=e.getLocation(n,Sh.RIGHT);if(r===pl.NONE)return null;if(this._label.getLocation(n)===pl.NONE)return this._label.setLocation(n,r),null}},Fh.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},Fh.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n=2,"found partial label"),this.computeIM(t)},qh.prototype.isInResult=function(){return this._isInResult},qh.prototype.isVisited=function(){return this._isVisited},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh};var Bh=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new Dh(0,pl.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=pl.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==pl.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new Dh(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof Dh)for(var r=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(r,i),s=t._label.getLocation(i);s===pl.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=pl.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case pl.BOUNDARY:n=pl.INTERIOR;break;case pl.INTERIOR:default:n=pl.BOUNDARY}this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qh),zh=function(){this.nodeMap=new Cc,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};zh.prototype.find=function(t){return this.nodeMap.get(t)},zh.prototype.addNode=function(){if(arguments[0]instanceof ul){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof Bh){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},zh.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},zh.prototype.iterator=function(){return this.nodeMap.values().iterator()},zh.prototype.values=function(){return this.nodeMap.values()},zh.prototype.getBoundaryNodes=function(t){for(var e=new lc,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===pl.BOUNDARY&&e.add(r)}return e},zh.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},zh.prototype.interfaces_=function(){return[]},zh.prototype.getClass=function(){return zh};var jh=function(){},Uh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh},jh.isNorthern=function(t){return t===jh.NE||t===jh.NW},jh.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},jh.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=te?t:e)?3:n},jh.isInHalfPlane=function(t,e){return e===jh.SE?t===jh.SE||t===jh.SW:t===e||t===e+1},jh.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new el("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?jh.NE:jh.SE:e>=0?jh.NW:jh.SW}if(arguments[0]instanceof ul&&arguments[1]instanceof ul){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new el("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?jh.NE:jh.SE:r.y>=n.y?jh.NW:jh.SW}},Uh.NE.get=function(){return 0},Uh.NW.get=function(){return 1},Uh.SW.get=function(){return 2},Uh.SE.get=function(){return 3},Object.defineProperties(jh,Uh);var Vh=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this._edge=o,this.init(s,a),this._label=u}};Vh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},Wh.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},Wh.prototype.buildMaximalEdgeRings=function(t){for(var e=new lc,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new Gh(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},Wh.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},Wh.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Wh.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(r)&&Xl.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},Wh.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return ql.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Wh.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Hh.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new lc,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},Wh.prototype.interfaces_=function(){return[]},Wh.prototype.getClass=function(){return Wh};var Jh=function(){};Jh.prototype.getBounds=function(){},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh};var Zh=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Zh.prototype.getItem=function(){return this._item},Zh.prototype.getBounds=function(){return this._bounds},Zh.prototype.interfaces_=function(){return[Jh,al]},Zh.prototype.getClass=function(){return Zh};var Kh=function(){this._size=null,this._items=null,this._size=0,this._items=new lc,this._items.add(null)};Kh.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Kh.prototype.size=function(){return this._size},Kh.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},Kh.prototype.clear=function(){this._size=0,this._items.clear()},Kh.prototype.isEmpty=function(){return 0===this._size},Kh.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh};var Qh=function(){};Qh.prototype.visitItem=function(t){},Qh.prototype.interfaces_=function(){return[]},Qh.prototype.getClass=function(){return Qh};var $h=function(){};$h.prototype.insert=function(t,e){},$h.prototype.remove=function(t,e){},$h.prototype.query=function(){},$h.prototype.interfaces_=function(){return[]},$h.prototype.getClass=function(){return $h};var tp=function(){if(this._childBoundables=new lc,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},ep={serialVersionUID:{configurable:!0}};tp.prototype.getLevel=function(){return this._level},tp.prototype.size=function(){return this._childBoundables.size()},tp.prototype.getChildBoundables=function(){return this._childBoundables},tp.prototype.addChildBoundable=function(t){ql.isTrue(null===this._bounds),this._childBoundables.add(t)},tp.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},tp.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},tp.prototype.interfaces_=function(){return[Jh,al]},tp.prototype.getClass=function(){return tp},ep.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(tp,ep);var np=function(){};np.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},np.min=function(t){return np.sort(t),t.get(0)},np.sort=function(t,e){var n=t.toArray();e?Rc.sort(n,e):Rc.sort(n);for(var r=t.iterator(),i=0,o=n.length;irp.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new el("neither boundable is composite")},rp.prototype.isLeaves=function(){return!(rp.isComposite(this._boundable1)||rp.isComposite(this._boundable2))},rp.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0},rp.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new rp(o,e,this._itemDistance);s.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},op={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};ip.prototype.getNodeCapacity=function(){return this._nodeCapacity},ip.prototype.lastNode=function(t){return t.get(t.size()-1)},ip.prototype.size=function(){var t=this;if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof tp?n+=t.size(i):i instanceof Zh&&(n+=1)}return n}},ip.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Zh&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},ip.prototype.itemsTree=function(){var t=this;if(0===arguments.length){this.build();var e=this.itemsTree(this._root);return null===e?new lc:e}if(1===arguments.length){for(var n=arguments[0],r=new lc,i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();if(o instanceof tp){var s=t.itemsTree(o);null!==s&&r.add(s)}else o instanceof Zh?r.add(o.getItem()):ql.shouldNeverReachHere()}return r.size()<=0?null:r}},ip.prototype.insert=function(t,e){ql.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Zh(t,e))},ip.prototype.boundablesAtLevel=function(){var t=this;if(1===arguments.length){var e=arguments[0],n=new lc;return this.boundablesAtLevel(e,this._root,n),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(ql.isTrue(r>-2),i.getLevel()===r)return o.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var a=s.next();a instanceof tp?t.boundablesAtLevel(r,a,o):(ql.isTrue(a instanceof Zh),-1===r&&o.add(a))}return null}},ip.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var n=new lc;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(2===arguments.length){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(3===arguments.length)if(gl(arguments[2],Qh)&&arguments[0]instanceof Object&&arguments[1]instanceof tp)for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getChildBoundables(),l=0;ln&&(n=o)}}return n+1}},ip.prototype.createParentBoundables=function(t,e){var n=this;ql.isTrue(!t.isEmpty());var r=new lc;r.add(this.createNode(e));var i=new lc(t);np.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},ip.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},ip.prototype.interfaces_=function(){return[al]},ip.prototype.getClass=function(){return ip},ip.compareDoubles=function(t,e){return t>e?1:t0);for(var n=new lc,r=0;r0;){var p=h.poll(),f=p.getDistance();if(f>=l)break;p.isLeaves()?(l=f,c=p):p.expandToQueue(h,l)}return[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else if(3===arguments.length){var g=arguments[0],d=arguments[1],y=arguments[2],v=new Zh(g,d),_=new rp(this.getRoot(),v,y);return this.nearestNeighbour(_)[0]}},e.prototype.interfaces_=function(){return[$h,al]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},n.STRtreeNode.get=function(){return lp},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[sl]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[sl]},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(ip),lp=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new Ll(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(tp),cp=function(){};cp.prototype.interfaces_=function(){return[]},cp.prototype.getClass=function(){return cp},cp.relativeSign=function(t,e){return te?1:0},cp.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=cp.relativeSign(e.x,n.x),i=cp.relativeSign(e.y,n.y);switch(t){case 0:return cp.compareValue(r,i);case 1:return cp.compareValue(i,r);case 2:return cp.compareValue(i,-r);case 3:return cp.compareValue(-r,i);case 4:return cp.compareValue(-r,-i);case 5:return cp.compareValue(-i,-r);case 6:return cp.compareValue(-i,r);case 7:return cp.compareValue(r,-i)}return ql.shouldNeverReachHere("invalid octant value"),0},cp.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var hp=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new ul(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};hp.prototype.getCoordinate=function(){return this.coord},hp.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},hp.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:cp.compare(this._segmentOctant,this.coord,e.coord)},hp.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},hp.prototype.isInterior=function(){return this._isInterior},hp.prototype.interfaces_=function(){return[il]},hp.prototype.getClass=function(){return hp};var pp=function(){this._nodeMap=new Cc,this._edge=null;var t=arguments[0];this._edge=t};pp.prototype.getSplitCoordinates=function(){var t=new hc;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},pp.prototype.addCollapsedNodes=function(){var t=new lc;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},pp.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},pp.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof ul&&arguments[1]instanceof ul){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new el("Cannot compute the octant for two identical points "+i);return fp.octant(s,a)}};var gp=function(){};gp.prototype.getCoordinates=function(){},gp.prototype.size=function(){},gp.prototype.getCoordinate=function(t){},gp.prototype.isClosed=function(){},gp.prototype.setData=function(t){},gp.prototype.getData=function(){},gp.prototype.interfaces_=function(){return[]},gp.prototype.getClass=function(){return gp};var dp=function(){};dp.prototype.addIntersection=function(t,e){},dp.prototype.interfaces_=function(){return[gp]},dp.prototype.getClass=function(){return dp};var yp=function(){this._nodeList=new pp(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};yp.prototype.getCoordinates=function(){return this._pts},yp.prototype.size=function(){return this._pts.length},yp.prototype.getCoordinate=function(t){return this._pts[t]},yp.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},yp.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},yp.prototype.setData=function(t){this._data=t},yp.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:fp.octant(t,e)},yp.prototype.getData=function(){return this._data},yp.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[3],o=new ul(n.getIntersection(i));this.addIntersection(o,r)}},yp.prototype.toString=function(){return Fl.toLineString(new lh(this._pts))},yp.prototype.getNodeList=function(){return this._nodeList},yp.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof ul){var r=arguments[0];return Xl.orientationIndex(this.p0,this.p1,r)}},vp.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},vp.prototype.isVertical=function(){return this.p0.x===this.p1.x},vp.prototype.equals=function(t){if(!(t instanceof vp))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},vp.prototype.intersection=function(t){var e=new jl;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},vp.prototype.project=function(){if(arguments[0]instanceof ul){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new ul(t);var e=this.projectionFactor(t),n=new ul;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof vp){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new vp(s,a)}},vp.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},vp.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},vp.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},vp.prototype.distancePerpendicular=function(t){return Xl.distancePointLinePerpendicular(t,this.p0,this.p1)},vp.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},vp.prototype.midPoint=function(){return vp.midPoint(this.p0,this.p1)},vp.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?nl.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},vp.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=nl.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||nl.isNaN(e))&&(e=1),e},vp.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},vp.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},vp.prototype.distance=function(){if(arguments[0]instanceof vp){var t=arguments[0];return Xl.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof ul){var e=arguments[0];return Xl.distancePointLine(e,this.p0,this.p1)}},vp.prototype.pointAlong=function(t){var e=new ul;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},vp.prototype.hashCode=function(){var t=nl.doubleToLongBits(this.p0.x);t^=31*nl.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=nl.doubleToLongBits(this.p1.x);return n^=31*nl.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},vp.prototype.interfaces_=function(){return[il,al]},vp.prototype.getClass=function(){return vp},vp.midPoint=function(t,e){return new ul((t.x+e.x)/2,(t.y+e.y)/2)},_p.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(vp,_p);var mp=function(){this.tempEnv1=new Ll,this.tempEnv2=new Ll,this._overlapSeg1=new vp,this._overlapSeg2=new vp};mp.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},mp.prototype.interfaces_=function(){return[]},mp.prototype.getClass=function(){return mp};var xp=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};xp.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},xp.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=jh.quadrant(t[n],t[n+1]),i=e+1;ir.getId()&&(r.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return Np},Object.defineProperties(e,n),e}(wp),Np=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3],o=e.getContext(),s=r.getContext();this._si.processIntersections(o,n,s,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(mp),Sp=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},Cp={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Sp.prototype.getEndCapStyle=function(){return this._endCapStyle},Sp.prototype.isSingleSided=function(){return this._isSingleSided},Sp.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Sp.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Sp.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Sp.JOIN_ROUND&&(this._quadrantSegments=Sp.DEFAULT_QUADRANT_SEGMENTS)},Sp.prototype.getJoinStyle=function(){return this._joinStyle},Sp.prototype.setJoinStyle=function(t){this._joinStyle=t},Sp.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Sp.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Sp.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Sp.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Sp.prototype.getMitreLimit=function(){return this._mitreLimit},Sp.prototype.setMitreLimit=function(t){this._mitreLimit=t},Sp.prototype.setSingleSided=function(t){this._isSingleSided=t},Sp.prototype.interfaces_=function(){return[]},Sp.prototype.getClass=function(){return Sp},Sp.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Cp.CAP_ROUND.get=function(){return 1},Cp.CAP_FLAT.get=function(){return 2},Cp.CAP_SQUARE.get=function(){return 3},Cp.JOIN_ROUND.get=function(){return 1},Cp.JOIN_MITRE.get=function(){return 2},Cp.JOIN_BEVEL.get=function(){return 3},Cp.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Cp.DEFAULT_MITRE_LIMIT.get=function(){return 5},Cp.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Sp,Cp);var Pp=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Xl.COUNTERCLOCKWISE,this._inputLine=t||null},Mp={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Pp.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r))},Pp.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;r--)this.addPt(t[r])},Lp.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=Rp.PI_TIMES_2;for(;t<=-Math.PI;)t+=Rp.PI_TIMES_2;return t},Rp.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},Rp.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},Rp.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},Rp.interiorAngle=function(t,e,n){var r=Rp.angle(e,t),i=Rp.angle(e,n);return Math.abs(i-r)},Rp.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Rp.PI_TIMES_2;t>=Rp.PI_TIMES_2&&(t=0)}else{for(;t>=Rp.PI_TIMES_2;)t-=Rp.PI_TIMES_2;t<0&&(t=0)}return t},Rp.angleBetween=function(t,e,n){var r=Rp.angle(e,t),i=Rp.angle(e,n);return Rp.diff(r,i)},Rp.diff=function(t,e){var n=null;return(n=tMath.PI&&(n=2*Math.PI-n),n},Rp.toRadians=function(t){return t*Math.PI/180},Rp.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Rp.COUNTERCLOCKWISE:n<0?Rp.CLOCKWISE:Rp.NONE},Rp.angleBetweenOriented=function(t,e,n){var r=Rp.angle(e,t),i=Rp.angle(e,n)-r;return i<=-Math.PI?i+Rp.PI_TIMES_2:i>Math.PI?i-Rp.PI_TIMES_2:i},Tp.PI_TIMES_2.get=function(){return 2*Math.PI},Tp.PI_OVER_2.get=function(){return Math.PI/2},Tp.PI_OVER_4.get=function(){return Math.PI/4},Tp.COUNTERCLOCKWISE.get=function(){return Xl.COUNTERCLOCKWISE},Tp.CLOCKWISE.get=function(){return Xl.CLOCKWISE},Tp.NONE.get=function(){return Xl.COLLINEAR},Object.defineProperties(Rp,Tp);var Ap=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new vp,this._seg1=new vp,this._offset0=new vp,this._offset1=new vp,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new jl,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Sp.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Dp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Ap.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=Xl.computeOrientation(this._s0,this._s1,this._s2),r=n===Xl.CLOCKWISE&&this._side===Sh.LEFT||n===Xl.COUNTERCLOCKWISE&&this._side===Sh.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Ap.prototype.addLineEndCap=function(t,e){var n=new vp(t,e),r=new vp;this.computeOffsetSegment(n,Sh.LEFT,this._distance,r);var i=new vp;this.computeOffsetSegment(n,Sh.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Sp.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,Xl.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Sp.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Sp.CAP_SQUARE:var u=new ul;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new ul(r.p1.x+u.x,r.p1.y+u.y),c=new ul(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Ap.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Ap.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=Ml.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof Cl))throw t;o=new ul(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Ap.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,u);r===Xl.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},Ap.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new ul((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new ul((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Ap.prototype.createCircle=function(t){var e=new ul(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Ap.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Ap.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Lp,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Ap.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Ap.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Sp.JOIN_BEVEL||this._bufParams.getJoinStyle()===Sp.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,Xl.CLOCKWISE,this._distance))},Ap.prototype.closeRing=function(){this._segList.closeRing()},Ap.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Ap.prototype.interfaces_=function(){return[]},Ap.prototype.getClass=function(){return Ap},Dp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Dp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Dp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Dp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Ap,Dp);var Fp=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Fp.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&pc.reverse(o),o},Fp.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Pp.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Sh.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=Pp.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Sh.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},Fp.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===Sh.RIGHT&&(r=-r);var i=Pp.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},Fp.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Pp.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],Sh.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Pp.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Sh.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Fp.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Sp.CAP_ROUND:e.createCircle(t);break;case Sp.CAP_SQUARE:e.createSquare(t)}},Fp.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},Fp.prototype.getBufferParameters=function(){return this._bufParams},Fp.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Fp.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Fp.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},Fp.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Pp.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Sh.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=Pp.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Sh.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},Fp.prototype.getSegGen=function(t){return new Ap(this._precisionModel,this._bufParams,t)},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Fp.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;no.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(3===arguments.length)if(gl(arguments[2],ac)&&arguments[0]instanceof ul&&arguments[1]instanceof Xh)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;ct._seg.p1.y&&t._seg.reverse();var h=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(ht._seg.p1.y||Xl.computeOrientation(t._seg.p0,t._seg.p1,s)===Xl.RIGHT)){var p=a.getDepth(Sh.LEFT);t._seg.p0.equals(l[c])||(p=a.getDepth(Sh.RIGHT));var f=new qp(t._seg,p);u.add(f)}}else if(gl(arguments[2],ac)&&arguments[0]instanceof ul&&gl(arguments[1],ac))for(var g=arguments[0],d=arguments[1],y=arguments[2],v=d.iterator();v.hasNext();){var _=v.next();_.isForward()&&t.findStabbedSegments(g,_,y)}},kp.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:np.min(e)._leftDepth},kp.prototype.interfaces_=function(){return[]},kp.prototype.getClass=function(){return kp},Gp.DepthSegment.get=function(){return qp},Object.defineProperties(kp,Gp);var qp=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new vp(t),this._leftDepth=e};qp.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},qp.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},qp.prototype.toString=function(){return this._upwardSeg.toString()},qp.prototype.interfaces_=function(){return[il]},qp.prototype.getClass=function(){return qp};var Bp=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Bp.prototype.area=function(){return Bp.area(this.p0,this.p1,this.p2)},Bp.prototype.signedArea=function(){return Bp.signedArea(this.p0,this.p1,this.p2)},Bp.prototype.interpolateZ=function(t){if(null===t)throw new el("Supplied point is null.");return Bp.interpolateZ(t,this.p0,this.p1,this.p2)},Bp.prototype.longestSideLength=function(){return Bp.longestSideLength(this.p0,this.p1,this.p2)},Bp.prototype.isAcute=function(){return Bp.isAcute(this.p0,this.p1,this.p2)},Bp.prototype.circumcentre=function(){return Bp.circumcentre(this.p0,this.p1,this.p2)},Bp.prototype.area3D=function(){return Bp.area3D(this.p0,this.p1,this.p2)},Bp.prototype.centroid=function(){return Bp.centroid(this.p0,this.p1,this.p2)},Bp.prototype.inCentre=function(){return Bp.inCentre(this.p0,this.p1,this.p2)},Bp.prototype.interfaces_=function(){return[]},Bp.prototype.getClass=function(){return Bp},Bp.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Bp.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Bp.det=function(t,e,n,r){return t*r-e*n},Bp.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,l=r.y-o,c=s*l-a*u,h=t.x-i,p=t.y-o,f=(l*h-a*p)/c,g=(-u*h+s*p)/c;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},Bp.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Bp.isAcute=function(t,e,n){return!!Rp.isAcute(t,e,n)&&(!!Rp.isAcute(e,n,t)&&!!Rp.isAcute(n,t,e))},Bp.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Bp.det(o,s,a,u),c=Bp.det(s,o*o+s*s,u,a*a+u*u),h=Bp.det(o,o*o+s*s,a,a*a+u*u);return new ul(r-c/l,i+h/l)},Bp.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Ml(t.x+n/2,t.y+r/2,1),o=new Ml(t.x-r+n/2,t.y+n+r/2,1);return new Ml(i,o)},Bp.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new ul(t.x+i*o,t.y+i*s)},Bp.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,c=o*s-r*u,h=r*a-i*s,p=l*l+c*c+h*h,f=Math.sqrt(p)/2;return f},Bp.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new ul(r,i)},Bp.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new ul(a,u)};var zp=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new lc;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};zp.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,pl.EXTERIOR,pl.INTERIOR)},zp.prototype.addPolygon=function(t){var e=this,n=this._distance,r=Sh.LEFT;this._distance<0&&(n=-this._distance,r=Sh.RIGHT);var i=t.getExteriorRing(),o=pc.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,r,pl.EXTERIOR,pl.INTERIOR);for(var s=0;s0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,Sh.opposite(r),pl.INTERIOR,pl.EXTERIOR)}},zp.prototype.isTriangleErodedCompletely=function(t,e){var n=new Bp(t[0],t[1],t[2]),r=n.inCentre();return Xl.distancePointLine(r,n.p0,n.p1)=nh.MINIMUM_VALID_SIZE&&Xl.isCCW(t)&&(o=i,s=r,n=Sh.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},zp.prototype.add=function(t){if(t.isEmpty())return null;t instanceof th?this.addPolygon(t):t instanceof Zc?this.addLineString(t):t instanceof Qc?this.addPoint(t):(t instanceof eh||t instanceof Gc||t instanceof rh||t instanceof kc)&&this.addCollection(t)},zp.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},zp.prototype.addCollection=function(t){for(var e=0;e=this._max)throw new uc;var t=this._parent.getGeometryN(this._index++);return t instanceof kc?(this._subcollectionIterator=new Up(t),this._subcollectionIterator.next()):t},Up.prototype.remove=function(){throw new Error(this.getClass().getName())},Up.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Up.prototype.interfaces_=function(){return[sc]},Up.prototype.getClass=function(){return Up},Up.isAtomic=function(t){return!(t instanceof kc)};var Vp=function(){this._geom=null;var t=arguments[0];this._geom=t};Vp.prototype.locate=function(t){return Vp.locate(t,this._geom)},Vp.prototype.interfaces_=function(){return[jp]},Vp.prototype.getClass=function(){return Vp},Vp.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&Xl.isPointInRing(t,e.getCoordinates())},Vp.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Vp.isPointInRing(t,n))return!1;for(var r=0;r=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){var t=this;if(1===arguments.length){var e=arguments[0],n=this.findIndex(e),r=e.getDepth(Sh.LEFT),i=e.getDepth(Sh.RIGHT),o=this.computeDepths(n+1,this._edgeList.size(),r),s=this.computeDepths(0,n,o);if(s!==i)throw new Oh("depth mismatch at "+e.getCoordinate())}else if(3===arguments.length){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=l,h=a;h=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===n&&s.getEdgeRing()===t&&(n=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;r=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;r.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(ql.isTrue(null!==n,"found null for first outgoing dirEdge"),ql.isTrue(n.getEdgeRing()===t,"unable to link last incoming dirEdge"),r.setNextMin(n))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){var n=e.next();n.isInResult()&&t++}return t}if(1===arguments.length){for(var r=arguments[0],i=0,o=this.iterator();o.hasNext();){var s=o.next();s.getEdgeRing()===r&&i++}return i}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=pl.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=pl.INTERIOR;break}if(r.isInResult()){t=pl.EXTERIOR;break}}}if(t===pl.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===pl.INTERIOR):(s.isInResult()&&(i=pl.EXTERIOR),a.isInResult()&&(i=pl.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new Dh(pl.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==pl.INTERIOR&&o!==pl.BOUNDARY||this._label.setLocation(i,pl.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xp),Hp=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new Bh(t,new Yp)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yh),Wp=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Wp.prototype.compareTo=function(t){var e=t;return Wp.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Wp.prototype.interfaces_=function(){return[il]},Wp.prototype.getClass=function(){return Wp},Wp.orientation=function(t){return 1===pc.increasingDirection(t)},Wp.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var h=(u+=i)===s,p=(l+=o)===a;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Jp=function(){this._edges=new lc,this._ocaMap=new Cc};Jp.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},Jp.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Jp.prototype.findEdgeIndex=function(t){for(var e=0;e0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new ul(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new of(o,new Dh(this.edge._label))},$p.prototype.add=function(t,e,n){var r=new Qp(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},$p.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},$p.prototype.interfaces_=function(){return[]},$p.prototype.getClass=function(){return $p};var tf=function(){};tf.prototype.getChainStartIndices=function(t){var e=0,n=new lc;n.add(new _l(e));do{var r=this.findChainEnd(t,e);n.add(new _l(r)),e=r}while(en?e:n},ef.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}},nf.prototype.getDelta=function(t){return this._depth[t][Sh.RIGHT]-this._depth[t][Sh.LEFT]},nf.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?pl.EXTERIOR:pl.INTERIOR},nf.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},nf.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==pl.EXTERIOR&&i!==pl.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=nf.depthAtLocation(i):t._depth[n][r]+=nf.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];a===pl.INTERIOR&&this._depth[o][s]++}},nf.prototype.interfaces_=function(){return[]},nf.prototype.getClass=function(){return nf},nf.depthAtLocation=function(t){return t===pl.EXTERIOR?0:t===pl.INTERIOR?1:nf.NULL_VALUE},rf.NULL_VALUE.get=function(){return-1},Object.defineProperties(nf,rf);var of=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new $p(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new nf,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,Dh.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new ef(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new Ll;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;er||this._maxyo;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return ql.isTrue(!(s&&a),"Found bad envelope test"),a},cf.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new ul(this._maxx,this._maxy),this._corner[1]=new ul(this._minx,this._maxy),this._corner[2]=new ul(this._minx,this._miny),this._corner[3]=new ul(this._maxx,this._miny)},cf.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},cf.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},cf.prototype.getCoordinate=function(){return this._originalPt},cf.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},cf.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=cf.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ll(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},cf.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},cf.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!n||!r)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},cf.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},hf.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(cf,hf);var pf=function(){this.tempEnv1=new Ll,this.selectedSegment=new vp};pf.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf};var ff=function(){this._index=null;var t=arguments[0];this._index=t},gf={HotPixelSnapAction:{configurable:!0}};ff.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new df(e,n,r);return this._index.query(i,{interfaces_:function(){return[Qh]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},gf.HotPixelSnapAction.get=function(){return df},Object.defineProperties(ff,gf);var df=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[0],n=arguments[1],r=e.getContext();if(null!==this._parentEdge&&r===this._parentEdge&&n===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pf),yf=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new lc};yf.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof Oh))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=_f.precisionScaleFactor(this._argGeom,this._distance,n),i=new gh(r);this.bufferFixedPrecision(i)}},_f.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===gh.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},_f.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},_f.prototype.bufferOriginalPrecision=function(){try{var t=new sf(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof kl))throw t;this._saveException=t}},_f.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},_f.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},_f.prototype.interfaces_=function(){return[]},_f.prototype.getClass=function(){return _f},_f.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new _f(t),r=n.getResultGeometry(e);return r}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Wl&&"number"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=arguments[2],a=new _f(i);a.setQuadrantSegments(s);var u=a.getResultGeometry(o);return u}if(arguments[2]instanceof Sp&&arguments[0]instanceof Wl&&"number"==typeof arguments[1]){var l=arguments[0],c=arguments[1],h=arguments[2],p=new _f(l,h),f=p.getResultGeometry(c);return f}}else if(4===arguments.length){var g=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],_=new _f(g);_.setQuadrantSegments(y),_.setEndCapStyle(v);var m=_.getResultGeometry(d);return m}},_f.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=dl.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},mf.CAP_ROUND.get=function(){return Sp.CAP_ROUND},mf.CAP_BUTT.get=function(){return Sp.CAP_FLAT},mf.CAP_FLAT.get=function(){return Sp.CAP_FLAT},mf.CAP_SQUARE.get=function(){return Sp.CAP_SQUARE},mf.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(_f,mf);var xf=function(){this._pt=[new ul,new ul],this._distance=nl.NaN,this._isNull=!0};xf.prototype.getCoordinates=function(){return this._pt},xf.prototype.getCoordinate=function(t){return this._pt[t]},xf.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}},xf.prototype.interfaces_=function(){return[]},xf.prototype.getClass=function(){return xf};var Ef=function(){};Ef.prototype.interfaces_=function(){return[]},Ef.prototype.getClass=function(){return Ef},Ef.computeDistance=function(){if(arguments[2]instanceof xf&&arguments[0]instanceof Zc&&arguments[1]instanceof ul)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new vp,o=0;o0||this._isIn?pl.INTERIOR:pl.EXTERIOR)},Pf.prototype.interfaces_=function(){return[]},Pf.prototype.getClass=function(){return Pf};var Mf=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},Lf={INSIDE_AREA:{configurable:!0}};Mf.prototype.isInsideArea=function(){return this._segIndex===Mf.INSIDE_AREA},Mf.prototype.getCoordinate=function(){return this._pt},Mf.prototype.getGeometryComponent=function(){return this._component},Mf.prototype.getSegmentIndex=function(){return this._segIndex},Mf.prototype.interfaces_=function(){return[]},Mf.prototype.getClass=function(){return Mf},Lf.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Mf,Lf);var Of=function(t){this._pts=t||null};Of.prototype.filter=function(t){t instanceof Qc&&this._pts.add(t)},Of.prototype.interfaces_=function(){return[Dc]},Of.prototype.getClass=function(){return Of},Of.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Qc?np.singletonList(t):Of.getPoints(t,new lc)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Qc?n.add(e):e instanceof kc&&e.apply(new Of(n)),n}};var Rf=function(){this._locations=null;var t=arguments[0];this._locations=t};Rf.prototype.filter=function(t){(t instanceof Qc||t instanceof Zc||t instanceof th)&&this._locations.add(new Mf(t,0,t.getCoordinate()))},Rf.prototype.interfaces_=function(){return[Dc]},Rf.prototype.getClass=function(){return Rf},Rf.getLocations=function(t){var e=new lc;return t.apply(new Rf(e)),e};var Tf=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Pf,this._minDistanceLocation=null,this._minDistance=nl.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Tf.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=1-n,o=Sf.getPolygons(this._geom[n]);if(o.size()>0){var s=Rf.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&gl(arguments[0],ac)&&gl(arguments[1],ac)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;cthis._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;sthis._minDistance)return null;for(var f=c.getCoordinates(),g=h.getCoordinates(),d=0;dthis._distance&&this.initialize(e,n,r)}},Af.prototype.interfaces_=function(){return[]},Af.prototype.getClass=function(){return Af};var Df=function(){};Df.prototype.interfaces_=function(){return[]},Df.prototype.getClass=function(){return Df},Df.computeDistance=function(){if(arguments[2]instanceof Af&&arguments[0]instanceof Zc&&arguments[1]instanceof ul)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new vp,i=t.getCoordinates(),o=0;o1||t<=0)throw new el("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Ff.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Ff.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ff.prototype.computeOrientedDistance=function(t,e,n){var r=new Gf(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new qf(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Ff.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ff.prototype.interfaces_=function(){return[]},Ff.prototype.getClass=function(){return Ff},Ff.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Ff(t,e);return n.distance()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new Ff(r,i);return s.setDensifyFraction(o),s.distance()}},kf.MaxPointDistanceFilter.get=function(){return Gf},kf.MaxDensifiedByFractionDistanceFilter.get=function(){return qf},Object.defineProperties(Ff,kf);var Gf=function(){this._maxPtDist=new Af,this._minPtDist=new Af,this._euclideanDist=new Df,this._geom=null;var t=arguments[0];this._geom=t};Gf.prototype.filter=function(t){this._minPtDist.initialize(),Df.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Gf.prototype.getMaxPointDistance=function(){return this._maxPtDist},Gf.prototype.interfaces_=function(){return[Kl]},Gf.prototype.getClass=function(){return Gf};var qf=function(){this._maxPtDist=new Af,this._minPtDist=new Af,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};qf.prototype.filter=function(t,e){var n=this;if(0===e)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;an){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Fl.toLineString(i[0],i[1])+")"}},Bf.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Bf.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Bf.VERBOSE&&Pl.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Bf.prototype.checkNegativeValid=function(){if(!(this._input instanceof th||this._input instanceof rh||this._input instanceof kc))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Bf.prototype.getErrorIndicator=function(){return this._errorIndicator},Bf.prototype.checkMinimumDistance=function(t,e,n){var r=new Tf(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},jf.prototype.report=function(t){if(!jf.VERBOSE)return null;Pl.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},jf.prototype.getErrorMessage=function(){return this._errorMsg},jf.prototype.interfaces_=function(){return[]},jf.prototype.getClass=function(){return jf},jf.isValidMsg=function(t,e,n){var r=new jf(t,e,n);return r.isValid()?null:r.getErrorMessage()},jf.isValid=function(t,e,n){return!!new jf(t,e,n).isValid()},Uf.VERBOSE.get=function(){return!1},Uf.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(jf,Uf);var Vf=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Vf.prototype.getCoordinates=function(){return this._pts},Vf.prototype.size=function(){return this._pts.length},Vf.prototype.getCoordinate=function(t){return this._pts[t]},Vf.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Vf.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:fp.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Vf.prototype.setData=function(t){this._data=t},Vf.prototype.getData=function(){return this._data},Vf.prototype.toString=function(){return Fl.toLineString(new lh(this._pts))},Vf.prototype.interfaces_=function(){return[gp]},Vf.prototype.getClass=function(){return Vf};var Xf=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new lc,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Xf.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Xf.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Xf.prototype.getIntersectionSegments=function(){return this._intSegments},Xf.prototype.count=function(){return this._intersectionCount},Xf.prototype.getIntersections=function(){return this._intersections},Xf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Xf.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Xf.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,r)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Xf.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Xf.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Xf.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Xf.prototype.interfaces_=function(){return[Zp]},Xf.prototype.getClass=function(){return Xf},Xf.createAllIntersectionsFinder=function(t){var e=new Xf(t);return e.setFindAllIntersections(!0),e},Xf.createAnyIntersectionFinder=function(t){return new Xf(t)},Xf.createIntersectionCounter=function(t){var e=new Xf(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Yf=function(){this._li=new jl,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Yf.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Yf.prototype.getIntersections=function(){return this._segInt.getIntersections()},Yf.prototype.isValid=function(){return this.execute(),this._isValid},Yf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Yf.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Xf(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ip;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Yf.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Oh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Yf.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Fl.toLineString(t[0],t[1])+" and "+Fl.toLineString(t[2],t[3])},Yf.prototype.interfaces_=function(){return[]},Yf.prototype.getClass=function(){return Yf},Yf.computeIntersections=function(t){var e=new Yf(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Hf=function t(){this._nv=null;var e=arguments[0];this._nv=new Yf(t.toSegmentStrings(e))};Hf.prototype.checkValid=function(){this._nv.checkValid()},Hf.prototype.interfaces_=function(){return[]},Hf.prototype.getClass=function(){return Hf},Hf.toSegmentStrings=function(t){for(var e=new lc,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Vf(r.getCoordinates(),r))}return e},Hf.checkValid=function(t){new Hf(t).checkValid()};var Wf=function(t){this._mapOp=t};Wf.prototype.map=function(t){for(var e=new lc,n=0;n0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Kf.prototype.interfaces_=function(){return[]},Kf.prototype.getClass=function(){return Kf};var Qf=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new vp,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Zc&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Qf.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r=0&&t.add(o+1,new ul(i),!1)}},Qf.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=nl.MAX_VALUE,i=-1,o=0;oe&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min($f.computeOverlaySnapTolerance(i),$f.computeOverlaySnapTolerance(o))}},$f.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*$f.SNAP_PRECISION_FACTOR},$f.snapToSelf=function(t,e,n){return new $f(t).snapToSelf(e,n)},tg.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties($f,tg);var eg=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Qf(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Kf),ng=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ng.prototype.getCommon=function(){return nl.longBitsToDouble(this._commonBits)},ng.prototype.add=function(t){var e=nl.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=ng.signExpBits(this._commonBits),this._isFirst=!1,null):ng.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=ng.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=ng.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},ng.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=nl.longBitsToDouble(t),n=nl.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),o=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return o}},ng.prototype.interfaces_=function(){return[]},ng.prototype.getClass=function(){return ng},ng.getBit=function(t,e){return 0!=(t&1<>52},ng.zeroLowerBits=function(t,e){return t&~((1<=0;r--){if(ng.getBit(t,r)!==ng.getBit(e,r))return n;n++}return 52};var rg=function(){this._commonCoord=null,this._ccFilter=new og},ig={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};rg.prototype.addCommonBits=function(t){var e=new sg(this._commonCoord);t.apply(e),t.geometryChanged()},rg.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new ul(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new sg(e);return t.apply(n),t.geometryChanged(),t},rg.prototype.getCommonCoordinate=function(){return this._commonCoord},rg.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},rg.prototype.interfaces_=function(){return[]},rg.prototype.getClass=function(){return rg},ig.CommonCoordinateFilter.get=function(){return og},ig.Translater.get=function(){return sg},Object.defineProperties(rg,ig);var og=function(){this._commonBitsX=new ng,this._commonBitsY=new ng};og.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},og.prototype.getCommonCoordinate=function(){return new ul(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},og.prototype.interfaces_=function(){return[Kl]},og.prototype.getClass=function(){return og};var sg=function(){this.trans=null;var t=arguments[0];this.trans=t};sg.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},sg.prototype.isDone=function(){return!1},sg.prototype.isGeometryChanged=function(){return!0},sg.prototype.interfaces_=function(){return[Fc]},sg.prototype.getClass=function(){return sg};var ag=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ag.prototype.selfSnap=function(t){return new $f(t).snapTo(t,this._snapTolerance)},ag.prototype.removeCommonBits=function(t){this._cbr=new rg,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},ag.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ag.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Mg.overlayOp(e[0],e[1],t);return this.prepareResult(n)},ag.prototype.checkValid=function(t){t.isValid()||Pl.out.println("Snapped geometry is invalid")},ag.prototype.computeSnapTolerance=function(){this._snapTolerance=$f.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ag.prototype.snap=function(t){var e=this.removeCommonBits(t);return $f.snap(e[0],e[1],this._snapTolerance)},ag.prototype.interfaces_=function(){return[]},ag.prototype.getClass=function(){return ag},ag.overlayOp=function(t,e,n){return new ag(t,e).getResultGeometry(n)},ag.union=function(t,e){return ag.overlayOp(t,e,Mg.UNION)},ag.intersection=function(t,e){return ag.overlayOp(t,e,Mg.INTERSECTION)},ag.symDifference=function(t,e){return ag.overlayOp(t,e,Mg.SYMDIFFERENCE)},ag.difference=function(t,e){return ag.overlayOp(t,e,Mg.DIFFERENCE)};var ug=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};ug.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=Mg.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof kl))throw t;r=t}if(!n)try{e=ag.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof kl?r:t}return e},ug.prototype.interfaces_=function(){return[]},ug.prototype.getClass=function(){return ug},ug.overlayOp=function(t,e,n){return new ug(t,e).getResultGeometry(n)},ug.union=function(t,e){return ug.overlayOp(t,e,Mg.UNION)},ug.intersection=function(t,e){return ug.overlayOp(t,e,Mg.INTERSECTION)},ug.symDifference=function(t,e){return ug.overlayOp(t,e,Mg.SYMDIFFERENCE)},ug.difference=function(t,e){return ug.overlayOp(t,e,Mg.DIFFERENCE)};var lg=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};lg.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},lg.prototype.interfaces_=function(){return[]},lg.prototype.getClass=function(){return lg};var cg=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},hg={INSERT:{configurable:!0},DELETE:{configurable:!0}};cg.prototype.isDelete=function(){return this._eventType===cg.DELETE},cg.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},cg.prototype.getObject=function(){return this._obj},cg.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},cg.prototype.getInsertEvent=function(){return this._insertEvent},cg.prototype.isInsert=function(){return this._eventType===cg.INSERT},cg.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},cg.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},cg.prototype.interfaces_=function(){return[il]},cg.prototype.getClass=function(){return cg},hg.INSERT.get=function(){return 1},hg.DELETE.get=function(){return 2},Object.defineProperties(cg,hg);var pg=function(){};pg.prototype.interfaces_=function(){return[]},pg.prototype.getClass=function(){return pg};var fg=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};fg.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(fg.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},fg.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},fg.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},fg.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},fg.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},fg.prototype.hasProperIntersection=function(){return this._hasProper},fg.prototype.hasIntersection=function(){return this._hasIntersection},fg.prototype.isDone=function(){return this._isDone},fg.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},fg.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},fg.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},fg.prototype.interfaces_=function(){return[]},fg.prototype.getClass=function(){return fg},fg.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var gg=function(t){function e(){t.call(this),this.events=new lc,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){np.sort(this.events);for(var t=0;te||this._maxo?1:0},vg.prototype.interfaces_=function(){return[sl]},vg.prototype.getClass=function(){return vg};var _g=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dg),mg=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dg),xg=function(){this._leaves=new lc,this._root=null,this._level=0};xg.prototype.buildTree=function(){np.sort(this._leaves,new dg.NodeComparator);for(var t=this._leaves,e=null,n=new lc;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},xg.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new _g(t,e,n))},xg.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},xg.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},xg.prototype.printNode=function(t){Pl.out.println(Fl.toLineString(new ul(t._min,this._level),new ul(t._max,this._level)))},xg.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},xg.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===pl.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=pc.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;Xl.isCCW(r)&&(i=n,o=e);var s=new of(r,new Dh(this._argIndex,pl.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],pl.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new Dh(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new gg},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof rh&&(this._useBoundaryDeterminationRule=!1),e instanceof th)this.addPolygon(e);else if(e instanceof Zc)this.addLineString(e);else if(e instanceof Qc)this.addPoint(e);else if(e instanceof eh)this.addCollection(e);else if(e instanceof Gc)this.addCollection(e);else if(e instanceof rh)this.addCollection(e);else{if(!(e instanceof kc))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new bg(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?pl.BOUNDARY:pl.INTERIOR},e}(Hh),Cg=function(){if(this._li=new jl,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Sg(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=Ql.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sg(0,e,r),this._arg[1]=new Sg(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Sg(0,i,s),this._arg[1]=new Sg(1,o,s)}};Cg.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Cg.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Cg.prototype.interfaces_=function(){return[]},Cg.prototype.getClass=function(){return Cg};var Pg=function(){};Pg.prototype.interfaces_=function(){return[]},Pg.prototype.getClass=function(){return Pg},Pg.map=function(){if(arguments[0]instanceof Wl&&gl(arguments[1],Pg.MapOp)){for(var t=arguments[0],e=arguments[1],n=new lc,r=0;r=t.size()?null:t.get(e)},Fg.union=function(t){return new Fg(t).union()},kg.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Fg,kg);var Gg=function(){};function qg(){return new Bg}function Bg(){this.reset()}Gg.prototype.interfaces_=function(){return[]},Gg.prototype.getClass=function(){return Gg},Gg.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Mg.createEmptyResult(Mg.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ug.overlayOp(t,e,Mg.UNION)},Bg.prototype={constructor:Bg,reset:function(){this.s=this.t=0},add:function(t){jg(zg,t,this.t),jg(this,zg.s,this.s),this.s?this.t+=zg.t:this.s=zg.t},valueOf:function(){return this.s}};var zg=new Bg;function jg(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var Ug=1e-6,Vg=Math.PI,Xg=Vg/2,Yg=Vg/4,Hg=2*Vg,Wg=180/Vg,Jg=Vg/180,Zg=Math.abs,Kg=Math.atan,Qg=Math.atan2,$g=Math.cos,td=Math.sin,ed=Math.sqrt;function nd(t){return t>1?0:t<-1?Vg:Math.acos(t)}function rd(t){return t>1?Xg:t<-1?-Xg:Math.asin(t)}function id(){}function od(t,e){t&&ad.hasOwnProperty(t.type)&&ad[t.type](t,e)}var sd={Feature:function(t,e){od(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rVg?t-Hg:t<-Vg?t+Hg:t,e]}function md(t){return function(e,n){return[(e+=t)>Vg?e-Hg:e<-Vg?e+Hg:e,n]}}function xd(t){var e=md(t);return e.invert=md(-t),e}function Ed(t,e){var n=$g(t),r=td(t),i=$g(e),o=td(e);function s(t,e){var s=$g(e),a=$g(t)*s,u=td(t)*s,l=td(e),c=l*n+a*r;return[Qg(u*i-c*o,a*n-l*r),rd(c*i+u*o)]}return s.invert=function(t,e){var s=$g(e),a=$g(t)*s,u=td(t)*s,l=td(e),c=l*i-u*o;return[Qg(u*i+l*o,a*n+c*r),rd(c*n-a*r)]},s}function bd(t,e){(e=hd(e))[0]-=t,yd(e);var n=nd(-e[1]);return((-e[2]<0?-n:n)+Hg-Ug)%Hg}function wd(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:id,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Id(t,e){return Zg(t[0]-e[0])=0;--o)i.point((c=l[o])[0],c[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}}function Cd(t){if(e=t.length){for(var e,n,r=0,i=t[0];++re?1:t>=e?0:NaN}_d.invert=_d;var Md,Ld;1===(Md=Pd).length&&(Ld=Md,Md=function(t,e){return Pd(Ld(t),e)});function Od(t){for(var e,n,r,i=t.length,o=-1,s=0;++o=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}var Rd=1e9,Td=-Rd;function Ad(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(r,i){return Zg(r[0]-t)0?0:3:Zg(r[0]-n)0?2:1:Zg(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,p,f,g,d,y,v,_,m=s,x=wd(),E={point:b,lineStart:function(){E.point=w,l&&l.push(c=[]);v=!0,y=!1,g=d=NaN},lineEnd:function(){u&&(w(h,p),f&&y&&x.rejoin(),u.push(x.result()));E.point=b,y&&m.lineEnd()},polygonStart:function(){m=x,u=[],l=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(p-o)*(r-s)>(f-s)*(t-o)&&++e:f<=r&&(p-o)*(r-s)<(f-s)*(t-o)&&--e;return e}(),n=_&&e,i=(u=Od(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&Sd(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function b(t,e){i(t,e)&&m.point(t,e)}function w(o,s){var a=i(o,s);if(l&&c.push([o,s]),v)h=o,p=s,f=a,v=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&y)m.point(o,s);else{var u=[g=Math.max(Td,Math.min(Rd,g)),d=Math.max(Td,Math.min(Rd,d))],x=[o=Math.max(Td,Math.min(Rd,o)),s=Math.max(Td,Math.min(Rd,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,p=e[1]-u;if(s=n-a,h||!(s>0)){if(s/=h,h<0){if(s0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s0)){if(s/=p,p<0){if(s0){if(s>c)return;s>l&&(l=s)}if(s=o-u,p||!(s<0)){if(s/=p,p<0){if(s>c)return;s>l&&(l=s)}else if(p>0){if(s0&&(t[0]=a+l*h,t[1]=u+l*p),c<1&&(e[0]=a+c*h,e[1]=u+c*p),!0}}}}}(u,x,t,e,n,r)?a&&(m.lineStart(),m.point(o,s),_=!1):(y||(m.lineStart(),m.point(u[0],u[1])),m.point(x[0],x[1]),a||m.lineEnd(),_=!1)}g=o,d=s,y=a}return E}}var Dd=qg();qg();function Fd(t){return t}qg(),qg();var kd=1/0,Gd=kd,qd=-kd,Bd=qd,zd={point:function(t,e){tqd&&(qd=t);eBd&&(Bd=e)},lineStart:id,lineEnd:id,polygonStart:id,polygonEnd:id,result:function(){var t=[[kd,Gd],[qd,Bd]];return qd=Bd=-(Gd=kd=1/0),t}};qg();function jd(t,e,n,r){return function(i,o){var s,a,u,l=e(o),c=i.invert(r[0],r[1]),h=wd(),p=e(h),f=!1,g={point:d,lineStart:v,lineEnd:_,polygonStart:function(){g.point=m,g.lineStart=x,g.lineEnd=E,a=[],s=[]},polygonEnd:function(){g.point=d,g.lineStart=v,g.lineEnd=_,a=Od(a);var t=function(t,e){var n=e[0],r=e[1],i=[td(n),-$g(n),0],o=0,s=0;Dd.reset();for(var a=0,u=t.length;a=0?1:-1,I=w*b,N=I>Vg,S=g*x;if(Dd.add(Qg(S*w*td(I),d*E+S*$g(I))),o+=N?b+w*Hg:b,N^p>=n^_>=n){var C=fd(hd(h),hd(v));yd(C);var P=fd(i,C);yd(P);var M=(N^b>=0?-1:1)*rd(P[2]);(r>M||r===M&&(C[0]||C[1]))&&(s+=N^b>=0?1:-1)}}return(o<-1e-6||o0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(Ud))}return g}}function Ud(t){return t.length>1}function Vd(t,e){return((t=t.x)[0]<0?t[1]-Xg-Ug:Xg-t[1])-((e=e.x)[0]<0?e[1]-Xg-Ug:Xg-e[1])}var Xd=jd((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Vg:-Vg,u=Zg(o-n);Zg(u-Vg)0?Xg:-Xg),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=Vg&&(Zg(n-i)Ug?Kg((td(e)*(o=$g(r))*td(n)-td(r)*(i=$g(e))*td(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*Xg,r.point(-Vg,i),r.point(0,i),r.point(Vg,i),r.point(Vg,0),r.point(Vg,-i),r.point(0,-i),r.point(-Vg,-i),r.point(-Vg,0),r.point(-Vg,i);else if(Zg(t[0]-e[0])>Ug){var o=t[0]0,i=Zg(n)>Ug;function o(t,e){return $g(t)*$g(e)>n}function s(t,e,r){var i=[1,0,0],o=fd(hd(t),hd(e)),s=pd(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var l=n*s/u,c=-n*a/u,h=fd(i,o),p=dd(i,l);gd(p,dd(o,c));var f=h,g=pd(p,f),d=pd(f,f),y=g*g-d*(pd(p,p)-1);if(!(y<0)){var v=ed(y),_=dd(f,(-g-v)/d);if(gd(_,p),_=cd(_),!r)return _;var m,x=t[0],E=e[0],b=t[1],w=e[1];E0^_[1]<(Zg(_[0]-x)Vg^(x<=_[0]&&_[0]<=E)){var S=dd(f,(-g+v)/d);return gd(S,p),[_,cd(S)]}}}function a(e,n){var i=r?t:Vg-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return jd(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,p){var f,g=[h,p],d=o(h,p),y=r?d?0:a(h,p):d?a(h+(h<0?Vg:-Vg),p):0;if(!e&&(l=u=d)&&t.lineStart(),d!==u&&(!(f=s(e,g))||Id(e,f)||Id(g,f))&&(g[0]+=Ug,g[1]+=Ug,d=o(g[0],g[1])),d!==u)c=0,d?(t.lineStart(),f=s(g,e),t.point(f[0],f[1])):(f=s(e,g),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&r^d){var v;y&n||!(v=s(g,e,!0))||(c=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!d||e&&Id(e,g)||t.point(g[0],g[1]),e=g,u=d,n=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=$g(e),a=td(e),u=r*n;null==i?(i=e+r*Hg,o=e-u/2):(i=bd(s,i),o=bd(s,o),(r>0?io)&&(i+=r*Hg));for(var l,c=i;r>0?c>o:c4*e&&d--){var x=s+p,E=a+f,b=u+g,w=ed(x*x+E*E+b*b),I=rd(b/=w),N=Zg(Zg(b)-1)e||Zg((v*M+_*L)/m-.5)>.3||s*p+a*f+u*g2?t[2]%360*Jg:0,P()):[y*Wg,v*Wg,_*Wg]},N.precision=function(t){return arguments.length?(I=Kd(C,w=t*t),M()):ed(w)},N.fitExtent=function(t,e){return Jd(N,t,e)},N.fitSize=function(t,e){return function(t,e,n){return Jd(t,[[0,0],e],n)}(N,t,e)},function(){return e=t.apply(this,arguments),N.invert=e.invert&&S,P()}}((function(){return t}))()}var ty=function(t){return function(e,n){var r=$g(e),i=$g(n),o=t(r*i);return[o*i*td(e),o*td(n)]}}((function(t){return(t=nd(t))&&t/td(t)}));function ey(){return $d(ty).scale(79.4188).clipAngle(179.999)}function ny(t,n,r,i){var s=t.properties||{},a="Feature"===t.type?t.geometry:t;if("GeometryCollection"===a.type){var u=[];return q(t,(function(t){var e=ny(t,n,r,i);e&&u.push(e)})),f(u)}var l=function(t){var n=xn(t).geometry.coordinates,r=[-n[0],-n[1]];return ey().rotate(r).scale(e)}(a),c={type:a.type,coordinates:iy(a.coordinates,l)},h=(new Ih).read(c),p=m(x(n,r),"meters"),g=_f.bufferOp(h,p,i);if(!ry((g=(new Nh).write(g)).coordinates))return o({type:g.type,coordinates:oy(g.coordinates,l)},s)}function ry(t){return Array.isArray(t[0])?ry(t[0]):isNaN(t[0])}function iy(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return iy(t,e)}))}function oy(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return oy(t,e)}))}function sy(t,e,n){void 0===n&&(n={});var r=rt(t),i=rt(e),o=$u.intersection(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],n.properties):y(o,n.properties)}function ay(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/me([i,u],[s,u],n)*(s-i),h=2*e/me([l,o],[l,a],n)*(a-o),p=c/2,g=2*p,d=Math.sqrt(3)/2*h,y=s-i,v=a-o,_=3/4*g,m=d,x=(y-g)/(g-p/2),E=Math.floor(x),b=(E*_-p/2-y)/2-p/2+_/2,w=Math.floor((v-d)/d),I=(v-w*d)/2,N=w*d-v>d/2;N&&(I-=d/4);for(var S=[],C=[],P=0;P<6;P++){var M=2*Math.PI/6*P;S.push(Math.cos(M)),C.push(Math.sin(M))}for(var L=[],O=0;O<=E;O++)for(var R=0;R<=w;R++){var T=O%2==1;if((0!==R||!T)&&(0!==R||!N)){var A=O*_+i-b,D=R*m+o+I;if(T&&(D-=d/2),!0===n.triangles)ly([A,D],c/2,h/2,JSON.parse(r),S,C).forEach((function(t){n.mask?sy(n.mask,t)&&L.push(t):L.push(t)}));else{var F=uy([A,D],c/2,h/2,JSON.parse(r),S,C);n.mask?sy(n.mask,F)&&L.push(F):L.push(F)}}}return f(L)}function uy(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],c=t[1]+n*o[a];s.push([u,c])}return s.push(s[0].slice()),l([s],r)}function ly(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(l([u],r))}return s}function cy(t){return y(t)}function hy(t){return l(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function py(t,e,n){return void 0===n&&(n={}),function(t,e,n,r){void 0===r&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],c=e/me([o,s],[a,s],r)*(a-o),h=n/me([o,s],[o,u],r)*(u-s),p=a-o,g=u-s,d=Math.floor(p/c),y=Math.floor(g/h),v=(g-y*h)/2,_=o+(p-d*c)/2,m=0;m=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var u=mn(r[o],r[o-1])-180;return vn(r[o],s,u,n)}return a(r[o])}i+=me(r[o],r[o+1],n)}return a(r[r.length-1])},t.angle=function(t,e,n,r){if(void 0===r&&(r={}),!P(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=b(!0!==r.mercator?mn(i,o):Bi(i,o)),u=b(!0!==r.mercator?mn(s,o):Bi(s,o)),l=Math.abs(a-u);return!0===r.explementary?360-l:l},t.applyFilter=uu,t.area=jr,t.areaFactors=i,t.bbox=Z,t.bboxClip=function(t,e){var n=rt(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){!function(t,e,n){var r,i,o,s,a,u=t.length,l=Ri(t[0],e),c=[];for(n||(n=[]),r=1;r0)for(var n=0;n0},t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Us(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Us(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Zn(tn(t)).features,r=Zn(tn(e)).features,i=0;in&&(e.numberOfClusters=n),!0!==e.mutate&&(t=Ie(t));var r=G(t),i=r.slice(0,e.numberOfClusters),o=zs(r,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),F(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=s[n]})),t},t.collect=function(t,e,n,r){var i=Nt(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=Z(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){ye([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t},t.collectionOf=nt,t.combine=function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return F(t,(function(t){var n,r,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(n=e.MultiPoint.coordinates).push.apply(n,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(r=e.MultiLineString.coordinates).push.apply(r,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),f(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return o({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},t.concave=function(t,e){void 0===e&&(e={});var n=e.maxEdge||1/0,r=xe(function(t){var e=[],n={};return F(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),f(e)}(t));if(r.features=r.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=me(r,i,e),a=me(i,o,e),u=me(r,o,e);return s<=n&&a<=n&&u<=n})),r.features.length<1)return null;var i=$e(r);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),o(i)},t.containsNumber=$,t.convertArea=S,t.convertDistance=N,t.convertLength=N,t.convex=de,t.coordAll=G,t.coordEach=R,t.coordReduce=T,t.createBins=au,t.degrees2radians=I,t.degreesToRadians=I,t.destination=vn,t.difference=function(t,e){var n=rt(t),r=rt(e),i=t.properties||{},o=$u.difference(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?l(o[0],i):y(o,i)},t.dissolve=function(t,e){if(!P(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;nt(t,"Polygon","dissolve");var r=[];if(!e.propertyName)return ni(y($u.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};F(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)}));for(var o=Object.keys(i),s=0;s0&&(s=l(o).geometry),qa(s,a),o=a.slice(0);n.push(l(o,i));break;case"MultiPolygon":o=[[[]]];for(var c=0;c0&&(s=y(o).geometry),Ba(s,a),o=a.slice(0);n.push(y(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),f(n)},t.polygonTangents=function(t,e){var n,r,i,o,s=Q(t),u=Q(e),l=Z(e),c=0,h=null;switch(s[0]>l[0]&&s[0]l[1]&&s[1] is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof r)throw new Error(" must be a boolean");!1===r&&(t=Ie(t));var i=[];switch(t.type){case"GeometryCollection":return q(t,(function(t){Hi(t,n)})),t;case"FeatureCollection":return F(t,(function(t){F(Hi(t,n),(function(t){i.push(t)}))})),f(i)}return Hi(t,n)},t.rhumbBearing=Bi,t.rhumbDestination=ji,t.rhumbDistance=Ar,t.round=_,t.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");return f(function(t,e){var n,r,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e))},t.sector=function(t,e,n,r,i){if(!P(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(qi(n)===qi(r))return _n(t,e,i);var s=Q(t),a=bi(t,e,n,r,i),u=[[s]];return R(a,(function(t){u[0].push(t)})),u[0].push(s),l(u,o)},t.segmentEach=U,t.segmentReduce=V,t.shortestPath=function(t,e,n){if(!P(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,s=n.obstacles||f([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!C(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var u=K(t),l=K(e);switch(t=a(u),e=a(l),it(s)){case"FeatureCollection":if(0===s.features.length)return h([u,l]);break;case"Polygon":s=f([o(rt(s))]);break;default:throw new Error("invalid obstacles")}var c=s;c.features.push(t),c.features.push(e);var p=Z(ts(gn(Z(c)),1.15));r||(r=me([p[0],p[1]],[p[2],p[1]],n)/100),c.features.pop(),c.features.pop();for(var g=p[0],d=p[1],y=p[2],v=p[3],_=r/me([g,d],[y,d],n)*(y-g),m=r/me([g,d],[g,v],n)*(v-d),x=y-g,E=v-d,b=Math.floor(x/_),w=Math.floor(E/m),I=(x-b*_)/2,N=[],S=[],M=[],L=[],O=1/0,R=1/0,T=v-(E-w*m)/2,A=0;T>=d;){for(var D=[],F=[],k=g+I,G=0;k<=y;){var q=a([k,T]),B=Js(q,s);D.push(B?0:1),F.push(k+"|"+T);var z=me(q,t);!B&&z + {% endblock extra_css %} @@ -233,7 +233,7 @@

{% endblock content %} {% block extra_js %} - + - + +