diff --git a/app/assets/stylesheets/maplibre-gl.css b/app/assets/stylesheets/maplibre-gl.css new file mode 100644 index 00000000..172ddf49 --- /dev/null +++ b/app/assets/stylesheets/maplibre-gl.css @@ -0,0 +1 @@ +.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0,0,0,0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} \ No newline at end of file diff --git a/app/controllers/maps_v2_controller.rb b/app/controllers/maps_v2_controller.rb new file mode 100644 index 00000000..05a289d2 --- /dev/null +++ b/app/controllers/maps_v2_controller.rb @@ -0,0 +1,9 @@ +class MapsV2Controller < ApplicationController + before_action :authenticate_user! + + def index + # Default to current month + @start_date = Date.today.beginning_of_month + @end_date = Date.today.end_of_month + end +end diff --git a/app/javascript/controllers/maps_v2_controller.js b/app/javascript/controllers/maps_v2_controller.js new file mode 100644 index 00000000..97c27987 --- /dev/null +++ b/app/javascript/controllers/maps_v2_controller.js @@ -0,0 +1,179 @@ +import { Controller } from '@hotwired/stimulus' +import maplibregl from 'maplibre-gl' +import { ApiClient } from 'maps_v2/services/api_client' +import { PointsLayer } from 'maps_v2/layers/points_layer' +import { pointsToGeoJSON } from 'maps_v2/utils/geojson_transformers' +import { PopupFactory } from 'maps_v2/components/popup_factory' + +/** + * Main map controller for Maps V2 + * Phase 1: MVP with points layer + */ +export default class extends Controller { + static values = { + apiKey: String, + startDate: String, + endDate: String + } + + static targets = ['container', 'loading', 'monthSelect'] + + connect() { + this.initializeMap() + this.initializeAPI() + this.loadMapData() + } + + disconnect() { + this.map?.remove() + } + + /** + * Initialize MapLibre map + */ + initializeMap() { + this.map = new maplibregl.Map({ + container: this.containerTarget, + style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json', + center: [0, 0], + zoom: 2 + }) + + // Add navigation controls + this.map.addControl(new maplibregl.NavigationControl(), 'top-right') + + // Setup click handler for points + this.map.on('click', 'points', this.handlePointClick.bind(this)) + + // Change cursor on hover + this.map.on('mouseenter', 'points', () => { + this.map.getCanvas().style.cursor = 'pointer' + }) + this.map.on('mouseleave', 'points', () => { + this.map.getCanvas().style.cursor = '' + }) + } + + /** + * Initialize API client + */ + initializeAPI() { + this.api = new ApiClient(this.apiKeyValue) + } + + /** + * Load points data from API + */ + async loadMapData() { + this.showLoading() + + try { + // Fetch all points for selected month + const points = await this.api.fetchAllPoints({ + start_at: this.startDateValue, + end_at: this.endDateValue, + onProgress: this.updateLoadingProgress.bind(this) + }) + + console.log(`Loaded ${points.length} points`) + + // Transform to GeoJSON + const geojson = pointsToGeoJSON(points) + + // Create/update points layer + if (!this.pointsLayer) { + this.pointsLayer = new PointsLayer(this.map) + + // Wait for map to load before adding layer + if (this.map.loaded()) { + this.pointsLayer.add(geojson) + } else { + this.map.on('load', () => { + this.pointsLayer.add(geojson) + }) + } + } else { + this.pointsLayer.update(geojson) + } + + // Fit map to data bounds + if (points.length > 0) { + this.fitMapToBounds(geojson) + } + + } catch (error) { + console.error('Failed to load map data:', error) + alert('Failed to load location data. Please try again.') + } finally { + this.hideLoading() + } + } + + /** + * Handle point click + */ + handlePointClick(e) { + const feature = e.features[0] + const coordinates = feature.geometry.coordinates.slice() + const properties = feature.properties + + // Create popup + new maplibregl.Popup() + .setLngLat(coordinates) + .setHTML(PopupFactory.createPointPopup(properties)) + .addTo(this.map) + } + + /** + * Fit map to data bounds + */ + fitMapToBounds(geojson) { + const coordinates = geojson.features.map(f => f.geometry.coordinates) + + const bounds = coordinates.reduce((bounds, coord) => { + return bounds.extend(coord) + }, new maplibregl.LngLatBounds(coordinates[0], coordinates[0])) + + this.map.fitBounds(bounds, { + padding: 50, + maxZoom: 15 + }) + } + + /** + * Month selector changed + */ + monthChanged(event) { + const [year, month] = event.target.value.split('-') + + // Update date values + this.startDateValue = `${year}-${month}-01T00:00:00Z` + const lastDay = new Date(year, month, 0).getDate() + this.endDateValue = `${year}-${month}-${lastDay}T23:59:59Z` + + // Reload data + this.loadMapData() + } + + /** + * Show loading indicator + */ + showLoading() { + this.loadingTarget.classList.remove('hidden') + } + + /** + * Hide loading indicator + */ + hideLoading() { + this.loadingTarget.classList.add('hidden') + } + + /** + * Update loading progress + */ + updateLoadingProgress({ loaded, totalPages, progress }) { + const percentage = Math.round(progress * 100) + this.loadingTarget.textContent = `Loading... ${percentage}%` + } +} diff --git a/app/javascript/maps_v2/components/popup_factory.js b/app/javascript/maps_v2/components/popup_factory.js new file mode 100644 index 00000000..386345c4 --- /dev/null +++ b/app/javascript/maps_v2/components/popup_factory.js @@ -0,0 +1,53 @@ +import { formatTimestamp } from '../utils/geojson_transformers' + +/** + * Factory for creating map popups + */ +export class PopupFactory { + /** + * Create popup for a point + * @param {Object} properties - Point properties + * @returns {string} HTML for popup + */ + static createPointPopup(properties) { + const { id, timestamp, altitude, battery, accuracy, velocity } = properties + + return ` +
+ + +
+ ` + } +} diff --git a/app/javascript/maps_v2/layers/base_layer.js b/app/javascript/maps_v2/layers/base_layer.js new file mode 100644 index 00000000..2a616ddb --- /dev/null +++ b/app/javascript/maps_v2/layers/base_layer.js @@ -0,0 +1,111 @@ +/** + * Base class for all map layers + * Provides common functionality for layer management + */ +export class BaseLayer { + constructor(map, options = {}) { + this.map = map + this.id = options.id || this.constructor.name.toLowerCase() + this.sourceId = `${this.id}-source` + this.visible = options.visible !== false + this.data = null + } + + /** + * Add layer to map with data + * @param {Object} data - GeoJSON or layer-specific data + */ + add(data) { + this.data = data + + // Add source + if (!this.map.getSource(this.sourceId)) { + this.map.addSource(this.sourceId, this.getSourceConfig()) + } + + // Add layers + const layers = this.getLayerConfigs() + layers.forEach(layerConfig => { + if (!this.map.getLayer(layerConfig.id)) { + this.map.addLayer(layerConfig) + } + }) + + this.setVisibility(this.visible) + } + + /** + * Update layer data + * @param {Object} data - New data + */ + update(data) { + this.data = data + const source = this.map.getSource(this.sourceId) + if (source && source.setData) { + source.setData(data) + } + } + + /** + * Remove layer from map + */ + remove() { + this.getLayerIds().forEach(layerId => { + if (this.map.getLayer(layerId)) { + this.map.removeLayer(layerId) + } + }) + + if (this.map.getSource(this.sourceId)) { + this.map.removeSource(this.sourceId) + } + + this.data = null + } + + /** + * Toggle layer visibility + * @param {boolean} visible - Show/hide layer + */ + toggle(visible = !this.visible) { + this.visible = visible + this.setVisibility(visible) + } + + /** + * Set visibility for all layer IDs + * @param {boolean} visible + */ + setVisibility(visible) { + const visibility = visible ? 'visible' : 'none' + this.getLayerIds().forEach(layerId => { + if (this.map.getLayer(layerId)) { + this.map.setLayoutProperty(layerId, 'visibility', visibility) + } + }) + } + + /** + * Get source configuration (override in subclass) + * @returns {Object} MapLibre source config + */ + getSourceConfig() { + throw new Error('Must implement getSourceConfig()') + } + + /** + * Get layer configurations (override in subclass) + * @returns {Array} Array of MapLibre layer configs + */ + getLayerConfigs() { + throw new Error('Must implement getLayerConfigs()') + } + + /** + * Get all layer IDs for this layer + * @returns {Array} + */ + getLayerIds() { + return this.getLayerConfigs().map(config => config.id) + } +} diff --git a/app/javascript/maps_v2/layers/points_layer.js b/app/javascript/maps_v2/layers/points_layer.js new file mode 100644 index 00000000..ae8e9220 --- /dev/null +++ b/app/javascript/maps_v2/layers/points_layer.js @@ -0,0 +1,85 @@ +import { BaseLayer } from './base_layer' + +/** + * Points layer with automatic clustering + */ +export class PointsLayer extends BaseLayer { + constructor(map, options = {}) { + super(map, { id: 'points', ...options }) + this.clusterRadius = options.clusterRadius || 50 + this.clusterMaxZoom = options.clusterMaxZoom || 14 + } + + getSourceConfig() { + return { + type: 'geojson', + data: this.data || { + type: 'FeatureCollection', + features: [] + }, + cluster: true, + clusterMaxZoom: this.clusterMaxZoom, + clusterRadius: this.clusterRadius + } + } + + getLayerConfigs() { + return [ + // Cluster circles + { + id: `${this.id}-clusters`, + type: 'circle', + source: this.sourceId, + filter: ['has', 'point_count'], + paint: { + 'circle-color': [ + 'step', + ['get', 'point_count'], + '#51bbd6', 10, + '#f1f075', 50, + '#f28cb1', 100, + '#ff6b6b' + ], + 'circle-radius': [ + 'step', + ['get', 'point_count'], + 20, 10, + 30, 50, + 40, 100, + 50 + ] + } + }, + + // Cluster count labels + { + id: `${this.id}-count`, + type: 'symbol', + source: this.sourceId, + filter: ['has', 'point_count'], + layout: { + 'text-field': '{point_count_abbreviated}', + 'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'], + 'text-size': 12 + }, + paint: { + 'text-color': '#ffffff' + } + }, + + // Individual points + { + id: this.id, + type: 'circle', + source: this.sourceId, + filter: ['!', ['has', 'point_count']], + paint: { + 'circle-color': '#3b82f6', + 'circle-radius': 6, + 'circle-stroke-width': 2, + 'circle-stroke-color': '#ffffff' + } + } + ] + } +} diff --git a/app/javascript/maps_v2/services/api_client.js b/app/javascript/maps_v2/services/api_client.js new file mode 100644 index 00000000..8329c1aa --- /dev/null +++ b/app/javascript/maps_v2/services/api_client.js @@ -0,0 +1,78 @@ +/** + * API client for Maps V2 + * Wraps all API endpoints with consistent error handling + */ +export class ApiClient { + constructor(apiKey) { + this.apiKey = apiKey + this.baseURL = '/api/v1' + } + + /** + * Fetch points for date range (paginated) + * @param {Object} options - { start_at, end_at, page, per_page } + * @returns {Promise} { points, currentPage, totalPages } + */ + async fetchPoints({ start_at, end_at, page = 1, per_page = 1000 }) { + const params = new URLSearchParams({ + start_at, + end_at, + page: page.toString(), + per_page: per_page.toString() + }) + + const response = await fetch(`${this.baseURL}/points?${params}`, { + headers: this.getHeaders() + }) + + if (!response.ok) { + throw new Error(`Failed to fetch points: ${response.statusText}`) + } + + const points = await response.json() + + return { + points, + currentPage: parseInt(response.headers.get('X-Current-Page') || '1'), + totalPages: parseInt(response.headers.get('X-Total-Pages') || '1') + } + } + + /** + * Fetch all points for date range (handles pagination) + * @param {Object} options - { start_at, end_at, onProgress } + * @returns {Promise} All points + */ + async fetchAllPoints({ start_at, end_at, onProgress = null }) { + const allPoints = [] + let page = 1 + let totalPages = 1 + + do { + const { points, currentPage, totalPages: total } = + await this.fetchPoints({ start_at, end_at, page, per_page: 1000 }) + + allPoints.push(...points) + totalPages = total + page++ + + if (onProgress) { + onProgress({ + loaded: allPoints.length, + currentPage, + totalPages, + progress: currentPage / totalPages + }) + } + } while (page <= totalPages) + + return allPoints + } + + getHeaders() { + return { + 'Authorization': `Bearer ${this.apiKey}`, + 'Content-Type': 'application/json' + } + } +} diff --git a/app/javascript/maps_v2/utils/geojson_transformers.js b/app/javascript/maps_v2/utils/geojson_transformers.js new file mode 100644 index 00000000..bc3fbd67 --- /dev/null +++ b/app/javascript/maps_v2/utils/geojson_transformers.js @@ -0,0 +1,41 @@ +/** + * Transform points array to GeoJSON FeatureCollection + * @param {Array} points - Array of point objects from API + * @returns {Object} GeoJSON FeatureCollection + */ +export function pointsToGeoJSON(points) { + return { + type: 'FeatureCollection', + features: points.map(point => ({ + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [point.longitude, point.latitude] + }, + properties: { + id: point.id, + timestamp: point.timestamp, + altitude: point.altitude, + battery: point.battery, + accuracy: point.accuracy, + velocity: point.velocity + } + })) + } +} + +/** + * Format timestamp for display + * @param {number} timestamp - Unix timestamp + * @returns {string} Formatted date/time + */ +export function formatTimestamp(timestamp) { + const date = new Date(timestamp * 1000) + return date.toLocaleString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + }) +} diff --git a/app/views/maps_v2/index.html.erb b/app/views/maps_v2/index.html.erb new file mode 100644 index 00000000..69f1edff --- /dev/null +++ b/app/views/maps_v2/index.html.erb @@ -0,0 +1,144 @@ +
+ + +
+
+ + + +
+ + +
+
+ + +
+
+
+ + diff --git a/config/importmap.rb b/config/importmap.rb index 53ca7e84..a0974258 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -4,6 +4,7 @@ pin_all_from 'app/javascript/channels', under: 'channels' pin_all_from 'app/javascript/maps', under: 'maps' +pin_all_from 'app/javascript/maps_v2', under: 'maps_v2' pin 'application', preload: true pin '@rails/actioncable', to: 'actioncable.esm.js' @@ -26,3 +27,4 @@ pin 'imports_channel', to: 'channels/imports_channel.js' pin 'family_locations_channel', to: 'channels/family_locations_channel.js' pin 'trix' pin '@rails/actiontext', to: 'actiontext.esm.js' +pin "maplibre-gl" # @5.12.0 diff --git a/config/routes.rb b/config/routes.rb index 16d2eacb..f860454f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -111,6 +111,9 @@ Rails.application.routes.draw do get 'map', to: 'map#index' + # Maps V2 + get '/maps_v2', to: 'maps_v2#index', as: :maps_v2 + namespace :api do namespace :v1 do get 'photos', to: 'photos#index' diff --git a/vendor/javascript/maplibre-gl.js b/vendor/javascript/maplibre-gl.js new file mode 100644 index 00000000..2d54e880 --- /dev/null +++ b/vendor/javascript/maplibre-gl.js @@ -0,0 +1,8 @@ +// maplibre-gl@5.12.0 downloaded from https://ga.jspm.io/npm:maplibre-gl@5.12.0/dist/maplibre-gl.js + +var e=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;var s={}; +/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.12.0/LICENSE.txt + */(function(e,a){s=a()})(0,(function(){var s={};var a={};function l(e,l,c){a[e]=c;if(e==="index"){var u="var sharedModule = {}; ("+a.shared+")(sharedModule); ("+a.worker+")(sharedModule);";var d={};a.shared(d);a.index(s,d);typeof window!=="undefined"&&s.setWorkerUrl(window.URL.createObjectURL(new Blob([u],{type:"text/javascript"})));return s}}l("shared",["exports"],(function(s){function a(e,s,a,l){return new(a||(a=Promise))((function(c,u){function d(e){try{_(l.next(e))}catch(e){u(e)}}function f(e){try{_(l.throw(e))}catch(e){u(e)}}function _(e){var s;e.done?c(e.value):(s=e.value,s instanceof a?s:new a((function(e){e(s)}))).then(d,f)}_((l=l.apply(e,s||[])).next())}))}function l(s,a){(this||e).x=s,(this||e).y=a}function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u,d;"function"==typeof SuppressedError&&SuppressedError,l.prototype={clone(){return new l((this||e).x,(this||e).y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,s){return this.clone()._rotateAround(e,s)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt((this||e).x*(this||e).x+(this||e).y*(this||e).y)},equals(s){return(this||e).x===s.x&&(this||e).y===s.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(s){const a=s.x-(this||e).x,l=s.y-(this||e).y;return a*a+l*l},angle(){return Math.atan2((this||e).y,(this||e).x)},angleTo(s){return Math.atan2((this||e).y-s.y,(this||e).x-s.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(s,a){return Math.atan2((this||e).x*a-(this||e).y*s,(this||e).x*s+(this||e).y*a)},_matMult(s){const a=s[2]*(this||e).x+s[3]*(this||e).y;return(this||e).x=s[0]*(this||e).x+s[1]*(this||e).y,(this||e).y=a,this||e},_add(s){return(this||e).x+=s.x,(this||e).y+=s.y,this||e},_sub(s){return(this||e).x-=s.x,(this||e).y-=s.y,this||e},_mult(s){return(this||e).x*=s,(this||e).y*=s,this||e},_div(s){return(this||e).x/=s,(this||e).y/=s,this||e},_multByPoint(s){return(this||e).x*=s.x,(this||e).y*=s.y,this||e},_divByPoint(s){return(this||e).x/=s.x,(this||e).y/=s.y,this||e},_unit(){return this._div(this.mag()),this||e},_perp(){const s=(this||e).y;return(this||e).y=(this||e).x,(this||e).x=-s,this||e},_rotate(s){const a=Math.cos(s),l=Math.sin(s),c=l*(this||e).x+a*(this||e).y;return(this||e).x=a*(this||e).x-l*(this||e).y,(this||e).y=c,this||e},_rotateAround(s,a){const l=Math.cos(s),c=Math.sin(s),u=a.y+c*((this||e).x-a.x)+l*((this||e).y-a.y);return(this||e).x=a.x+l*((this||e).x-a.x)-c*((this||e).y-a.y),(this||e).y=u,this||e},_round(){return(this||e).x=Math.round((this||e).x),(this||e).y=Math.round((this||e).y),this||e},constructor:l},l.convert=function(e){if(e instanceof l)return e;if(Array.isArray(e))return new l(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new l(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var f=function(){if(d)return u;function s(s,a,l,c){(this||e).cx=3*s,(this||e).bx=3*(l-s)-(this||e).cx,(this||e).ax=1-(this||e).cx-(this||e).bx,(this||e).cy=3*a,(this||e).by=3*(c-a)-(this||e).cy,(this||e).ay=1-(this||e).cy-(this||e).by,(this||e).p1x=s,(this||e).p1y=a,(this||e).p2x=l,(this||e).p2y=c}return d=1,u=s,s.prototype={sampleCurveX:function(s){return(((this||e).ax*s+(this||e).bx)*s+(this||e).cx)*s},sampleCurveY:function(s){return(((this||e).ay*s+(this||e).by)*s+(this||e).cy)*s},sampleCurveDerivativeX:function(s){return(3*(this||e).ax*s+2*(this||e).bx)*s+(this||e).cx},solveCurveX:function(e,s){if(void 0===s&&(s=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,l=0;l<8;l++){var c=this.sampleCurveX(a)-e;if(Math.abs(c)c?d=a:f=a,a=.5*(f-d)+d;return a},solve:function(e,s){return this.sampleCurveY(this.solveCurveX(e,s))}},u}(),_=c(f);let y,b;function S(){return null==y&&(y="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),y}function P(){if(null==b&&(b=!1,S())){const e=5,s=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(s){for(let a=0;a4&&void 0!==arguments[4]?arguments[4]:"zyx",u=Math.PI/360;s*=u,l*=u,a*=u;var d=Math.sin(s),f=Math.cos(s),_=Math.sin(a),y=Math.cos(a),b=Math.sin(l),S=Math.cos(l);switch(c){case"xyz":e[0]=d*y*S+f*_*b,e[1]=f*_*S-d*y*b,e[2]=f*y*b+d*_*S,e[3]=f*y*S-d*_*b;break;case"xzy":e[0]=d*y*S-f*_*b,e[1]=f*_*S-d*y*b,e[2]=f*y*b+d*_*S,e[3]=f*y*S+d*_*b;break;case"yxz":e[0]=d*y*S+f*_*b,e[1]=f*_*S-d*y*b,e[2]=f*y*b-d*_*S,e[3]=f*y*S+d*_*b;break;case"yzx":e[0]=d*y*S+f*_*b,e[1]=f*_*S+d*y*b,e[2]=f*y*b-d*_*S,e[3]=f*y*S-d*_*b;break;case"zxy":e[0]=d*y*S-f*_*b,e[1]=f*_*S+d*y*b,e[2]=f*y*b+d*_*S,e[3]=f*y*S-d*_*b;break;case"zyx":e[0]=d*y*S-f*_*b,e[1]=f*_*S+d*y*b,e[2]=f*y*b-d*_*S,e[3]=f*y*S+d*_*b;break;default:throw new Error("Unknown angle order "+c)}return e}function Q(){var e=new C(2);return C!=Float32Array&&(e[0]=0,e[1]=0),e}function se(e,s){var a=new C(2);return a[0]=e,a[1]=s,a}F(),G=new C(4),C!=Float32Array&&(G[0]=0,G[1]=0,G[2]=0,G[3]=0),F(),O(1,0,0),O(0,1,0),W(),W(),D(),Q();const oe=8192;function ce(e,s,a){return s*(oe/(e.tileSize*Math.pow(2,a-e.tileID.overscaledZ)))}function pe(e,s){return(e%s+s)%s}function fe(e,s,a){return e*(1-a)+s*a}function xe(e){if(e<=0)return 0;if(e>=1)return 1;const s=e*e,a=s*e;return 4*(e<.5?a:3*(e-s)+a-.75)}function ve(e,s,a,l){const c=new _(e,s,a,l);return e=>c.solve(e)}const be=ve(.25,.1,.25,1);function we(e,s,a){return Math.min(a,Math.max(s,e))}function Te(e,s,a){const l=a-s,c=((e-s)%l+l)%l+s;return c===s?a:c}function Se(e,...s){for(const a of s)for(const s in a)e[s]=a[s];return e}let Me=1;function Ee(s,a,l){const c={};for(const l in s)c[l]=a.call(this||e,s[l],l,s);return c}function Ce(s,a,l){const c={};for(const l in s)a.call(this||e,s[l],l,s)&&(c[l]=s[l]);return c}function Ae(e){return Array.isArray(e)?e.map(Ae):"object"==typeof e&&e?Ee(e,Ae):e}const ke={};function Le(e){ke[e]||("undefined"!=typeof console&&console.warn(e),ke[e]=!0)}function Fe(e,s,a){return(a.y-e.y)*(s.x-e.x)>(s.y-e.y)*(a.x-e.x)}function Oe(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let Ve=null;function Ne(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const je="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ue(s,l,c,u,d){return a(this||e,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(s,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const f=a.startsWith("BGR"),_=new Uint8ClampedArray(u*d*4);if(yield e.copyTo(_,function(e,s,a,l,c){const u=4*Math.max(-s,0),d=(Math.max(0,a)-a)*l*4+u,f=4*l,_=Math.max(0,s),y=Math.max(0,a);return{rect:{x:_,y:y,width:Math.min(e.width,s+l)-_,height:Math.min(e.height,a+c)-y},layout:[{offset:d,stride:f}]}}(s,l,c,u,d)),f)for(let e=0;e<_.length;e+=4){const s=_[e];_[e]=_[e+2],_[e+2]=s}return _}finally{e.close()}}))}let Ge,Ze;function qe(e,s,a,l){return e.addEventListener(s,a,l),{unsubscribe:()=>{e.removeEventListener(s,a,l)}}}function $e(e){return e*Math.PI/180}function We(e){return e/Math.PI*180}const He={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Xe={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Ye="AbortError";function Ke(){return new Error(Ye)}const Je={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Qe(e){return Je.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const et="global-dispatcher";class ue extends Error{constructor(e,s,a,l){super(`AJAXError: ${s} (${e}): ${a}`),this.status=e,this.statusText=s,this.url=a,this.body=l}}const nt=()=>Oe(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ct=function(s,l){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const e=Qe(s.url);if(e)return e(s,l);if(Oe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:et},l)}if(!(/^file:/.test(c=s.url)||/^file:/.test(nt())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return a(this||e,void 0,void 0,(function*(){const e=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:nt(),signal:l.signal});let a,c;"json"!==s.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{a=yield fetch(e)}catch(e){throw new ue(0,e.message,s.url,new Blob)}if(!a.ok){const e=yield a.blob();throw new ue(a.status,a.statusText,s.url,e)}c="arrayBuffer"===s.type||"image"===s.type?a.arrayBuffer():"json"===s.type?a.json():a.text();const u=yield c;if(l.signal.aborted)throw Ke();return{data:u,cacheControl:a.headers.get("Cache-Control"),expires:a.headers.get("Expires")}}))}(s,l);if(Oe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:et},l)}var c;return function(e,s){return new Promise(((a,l)=>{var c;const u=new XMLHttpRequest;u.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(u.responseType="arraybuffer");for(const s in e.headers)u.setRequestHeader(s,e.headers[s]);"json"===e.type&&(u.responseType="text",(null===(c=e.headers)||void 0===c?void 0:c.Accept)||u.setRequestHeader("Accept","application/json")),u.withCredentials="include"===e.credentials,u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if(!s.signal.aborted)if((u.status>=200&&u.status<300||0===u.status)&&null!==u.response){let s=u.response;if("json"===e.type)try{s=JSON.parse(u.response)}catch(e){return void l(e)}a({data:s,cacheControl:u.getResponseHeader("Cache-Control"),expires:u.getResponseHeader("Expires")})}else{const s=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new ue(u.status,u.statusText,e.url,s))}},s.signal.addEventListener("abort",(()=>{u.abort(),l(Ke())})),u.send(e.body)}))}(s,l)};function ht(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const s=new URL(e),a=window.location;return s.protocol===a.protocol&&s.host===a.host}function ut(e,s,a){a[e]&&-1!==a[e].indexOf(s)||(a[e]=a[e]||[],a[e].push(s))}function dt(e,s,a){if(a&&a[e]){const l=a[e].indexOf(s);-1!==l&&a[e].splice(l,1)}}class ye{constructor(e,s={}){Se(this,s),this.type=e}}class me extends ye{constructor(e,s={}){super("error",Se({error:e},s))}}class ge{on(e,s){return this._listeners=this._listeners||{},ut(e,s,this._listeners),{unsubscribe:()=>{this.off(e,s)}}}off(e,s){return dt(e,s,this._listeners),dt(e,s,this._oneTimeListeners),this}once(e,s){return s?(this._oneTimeListeners=this._oneTimeListeners||{},ut(e,s,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,s){"string"==typeof e&&(e=new ye(e,s||{}));const a=e.type;if(this.listens(a)){e.target=this;const s=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const a of s)a.call(this,e);const l=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const s of l)dt(a,s,this._oneTimeListeners),s.call(this,e);const c=this._eventedParent;c&&(Se(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(e))}else e instanceof me&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,s){return this._eventedParent=e,this._eventedParentData=s,this}}var pt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"array",value:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const ft=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function mt(e,s){const a={};for(const s in e)"ref"!==s&&(a[s]=e[s]);return ft.forEach((e=>{e in s&&(a[e]=s[e])})),a}function _t(e,s){if(Array.isArray(e)){if(!Array.isArray(s)||e.length!==s.length)return!1;for(let a=0;a`:"value"===e.itemType.kind?"array":`array<${s}>`}return e.kind}const Ri=[oi,li,ci,hi,ui,di,_i,pi,Ai(fi),xi,wi,bi,Ii,Ei];function Li(e,s){if("error"===s.kind)return null;if("array"===e.kind){if("array"===s.kind&&(0===s.N&&"value"===s.itemType.kind||!Li(e.itemType,s.itemType))&&("number"!=typeof e.N||e.N===s.N))return null}else{if(e.kind===s.kind)return null;if("value"===e.kind)for(const e of Ri)if(!Li(e,s))return null}return`Expected ${zi(e)} but found ${zi(s)} instead.`}function Fi(e,s){return s.some((s=>s.kind===e.kind))}function Bi(e,s){return s.some((s=>"null"===s?null===e:"array"===s?Array.isArray(e):"object"===s?e&&!Array.isArray(e)&&"object"==typeof e:s===typeof e))}function Oi(e,s){return"array"===e.kind&&"array"===s.kind?e.itemType.kind===s.itemType.kind&&"number"==typeof e.N:e.kind===s.kind}const Vi=.96422,Ni=.82521,ji=4/29,Ui=6/29,Gi=3*Ui*Ui,Zi=Ui*Ui*Ui,qi=Math.PI/180,$i=180/Math.PI;function Wi(e){return(e%=360)<0&&(e+=360),e}function Hi([e,s,a,l]){let c,u;const d=Yi((.2225045*(e=Xi(e))+.7168786*(s=Xi(s))+.0606169*(a=Xi(a)))/1);e===s&&s===a?c=u=d:(c=Yi((.4360747*e+.3850649*s+.1430804*a)/Vi),u=Yi((.0139322*e+.0971045*s+.7141733*a)/Ni));const f=116*d-16;return[f<0?0:f,500*(c-d),200*(d-u),l]}function Xi(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Yi(e){return e>Zi?Math.pow(e,1/3):e/Gi+ji}function Ki([e,s,a,l]){let c=(e+16)/116,u=isNaN(s)?c:c+s/500,d=isNaN(a)?c:c-a/200;return c=1*Qi(c),u=Vi*Qi(u),d=Ni*Qi(d),[Ji(3.1338561*u-1.6168667*c-.4906146*d),Ji(-.9787684*u+1.9161415*c+.033454*d),Ji(.0719453*u-.2289914*c+1.4052427*d),l]}function Ji(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function Qi(e){return e>Ui?e*e*e:Gi*(e-ji)}const sr=Object.hasOwn||function(e,s){return Object.prototype.hasOwnProperty.call(e,s)};function or(e,s){return sr(e,s)?e[s]:void 0}function lr(e){return parseInt(e.padEnd(2,e),16)/255}function cr(e,s){return hr(s?e/100:e,0,1)}function hr(e,s,a){return Math.min(Math.max(s,e),a)}function ur(e){return!e.some(Number.isNaN)}const dr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function fr(e,s,a){return e+a*(s-e)}function mr(e,s,a){return e.map(((e,l)=>fr(e,s[l],a)))}class It{constructor(e,s,a,l=1,c=!0){this.r=e,this.g=s,this.b=a,this.a=l,c||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,s,a,l]))}static parse(e){if(e instanceof It)return e;if("string"!=typeof e)return;const s=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const s=or(dr,e);if(s){const[e,a,l]=s;return[e/255,a/255,l/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const s=e.length<6?1:2;let a=1;return[lr(e.slice(a,a+=s)),lr(e.slice(a,a+=s)),lr(e.slice(a,a+=s)),lr(e.slice(a,a+s)||"ff")]}if(e.startsWith("rgb")){const s=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(s){const[e,a,l,c,u,d,f,_,y,b,S,P]=s,M=[c||" ",f||" ",b].join("");if(" "===M||" /"===M||",,"===M||",,,"===M){const e=[l,d,y].join(""),s="%%%"===e?100:""===e?255:0;if(s){const e=[hr(+a/s,0,1),hr(+u/s,0,1),hr(+_/s,0,1),S?cr(+S,P):1];if(ur(e))return e}}return}}const a=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(a){const[e,s,l,c,u,d,f,_,y]=a,b=[l||" ",u||" ",f].join("");if(" "===b||" /"===b||",,"===b||",,,"===b){const e=[+s,hr(+c,0,100),hr(+d,0,100),_?cr(+_,y):1];if(ur(e))return function([e,s,a,l]){function c(l){const c=(l+e/30)%12,u=s*Math.min(a,1-a);return a-u*Math.max(-1,Math.min(c-3,9-c,1))}return e=Wi(e),s/=100,a/=100,[c(0),c(8),c(4),l]}(e)}}}(e);return s?new It(...s,!1):void 0}get rgb(){const{r:e,g:s,b:a,a:l}=this,c=l||1/0;return this.overwriteGetter("rgb",[e/c,s/c,a/c,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[s,a,l,c]=Hi(e),u=Math.sqrt(a*a+l*l);return[Math.round(1e4*u)?Wi(Math.atan2(l,a)*$i):NaN,u,s,c]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Hi(this.rgb))}overwriteGetter(e,s){return Object.defineProperty(this,e,{value:s}),s}toString(){const[e,s,a,l]=this.rgb;return`rgba(${[e,s,a].map((e=>Math.round(255*e))).join(",")},${l})`}static interpolate(e,s,a,l="rgb"){switch(l){case"rgb":{const[l,c,u,d]=mr(e.rgb,s.rgb,a);return new It(l,c,u,d,!1)}case"hcl":{const[l,c,u,d]=e.hcl,[f,_,y,b]=s.hcl;let S,P;if(isNaN(l)||isNaN(f))isNaN(l)?isNaN(f)?S=NaN:(S=f,1!==u&&0!==u||(P=_)):(S=l,1!==y&&0!==y||(P=c));else{let e=f-l;f>l&&e>180?e-=360:f180&&(e+=360),S=l+a*e}const[M,C,D,L]=function([e,s,a,l]){return e=isNaN(e)?0:e*qi,Ki([a,Math.cos(e)*s,Math.sin(e)*s,l])}([S,null!=P?P:fr(c,_,a),fr(u,y,a),fr(d,b,a)]);return new It(M,C,D,L,!1)}case"lab":{const[l,c,u,d]=Ki(mr(e.lab,s.lab,a));return new It(l,c,u,d,!1)}}}}It.black=new It(0,0,0,1),It.white=new It(1,1,1,1),It.transparent=new It(0,0,0,0),It.red=new It(1,0,0,1);class Mt{constructor(e,s,a){this.sensitivity=e?s?"variant":"case":s?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,s){return this.collator.compare(e,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const _r=["bottom","center","top"];class kt{constructor(e,s,a,l,c,u){this.text=e,this.image=s,this.scale=a,this.fontStack=l,this.textColor=c,this.verticalAlign=u}}class Dt{constructor(e){this.sections=e}static fromString(e){return new Dt([new kt(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Dt?e:Dt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class Ft{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ft)return e;if("number"==typeof e)return new Ft([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const s of e)if("number"!=typeof s)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ft(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,s,a){return new Ft(mr(e.values,s.values,a))}}class Bt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bt)return e;if("number"==typeof e)return new Bt([e]);if(Array.isArray(e)){for(const s of e)if("number"!=typeof s)return;return new Bt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,s,a){return new Bt(mr(e.values,s.values,a))}}class Pt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pt)return e;if("string"==typeof e){const s=It.parse(e);if(!s)return;return new Pt([s])}if(!Array.isArray(e))return;const s=[];for(const a of e){if("string"!=typeof a)return;const e=It.parse(a);if(!e)return;s.push(e)}return new Pt(s)}toString(){return JSON.stringify(this.values)}static interpolate(e,s,a,l="rgb"){const c=[];if(e.values.length!=s.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${s.values.length}), cannot interpolate.`);for(let u=0;u=0&&e<=255&&"number"==typeof s&&s>=0&&s<=255&&"number"==typeof a&&a>=0&&a<=255?void 0===l||"number"==typeof l&&l>=0&&l<=1?null:`Invalid rgba value [${[e,s,a,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof l?[e,s,a,l]:[e,s,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vr(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Ot||e instanceof It||e instanceof Mt||e instanceof Dt||e instanceof Ft||e instanceof Bt||e instanceof Pt||e instanceof Ct||e instanceof Lt)return!0;if(Array.isArray(e)){for(const s of e)if(!vr(s))return!1;return!0}if("object"==typeof e){for(const s in e)if(!vr(e[s]))return!1;return!0}return!1}function br(e){if(null===e)return oi;if("string"==typeof e)return ci;if("boolean"==typeof e)return hi;if("number"==typeof e)return li;if(e instanceof It)return ui;if(e instanceof Ot)return di;if(e instanceof Mt)return mi;if(e instanceof Dt)return _i;if(e instanceof Ft)return xi;if(e instanceof Bt)return wi;if(e instanceof Pt)return bi;if(e instanceof Ct)return Ei;if(e instanceof Lt)return Ii;if(Array.isArray(e)){const s=e.length;let a;for(const s of e){const e=br(s);if(a){if(a===e)continue;a=fi;break}a=e}return Ai(a||fi,s)}return pi}function wr(e){const s=typeof e;return null===e?"":"string"===s||"number"===s||"boolean"===s?String(e):e instanceof It||e instanceof Ot||e instanceof Dt||e instanceof Ft||e instanceof Bt||e instanceof Pt||e instanceof Ct||e instanceof Lt?e.toString():JSON.stringify(e)}class qt{constructor(e,s){this.type=e,this.value=s}static parse(e,s){if(2!==e.length)return s.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!vr(e[1]))return s.error("invalid value");const a=e[1];let l=br(a);const c=s.expectedType;return"array"!==l.kind||0!==l.N||!c||"array"!==c.kind||"number"==typeof c.N&&0!==c.N||(l=c),new qt(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Sr={string:ci,number:li,boolean:hi,object:pi};class Gt{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");let a,l=1;const c=e[0];if("array"===c){let c,u;if(e.length>2){const a=e[1];if("string"!=typeof a||!(a in Sr)||"object"===a)return s.error('The item type argument of "array" must be one of string, number, boolean',1);c=Sr[a],l++}else c=fi;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return s.error('The length argument to "array" must be a positive integer literal',2);u=e[2],l++}a=Ai(c,u)}else{if(!Sr[c])throw new Error(`Types doesn't contain name = ${c}`);a=Sr[c]}const u=[];for(;le.outputDefined()))}}const Pr={"to-boolean":hi,"to-color":ui,"to-number":li,"to-string":ci};class Yt{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const a=e[0];if(!Pr[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if(("to-boolean"===a||"to-string"===a)&&2!==e.length)return s.error("Expected one argument.");const l=Pr[a],c=[];for(let a=1;a4?`Invalid rgba value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:xr(s[0],s[1],s[2],s[3]),!a))return new It(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new zt(a||`Could not parse color from value '${"string"==typeof s?s:JSON.stringify(s)}'`)}case"padding":{let s;for(const a of this.args){s=a.evaluate(e);const l=Ft.parse(s);if(l)return l}throw new zt(`Could not parse padding from value '${"string"==typeof s?s:JSON.stringify(s)}'`)}case"numberArray":{let s;for(const a of this.args){s=a.evaluate(e);const l=Bt.parse(s);if(l)return l}throw new zt(`Could not parse numberArray from value '${"string"==typeof s?s:JSON.stringify(s)}'`)}case"colorArray":{let s;for(const a of this.args){s=a.evaluate(e);const l=Pt.parse(s);if(l)return l}throw new zt(`Could not parse colorArray from value '${"string"==typeof s?s:JSON.stringify(s)}'`)}case"variableAnchorOffsetCollection":{let s;for(const a of this.args){s=a.evaluate(e);const l=Ct.parse(s);if(l)return l}throw new zt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof s?s:JSON.stringify(s)}'`)}case"number":{let s=null;for(const a of this.args){if(s=a.evaluate(e),null===s)return 0;const l=Number(s);if(!isNaN(l))return l}throw new zt(`Could not convert ${JSON.stringify(s)} to number.`)}case"formatted":return Dt.fromString(wr(this.args[0].evaluate(e)));case"resolvedImage":return Lt.fromString(wr(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return wr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Cr=["Unknown","Point","LineString","Polygon"];class Ht{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Cr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let s=this._parseColorCache.get(e);return s||(s=It.parse(e),this._parseColorCache.set(e,s)),s}}class Kt{constructor(e,s,a=[],l,c=new Pe,u=[]){this.registry=e,this.path=a,this.key=a.map((e=>`[${e}]`)).join(""),this.scope=c,this.errors=u,this.expectedType=l,this._isConstant=s}parse(e,s,a,l,c={}){return s?this.concat(s,a,l)._parse(e,c):this._parse(e,c)}_parse(e,s){function a(e,s,a){return"assert"===a?new Gt(s,[e]):"coerce"===a?new Yt(s,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if("string"!=typeof l)return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const c=this.registry[l];if(c){let l=c.parse(e,this);if(!l)return null;if(this.expectedType){const e=this.expectedType,c=l.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==c.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(c.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(c.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(c.kind)||"colorArray"===e.kind&&["value","string","array"].includes(c.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(c.kind))l=a(l,e,s.typeAnnotation||"coerce");else if(this.checkSubtype(e,c))return null}else l=a(l,e,s.typeAnnotation||"assert")}if(!(l instanceof qt)&&"resolvedImage"!==l.type.kind&&this._isConstant(l)){const s=new Ht;try{l=new qt(l.type,l.evaluate(s))}catch(e){return this.error(e.message),null}}return l}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,s,a){const l="number"==typeof e?this.path.concat(e):this.path,c=a?this.scope.concat(a):this.scope;return new Kt(this.registry,this._isConstant,l,s||null,c,this.errors)}error(e,...s){const a=`${this.key}${s.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Be(a,e))}checkSubtype(e,s){const a=Li(e,s);return a&&this.error(a),a}}class Jt{constructor(e,s){this.type=s.type,this.bindings=[].concat(e),this.result=s}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const s of this.bindings)e(s[1]);e(this.result)}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let l=1;l=a.length)throw new zt(`Array index out of bounds: ${s} > ${a.length-1}.`);if(s!==Math.floor(s))throw new zt(`Array index must be an integer, but found ${s} instead.`);return a[s]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class er{constructor(e,s){this.type=hi,this.needle=e,this.haystack=s}static parse(e,s){if(3!==e.length)return s.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=s.parse(e[1],1,fi),l=s.parse(e[2],2,fi);return a&&l?Fi(a.type,[hi,ci,li,oi,fi])?new er(a,l):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${zi(a.type)} instead`):null}evaluate(e){const s=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!Bi(s,["boolean","string","number","null"]))throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${zi(br(s))} instead.`);if(!Bi(a,["string","array"]))throw new zt(`Expected second argument to be of type array or string, but found ${zi(br(a))} instead.`);return a.indexOf(s)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class tr{constructor(e,s,a){this.type=li,this.needle=e,this.haystack=s,this.fromIndex=a}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=s.parse(e[1],1,fi),l=s.parse(e[2],2,fi);if(!a||!l)return null;if(!Fi(a.type,[hi,ci,li,oi,fi]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${zi(a.type)} instead`);if(4===e.length){const c=s.parse(e[3],3,li);return c?new tr(a,l,c):null}return new tr(a,l)}evaluate(e){const s=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!Bi(s,["boolean","string","number","null"]))throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${zi(br(s))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(e)),Bi(a,["string"])){const e=a.indexOf(s,l);return-1===e?-1:[...a.slice(0,e)].length}if(Bi(a,["array"]))return a.indexOf(s,l);throw new zt(`Expected second argument to be of type array or string, but found ${zi(br(a))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class rr{constructor(e,s,a,l,c,u){this.inputType=e,this.type=s,this.input=a,this.cases=l,this.outputs=c,this.otherwise=u}static parse(e,s){if(e.length<5)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return s.error("Expected an even number of arguments.");let a,l;s.expectedType&&"value"!==s.expectedType.kind&&(l=s.expectedType);const c={},u=[];for(let d=2;dNumber.MAX_SAFE_INTEGER)return y.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return y.error("Numeric branch labels must be integer values.");if(a){if(y.checkSubtype(a,br(e)))return null}else a=br(e);if(void 0!==c[String(e)])return y.error("Branch labels must be unique.");c[String(e)]=u.length}const b=s.parse(_,d,l);if(!b)return null;l=l||b.type,u.push(b)}const d=s.parse(e[1],1,fi);if(!d)return null;const f=s.parse(e[e.length-1],e.length-1,l);return f?"value"!==d.type.kind&&s.concat(1).checkSubtype(a,d.type)?null:new rr(a,l,d,c,u,f):null}evaluate(e){const s=this.input.evaluate(e);return(br(s)===this.inputType&&this.outputs[this.cases[s]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class nr{constructor(e,s,a){this.type=e,this.branches=s,this.otherwise=a}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return s.error("Expected an odd number of arguments.");let a;s.expectedType&&"value"!==s.expectedType.kind&&(a=s.expectedType);const l=[];for(let c=1;cs.outputDefined()))&&this.otherwise.outputDefined()}}class ir{constructor(e,s,a,l){this.type=e,this.input=s,this.beginIndex=a,this.endIndex=l}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=s.parse(e[1],1,fi),l=s.parse(e[2],2,li);if(!a||!l)return null;if(!Fi(a.type,[Ai(fi),ci,fi]))return s.error(`Expected first argument to be of type array or string, but found ${zi(a.type)} instead`);if(4===e.length){const c=s.parse(e[3],3,li);return c?new ir(a.type,a,l,c):null}return new ir(a.type,a,l)}evaluate(e){const s=this.input.evaluate(e),a=this.beginIndex.evaluate(e);let l;if(this.endIndex&&(l=this.endIndex.evaluate(e)),Bi(s,["string"]))return[...s].slice(a,l).join("");if(Bi(s,["array"]))return s.slice(a,l);throw new zt(`Expected first argument to be of type array or string, but found ${zi(br(s))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ar(e,s){const a=e.length-1;let l,c,u=0,d=a,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),l=e[f],c=e[f+1],l<=s){if(f===a||ss))throw new zt("Input is not a number.");d=f-1}return 0}class ar{constructor(e,s,a){this.type=e,this.input=s,this.labels=[],this.outputs=[];for(const[e,s]of a)this.labels.push(e),this.outputs.push(s)}static parse(e,s){if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");const a=s.parse(e[1],1,li);if(!a)return null;const l=[];let c=null;s.expectedType&&"value"!==s.expectedType.kind&&(c=s.expectedType);for(let a=1;a=u)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',f);const y=s.parse(d,_,c);if(!y)return null;c=c||y.type,l.push([u,y])}return new ar(c,a,l)}evaluate(e){const s=this.labels,a=this.outputs;if(1===s.length)return a[0].evaluate(e);const l=this.input.evaluate(e);if(l<=s[0])return a[0].evaluate(e);const c=s.length;return l>=s[c-1]?a[c-1].evaluate(e):a[Ar(s,l)].evaluate(e)}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Dr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zr,Rr,Lr=function(){if(Rr)return zr;function s(s,a,l,c){(this||e).cx=3*s,(this||e).bx=3*(l-s)-(this||e).cx,(this||e).ax=1-(this||e).cx-(this||e).bx,(this||e).cy=3*a,(this||e).by=3*(c-a)-(this||e).cy,(this||e).ay=1-(this||e).cy-(this||e).by,(this||e).p1x=s,(this||e).p1y=a,(this||e).p2x=l,(this||e).p2y=c}return Rr=1,zr=s,s.prototype={sampleCurveX:function(s){return(((this||e).ax*s+(this||e).bx)*s+(this||e).cx)*s},sampleCurveY:function(s){return(((this||e).ay*s+(this||e).by)*s+(this||e).cy)*s},sampleCurveDerivativeX:function(s){return(3*(this||e).ax*s+2*(this||e).bx)*s+(this||e).cx},solveCurveX:function(e,s){if(void 0===s&&(s=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,l=0;l<8;l++){var c=this.sampleCurveX(a)-e;if(Math.abs(c)c?d=a:f=a,a=.5*(f-d)+d;return a},solve:function(e,s){return this.sampleCurveY(this.solveCurveX(e,s))}},zr}(),Fr=Dr(Lr);class pr{constructor(e,s,a,l,c){this.type=e,this.operator=s,this.interpolation=a,this.input=l,this.labels=[],this.outputs=[];for(const[e,s]of c)this.labels.push(e),this.outputs.push(s)}static interpolationFactor(e,s,a,l){let c=0;if("exponential"===e.name)c=Br(s,e.base,a,l);else if("linear"===e.name)c=Br(s,1,a,l);else if("cubic-bezier"===e.name){const u=e.controlPoints;c=new Fr(u[0],u[1],u[2],u[3]).solve(Br(s,1,a,l))}return c}static parse(e,s){let[a,l,c,...u]=e;if(!Array.isArray(l)||0===l.length)return s.error("Expected an interpolation type expression.",1);if("linear"===l[0])l={name:"linear"};else if("exponential"===l[0]){const e=l[1];if("number"!=typeof e)return s.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:e}}else{if("cubic-bezier"!==l[0])return s.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const e=l.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(c=s.parse(c,2,li),!c)return null;const d=[];let f=null;"interpolate-hcl"!==a&&"interpolate-lab"!==a||s.expectedType==bi?s.expectedType&&"value"!==s.expectedType.kind&&(f=s.expectedType):f=ui;for(let e=0;e=a)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',c);const y=s.parse(l,_,f);if(!y)return null;f=f||y.type,d.push([a,y])}return Oi(f,li)||Oi(f,di)||Oi(f,ui)||Oi(f,xi)||Oi(f,wi)||Oi(f,bi)||Oi(f,Ei)||Oi(f,Ai(li))?new pr(f,a,l,c,d):s.error(`Type ${zi(f)} is not interpolatable.`)}evaluate(e){const s=this.labels,a=this.outputs;if(1===s.length)return a[0].evaluate(e);const l=this.input.evaluate(e);if(l<=s[0])return a[0].evaluate(e);const c=s.length;if(l>=s[c-1])return a[c-1].evaluate(e);const u=Ar(s,l),d=pr.interpolationFactor(this.interpolation,l,s[u],s[u+1]),f=a[u].evaluate(e),_=a[u+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return fr(f,_,d);case"color":return It.interpolate(f,_,d);case"padding":return Ft.interpolate(f,_,d);case"colorArray":return Pt.interpolate(f,_,d);case"numberArray":return Bt.interpolate(f,_,d);case"variableAnchorOffsetCollection":return Ct.interpolate(f,_,d);case"array":return mr(f,_,d);case"projectionDefinition":return Ot.interpolate(f,_,d)}case"interpolate-hcl":switch(this.type.kind){case"color":return It.interpolate(f,_,d,"hcl");case"colorArray":return Pt.interpolate(f,_,d,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return It.interpolate(f,_,d,"lab");case"colorArray":return Pt.interpolate(f,_,d,"lab")}}}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Br(e,s,a,l){const c=l-a,u=e-a;return 0===c?0:1===s?u/c:(Math.pow(s,u)-1)/(Math.pow(s,c)-1)}const Or={color:It.interpolate,number:fr,padding:Ft.interpolate,numberArray:Bt.interpolate,colorArray:Pt.interpolate,variableAnchorOffsetCollection:Ct.interpolate,array:mr};class yr{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");let a=null;const l=s.expectedType;l&&"value"!==l.kind&&(a=l);const c=[];for(const l of e.slice(1)){const e=s.parse(l,1+c.length,a,void 0,{typeAnnotation:"omit"});if(!e)return null;a=a||e.type,c.push(e)}if(!a)throw new Error("No output type");const u=l&&c.some((e=>Li(l,e.type)));return new yr(u?fi:a,c)}evaluate(e){let s,a=null,l=0;for(const c of this.args)if(l++,a=c.evaluate(e),a&&a instanceof Lt&&!a.available&&(s||(s=a.name),a=null,l===this.args.length&&(a=s)),null!==a)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Vr(e,s){return"=="===e||"!="===e?"boolean"===s.kind||"string"===s.kind||"number"===s.kind||"null"===s.kind||"value"===s.kind:"string"===s.kind||"number"===s.kind||"value"===s.kind}function Ur(e,s,a,l){return 0===l.compare(s,a)}function Gr(e,s,a){const l="=="!==e&&"!="!==e;return class i{constructor(e,s,a){this.type=hi,this.lhs=e,this.rhs=s,this.collator=a,this.hasUntypedArgument="value"===e.type.kind||"value"===s.type.kind}static parse(e,s){if(3!==e.length&&4!==e.length)return s.error("Expected two or three arguments.");const a=e[0];let c=s.parse(e[1],1,fi);if(!c)return null;if(!Vr(a,c.type))return s.concat(1).error(`"${a}" comparisons are not supported for type '${zi(c.type)}'.`);let u=s.parse(e[2],2,fi);if(!u)return null;if(!Vr(a,u.type))return s.concat(2).error(`"${a}" comparisons are not supported for type '${zi(u.type)}'.`);if(c.type.kind!==u.type.kind&&"value"!==c.type.kind&&"value"!==u.type.kind)return s.error(`Cannot compare types '${zi(c.type)}' and '${zi(u.type)}'.`);l&&("value"===c.type.kind&&"value"!==u.type.kind?c=new Gt(u.type,[c]):"value"!==c.type.kind&&"value"===u.type.kind&&(u=new Gt(c.type,[u])));let d=null;if(4===e.length){if("string"!==c.type.kind&&"string"!==u.type.kind&&"value"!==c.type.kind&&"value"!==u.type.kind)return s.error("Cannot use collator to compare non-string types.");if(d=s.parse(e[3],3,mi),!d)return null}return new i(c,u,d)}evaluate(c){const u=this.lhs.evaluate(c),d=this.rhs.evaluate(c);if(l&&this.hasUntypedArgument){const s=br(u),a=br(d);if(s.kind!==a.kind||"string"!==s.kind&&"number"!==s.kind)throw new zt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${s.kind}, ${a.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){const e=br(u),a=br(d);if("string"!==e.kind||"string"!==a.kind)return s(c,u,d)}return this.collator?a(c,u,d,this.collator.evaluate(c)):s(c,u,d)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const qr=Gr("==",(function(e,s,a){return s===a}),Ur),$r=Gr("!=",(function(e,s,a){return s!==a}),(function(e,s,a,l){return!Ur(0,s,a,l)})),Wr=Gr("<",(function(e,s,a){return s",(function(e,s,a){return s>a}),(function(e,s,a,l){return l.compare(s,a)>0})),Kr=Gr("<=",(function(e,s,a){return s<=a}),(function(e,s,a,l){return l.compare(s,a)<=0})),en=Gr(">=",(function(e,s,a){return s>=a}),(function(e,s,a,l){return l.compare(s,a)>=0}));class Tr{constructor(e,s,a){this.type=mi,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=s}static parse(e,s){if(2!==e.length)return s.error("Expected one argument.");const a=e[1];if("object"!=typeof a||Array.isArray(a))return s.error("Collator options argument must be an object.");const l=s.parse(void 0!==a["case-sensitive"]&&a["case-sensitive"],1,hi);if(!l)return null;const c=s.parse(void 0!==a["diacritic-sensitive"]&&a["diacritic-sensitive"],1,hi);if(!c)return null;let u=null;return a.locale&&(u=s.parse(a.locale,1,ci),!u)?null:new Tr(l,c,u)}evaluate(e){return new Mt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Ir{constructor(e,s,a,l,c){this.type=ci,this.number=e,this.locale=s,this.currency=a,this.minFractionDigits=l,this.maxFractionDigits=c}static parse(e,s){if(3!==e.length)return s.error("Expected two arguments.");const a=s.parse(e[1],1,li);if(!a)return null;const l=e[2];if("object"!=typeof l||Array.isArray(l))return s.error("NumberFormat options argument must be an object.");let c=null;if(l.locale&&(c=s.parse(l.locale,1,ci),!c))return null;let u=null;if(l.currency&&(u=s.parse(l.currency,1,ci),!u))return null;let d=null;if(l["min-fraction-digits"]&&(d=s.parse(l["min-fraction-digits"],1,li),!d))return null;let f=null;return l["max-fraction-digits"]&&(f=s.parse(l["max-fraction-digits"],1,li),!f)?null:new Ir(a,c,u,d,f)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Mr{constructor(e){this.type=_i,this.sections=e}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&"object"==typeof a)return s.error("First argument must be an image or text section.");const l=[];let c=!1;for(let a=1;a<=e.length-1;++a){const u=e[a];if(c&&"object"==typeof u&&!Array.isArray(u)){c=!1;let e=null;if(u["font-scale"]&&(e=s.parse(u["font-scale"],1,li),!e))return null;let a=null;if(u["text-font"]&&(a=s.parse(u["text-font"],1,Ai(ci)),!a))return null;let d=null;if(u["text-color"]&&(d=s.parse(u["text-color"],1,ui),!d))return null;let f=null;if(u["vertical-align"]){if("string"==typeof u["vertical-align"]&&!_r.includes(u["vertical-align"]))return s.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${u["vertical-align"]}' instead.`);if(f=s.parse(u["vertical-align"],1,ci),!f)return null}const _=l[l.length-1];_.scale=e,_.font=a,_.textColor=d,_.verticalAlign=f}else{const u=s.parse(e[a],1,fi);if(!u)return null;const d=u.type.kind;if("string"!==d&&"value"!==d&&"null"!==d&&"resolvedImage"!==d)return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");c=!0,l.push({content:u,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Mr(l)}evaluate(e){return new Dt(this.sections.map((s=>{const a=s.content.evaluate(e);return br(a)===Ii?new kt("",a,null,null,null,s.verticalAlign?s.verticalAlign.evaluate(e):null):new kt(wr(a),null,s.scale?s.scale.evaluate(e):null,s.font?s.font.evaluate(e).join(","):null,s.textColor?s.textColor.evaluate(e):null,s.verticalAlign?s.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const s of this.sections)e(s.content),s.scale&&e(s.scale),s.font&&e(s.font),s.textColor&&e(s.textColor),s.verticalAlign&&e(s.verticalAlign)}outputDefined(){return!1}}class Er{constructor(e){this.type=Ii,this.input=e}static parse(e,s){if(2!==e.length)return s.error("Expected two arguments.");const a=s.parse(e[1],1,ci);return a?new Er(a):s.error("No image name provided.")}evaluate(e){const s=this.input.evaluate(e),a=Lt.fromString(s);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(s)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class kr{constructor(e){this.type=li,this.input=e}static parse(e,s){if(2!==e.length)return s.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=s.parse(e[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?s.error(`Expected argument of type string or array, but found ${zi(a.type)} instead.`):new kr(a):null}evaluate(e){const s=this.input.evaluate(e);if("string"==typeof s)return[...s].length;if(Array.isArray(s))return s.length;throw new zt(`Expected value to be of type string or array, but found ${zi(br(s))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const tn=8192;function rn(e,s){const a=(180+e[0])/360,l=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,c=Math.pow(2,s.z);return[Math.round(a*c*tn),Math.round(l*c*tn)]}function nn(e,s){const a=Math.pow(2,s.z);return[(c=(e[0]/tn+s.x)/a,360*c-180),(l=(e[1]/tn+s.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90)];var l,c}function sn(e,s){e[0]=Math.min(e[0],s[0]),e[1]=Math.min(e[1],s[1]),e[2]=Math.max(e[2],s[0]),e[3]=Math.max(e[3],s[1])}function on(e,s){return!(e[0]<=s[0]||e[2]>=s[2]||e[1]<=s[1]||e[3]>=s[3])}function ln(e,s,a){const l=e[0]-s[0],c=e[1]-s[1],u=e[0]-a[0],d=e[1]-a[1];return l*d-u*c==0&&l*u<=0&&c*d<=0}function cn(e,s,a,l){return 0!=(c=[l[0]-a[0],l[1]-a[1]])[0]*(u=[s[0]-e[0],s[1]-e[1]])[1]-c[1]*u[0]&&!(!mn(e,s,a,l)||!mn(a,l,e,s));var c,u}function hn(e,s,a){for(const l of a)for(let a=0;a(c=e)[1]!=(d=f[s+1])[1]>c[1]&&c[0]<(d[0]-u[0])*(c[1]-u[1])/(d[1]-u[1])+u[0]&&(l=!l)}var c,u,d;return l}function dn(e,s){for(const a of s)if(un(e,a))return!0;return!1}function pn(e,s){for(const a of e)if(!un(a,s))return!1;for(let a=0;a0&&f<0||d<0&&f>0}function _n(e,s,a){const l=[];for(let c=0;ca[2]){const s=.5*l;let c=e[0]-a[0]>s?-l:a[0]-e[0]>s?l:0;0===c&&(c=e[0]-a[2]>s?-l:a[2]-e[0]>s?l:0),e[0]+=c}sn(s,e)}function xn(e,s,a,l){const c=Math.pow(2,l.z)*tn,u=[l.x*tn,l.y*tn],d=[];for(const l of e)for(const e of l){const l=[e.x+u[0],e.y+u[1]];yn(l,s,a,c),d.push(l)}return d}function vn(e,s,a,l){const c=Math.pow(2,l.z)*tn,u=[l.x*tn,l.y*tn],d=[];for(const a of e){const e=[];for(const l of a){const a=[l.x+u[0],l.y+u[1]];sn(s,a),e.push(a)}d.push(e)}if(s[2]-s[0]<=c/2){(f=s)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const e of d)for(const l of e)yn(l,s,a,c)}var f;return d}class Zr{constructor(e,s){this.type=hi,this.geojson=e,this.geometries=s}static parse(e,s){if(2!==e.length)return s.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(vr(e[1])){const s=e[1];if("FeatureCollection"===s.type){const e=[];for(const a of s.features){const{type:s,coordinates:l}=a.geometry;"Polygon"===s&&e.push(l),"MultiPolygon"===s&&e.push(...l)}if(e.length)return new Zr(s,{type:"MultiPolygon",coordinates:e})}else if("Feature"===s.type){const e=s.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Zr(s,s.geometry)}else if("Polygon"===s.type||"MultiPolygon"===s.type)return new Zr(s,s)}return s.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=e.canonicalID();if("Polygon"===s.type){const u=_n(s.coordinates,l,c),d=xn(e.geometry(),a,l,c);if(!on(a,l))return!1;for(const e of d)if(!un(e,u))return!1}if("MultiPolygon"===s.type){const u=gn(s.coordinates,l,c),d=xn(e.geometry(),a,l,c);if(!on(a,l))return!1;for(const e of d)if(!dn(e,u))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=e.canonicalID();if("Polygon"===s.type){const u=_n(s.coordinates,l,c),d=vn(e.geometry(),a,l,c);if(!on(a,l))return!1;for(const e of d)if(!pn(e,u))return!1}if("MultiPolygon"===s.type){const u=gn(s.coordinates,l,c),d=vn(e.geometry(),a,l,c);if(!on(a,l))return!1;for(const e of d)if(!fn(e,u))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let bn=class{constructor(e=[],s=(e,s)=>es?1:0){if(this.data=e,this.length=this.data.length,this.compare=s,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:s,compare:a}=this,l=s[e];for(;e>0;){const c=e-1>>1,u=s[c];if(a(l,u)>=0)break;s[e]=u,e=c}s[e]=l}_down(e){const{data:s,compare:a}=this,l=this.length>>1,c=s[e];for(;e=0)break;s[e]=s[l],e=l}s[e]=c}};function wn(e,s,a=0,l=e.length-1,c=Sn){for(;l>a;){if(l-a>600){const u=l-a+1,d=s-a+1,f=Math.log(u),_=.5*Math.exp(2*f/3),y=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);wn(e,s,Math.max(a,Math.floor(s-d*_/u+y)),Math.min(l,Math.floor(s+(u-d)*_/u+y)),c)}const u=e[s];let d=a,f=l;for(Tn(e,a,s),c(e[l],u)>0&&Tn(e,a,l);d0;)f--}0===c(e[a],u)?Tn(e,a,f):(f++,Tn(e,f,l)),f<=s&&(a=f+1),s<=f&&(l=f-1)}}function Tn(e,s,a){const l=e[s];e[s]=e[a],e[a]=l}function Sn(e,s){return es?1:0}function Pn(e,s){if(e.length<=1)return[e];const a=[];let l,c;for(const s of e){const e=Mn(s);0!==e&&(s.area=Math.abs(e),void 0===c&&(c=e<0),c===e<0?(l&&a.push(l),l=[s]):l.push(s))}if(l&&a.push(l),s>1)for(let e=0;e1?(_=e[f+1][0],y=e[f+1][1]):P>0&&(_+=b/this.kx*P,y+=S/this.ky*P)),b=this.wrap(s[0]-_)*this.kx,S=(s[1]-y)*this.ky;const M=b*b+S*S;M180;)e-=360;return e}}function zn(e,s){return s[0]-e[0]}function Rn(e){return e[1]-e[0]+1}function Ln(e,s){return e[1]>=e[0]&&e[1]e[1])return[null,null];const a=Rn(e);if(s){if(2===a)return[e,null];const s=Math.floor(a/2);return[[e[0],e[0]+s],[e[0]+s,e[1]]]}if(1===a)return[e,null];const l=Math.floor(a/2)-1;return[[e[0],e[0]+l],[e[0]+l+1,e[1]]]}function On(e,s){if(!Ln(s,e.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let l=s[0];l<=s[1];++l)sn(a,e[l]);return a}function Vn(e){const s=[1/0,1/0,-1/0,-1/0];for(const a of e)for(const e of a)sn(s,e);return s}function Nn(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function jn(e,s,a){if(!Nn(e)||!Nn(s))return NaN;let l=0,c=0;return e[2]s[2]&&(l=e[0]-s[2]),e[1]>s[3]&&(c=e[1]-s[3]),e[3]=l)return l;if(on(c,u)){if(Hn(e,s))return 0}else if(Hn(s,e))return 0;let d=1/0;for(const l of e)for(let e=0,c=l.length,u=c-1;e0;){const c=d.pop();if(c[0]>=u)continue;const _=c[1],y=s?50:100;if(Rn(_)<=y){if(!Ln(_,e.length))return NaN;if(s){const s=Wn(e,_,a,l);if(isNaN(s)||0===s)return s;u=Math.min(u,s)}else for(let s=_[0];s<=_[1];++s){const c=$n(e[s],a,l);if(u=Math.min(u,c),0===u)return 0}}else{const a=Bn(_,s);Yn(d,u,l,e,f,a[0]),Yn(d,u,l,e,f,a[1])}}return u}function Qn(e,s,a,l,c,u=1/0){let d=Math.min(u,c.distance(e[0],a[0]));if(0===d)return d;const f=new bn([[0,[0,e.length-1],[0,a.length-1]]],zn);for(;f.length>0;){const u=f.pop();if(u[0]>=d)continue;const _=u[1],y=u[2],b=s?50:100,S=l?50:100;if(Rn(_)<=b&&Rn(y)<=S){if(!Ln(_,e.length)&&Ln(y,a.length))return NaN;let u;if(s&&l)u=Zn(e,_,a,y,c),d=Math.min(d,u);else if(s&&!l){const s=e.slice(_[0],_[1]+1);for(let e=y[0];e<=y[1];++e)if(u=Un(a[e],s,c),d=Math.min(d,u),0===d)return d}else if(!s&&l){const s=a.slice(y[0],y[1]+1);for(let a=_[0];a<=_[1];++a)if(u=Un(e[a],s,c),d=Math.min(d,u),0===d)return d}else u=qn(e,_,a,y,c),d=Math.min(d,u)}else{const u=Bn(_,s),b=Bn(y,l);Kn(f,d,c,e,a,u[0],b[0]),Kn(f,d,c,e,a,u[0],b[1]),Kn(f,d,c,e,a,u[1],b[0]),Kn(f,d,c,e,a,u[1],b[1])}}return d}function es(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class En{constructor(e,s){this.type=li,this.geojson=e,this.geometries=s}static parse(e,s){if(2!==e.length)return s.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(vr(e[1])){const s=e[1];if("FeatureCollection"===s.type)return new En(s,s.features.map((e=>es(e.geometry))).flat());if("Feature"===s.type)return new En(s,es(s.geometry));if("type"in s&&"coordinates"in s)return new En(s,es(s))}return s.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,s){const a=e.geometry(),l=a.flat().map((s=>nn([s.x,s.y],e.canonical)));if(0===a.length)return NaN;const c=new an(l[0][1]);let u=1/0;for(const e of s){switch(e.type){case"Point":u=Math.min(u,Qn(l,!1,[e.coordinates],!1,c,u));break;case"LineString":u=Math.min(u,Qn(l,!1,e.coordinates,!0,c,u));break;case"Polygon":u=Math.min(u,Jn(l,!1,e.coordinates,c,u))}if(0===u)return u}return u}(e,this.geometries);if("LineString"===e.geometryType())return function(e,s){const a=e.geometry(),l=a.flat().map((s=>nn([s.x,s.y],e.canonical)));if(0===a.length)return NaN;const c=new an(l[0][1]);let u=1/0;for(const e of s){switch(e.type){case"Point":u=Math.min(u,Qn(l,!0,[e.coordinates],!1,c,u));break;case"LineString":u=Math.min(u,Qn(l,!0,e.coordinates,!0,c,u));break;case"Polygon":u=Math.min(u,Jn(l,!0,e.coordinates,c,u))}if(0===u)return u}return u}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,s){const a=e.geometry();if(0===a.length||0===a[0].length)return NaN;const l=Pn(a,0).map((s=>s.map((s=>s.map((s=>nn([s.x,s.y],e.canonical))))))),c=new an(l[0][0][0][1]);let u=1/0;for(const e of s)for(const s of l){switch(e.type){case"Point":u=Math.min(u,Jn([e.coordinates],!1,s,c,u));break;case"LineString":u=Math.min(u,Jn(e.coordinates,!0,s,c,u));break;case"Polygon":u=Math.min(u,Xn(s,e.coordinates,c,u))}if(0===u)return u}return u}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class kn{constructor(e){this.type=fi,this.key=e}static parse(e,s){if(2!==e.length)return s.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=e[1];return null==a?s.error("Global state property must be defined."):"string"!=typeof a?s.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new kn(a)}evaluate(e){var s;const a=null===(s=e.globals)||void 0===s?void 0:s.globalState;return a&&0!==Object.keys(a).length?or(a,this.key):null}eachChild(){}outputDefined(){return!1}}const ts={"==":qr,"!=":$r,">":Xr,"<":Wr,">=":en,"<=":Kr,array:Gt,at:Qt,boolean:Gt,case:nr,coalesce:yr,collator:Tr,format:Mr,image:Er,in:er,"index-of":tr,interpolate:pr,"interpolate-hcl":pr,"interpolate-lab":pr,length:kr,let:Jt,literal:qt,match:rr,number:Gt,"number-format":Ir,object:Gt,slice:ir,step:ar,string:Gt,"to-boolean":Yt,"to-color":Yt,"to-number":Yt,"to-string":Yt,var:Wt,within:Zr,distance:En,"global-state":kn};class Fn{constructor(e,s,a,l){this.name=e,this.type=s,this._evaluate=a,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,s){const a=e[0],l=Fn.definitions[a];if(!l)return s.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const c=Array.isArray(l)?l[0]:l.type,u=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,d=u.filter((([s])=>!Array.isArray(s)||s.length===e.length-1));let f=null;for(const[l,u]of d){f=new Kt(s.registry,ls,s.path,null,s.scope);const d=[];let _=!1;for(let s=1;s{return s=e,Array.isArray(s)?`(${s.map(zi).join(", ")})`:`(${zi(s.type)}...)`;var s})).join(" | "),l=[];for(let a=1;a{a=s?a&&ls(e):a&&e instanceof qt})),!!a&&hs(e)&&ps(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function hs(e){if(e instanceof Fn){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Zr)return!1;if(e instanceof En)return!1;let s=!0;return e.eachChild((e=>{s&&!hs(e)&&(s=!1)})),s}function us(e){if(e instanceof Fn&&"feature-state"===e.name)return!1;let s=!0;return e.eachChild((e=>{s&&!us(e)&&(s=!1)})),s}function ps(e,s){if(e instanceof Fn&&s.indexOf(e.name)>=0)return!1;let a=!0;return e.eachChild((e=>{a&&!ps(e,s)&&(a=!1)})),a}function fs(e){return{result:"success",value:e}}function ms(e){return{result:"error",value:e}}function _s(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function gs(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function ys(e){return!!e.expression&&e.expression.interpolated}function xs(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function vs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&br(e)===pi}function bs(e){return e}function ws(e,s){const a=e.stops&&"object"==typeof e.stops[0][0],l=a||!(a||void 0!==e.property),c=e.type||(ys(s)?"exponential":"interval"),u=function(e){switch(e.type){case"color":return It.parse;case"padding":return Ft.parse;case"numberArray":return Bt.parse;case"colorArray":return Pt.parse;default:return null}}(s);if(u&&((e=ti({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],u(e[1])]))),e.default=u(e.default?e.default:s.default)),e.colorSpace&&"rgb"!==(d=e.colorSpace)&&"hcl"!==d&&"lab"!==d)throw new Error(`Unknown color space: "${e.colorSpace}"`);var d;const f=function(e){switch(e){case"exponential":return Ms;case"interval":return Is;case"categorical":return Ss;case"identity":return As;default:throw new Error(`Unknown function type "${e}"`)}}(c);let _,y;if("categorical"===c){_=Object.create(null);for(const s of e.stops)_[s[0]]=s[1];y=typeof e.stops[0][0]}if(a){const a={},l=[];for(let s=0;se[0])),evaluate:({zoom:a},l)=>Ms({stops:c,base:e.base},s,a).evaluate(a,l)}}if(l){const a="exponential"===c?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:a,interpolationFactor:pr.interpolationFactor.bind(void 0,a),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:a})=>f(e,s,a,_,y)}}return{kind:"source",evaluate(a,l){const c=l&&l.properties?l.properties[e.property]:void 0;return void 0===c?Ts(e.default,s.default):f(e,s,c,_,y)}}}function Ts(e,s,a){return void 0!==e?e:void 0!==s?s:void 0!==a?a:void 0}function Ss(e,s,a,l,c){return Ts(typeof a===c?l[a]:void 0,e.default,s.default)}function Is(e,s,a){if("number"!==xs(a))return Ts(e.default,s.default);const l=e.stops.length;if(1===l)return e.stops[0][1];if(a<=e.stops[0][0])return e.stops[0][1];if(a>=e.stops[l-1][0])return e.stops[l-1][1];const c=Ar(e.stops.map((e=>e[0])),a);return e.stops[c][1]}function Ms(e,s,a){const l=void 0!==e.base?e.base:1;if("number"!==xs(a))return Ts(e.default,s.default);const c=e.stops.length;if(1===c)return e.stops[0][1];if(a<=e.stops[0][0])return e.stops[0][1];if(a>=e.stops[c-1][0])return e.stops[c-1][1];const u=Ar(e.stops.map((e=>e[0])),a),d=function(e,s,a,l){const c=l-a,u=e-a;return 0===c?0:1===s?u/c:(Math.pow(s,u)-1)/(Math.pow(s,c)-1)}(a,l,e.stops[u][0],e.stops[u+1][0]),f=e.stops[u][1],_=e.stops[u+1][1],y=Or[s.type]||bs;return"function"==typeof f.evaluate?{evaluate(...s){const a=f.evaluate.apply(void 0,s),l=_.evaluate.apply(void 0,s);if(void 0!==a&&void 0!==l)return y(a,l,d,e.colorSpace)}}:y(f,_,d,e.colorSpace)}function As(e,s,a){switch(s.type){case"color":a=It.parse(a);break;case"formatted":a=Dt.fromString(a.toString());break;case"resolvedImage":a=Lt.fromString(a.toString());break;case"padding":a=Ft.parse(a);break;case"colorArray":a=Pt.parse(a);break;case"numberArray":a=Bt.parse(a);break;default:xs(a)===s.type||"enum"===s.type&&s.values[a]||(a=void 0)}return Ts(a,e.default,s.default)}Fn.register(ts,{error:[{kind:"error"},[ci],(e,[s])=>{throw new zt(s.evaluate(e))}],typeof:[ci,[fi],(e,[s])=>zi(br(s.evaluate(e)))],"to-rgba":[Ai(li,4),[ui],(e,[s])=>{const[a,l,c,u]=s.evaluate(e).rgb;return[255*a,255*l,255*c,u]}],rgb:[ui,[li,li,li],is],rgba:[ui,[li,li,li,li],is],has:{type:hi,overloads:[[[ci],(e,[s])=>ns(s.evaluate(e),e.properties())],[[ci,pi],(e,[s,a])=>ns(s.evaluate(e),a.evaluate(e))]]},get:{type:fi,overloads:[[[ci],(e,[s])=>ss(s.evaluate(e),e.properties())],[[ci,pi],(e,[s,a])=>ss(s.evaluate(e),a.evaluate(e))]]},"feature-state":[fi,[ci],(e,[s])=>ss(s.evaluate(e),e.featureState||{})],properties:[pi,[],e=>e.properties()],"geometry-type":[ci,[],e=>e.geometryType()],id:[fi,[],e=>e.id()],zoom:[li,[],e=>e.globals.zoom],"heatmap-density":[li,[],e=>e.globals.heatmapDensity||0],elevation:[li,[],e=>e.globals.elevation||0],"line-progress":[li,[],e=>e.globals.lineProgress||0],accumulated:[fi,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[li,os(li),(e,s)=>{let a=0;for(const l of s)a+=l.evaluate(e);return a}],"*":[li,os(li),(e,s)=>{let a=1;for(const l of s)a*=l.evaluate(e);return a}],"-":{type:li,overloads:[[[li,li],(e,[s,a])=>s.evaluate(e)-a.evaluate(e)],[[li],(e,[s])=>-s.evaluate(e)]]},"/":[li,[li,li],(e,[s,a])=>s.evaluate(e)/a.evaluate(e)],"%":[li,[li,li],(e,[s,a])=>s.evaluate(e)%a.evaluate(e)],ln2:[li,[],()=>Math.LN2],pi:[li,[],()=>Math.PI],e:[li,[],()=>Math.E],"^":[li,[li,li],(e,[s,a])=>Math.pow(s.evaluate(e),a.evaluate(e))],sqrt:[li,[li],(e,[s])=>Math.sqrt(s.evaluate(e))],log10:[li,[li],(e,[s])=>Math.log(s.evaluate(e))/Math.LN10],ln:[li,[li],(e,[s])=>Math.log(s.evaluate(e))],log2:[li,[li],(e,[s])=>Math.log(s.evaluate(e))/Math.LN2],sin:[li,[li],(e,[s])=>Math.sin(s.evaluate(e))],cos:[li,[li],(e,[s])=>Math.cos(s.evaluate(e))],tan:[li,[li],(e,[s])=>Math.tan(s.evaluate(e))],asin:[li,[li],(e,[s])=>Math.asin(s.evaluate(e))],acos:[li,[li],(e,[s])=>Math.acos(s.evaluate(e))],atan:[li,[li],(e,[s])=>Math.atan(s.evaluate(e))],min:[li,os(li),(e,s)=>Math.min(...s.map((s=>s.evaluate(e))))],max:[li,os(li),(e,s)=>Math.max(...s.map((s=>s.evaluate(e))))],abs:[li,[li],(e,[s])=>Math.abs(s.evaluate(e))],round:[li,[li],(e,[s])=>{const a=s.evaluate(e);return a<0?-Math.round(-a):Math.round(a)}],floor:[li,[li],(e,[s])=>Math.floor(s.evaluate(e))],ceil:[li,[li],(e,[s])=>Math.ceil(s.evaluate(e))],"filter-==":[hi,[ci,fi],(e,[s,a])=>e.properties()[s.value]===a.value],"filter-id-==":[hi,[fi],(e,[s])=>e.id()===s.value],"filter-type-==":[hi,[ci],(e,[s])=>e.geometryType()===s.value],"filter-<":[hi,[ci,fi],(e,[s,a])=>{const l=e.properties()[s.value],c=a.value;return typeof l==typeof c&&l{const a=e.id(),l=s.value;return typeof a==typeof l&&a":[hi,[ci,fi],(e,[s,a])=>{const l=e.properties()[s.value],c=a.value;return typeof l==typeof c&&l>c}],"filter-id->":[hi,[fi],(e,[s])=>{const a=e.id(),l=s.value;return typeof a==typeof l&&a>l}],"filter-<=":[hi,[ci,fi],(e,[s,a])=>{const l=e.properties()[s.value],c=a.value;return typeof l==typeof c&&l<=c}],"filter-id-<=":[hi,[fi],(e,[s])=>{const a=e.id(),l=s.value;return typeof a==typeof l&&a<=l}],"filter->=":[hi,[ci,fi],(e,[s,a])=>{const l=e.properties()[s.value],c=a.value;return typeof l==typeof c&&l>=c}],"filter-id->=":[hi,[fi],(e,[s])=>{const a=e.id(),l=s.value;return typeof a==typeof l&&a>=l}],"filter-has":[hi,[fi],(e,[s])=>s.value in e.properties()],"filter-has-id":[hi,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[hi,[Ai(ci)],(e,[s])=>s.value.indexOf(e.geometryType())>=0],"filter-id-in":[hi,[Ai(fi)],(e,[s])=>s.value.indexOf(e.id())>=0],"filter-in-small":[hi,[ci,Ai(fi)],(e,[s,a])=>a.value.indexOf(e.properties()[s.value])>=0],"filter-in-large":[hi,[ci,Ai(fi)],(e,[s,a])=>function(e,s,a,l){for(;a<=l;){const c=a+l>>1;if(s[c]===e)return!0;s[c]>e?l=c-1:a=c+1}return!1}(e.properties()[s.value],a.value,0,a.value.length-1)],all:{type:hi,overloads:[[[hi,hi],(e,[s,a])=>s.evaluate(e)&&a.evaluate(e)],[os(hi),(e,s)=>{for(const a of s)if(!a.evaluate(e))return!1;return!0}]]},any:{type:hi,overloads:[[[hi,hi],(e,[s,a])=>s.evaluate(e)||a.evaluate(e)],[os(hi),(e,s)=>{for(const a of s)if(a.evaluate(e))return!0;return!1}]]},"!":[hi,[hi],(e,[s])=>!s.evaluate(e)],"is-supported-script":[hi,[ci],(e,[s])=>{const a=e.globals&&e.globals.isSupportedScript;return!a||a(s.evaluate(e))}],upcase:[ci,[ci],(e,[s])=>s.evaluate(e).toUpperCase()],downcase:[ci,[ci],(e,[s])=>s.evaluate(e).toLowerCase()],concat:[ci,os(fi),(e,s)=>s.map((s=>wr(s.evaluate(e)))).join("")],"resolved-locale":[ci,[mi],(e,[s])=>s.evaluate(e).resolvedLocale()]});class ei{constructor(e,s,a){this.expression=e,this._warningHistory={},this._evaluator=new Ht,this._defaultValue=s?function(e){if("color"===e.type&&vs(e.default))return new It(0,0,0,0);switch(e.type){case"color":return It.parse(e.default)||null;case"padding":return Ft.parse(e.default)||null;case"numberArray":return Bt.parse(e.default)||null;case"colorArray":return Pt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Ct.parse(e.default)||null;case"projectionDefinition":return Ot.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(s):null,this._enumValues=s&&"enum"===s.type?s.values:null,this._globalState=a}evaluateWithoutErrorHandling(e,s,a,l,c,u){return this._globalState&&(e=Ys(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=s,this._evaluator.featureState=a,this._evaluator.canonical=l,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(e,s,a,l,c,u){this._globalState&&(e=Ys(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=s||null,this._evaluator.featureState=a||null,this._evaluator.canonical=l,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=u||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new zt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function ks(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in ts}function js(e,s,a){const l=new Kt(ts,ls,[],s?function(e){const s={color:ui,string:ci,number:li,enum:ci,boolean:hi,formatted:_i,padding:xi,numberArray:wi,colorArray:bi,projectionDefinition:di,resolvedImage:Ii,variableAnchorOffsetCollection:Ei};return"array"===e.type?Ai(s[e.value]||fi,e.length):s[e.type]}(s):void 0),c=l.parse(e,void 0,void 0,void 0,s&&"string"===s.type?{typeAnnotation:"coerce"}:void 0);return c?fs(new ei(c,s,a)):ms(l.errors)}class ni{constructor(e,s,a){this.kind=e,this._styleExpression=s,this.isStateDependent="constant"!==e&&!us(s.expression),this.globalStateRefs=Xs(s.expression),this._globalState=a}evaluateWithoutErrorHandling(e,s,a,l,c,u){return this._globalState&&(e=Ys(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,s,a,l,c,u)}evaluate(e,s,a,l,c,u){return this._globalState&&(e=Ys(e,this._globalState)),this._styleExpression.evaluate(e,s,a,l,c,u)}}class ii{constructor(e,s,a,l,c){this.kind=e,this.zoomStops=a,this._styleExpression=s,this.isStateDependent="camera"!==e&&!us(s.expression),this.globalStateRefs=Xs(s.expression),this.interpolationType=l,this._globalState=c}evaluateWithoutErrorHandling(e,s,a,l,c,u){return this._globalState&&(e=Ys(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,s,a,l,c,u)}evaluate(e,s,a,l,c,u){return this._globalState&&(e=Ys(e,this._globalState)),this._styleExpression.evaluate(e,s,a,l,c,u)}interpolationFactor(e,s,a){return this.interpolationType?pr.interpolationFactor(this.interpolationType,e,s,a):0}}function Ws(e,s,a){const l=js(e,s,a);if("error"===l.result)return l;const c=l.value.expression,u=hs(c);if(!u&&!_s(s))return ms([new Be("","data expressions not supported")]);const d=ps(c,["zoom"]);if(!d&&!gs(s))return ms([new Be("","zoom expressions not supported")]);const f=Hs(c);return f||d?f instanceof Be?ms([f]):f instanceof pr&&!ys(s)?ms([new Be("",'"interpolate" expressions cannot be used with this property')]):fs(f?new ii(u?"camera":"composite",l.value,f.labels,f instanceof pr?f.interpolation:void 0,a):new ni(u?"constant":"source",l.value,a)):ms([new Be("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ai{constructor(e,s){this._parameters=e,this._specification=s,ti(this,ws(this._parameters,this._specification))}static deserialize(e){return new ai(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Hs(e){let s=null;if(e instanceof Jt)s=Hs(e.result);else if(e instanceof yr){for(const a of e.args)if(s=Hs(a),s)break}else(e instanceof ar||e instanceof pr)&&e.input instanceof Fn&&"zoom"===e.input.name&&(s=e);return s instanceof Be||e.eachChild((e=>{const a=Hs(e);a instanceof Be?s=a:!s&&a?s=new Be("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):s&&a&&s!==a&&(s=new Be("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),s}function Xs(e,s=new Set){return e instanceof kn&&s.add(e.key),e.eachChild((e=>{Xs(e,s)})),s}function Ys(e,s){const{zoom:a,heatmapDensity:l,elevation:c,lineProgress:u,isSupportedScript:d,accumulated:f}=null!=e?e:{};return{zoom:a,heatmapDensity:l,elevation:c,lineProgress:u,isSupportedScript:d,accumulated:f,globalState:s}}function Qs(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const s of e.slice(1))if(!Qs(s)&&"boolean"!=typeof s)return!1;return!0;default:return!0}}const ro={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function co(e,s){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Qs(e)||(e=bo(e));const a=js(e,ro,s);if("error"===a.result)throw new Error(a.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,s,l)=>a.value.evaluate(e,s,{},l),needGeometry:fo(e),getGlobalStateRefs:()=>Xs(a.value.expression)}}function uo(e,s){return es?1:0}function fo(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let s=1;s"===s||"<="===s||">="===s?wo(e[1],e[2],s):"any"===s?(a=e.slice(1),["any"].concat(a.map(bo))):"all"===s?["all"].concat(e.slice(1).map(bo)):"none"===s?["all"].concat(e.slice(1).map(bo).map(Vo)):"in"===s?Po(e[1],e.slice(2)):"!in"===s?Vo(Po(e[1],e.slice(2))):"has"===s?Co(e[1]):"!has"!==s||Vo(Co(e[1]));var a}function wo(e,s,a){switch(e){case"$type":return[`filter-type-${a}`,s];case"$id":return[`filter-id-${a}`,s];default:return[`filter-${a}`,e,s]}}function Po(e,s){if(0===s.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some((e=>typeof e!=typeof s[0]))?["filter-in-large",e,["literal",s.sort(uo)]]:["filter-in-small",e,["literal",s]]}}function Co(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Vo(e){return["!",e]}function No(e){const s=typeof e;if("number"===s||"boolean"===s||"string"===s||null==e)return JSON.stringify(e);if(Array.isArray(e)){let s="[";for(const a of e)s+=`${No(a)},`;return`${s}]`}const a=Object.keys(e).sort();let l="{";for(let s=0;sl.maximum?[new De(s,a,`${a} is greater than the maximum value ${l.maximum}`)]:[]}function rl(e){const s=e.valueSpec,a=Qo(e.value.type);let l,c,u,d={};const f="categorical"!==a&&void 0===e.value.property,_=!f,y="array"===xs(e.value.stops)&&"array"===xs(e.value.stops[0])&&"object"===xs(e.value.stops[0][0]),b=el({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new De(e.key,e.value,'identity function may not have a "stops" property')];let s=[];const l=e.value;return s=s.concat(tl({key:e.key,value:l,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:S})),"array"===xs(l)&&0===l.length&&s.push(new De(e.key,l,"array must have at least one stop")),s},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:s,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&f&&b.push(new De(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||b.push(new De(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!ys(e.valueSpec)&&b.push(new De(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(_&&!_s(e.valueSpec)?b.push(new De(e.key,e.value,"property functions not supported")):f&&!gs(e.valueSpec)&&b.push(new De(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!y||void 0!==e.value.property||b.push(new De(e.key,e.value,'"property" property is required')),b;function S(e){let a=[];const l=e.value,f=e.key;if("array"!==xs(l))return[new De(f,l,`array expected, ${xs(l)} found`)];if(2!==l.length)return[new De(f,l,`array length 2 expected, length ${l.length} found`)];if(y){if("object"!==xs(l[0]))return[new De(f,l,`object expected, ${xs(l[0])} found`)];if(void 0===l[0].zoom)return[new De(f,l,"object stop key must have zoom")];if(void 0===l[0].value)return[new De(f,l,"object stop key must have value")];if(u&&u>Qo(l[0].zoom))return[new De(f,l[0].zoom,"stop zoom values must appear in ascending order")];Qo(l[0].zoom)!==u&&(u=Qo(l[0].zoom),c=void 0,d={}),a=a.concat(el({key:`${f}[0]`,value:l[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:il,value:P}}))}else a=a.concat(P({key:`${f}[0]`,value:l[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},l));return ks(Ja(l[1]))?a.concat([new De(`${f}[1]`,l[1],"expressions are not allowed in function stops.")]):a.concat(e.validateSpec({key:`${f}[1]`,value:l[1],valueSpec:s,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function P(e,u){const f=xs(e.value),_=Qo(e.value),y=null!==e.value?e.value:u;if(l){if(f!==l)return[new De(e.key,y,`${f} stop domain type must match previous stop domain type ${l}`)]}else l=f;if("number"!==f&&"string"!==f&&"boolean"!==f)return[new De(e.key,y,"stop domain value must be a number, string, or boolean")];if("number"!==f&&"categorical"!==a){let l=`number expected, ${f} found`;return _s(s)&&void 0===a&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new De(e.key,y,l)]}return"categorical"!==a||"number"!==f||isFinite(_)&&Math.floor(_)===_?"categorical"!==a&&"number"===f&&void 0!==c&&_new De(`${e.key}${s.key}`,e.value,s.message)));const a=s.value.expression||s.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!a.outputDefined())return[new De(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!us(a))return[new De(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!us(a))return[new De(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!ps(a,["zoom","feature-state"]))return[new De(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!hs(a))return[new De(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function sl(e){const s=e.key,a=e.value,l=xs(a);return"string"!==l?[new De(s,a,`color expected, ${l} found`)]:It.parse(String(a))?[]:[new De(s,a,`color expected, "${a}" found`)]}function ol(e){const s=e.key,a=e.value,l=e.valueSpec,c=[];return Array.isArray(l.values)?-1===l.values.indexOf(Qo(a))&&c.push(new De(s,a,`expected one of [${l.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(l.values).indexOf(Qo(a))&&c.push(new De(s,a,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(a)} found`)),c}function al(e){return Qs(Ja(e.value))?nl(ti({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ll(e)}function ll(e){const s=e.value,a=e.key;if("array"!==xs(s))return[new De(a,s,`array expected, ${xs(s)} found`)];const l=e.styleSpec;let c,u=[];if(s.length<1)return[new De(a,s,"filter array must have at least 1 element")];switch(u=u.concat(ol({key:`${a}[0]`,value:s[0],valueSpec:l.filter_operator,style:e.style,styleSpec:e.styleSpec})),Qo(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"===Qo(s[1])&&u.push(new De(a,s,`"$type" cannot be use with operator "${s[0]}"`));case"==":case"!=":3!==s.length&&u.push(new De(a,s,`filter array for operator "${s[0]}" must have 3 elements`));case"in":case"!in":s.length>=2&&(c=xs(s[1]),"string"!==c&&u.push(new De(`${a}[1]`,s[1],`string expected, ${c} found`)));for(let d=2;d{e in a&&s.push(new De(l,a[e],`"${e}" is prohibited for ref layers`))})),c.layers.forEach((s=>{Qo(s.id)===f&&(e=s)})),e?e.ref?s.push(new De(l,a.ref,"ref cannot reference another ref layer")):d=Qo(e.type):s.push(new De(l,a.ref,`ref layer "${f}" not found`))}else if("background"!==d)if(a.source){const e=c.sources&&c.sources[a.source],u=e&&Qo(e.type);e?"vector"===u&&"raster"===d?s.push(new De(l,a.source,`layer "${a.id}" requires a raster source`)):"raster-dem"!==u&&"hillshade"===d||"raster-dem"!==u&&"color-relief"===d?s.push(new De(l,a.source,`layer "${a.id}" requires a raster-dem source`)):"raster"===u&&"raster"!==d?s.push(new De(l,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==u||a["source-layer"]?"raster-dem"===u&&"hillshade"!==d&&"color-relief"!==d?s.push(new De(l,a.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==d||!a.paint||!a.paint["line-gradient"]||"geojson"===u&&e.lineMetrics||s.push(new De(l,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new De(l,a,`layer "${a.id}" must specify a "source-layer"`)):s.push(new De(l,a.source,`source "${a.source}" not found`))}else s.push(new De(l,a,'missing required property "source"'));return s=s.concat(el({key:l,value:a,valueSpec:u.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${l}.type`,value:a.type,valueSpec:u.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:a,objectKey:"type"}),filter:al,layout:e=>el({layer:a,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>pl(ti({layerType:d},e))}}),paint:e=>el({layer:a,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>dl(ti({layerType:d},e))}})}})),s}function _l(e){const s=e.value,a=e.key,l=xs(s);return"string"!==l?[new De(a,s,`string expected, ${l} found`)]:[]}const yl={promoteId:function({key:e,value:s}){if("string"===xs(s))return _l({key:e,value:s});{const a=[];for(const l in s)a.push(..._l({key:`${e}.${l}`,value:s[l]}));return a}}};function xl(e){const s=e.value,a=e.key,l=e.styleSpec,c=e.style,u=e.validateSpec;if(!s.type)return[new De(a,s,'"type" is required')];const d=Qo(s.type);let f;switch(d){case"vector":case"raster":return f=el({key:a,value:s,valueSpec:l[`source_${d.replace("-","_")}`],style:e.style,styleSpec:l,objectElementValidators:yl,validateSpec:u}),f;case"raster-dem":return f=function(e){var s;const a=null!==(s=e.sourceName)&&void 0!==s?s:"",l=e.value,c=e.styleSpec,u=c.source_raster_dem,d=e.style;let f=[];const _=xs(l);if(void 0===l)return f;if("object"!==_)return f.push(new De("source_raster_dem",l,`object expected, ${_} found`)),f;const y="custom"===Qo(l.encoding),b=["redFactor","greenFactor","blueFactor","baseShift"],S=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const s in l)!y&&b.includes(s)?f.push(new De(s,l[s],`In "${a}": "${s}" is only valid when "encoding" is set to "custom". ${S} encoding found`)):u[s]?f=f.concat(e.validateSpec({key:s,value:l[s],valueSpec:u[s],validateSpec:e.validateSpec,style:d,styleSpec:c})):f.push(new De(s,l[s],`unknown property "${s}"`));return f}({sourceName:a,value:s,style:e.style,styleSpec:l,validateSpec:u}),f;case"geojson":if(f=el({key:a,value:s,valueSpec:l.source_geojson,style:c,styleSpec:l,validateSpec:u,objectElementValidators:yl}),s.cluster)for(const e in s.clusterProperties){const[l,c]=s.clusterProperties[e],u="string"==typeof l?[l,["accumulated"],["get",e]]:l;f.push(...nl({key:`${a}.${e}.map`,value:c,expressionContext:"cluster-map"})),f.push(...nl({key:`${a}.${e}.reduce`,value:u,expressionContext:"cluster-reduce"}))}return f;case"video":return el({key:a,value:s,valueSpec:l.source_video,style:c,validateSpec:u,styleSpec:l});case"image":return el({key:a,value:s,valueSpec:l.source_image,style:c,validateSpec:u,styleSpec:l});case"canvas":return[new De(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ol({key:`${a}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function vl(e){const s=e.value,a=e.styleSpec,l=a.light,c=e.style;let u=[];const d=xs(s);if(void 0===s)return u;if("object"!==d)return u=u.concat([new De("light",s,`object expected, ${d} found`)]),u;for(const d in s){const f=d.match(/^(.*)-transition$/);u=u.concat(f&&l[f[1]]&&l[f[1]].transition?e.validateSpec({key:d,value:s[d],valueSpec:a.transition,validateSpec:e.validateSpec,style:c,styleSpec:a}):l[d]?e.validateSpec({key:d,value:s[d],valueSpec:l[d],validateSpec:e.validateSpec,style:c,styleSpec:a}):[new De(d,s[d],`unknown property "${d}"`)])}return u}function wl(e){const s=e.value,a=e.styleSpec,l=a.sky,c=e.style,u=xs(s);if(void 0===s)return[];if("object"!==u)return[new De("sky",s,`object expected, ${u} found`)];let d=[];for(const u in s)d=d.concat(l[u]?e.validateSpec({key:u,value:s[u],valueSpec:l[u],style:c,styleSpec:a}):[new De(u,s[u],`unknown property "${u}"`)]);return d}function Tl(e){const s=e.value,a=e.styleSpec,l=a.terrain,c=e.style;let u=[];const d=xs(s);if(void 0===s)return u;if("object"!==d)return u=u.concat([new De("terrain",s,`object expected, ${d} found`)]),u;for(const d in s)u=u.concat(l[d]?e.validateSpec({key:d,value:s[d],valueSpec:l[d],validateSpec:e.validateSpec,style:c,styleSpec:a}):[new De(d,s[d],`unknown property "${d}"`)]);return u}function Pl(e){let s=[];const a=e.value,l=e.key;if(Array.isArray(a)){const c=[],u=[];for(const d in a)a[d].id&&c.includes(a[d].id)&&s.push(new De(l,a,`all the sprites' ids must be unique, but ${a[d].id} is duplicated`)),c.push(a[d].id),a[d].url&&u.includes(a[d].url)&&s.push(new De(l,a,`all the sprites' URLs must be unique, but ${a[d].url} is duplicated`)),u.push(a[d].url),s=s.concat(el({key:`${l}[${d}]`,value:a[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return s}return _l({key:l,value:a})}function El(e){return s=e.value,Boolean(s)&&s.constructor===Object?[]:[new De(e.key,e.value,`object expected, ${xs(e.value)} found`)];var s}const Cl={"*":()=>[],array:tl,boolean:function(e){const s=e.value,a=e.key,l=xs(s);return"boolean"!==l?[new De(a,s,`boolean expected, ${l} found`)]:[]},number:il,color:sl,constants:Ho,enum:ol,filter:al,function:rl,layer:fl,object:el,source:xl,light:vl,sky:wl,terrain:Tl,projection:function(e){const s=e.value,a=e.styleSpec,l=a.projection,c=e.style,u=xs(s);if(void 0===s)return[];if("object"!==u)return[new De("projection",s,`object expected, ${u} found`)];let d=[];for(const u in s)d=d.concat(l[u]?e.validateSpec({key:u,value:s[u],valueSpec:l[u],style:c,styleSpec:a}):[new De(u,s[u],`unknown property "${u}"`)]);return d},projectionDefinition:function(e){const s=e.key;let a=e.value;a=a instanceof String?a.valueOf():a;const l=xs(a);return"array"!==l||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(a)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(a)?["array","string"].includes(l)?[]:[new De(s,a,`projection expected, invalid type "${l}" found`)]:[new De(s,a,`projection expected, invalid array ${JSON.stringify(a)} found`)]},string:_l,formatted:function(e){return 0===_l(e).length?[]:nl(e)},resolvedImage:function(e){return 0===_l(e).length?[]:nl(e)},padding:function(e){const s=e.key,a=e.value;if("array"===xs(a)){if(a.length<1||a.length>4)return[new De(s,a,`padding requires 1 to 4 values; ${a.length} values found`)];const l={type:"number"};let c=[];for(let u=0;u[]}})),e.constants&&(a=a.concat(Ho({key:"constants",value:e.constants}))),Ll(a)}function Rl(e){return function(s){return e(Object.assign({},s,{validateSpec:Al}))}}function Ll(e){return[].concat(e).sort(((e,s)=>e.line-s.line))}function Fl(s){return function(...a){return Ll(s.apply(this||e,a))}}zl.source=Fl(Rl(xl)),zl.sprite=Fl(Rl(Pl)),zl.glyphs=Fl(Rl(Dl)),zl.light=Fl(Rl(vl)),zl.sky=Fl(Rl(wl)),zl.terrain=Fl(Rl(Tl)),zl.state=Fl(Rl(El)),zl.layer=Fl(Rl(fl)),zl.filter=Fl(Rl(al)),zl.paintProperty=Fl(Rl(dl)),zl.layoutProperty=Fl(Rl(pl));const Bl=pt,Ol=zl,Vl=Ol.light,Nl=Ol.sky,jl=Ol.paintProperty,Ul=Ol.layoutProperty;function Gl(e,s){let a=!1;if(s&&s.length)for(const l of s)e.fire(new me(new Error(l.message))),a=!0;return a}class as{constructor(e,s,a){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const c=new Int32Array(this.arrayBuffer);e=c[0],this.d=(s=c[1])+2*(a=c[2]);for(let e=0;e=y[_+0]&&l>=y[_+1])?(d[S]=!0,u.push(c[S])):d[S]=!1}}}}_forEachCell(e,s,a,l,c,u,d,f){const _=this._convertToCellCoord(e),y=this._convertToCellCoord(s),b=this._convertToCellCoord(a),S=this._convertToCellCoord(l);for(let P=_;P<=b;P++)for(let _=y;_<=S;_++){const y=this.d*_+P;if((!f||f(this._convertFromCellCoord(P),this._convertFromCellCoord(_),this._convertFromCellCoord(P+1),this._convertFromCellCoord(_+1)))&&c.call(this,e,s,a,l,y,u,d,f))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,s=3+this.cells.length+1+1;let a=0;for(let e=0;e=0)continue;const u=e[l];c[l]=Zl[a].shallow.indexOf(l)>=0?u:Xl(u,s)}e instanceof Error&&(c.message=e.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(c.$name=a),c}function Yl(e){if(Hl(e))return e;if(Array.isArray(e))return e.map(Yl);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const s=Wl(e)||"Object";if(!Zl[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:a}=Zl[s];if(!a)throw new Error(`can't deserialize unregistered class ${s}`);if(a.deserialize)return a.deserialize(e);const l=Object.create(a.prototype);for(const a of Object.keys(e)){if("$name"===a)continue;const c=e[a];l[a]=Zl[s].shallow.indexOf(a)>=0?c:Yl(c)}return l}class ds{constructor(){this.first=!0}update(e,s){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=s):this.lastFloorZoom{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}})).filter((e=>e));return new RegExp(s.join("|"),"u")}const ic=tc(["Arab","Dupl","Mong","Ougr","Syrc"]);function rc(e){return!ic.test(String.fromCodePoint(e))}function nc(e){return!(Jl(e)||(s=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]/gim.test(String.fromCodePoint(s))));var s}const sc=tc(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function oc(e){return sc.test(String.fromCodePoint(e))}function ac(e,s){return!(!s&&oc(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function lc(e){for(const s of e)if(oc(s.charCodeAt(0)))return!0;return!1}const cc=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(cc.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,s){return a(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const a=e.pluginURL,l=new Promise((e=>{this.loadScriptResolve=e}));s(a);const c=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([l,c]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:a};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${a}`)}))}};class Es{constructor(e,s){this.isSupportedScript=hc,this.zoom=e,s?(this.now=s.now||0,this.fadeDuration=s.fadeDuration||0,this.zoomHistory=s.zoomHistory||new ds,this.transition=s.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ds,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,s=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*s}}}function hc(e){return function(e,s){for(const a of e)if(!ac(a.charCodeAt(0),s))return!1;return!0}(e,"loaded"===cc.getRTLTextPluginStatus())}class Ds{constructor(e,s,a){this.property=e,this.value=s,this.expression=function(e,s,a){if(vs(e))return new ai(e,s);if(ks(e)){const l=Ws(e,s,a);if("error"===l.result)throw new Error(l.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return l.value}{let a=e;return"color"===s.type&&"string"==typeof e?a=It.parse(e):"padding"!==s.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==s.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==s.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===s.type&&Array.isArray(e)?a=Ct.parse(e):"projectionDefinition"===s.type&&"string"==typeof e&&(a=Ot.parse(e)):a=Pt.parse(e):a=Bt.parse(e):a=Ft.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}(void 0===s?e.specification.default:s,e.specification,a)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,s,a){return this.property.possiblyEvaluate(this,e,s,a)}}class Fs{constructor(e,s){this.property=e,this.value=new Ds(e,void 0,s)}transitioned(e,s){return new Ps(this.property,this.value,s,Se({},e.transition,this.transition),e.now)}untransitioned(){return new Ps(this.property,this.value,null,{},0)}}class Bs{constructor(e,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=s}getValue(e){return Ae(this._values[e].value.value)}setValue(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Fs(this._values[e].property,this._globalState)),this._values[e].value=new Ds(this._values[e].property,null===s?void 0:Ae(s),this._globalState)}getTransition(e){return Ae(this._values[e].transition)}setTransition(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Fs(this._values[e].property,this._globalState)),this._values[e].transition=Ae(s)||void 0}serialize(){const e={};for(const s of Object.keys(this._values)){const a=this.getValue(s);void 0!==a&&(e[s]=a);const l=this.getTransition(s);void 0!==l&&(e[`${s}-transition`]=l)}return e}transitioned(e,s){const a=new zs(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].transitioned(e,s._values[l]);return a}untransitioned(){const e=new zs(this._properties);for(const s of Object.keys(this._values))e._values[s]=this._values[s].untransitioned();return e}}class Ps{constructor(e,s,a,l,c){this.property=e,this.value=s,this.begin=c+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=a)}possiblyEvaluate(e,s,a){const l=e.now||0,c=this.value.possiblyEvaluate(e,s,a),u=this.prior;if(u){if(l>this.end)return this.prior=null,c;if(this.value.isDataDriven())return this.prior=null,c;if(ll.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:a,to:s}}interpolate(e){return e}}class $s{constructor(e){this.specification=e}possiblyEvaluate(e,s,a,l){if(void 0!==e.value){if("constant"===e.expression.kind){const c=e.expression.evaluate(s,null,{},a,l);return this._calculate(c,c,c,s)}return this._calculate(e.expression.evaluate(new Es(Math.floor(s.zoom-1),s)),e.expression.evaluate(new Es(Math.floor(s.zoom),s)),e.expression.evaluate(new Es(Math.floor(s.zoom+1),s)),s)}}_calculate(e,s,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:a,to:s}}interpolate(e){return e}}class Us{constructor(e){this.specification=e}possiblyEvaluate(e,s,a,l){return!!e.expression.evaluate(s,null,{},a,l)}interpolate(){return!1}}class qs{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in e){const a=e[s];a.specification.overridable&&this.overridableProperties.push(s);const l=this.defaultPropertyValues[s]=new Ds(a,void 0,void 0),c=this.defaultTransitionablePropertyValues[s]=new Fs(a,void 0);this.defaultTransitioningPropertyValues[s]=c.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=l.possiblyEvaluate({})}}}ql("DataDrivenProperty",Rs),ql("DataConstantProperty",Os),ql("CrossFadedDataDrivenProperty",Ns),ql("CrossFadedProperty",$s),ql("ColorRampProperty",Us);const uc="-transition";class Gs extends ge{constructor(e,s,a){if(super(),this.id=e.id,this.type=e.type,this._globalState=a,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=co(e.filter,a)),s.layout&&(this._unevaluatedLayout=new Vs(s.layout,a)),s.paint)){this._transitionablePaint=new Bs(s.paint,a);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ls(s.paint)}}setFilter(e){this.filter=e,this._featureFilter=co(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;if(this._unevaluatedLayout)for(const s in this._unevaluatedLayout._values){const a=this._unevaluatedLayout._values[s];for(const s of a.getGlobalStateRefs())e.add(s)}for(const s of this._featureFilter.getGlobalStateRefs())e.add(s);return e}getPaintAffectingGlobalStateRefs(){var e;const s=new globalThis.Map;if(this._transitionablePaint)for(const a in this._transitionablePaint._values){const l=this._transitionablePaint._values[a].value;for(const c of l.getGlobalStateRefs()){const u=null!==(e=s.get(c))&&void 0!==e?e:[];u.push({name:a,value:l.value}),s.set(c,u)}}return s}setLayoutProperty(e,s,a={}){null!=s&&this._validate(Ul,`layers.${this.id}.layout.${e}`,e,s,a)||("visibility"!==e?this._unevaluatedLayout.setValue(e,s):this.visibility=s)}getPaintProperty(e){return e.endsWith(uc)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,s,a={}){if(null!=s&&this._validate(jl,`layers.${this.id}.paint.${e}`,e,s,a))return!1;if(e.endsWith(uc))return this._transitionablePaint.setTransition(e.slice(0,-11),s||void 0),!1;{const a=this._transitionablePaint._values[e],l="cross-faded-data-driven"===a.property.specification["property-type"],c=a.value.isDataDriven(),u=a.value;this._transitionablePaint.setValue(e,s),this._handleSpecialPaintPropertyUpdate(e);const d=this._transitionablePaint._values[e].value;return d.isDataDriven()||c||l||this._handleOverridablePaintPropertyUpdate(e,u,d)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,s,a){return!1}isHidden(e,s=!1){return!!(this.minzoom&&e<(s?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,s){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,s)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Ce(e,((e,s)=>!(void 0===e||"layout"===s&&!Object.keys(e).length||"paint"===s&&!Object.keys(e).length)))}_validate(e,s,a,l,c={}){return(!c||!1!==c.validate)&&Gl(this,e.call(Ol,{key:s,layerType:this.type,objectKey:a,value:l,styleSpec:pt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const s=this.paint.get(e);if(s instanceof Cs&&_s(s.property.specification)&&("source"===s.value.kind||"composite"===s.value.kind)&&s.value.isStateDependent)return!0}return!1}}let dc;var fc={get paint(){return dc=dc||new qs({"raster-opacity":new Os(pt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Os(pt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Os(pt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Os(pt.paint_raster["raster-brightness-max"]),"raster-saturation":new Os(pt.paint_raster["raster-saturation"]),"raster-contrast":new Os(pt.paint_raster["raster-contrast"]),"raster-resampling":new Os(pt.paint_raster["raster-resampling"]),"raster-fade-duration":new Os(pt.paint_raster["raster-fade-duration"])})}};class Zs extends Gs{constructor(e,s){super(e,fc,s)}}const mc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ks{constructor(e,s){this._structArray=e,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Js{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,s){return e._trim(),s&&(e.isTransferred=!0,s.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const s=Object.create(this.prototype);return s.arrayBuffer=e.arrayBuffer,s.length=e.length,s.capacity=e.arrayBuffer.byteLength/s.bytesPerElement,s._refreshViews(),s}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function _c(e,s=1){let a=0,l=0;return{members:e.map((e=>{const c=mc[e.type].BYTES_PER_ELEMENT,u=a=gc(a,Math.max(s,c)),d=e.components||1;return l=Math.max(l,c),a+=c*d,{name:e.name,type:e.type,components:d,offset:u}})),size:gc(a,Math.max(l,s)),alignment:s}}function gc(e,s){return Math.ceil(e/s)*s}class ea extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,s)}emplace(e,s,a){const l=2*e;return this.int16[l+0]=s,this.int16[l+1]=a,e}}ea.prototype.bytesPerElement=4,ql("StructArrayLayout2i4",ea);class ta extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,s,a)}emplace(e,s,a,l){const c=3*e;return this.int16[c+0]=s,this.int16[c+1]=a,this.int16[c+2]=l,e}}ta.prototype.bytesPerElement=6,ql("StructArrayLayout3i6",ta);class ra extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,s,a,l)}emplace(e,s,a,l,c){const u=4*e;return this.int16[u+0]=s,this.int16[u+1]=a,this.int16[u+2]=l,this.int16[u+3]=c,e}}ra.prototype.bytesPerElement=8,ql("StructArrayLayout4i8",ra);class na extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,s,a,l,c,u)}emplace(e,s,a,l,c,u,d){const f=6*e;return this.int16[f+0]=s,this.int16[f+1]=a,this.int16[f+2]=l,this.int16[f+3]=c,this.int16[f+4]=u,this.int16[f+5]=d,e}}na.prototype.bytesPerElement=12,ql("StructArrayLayout2i4i12",na);class ia extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,s,a,l,c,u)}emplace(e,s,a,l,c,u,d){const f=4*e,_=8*e;return this.int16[f+0]=s,this.int16[f+1]=a,this.uint8[_+4]=l,this.uint8[_+5]=c,this.uint8[_+6]=u,this.uint8[_+7]=d,e}}ia.prototype.bytesPerElement=8,ql("StructArrayLayout2i4ub8",ia);class sa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,s)}emplace(e,s,a){const l=2*e;return this.float32[l+0]=s,this.float32[l+1]=a,e}}sa.prototype.bytesPerElement=8,ql("StructArrayLayout2f8",sa);class aa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f,_,y){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,a,l,c,u,d,f,_,y)}emplace(e,s,a,l,c,u,d,f,_,y,b){const S=10*e;return this.uint16[S+0]=s,this.uint16[S+1]=a,this.uint16[S+2]=l,this.uint16[S+3]=c,this.uint16[S+4]=u,this.uint16[S+5]=d,this.uint16[S+6]=f,this.uint16[S+7]=_,this.uint16[S+8]=y,this.uint16[S+9]=b,e}}aa.prototype.bytesPerElement=20,ql("StructArrayLayout10ui20",aa);class oa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,s,a,l,c,u,d,f)}emplace(e,s,a,l,c,u,d,f,_){const y=8*e;return this.uint16[y+0]=s,this.uint16[y+1]=a,this.uint16[y+2]=l,this.uint16[y+3]=c,this.uint16[y+4]=u,this.uint16[y+5]=d,this.uint16[y+6]=f,this.uint16[y+7]=_,e}}oa.prototype.bytesPerElement=16,ql("StructArrayLayout8ui16",oa);class la extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f,_,y,b,S){const P=this.length;return this.resize(P+1),this.emplace(P,e,s,a,l,c,u,d,f,_,y,b,S)}emplace(e,s,a,l,c,u,d,f,_,y,b,S,P){const M=12*e;return this.int16[M+0]=s,this.int16[M+1]=a,this.int16[M+2]=l,this.int16[M+3]=c,this.uint16[M+4]=u,this.uint16[M+5]=d,this.uint16[M+6]=f,this.uint16[M+7]=_,this.int16[M+8]=y,this.int16[M+9]=b,this.int16[M+10]=S,this.int16[M+11]=P,e}}la.prototype.bytesPerElement=24,ql("StructArrayLayout4i4ui4i24",la);class ua extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,s,a)}emplace(e,s,a,l){const c=3*e;return this.float32[c+0]=s,this.float32[c+1]=a,this.float32[c+2]=l,e}}ua.prototype.bytesPerElement=12,ql("StructArrayLayout3f12",ua);class ca extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint32[1*e+0]=s,e}}ca.prototype.bytesPerElement=4,ql("StructArrayLayout1ul4",ca);class ha extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f,_){const y=this.length;return this.resize(y+1),this.emplace(y,e,s,a,l,c,u,d,f,_)}emplace(e,s,a,l,c,u,d,f,_,y){const b=10*e,S=5*e;return this.int16[b+0]=s,this.int16[b+1]=a,this.int16[b+2]=l,this.int16[b+3]=c,this.int16[b+4]=u,this.int16[b+5]=d,this.uint32[S+3]=f,this.uint16[b+8]=_,this.uint16[b+9]=y,e}}ha.prototype.bytesPerElement=20,ql("StructArrayLayout6i1ul2ui20",ha);class pa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,s,a,l,c,u)}emplace(e,s,a,l,c,u,d){const f=6*e;return this.int16[f+0]=s,this.int16[f+1]=a,this.int16[f+2]=l,this.int16[f+3]=c,this.int16[f+4]=u,this.int16[f+5]=d,e}}pa.prototype.bytesPerElement=12,ql("StructArrayLayout2i2i2i12",pa);class fa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,s,a,l,c)}emplace(e,s,a,l,c,u){const d=4*e,f=8*e;return this.float32[d+0]=s,this.float32[d+1]=a,this.float32[d+2]=l,this.int16[f+6]=c,this.int16[f+7]=u,e}}fa.prototype.bytesPerElement=16,ql("StructArrayLayout2f1f2i16",fa);class da extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,s,a,l,c,u)}emplace(e,s,a,l,c,u,d){const f=16*e,_=4*e,y=8*e;return this.uint8[f+0]=s,this.uint8[f+1]=a,this.float32[_+1]=l,this.float32[_+2]=c,this.int16[y+6]=u,this.int16[y+7]=d,e}}da.prototype.bytesPerElement=16,ql("StructArrayLayout2ub2f2i16",da);class ya extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,s,a)}emplace(e,s,a,l){const c=3*e;return this.uint16[c+0]=s,this.uint16[c+1]=a,this.uint16[c+2]=l,e}}ya.prototype.bytesPerElement=6,ql("StructArrayLayout3ui6",ya);class ma extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L){const F=this.length;return this.resize(F+1),this.emplace(F,e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L)}emplace(e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F){const B=24*e,O=12*e,V=48*e;return this.int16[B+0]=s,this.int16[B+1]=a,this.uint16[B+2]=l,this.uint16[B+3]=c,this.uint32[O+2]=u,this.uint32[O+3]=d,this.uint32[O+4]=f,this.uint16[B+10]=_,this.uint16[B+11]=y,this.uint16[B+12]=b,this.float32[O+7]=S,this.float32[O+8]=P,this.uint8[V+36]=M,this.uint8[V+37]=C,this.uint8[V+38]=D,this.uint32[O+10]=L,this.int16[B+22]=F,e}}ma.prototype.bytesPerElement=48,ql("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ma);class ga extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O,V,N,j,G,Z,q,W,J){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O,V,N,j,G,Z,q,W,J)}emplace(e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O,V,N,j,G,Z,q,W,J,Q){const se=32*e,oe=16*e;return this.int16[se+0]=s,this.int16[se+1]=a,this.int16[se+2]=l,this.int16[se+3]=c,this.int16[se+4]=u,this.int16[se+5]=d,this.int16[se+6]=f,this.int16[se+7]=_,this.uint16[se+8]=y,this.uint16[se+9]=b,this.uint16[se+10]=S,this.uint16[se+11]=P,this.uint16[se+12]=M,this.uint16[se+13]=C,this.uint16[se+14]=D,this.uint16[se+15]=L,this.uint16[se+16]=F,this.uint16[se+17]=B,this.uint16[se+18]=O,this.uint16[se+19]=V,this.uint16[se+20]=N,this.uint16[se+21]=j,this.uint16[se+22]=G,this.uint32[oe+12]=Z,this.float32[oe+13]=q,this.float32[oe+14]=W,this.uint16[se+30]=J,this.uint16[se+31]=Q,e}}ga.prototype.bytesPerElement=64,ql("StructArrayLayout8i15ui1ul2f2ui64",ga);class xa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.float32[1*e+0]=s,e}}xa.prototype.bytesPerElement=4,ql("StructArrayLayout1f4",xa);class va extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,s,a)}emplace(e,s,a,l){const c=3*e;return this.uint16[6*e+0]=s,this.float32[c+1]=a,this.float32[c+2]=l,e}}va.prototype.bytesPerElement=12,ql("StructArrayLayout1ui2f12",va);class ba extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,s,a)}emplace(e,s,a,l){const c=4*e;return this.uint32[2*e+0]=s,this.uint16[c+2]=a,this.uint16[c+3]=l,e}}ba.prototype.bytesPerElement=8,ql("StructArrayLayout1ul2ui8",ba);class wa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,s)}emplace(e,s,a){const l=2*e;return this.uint16[l+0]=s,this.uint16[l+1]=a,e}}wa.prototype.bytesPerElement=4,ql("StructArrayLayout2ui4",wa);class _a extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint16[1*e+0]=s,e}}_a.prototype.bytesPerElement=2,ql("StructArrayLayout1ui2",_a);class Sa extends Js{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,s,a,l)}emplace(e,s,a,l,c){const u=4*e;return this.float32[u+0]=s,this.float32[u+1]=a,this.float32[u+2]=l,this.float32[u+3]=c,e}}Sa.prototype.bytesPerElement=16,ql("StructArrayLayout4f16",Sa);class Aa extends Ks{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 l(this.anchorPointX,this.anchorPointY)}}Aa.prototype.size=20;class Ta extends ha{get(e){return new Aa(this,e)}}ql("CollisionBoxArray",Ta);class Ia extends Ks{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ia.prototype.size=48;class Ma extends ma{get(e){return new Ia(this,e)}}ql("PlacedSymbolArray",Ma);class Ea extends Ks{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ea.prototype.size=64;class ka extends ga{get(e){return new Ea(this,e)}}ql("SymbolInstanceArray",ka);class Da extends xa{getoffsetX(e){return this.float32[1*e+0]}}ql("GlyphOffsetArray",Da);class Fa extends ta{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}ql("SymbolLineVertexArray",Fa);class Ba extends Ks{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Ba.prototype.size=12;class Pa extends va{get(e){return new Ba(this,e)}}ql("TextAnchorOffsetArray",Pa);class za extends Ks{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]}}za.prototype.size=8;class Va extends ba{get(e){return new za(this,e)}}ql("FeatureIndexArray",Va);class Ca extends ea{}class La extends ea{}class Oa extends ea{}class Ra extends na{}class Na extends ia{}class $a extends sa{}class Ua extends aa{}class qa extends oa{}class ja extends la{}class Ga extends ua{}class Xa extends ca{}class Ya extends pa{}class Za extends da{}class Ha extends ya{}class Ka extends wa{}const yc=_c([{name:"a_pos",components:2,type:"Int16"}],4),{members:xc}=yc;class Qa{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,s,a,l){const c=this.segments[this.segments.length-1];return e>Qa.MAX_VERTEX_ARRAY_LENGTH&&Le(`Max vertices per segment is ${Qa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Qa.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!c||c.vertexLength+e>Qa.MAX_VERTEX_ARRAY_LENGTH||c.sortKey!==l?this.createNewSegment(s,a,l):c}createNewSegment(e,s,a){const l={vertexOffset:e.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==a&&(l.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(l),l}getOrCreateLatestSegment(e,s,a){return this.prepareSegment(0,e,s,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const s in e.vaos)e.vaos[s].destroy()}static simpleSegment(e,s,a,l){return new Qa([{vertexOffset:e,primitiveOffset:s,vertexLength:a,primitiveLength:l,vaos:{},sortKey:0}])}}function vc(e,s){return 256*(e=we(Math.floor(e),0,255))+we(Math.floor(s),0,255)}Qa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ql("SegmentVector",Qa);const bc=_c([{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"}]),wc=_c([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Tc,Sc,Pc,Ic={exports:{}},Mc={exports:{}},Cc={exports:{}},Ac=function(){if(Pc)return Ic.exports;Pc=1;var e=(Tc||(Tc=1,Mc.exports=function(e,s){var a,l,c,u,d,f,_,y;for(l=e.length-(a=3&e.length),c=s,d=3432918353,f=461845907,y=0;y>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,a){case 3:_^=(255&e.charCodeAt(y+2))<<16;case 2:_^=(255&e.charCodeAt(y+1))<<8;case 1:c^=_=(65535&(_=(_=(65535&(_^=255&e.charCodeAt(y)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return c^=e.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0}),Mc.exports),s=(Sc||(Sc=1,Cc.exports=function(e,s){for(var a,l=e.length,c=s^l,u=0;l>=4;)a=1540483477*(65535&(a=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24))+((1540483477*(a>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),l-=4,++u;switch(l){case 3:c^=(255&e.charCodeAt(u+2))<<16;case 2:c^=(255&e.charCodeAt(u+1))<<8;case 1:c=1540483477*(65535&(c^=255&e.charCodeAt(u)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0}),Cc.exports);return Ic.exports=e,Ic.exports.murmur3=e,Ic.exports.murmur2=s,Ic.exports}(),Dc=c(Ac);class ho{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,s,a,l){this.ids.push(zc(e)),this.positions.push(s,a,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=zc(e);let a=0,l=this.ids.length-1;for(;a>1;this.ids[e]>=s?l=e:a=e+1}const c=[];for(;this.ids[a]===s;)c.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return c}static serialize(e,s){const a=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Rc(a,l,0,a.length-1),s&&s.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(e){const s=new ho;return s.ids=e.ids,s.positions=e.positions,s.indexed=!0,s}}function zc(e){const s=+e;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Dc(String(e))}function Rc(e,s,a,l){for(;a>1];let u=a-1,d=l+1;for(;;){do{u++}while(e[u]c);if(u>=d)break;Lc(e,u,d),Lc(s,3*u,3*d),Lc(s,3*u+1,3*d+1),Lc(s,3*u+2,3*d+2)}d-a`u_${e}`)),this.type=a}setUniform(e,s,a){e.set(a.constantOr(this.value))}getBinding(e,s,a){return"color"===this.type?new vo(e,s):new go(e,s)}}class So{constructor(e,s){this.uniformNames=s.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,s){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,s.y,s.height,s.width]}setUniform(e,s,a,l){let c=null;"u_pattern_to"===l?c=this.patternTo:"u_pattern_from"===l?c=this.patternFrom:"u_dasharray_to"===l?c=this.dashTo:"u_dasharray_from"===l?c=this.dashFrom:"u_pixel_ratio_to"===l?c=this.pixelRatioTo:"u_pixel_ratio_from"===l&&(c=this.pixelRatioFrom),null!==c&&e.set(c)}getBinding(e,s,a){return"u_pattern"===a.substr(0,9)||"u_dasharray_"===a.substr(0,12)?new xo(e,s):new go(e,s)}}class Ao{constructor(e,s,a,l){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=s.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===a?2:1,offset:0}))),this.paintVertexArray=new l}populatePaintArray(e,s,a){const l=this.paintVertexArray.length,c=this.expression.evaluate(new Es(0,a),s,{},a.canonical,[],a.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(l,e,c)}updatePaintArray(e,s,a,l,c){const u=this.expression.evaluate(new Es(0,c),a,l);this._setPaintValue(e,s,u)}_setPaintValue(e,s,a){if("color"===this.type){const l=Vc(a);for(let a=e;a`u_${e}_t`)),this.type=a,this.useIntegerZoom=l,this.zoom=c,this.maxValue=0,this.paintVertexAttributes=s.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===a?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,s,a){const l=this.expression.evaluate(new Es(this.zoom,a),s,{},a.canonical,[],a.formattedSection),c=this.expression.evaluate(new Es(this.zoom+1,a),s,{},a.canonical,[],a.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,l,c)}updatePaintArray(e,s,a,l,c){const u=this.expression.evaluate(new Es(this.zoom,c),a,l),d=this.expression.evaluate(new Es(this.zoom+1,c),a,l);this._setPaintValue(e,s,u,d)}_setPaintValue(e,s,a,l){if("color"===this.type){const c=Vc(a),u=Vc(l);for(let a=e;a`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof Ao||a instanceof To)for(let s=0;s!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new ko(l,s,a);this.needsUpload=!1,this._featureMap=new ho,this._bufferOffset=0}populatePaintArrays(e,s,a,l){for(const a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(e,s,l);void 0!==s.id&&this._featureMap.add(s.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,s,a,l){for(const c of a)this.needsUpload=this.programConfigurations[c.id].updatePaintArrays(e,this._featureMap,s,c,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Nc(e,s){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-dasharray":["dasharray_to","dasharray_from"],"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"]}[e]||[e.replace(`${s}-`,"").replace(/-/g,"_")]}function jc(e,s,a){const l={color:{source:sa,composite:Sa},number:{source:xa,composite:sa}},c=function(e){return{"line-pattern":{source:Ua,composite:Ua},"fill-pattern":{source:Ua,composite:Ua},"fill-extrusion-pattern":{source:Ua,composite:Ua},"line-dasharray":{source:qa,composite:qa}}[e]}(e);return c&&c[a]||l[s][a]}ql("ConstantBinder",_o),ql("CrossFadedConstantBinder",So),ql("SourceExpressionBinder",Ao),ql("CrossFadedPatternBinder",Mo),ql("CrossFadedDasharrayBinder",Eo),ql("CompositeExpressionBinder",To),ql("ProgramConfiguration",ko,{omit:["_buffers"]}),ql("ProgramConfigurationSet",Do);const Uc=Math.pow(2,14)-1,Gc=-Uc-1;function Zc(e){const s=oe/e.extent,a=e.loadGeometry();for(let e=0;ea.x+1||ua.y+1)&&Le("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function qc(e,s){return{type:e.type,id:e.id,properties:e.properties,geometry:s?Zc(e):[]}}const $c=-32768;function Wc(e,s,a,l,c){e.emplaceBack($c+8*s+l,$c+8*a+c)}class Ro{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new La,this.indexArray=new Ha,this.segments=new Qa,this.programConfigurations=new Do(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,s,a){const l=this.layers[0],c=[];let u=null,d=!1,f="heatmap"===l.type;if("circle"===l.type){const e=l;u=e.layout.get("circle-sort-key"),d=!u.isConstant(),f=f||"map"===e.paint.get("circle-pitch-alignment")}const _=f?s.subdivisionGranularity.circle:1;for(const{feature:s,id:l,index:f,sourceLayerIndex:_}of e){const e=this.layers[0]._featureFilter.needGeometry,y=qc(s,e);if(!this.layers[0]._featureFilter.filter(new Es(this.zoom),y,a))continue;const b=d?u.evaluate(y,{},a):void 0,S={id:l,properties:s.properties,type:s.type,sourceLayerIndex:_,index:f,geometry:e?y.geometry:Zc(s),patterns:{},sortKey:b};c.push(S)}d&&c.sort(((e,s)=>e.sortKey-s.sortKey));for(const l of c){const{geometry:c,index:u,sourceLayerIndex:d}=l,f=e[u].feature;this.addFeature(l,c,u,a,_),s.featureIndex.insert(f,c,u,d,this.index)}}update(e,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,s,a,l,c=1){let u;switch(c){case 1:u=[0,7];break;case 3:u=[0,2,5,7];break;case 5:u=[0,1,3,4,6,7];break;case 7:u=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${c}; valid values are 1, 3, 5, 7.`)}const d=u.length;for(const a of s)for(const s of a){const a=s.x,l=s.y;if(a<0||a>=oe||l<0||l>=oe)continue;const c=this.segments.prepareSegment(d*d,this.layoutVertexArray,this.indexArray,e.sortKey),f=c.vertexLength;for(let e=0;e1){if(Jc(e,s))return!0;for(let l=0;l1?a:a.sub(s)._mult(c)._add(s))}function ih(e,s){let a,l,c,u=!1;for(let d=0;ds.y!=c.y>s.y&&s.x<(c.x-l.x)*(s.y-l.y)/(c.y-l.y)+l.x&&(u=!u)}return u}function rh(e,s){let a=!1;for(let l=0,c=e.length-1;ls.y!=d.y>s.y&&s.x<(d.x-u.x)*(s.y-u.y)/(d.y-u.y)+u.x&&(a=!a)}return a}function nh(e,s,a){const l=a[0],c=a[2];if(e.xc.x&&s.x>c.x||e.yc.y&&s.y>c.y)return!1;const u=Fe(e,s,a[0]);return u!==Fe(e,s,a[1])||u!==Fe(e,s,a[2])||u!==Fe(e,s,a[3])}function sh(e,s,a){const l=s.paint.get(e).value;return"constant"===l.kind?l.value:a.programConfigurations.get(s.id).getMaxValue(e)}function ah(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ch(e,s,a,c,u){if(!s[0]&&!s[1])return e;const d=l.convert(s)._mult(u);"viewport"===a&&d._rotate(-c);const f=[];for(let s=0;swh(e,s,a,l)))}(_,c,d,f),M=y),bh({queryGeometry:P,size:M,transform:c,unwrappedTileID:d,getElevation:f,pitchAlignment:S,pitchScale:b},l)}}class cl extends Ro{}let Mh;ql("HeatmapBucket",cl,{omit:["layers"]});var Eh={get paint(){return Mh=Mh||new qs({"heatmap-radius":new Rs(pt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Rs(pt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Os(pt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Us(pt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Os(pt.paint_heatmap["heatmap-opacity"])})}};function Ch(e,{width:s,height:a},l,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==s*a*l)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${s*a*l}`)}else c=new Uint8Array(s*a*l);return e.width=s,e.height=a,e.data=c,e}function Ah(e,{width:s,height:a},l){if(s===e.width&&a===e.height)return;const c=Ch({},{width:s,height:a},l);Dh(e,c,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,s),height:Math.min(e.height,a)},l),e.width=s,e.height=a,e.data=c.data}function Dh(e,s,a,l,c,u){if(0===c.width||0===c.height)return s;if(c.width>e.width||c.height>e.height||a.x>e.width-c.width||a.y>e.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>s.width||c.height>s.height||l.x>s.width-c.width||l.y>s.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const d=e.data,f=s.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{s[e.evaluationKey]=d;const f=e.expression.evaluate(s);c.setPixel(l/4/a,u/4,f)};if(e.clips)for(let s=0,c=0;sthis.max&&(this.max=a),a=this.dim+1||s<-1||s>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(s+1)*this.stride+(e+1)}unpack(e,s,a){return e*this.redFactor+s*this.greenFactor+a*this.blueFactor-this.baseShift}pack(e){return Qh(e,this.getUnpackVector())}getPixels(){return new gl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,s,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=s*this.dim,c=s*this.dim+this.dim,u=a*this.dim,d=a*this.dim+this.dim;switch(s){case-1:l=c-1;break;case 1:c=l+1}switch(a){case-1:u=d-1;break;case 1:d=u+1}const f=-s*this.dim,_=-a*this.dim;for(let s=u;s0)for(let c=s;c=s;c-=l)u=Ru(c/l|0,e[c],e[c+1],u);return u&&Mu(u,u.next)&&(Lu(u),u=u.next),u}function ou(e,s){if(!e)return e;s||(s=e);let a,l=e;do{if(a=!1,l.steiner||!Mu(l,l.next)&&0!==Pu(l.prev,l,l.next))l=l.next;else{if(Lu(l),l=s=l.prev,l===l.next)break;a=!0}}while(a||l!==s);return s}function lu(e,s,a,l,c,u,d){if(!e)return;!d&&u&&function(e,s,a,l){let c=e;do{0===c.z&&(c.z=gu(c.x,c.y,s,a,l)),c.prevZ=c.prev,c.nextZ=c.next,c=c.next}while(c!==e);c.prevZ.nextZ=null,c.prevZ=null,function(e){let s,a=1;do{let l,c=e;e=null;let u=null;for(s=0;c;){s++;let d=c,f=0;for(let e=0;e0||_>0&&d;)0!==f&&(0===_||!d||c.z<=d.z)?(l=c,c=c.nextZ,f--):(l=d,d=d.nextZ,_--),u?u.nextZ=l:e=l,l.prevZ=u,u=l;c=d}u.nextZ=null,a*=2}while(s>1)}(c)}(e,l,c,u);let f=e;for(;e.prev!==e.next;){const _=e.prev,y=e.next;if(u?hu(e,l,c,u):cu(e))s.push(_.i,e.i,y.i),Lu(e),e=y.next,f=y.next;else if((e=y)===f){d?1===d?lu(e=du(ou(e),s),s,a,l,c,u,2):2===d&&pu(e,s,a,l,c,u):lu(ou(e),s,a,l,c,u,1);break}}}function cu(e){const s=e.prev,a=e,l=e.next;if(Pu(s,a,l)>=0)return!1;const c=s.x,u=a.x,d=l.x,f=s.y,_=a.y,y=l.y,b=Math.min(c,u,d),S=Math.min(f,_,y),P=Math.max(c,u,d),M=Math.max(f,_,y);let C=l.next;for(;C!==s;){if(C.x>=b&&C.x<=P&&C.y>=S&&C.y<=M&&wu(c,f,u,_,d,y,C.x,C.y)&&Pu(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function hu(e,s,a,l){const c=e.prev,u=e,d=e.next;if(Pu(c,u,d)>=0)return!1;const f=c.x,_=u.x,y=d.x,b=c.y,S=u.y,P=d.y,M=Math.min(f,_,y),C=Math.min(b,S,P),D=Math.max(f,_,y),L=Math.max(b,S,P),F=gu(M,C,s,a,l),B=gu(D,L,s,a,l);let O=e.prevZ,V=e.nextZ;for(;O&&O.z>=F&&V&&V.z<=B;){if(O.x>=M&&O.x<=D&&O.y>=C&&O.y<=L&&O!==c&&O!==d&&wu(f,b,_,S,y,P,O.x,O.y)&&Pu(O.prev,O,O.next)>=0)return!1;if(O=O.prevZ,V.x>=M&&V.x<=D&&V.y>=C&&V.y<=L&&V!==c&&V!==d&&wu(f,b,_,S,y,P,V.x,V.y)&&Pu(V.prev,V,V.next)>=0)return!1;V=V.nextZ}for(;O&&O.z>=F;){if(O.x>=M&&O.x<=D&&O.y>=C&&O.y<=L&&O!==c&&O!==d&&wu(f,b,_,S,y,P,O.x,O.y)&&Pu(O.prev,O,O.next)>=0)return!1;O=O.prevZ}for(;V&&V.z<=B;){if(V.x>=M&&V.x<=D&&V.y>=C&&V.y<=L&&V!==c&&V!==d&&wu(f,b,_,S,y,P,V.x,V.y)&&Pu(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function du(e,s){let a=e;do{const l=a.prev,c=a.next.next;!Mu(l,c)&&Cu(l,a,a.next,c)&&zu(l,c)&&zu(c,l)&&(s.push(l.i,a.i,c.i),Lu(a),Lu(a.next),a=e=c),a=a.next}while(a!==e);return ou(a)}function pu(e,s,a,l,c,u){let d=e;do{let e=d.next.next;for(;e!==d.prev;){if(d.i!==e.i&&Tu(d,e)){let f=ku(d,e);return d=ou(d,d.next),f=ou(f,f.next),lu(d,s,a,l,c,u,0),void lu(f,s,a,l,c,u,0)}e=e.next}d=d.next}while(d!==e)}function fu(e,s){let a=e.x-s.x;return 0===a&&(a=e.y-s.y,0===a)&&(a=(e.next.y-e.y)/(e.next.x-e.x)-(s.next.y-s.y)/(s.next.x-s.x)),a}function mu(e,s){const a=function(e,s){let a=s;const l=e.x,c=e.y;let u,d=-1/0;if(Mu(e,a))return a;do{if(Mu(e,a.next))return a.next;if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y){const e=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(e<=l&&e>d&&(d=e,u=a.x=a.x&&a.x>=_&&l!==a.x&&bu(cu.x||a.x===u.x&&_u(u,a)))&&(u=a,b=s)}a=a.next}while(a!==f);return u}(e,s);if(!a)return s;const l=ku(a,e);return ou(l,l.next),ou(a,a.next)}function _u(e,s){return Pu(e.prev,e,s.prev)<0&&Pu(s.next,e,e.next)<0}function gu(e,s,a,l,c){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-l)*c|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function xu(e){let s=e,a=e;do{(s.x=(e-d)*(u-f)&&(e-d)*(l-f)>=(a-d)*(s-f)&&(a-d)*(u-f)>=(c-d)*(l-f)}function wu(e,s,a,l,c,u,d,f){return!(e===d&&s===f)&&bu(e,s,a,l,c,u,d,f)}function Tu(e,s){return e.next.i!==s.i&&e.prev.i!==s.i&&!function(e,s){let a=e;do{if(a.i!==e.i&&a.next.i!==e.i&&a.i!==s.i&&a.next.i!==s.i&&Cu(a,a.next,e,s))return!0;a=a.next}while(a!==e);return!1}(e,s)&&(zu(e,s)&&zu(s,e)&&function(e,s){let a=e,l=!1;const c=(e.x+s.x)/2,u=(e.y+s.y)/2;do{a.y>u!=a.next.y>u&&a.next.y!==a.y&&c<(a.next.x-a.x)*(u-a.y)/(a.next.y-a.y)+a.x&&(l=!l),a=a.next}while(a!==e);return l}(e,s)&&(Pu(e.prev,e,s.prev)||Pu(e,s.prev,s))||Mu(e,s)&&Pu(e.prev,e,e.next)>0&&Pu(s.prev,s,s.next)>0)}function Pu(e,s,a){return(s.y-e.y)*(a.x-s.x)-(s.x-e.x)*(a.y-s.y)}function Mu(e,s){return e.x===s.x&&e.y===s.y}function Cu(e,s,a,l){const c=Du(Pu(e,s,a)),u=Du(Pu(e,s,l)),d=Du(Pu(a,l,e)),f=Du(Pu(a,l,s));return c!==u&&d!==f||!(0!==c||!Au(e,a,s))||!(0!==u||!Au(e,l,s))||!(0!==d||!Au(a,e,l))||!(0!==f||!Au(a,s,l))}function Au(e,s,a){return s.x<=Math.max(e.x,a.x)&&s.x>=Math.min(e.x,a.x)&&s.y<=Math.max(e.y,a.y)&&s.y>=Math.min(e.y,a.y)}function Du(e){return e>0?1:e<0?-1:0}function zu(e,s){return Pu(e.prev,e,e.next)<0?Pu(e,s,e.next)>=0&&Pu(e,e.prev,s)>=0:Pu(e,s,e.prev)<0||Pu(e,e.next,s)<0}function ku(e,s){const a=Fu(e.i,e.x,e.y),l=Fu(s.i,s.x,s.y),c=e.next,u=s.prev;return e.next=s,s.prev=e,a.next=c,c.prev=a,l.next=a,a.prev=l,u.next=l,l.prev=u,l}function Ru(e,s,a,l){const c=Fu(e,s,a);return l?(c.next=l.next,c.prev=l,l.next.prev=c,l.next=c):(c.prev=c,c.next=c),c}function Lu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Fu(e,s,a){return{i:e,x:s,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class su{constructor(e,s){if(s>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=s}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<32767||s>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(e),l=0|Math.round(s),c=this._getKey(a,l);if(this._vertexDictionary.has(c))return this._vertexDictionary.get(c);const u=this._vertexBuffer.length/2;return this._vertexDictionary.set(c,u),this._vertexBuffer.push(a,l),u}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,s){const a=[];for(let l=0;l0?(a.push(c),a.push(d),a.push(u)):(a.push(c),a.push(u),a.push(d))}return a}(this._vertexBuffer,e);const s=[],a=e.length;for(let l=0;l=1||O<=0)||D&&(fc)){y>=l&&y<=c&&u.push(a[(e+1)%3]);continue}!D&&B>0&&u.push(this._vertexToIndex(d+P*B,f+M*B));const V=d+P*Math.max(B,0),N=d+P*Math.min(O,1);C||this._generateIntraEdgeVertices(u,d,f,_,y,V,N),!D&&O<1&&u.push(this._vertexToIndex(d+P*O,f+M*O)),(D||y>=l&&y<=c)&&u.push(a[(e+1)%3]),!D&&(y<=l||y>=c)&&this._generateInterEdgeVertices(u,d,f,_,y,b,S,N,l,c)}return u}_generateIntraEdgeVertices(e,s,a,l,c,u,d){const f=l-s,_=c-a,y=0===_,b=y?Math.min(s,l):Math.min(u,d),S=y?Math.max(s,l):Math.max(u,d),P=Math.floor(b/this._granularityCellSize)+1,M=Math.ceil(S/this._granularityCellSize)-1;if(y?s=P;l--){const c=l*this._granularityCellSize;e.push(this._vertexToIndex(c,a+_*(c-s)/f))}}_generateInterEdgeVertices(e,s,a,l,c,u,d,f,_,y){const b=c-a,S=u-l,P=d-c,M=(_-c)/P,C=(y-c)/P,D=Math.min(M,C),L=Math.max(M,C),F=l+S*D;let B=Math.floor(Math.min(F,f)/this._granularityCellSize)+1,O=Math.ceil(Math.max(F,f)/this._granularityCellSize)-1,V=f=1||L<=0){const e=a-d,l=u+(s-u)*Math.min((_-d)/e,(y-d)/e);B=Math.floor(Math.min(l,f)/this._granularityCellSize)+1,O=Math.ceil(Math.max(l,f)/this._granularityCellSize)-1,V=f0?y:_;if(V)for(let s=B;s<=O;s++)e.push(this._vertexToIndex(s*this._granularityCellSize,j));else for(let s=O;s>=B;s--)e.push(this._vertexToIndex(s*this._granularityCellSize,j))}_generateOutline(e){const s=[];for(const a of e){const e=Uu(a,this._granularity,!0),l=this._pointArrayToIndices(e),c=[];for(let e=1;ec!=(u===Vu)?(e.push(s),e.push(a),e.push(this._vertexToIndex(l,u)),e.push(a),e.push(this._vertexToIndex(c,u)),e.push(this._vertexToIndex(l,u))):(e.push(a),e.push(s),e.push(this._vertexToIndex(l,u)),e.push(this._vertexToIndex(c,u)),e.push(a),e.push(this._vertexToIndex(l,u)))}_fillPoles(e,s,a){const l=this._vertexBuffer,c=oe,u=e.length;for(let d=2;d80*a){f=e[0],_=e[1];let s=f,l=_;for(let u=a;us&&(s=a),c>l&&(l=c)}y=Math.max(s-f,l-_),y=0!==y?32767/y:0}return lu(u,d,a,f,_,y,0),d}(a,l),s=this._convertIndices(a,e);c=this._subdivideTrianglesScanline(s)}catch(e){console.error(e)}let u=[];return s&&(u=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(c),{verticesFlattened:this._vertexBuffer,indicesTriangles:c,indicesLineList:u}}_convertIndices(e,s){const a=[];for(let l=0;l0?(Math.floor(B/f)+1)*f:(Math.ceil(B/f)-1)*f,s=D>0?(Math.floor(O/f)+1)*f:(Math.ceil(O/f)-1)*f,a=Math.abs(B-e),c=Math.abs(O-s),u=Math.abs(B-b),d=Math.abs(O-S),y=P?a/L:Number.POSITIVE_INFINITY,V=M?c/F:Number.POSITIVE_INFINITY;if((u<=a||!P)&&(d<=c||!M))break;if(y=0?d-1:u-1,c=(f+1)%u,_=e[2*s[l]],y=e[2*s[c]],b=e[2*s[d]],S=e[2*s[d]+1],P=e[2*s[f]+1];let M=!1;if(_y)M=!1;else{const a=P-S,u=-(e[2*s[f]]-b),d=S((y-b)*a+(e[2*s[c]+1]-S)*u)*d&&(M=!0)}if(M){const e=s[l],c=s[d],_=s[f];e!==c&&e!==_&&c!==_&&a.push(_,c,e),d--,d<0&&(d=u-1)}else{const e=s[c],l=s[d],_=s[f];e!==l&&e!==_&&l!==_&&a.push(_,l,e),f++,f>=u&&(f=0)}if(l===c)break}}function Zu(e,s,a,l,c,u,d,f,_){const y=c.length/2,b=d&&f&&_;if(yQa.MAX_VERTEX_ARRAY_LENGTH&&(y=e.createNewSegment(s,a),_=f.count,D=!0,L=!0,F=!0,b=0);const B=qu(d,l,u,f,P,D,y),O=qu(d,l,u,f,M,L,y),V=qu(d,l,u,f,C,F,y);a.emplaceBack(b+B-_,b+O-_,b+V-_),y.primitiveLength++}}(s,a,l,c,u,e),b&&function(e,s,a,l,c,u){const d=[];for(let e=0;eQa.MAX_VERTEX_ARRAY_LENGTH&&(y=e.createNewSegment(s,a),_=f.count,C=!0,D=!0,b=0);const L=qu(d,l,u,f,c,C,y),F=qu(d,l,u,f,S,D,y);a.emplaceBack(b+L-_,b+F-_),y.primitiveLength++}}}(d,a,f,c,_,e),s.forceNewSegmentOnNextPrepare(),null==d||d.forceNewSegmentOnNextPrepare()}function qu(e,s,a,l,c,u,d){if(u){const u=l.count;return a(s[2*c],s[2*c+1]),e[c]=l.count,l.count++,d.vertexLength++,u}return e[c]}class yu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Oa,this.indexArray=new Ha,this.indexArray2=new Ka,this.programConfigurations=new Do(e.layers,e.zoom),this.segments=new Qa,this.segments2=new Qa,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,s,a){this.hasDependencies=iu("fill",this.layers,s);const l=this.layers[0].layout.get("fill-sort-key"),c=!l.isConstant(),u=[];for(const{feature:d,id:f,index:_,sourceLayerIndex:y}of e){const e=this.layers[0]._featureFilter.needGeometry,b=qc(d,e);if(!this.layers[0]._featureFilter.filter(new Es(this.zoom),b,a))continue;const S=c?l.evaluate(b,{},a,s.availableImages):void 0,P={id:f,properties:d.properties,type:d.type,sourceLayerIndex:y,index:_,geometry:e?b.geometry:Zc(d),patterns:{},sortKey:S};u.push(P)}c&&u.sort(((e,s)=>e.sortKey-s.sortKey));for(const l of u){const{geometry:c,index:u,sourceLayerIndex:d}=l;if(this.hasDependencies){const e=ru("fill",this.layers,l,{zoom:this.zoom},s);this.patternFeatures.push(e)}else this.addFeature(l,c,u,a,{},s.subdivisionGranularity);s.featureIndex.insert(e[u].feature,c,u,d,this.index)}}update(e,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,{imagePositions:a})}addFeatures(e,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,s,a,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,s,a,l,c,u){for(const e of Pn(s,500)){const s=ju(e,l,u.fill.getGranularityForZoomLevel(l.z)),a=this.layoutVertexArray;Zu(((e,s)=>{a.emplaceBack(e,s)}),this.segments,this.layoutVertexArray,this.indexArray,s.verticesFlattened,s.indicesTriangles,this.segments2,this.indexArray2,s.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:c,canonical:l})}}let $u,Wu;ql("FillBucket",yu,{omit:["layers","patternFeatures"]});var Hu={get paint(){return Wu=Wu||new qs({"fill-antialias":new Os(pt.paint_fill["fill-antialias"]),"fill-opacity":new Rs(pt.paint_fill["fill-opacity"]),"fill-color":new Rs(pt.paint_fill["fill-color"]),"fill-outline-color":new Rs(pt.paint_fill["fill-outline-color"]),"fill-translate":new Os(pt.paint_fill["fill-translate"]),"fill-translate-anchor":new Os(pt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ns(pt.paint_fill["fill-pattern"])})},get layout(){return $u=$u||new qs({"fill-sort-key":new Rs(pt.layout_fill["fill-sort-key"])})}};class vu extends Gs{constructor(e,s){super(e,Hu,s)}recalculate(e,s){super.recalculate(e,s);const a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&&void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new yu(e)}queryRadius(){return ah(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:s,transform:a,pixelsToTileUnits:l}){return Yc(ch(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,l),s)}isTileClipped(){return!0}}const Xu=_c([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ku=_c([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ed}=Xu;class Su{constructor(e,s,a,l,c){this.properties={},this.extent=a,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=l,this._values=c,e.readFields(td,this,s)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const s=e.readVarint()+e.pos,a=[];let c,u=1,d=0,f=0,_=0;for(;e.pos>3}if(d--,1===u||2===u)f+=e.readSVarint(),_+=e.readSVarint(),1===u&&(c&&a.push(c),c=[]),c&&c.push(new l(f,_));else{if(7!==u)throw new Error(`unknown command ${u}`);c&&c.push(c[0].clone())}}return c&&a.push(c),a}bbox(){const e=this._pbf;e.pos=this._geometry;const s=e.readVarint()+e.pos;let a=1,l=0,c=0,u=0,d=1/0,f=-1/0,_=1/0,y=-1/0;for(;e.pos>3}if(l--,1===a||2===a)c+=e.readSVarint(),u+=e.readSVarint(),cf&&(f=c),u<_&&(_=u),u>y&&(y=u);else if(7!==a)throw new Error(`unknown command ${a}`)}return[d,_,f,y]}toGeoJSON(e,s,a){const l=this.extent*Math.pow(2,a),c=this.extent*e,u=this.extent*s,d=this.loadGeometry();function f(e){return[360*(e.x+c)/l-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+u)/l)*Math.PI))-90]}function _(e){return e.map(f)}let y;if(1===this.type){const e=[];for(const s of d)e.push(s[0]);const s=_(e);y=1===e.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s}}else if(2===this.type){const e=d.map(_);y=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const s=e.length;if(s<=1)return[e];const a=[];let l,c;for(let u=0;u=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const s=this._pbf.readVarint()+this._pbf.pos;return new Su(this._pbf,s,this.extent,this._keys,this._values)}}function rd(e,s,a){15===e?s.version=a.readVarint():1===e?s.name=a.readString():5===e?s.extent=a.readVarint():2===e?s._features.push(a.pos):3===e?s._keys.push(a.readString()):4===e&&s._values.push(function(e){let s=null;const a=e.readVarint()+e.pos;for(;e.pos>3;s=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}if(null==s)throw new Error("unknown feature value");return s}(a))}class Eu{constructor(e,s){this.layers=e.readFields(sd,{},s)}}function sd(e,s,a){if(3===e){const e=new Iu(a,a.readVarint()+a.pos);e.length&&(s[e.name]=e)}}const od=Math.pow(2,13);function ad(e,s,a,l,c,u,d,f){e.emplaceBack(s,a,2*Math.floor(l*od)+d,c*od*2,u*od*2,Math.round(f))}class Bu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ra,this.centroidVertexArray=new Ca,this.indexArray=new Ha,this.programConfigurations=new Do(e.layers,e.zoom),this.segments=new Qa,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,s,a){this.features=[],this.hasDependencies=iu("fill-extrusion",this.layers,s);for(const{feature:l,id:c,index:u,sourceLayerIndex:d}of e){const e=this.layers[0]._featureFilter.needGeometry,f=qc(l,e);if(!this.layers[0]._featureFilter.filter(new Es(this.zoom),f,a))continue;const _={id:c,sourceLayerIndex:d,index:u,geometry:e?f.geometry:Zc(l),properties:l.properties,type:l.type,patterns:{}};this.hasDependencies?this.features.push(ru("fill-extrusion",this.layers,_,{zoom:this.zoom},s)):this.addFeature(_,_.geometry,u,a,{},s.subdivisionGranularity),s.featureIndex.insert(l,_.geometry,u,d,this.index,!0)}}addFeatures(e,s,a){for(const l of this.features){const{geometry:c}=l;this.addFeature(l,c,l.index,s,a,e.subdivisionGranularity)}}update(e,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ed),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ku.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,s,a,l,c,u){for(const a of Pn(s,500)){const s={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(s,l,e,a,u);const d=this.layoutVertexArray.length-c,f=Math.floor(s.x/s.sampleCount),_=Math.floor(s.y/s.sampleCount);for(let e=0;e{ad(y,e,s,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,_.verticesFlattened,_.indicesTriangles)}_generateSideFaces(e,s){let a=0;for(let l=1;lQa.MAX_VERTEX_ARRAY_LENGTH&&(s.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const d=c.sub(u)._perp()._unit(),f=u.dist(c);a+f>32768&&(a=0),ad(this.layoutVertexArray,c.x,c.y,d.x,d.y,0,0,a),ad(this.layoutVertexArray,c.x,c.y,d.x,d.y,0,1,a),a+=f,ad(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,0,a),ad(this.layoutVertexArray,u.x,u.y,d.x,d.y,0,1,a);const _=s.segment.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),s.segment.vertexLength+=4,s.segment.primitiveLength+=2}}}function ld(e,s){for(let a=0;aoe)||e.y===s.y&&(e.y<0||e.y>oe)}function hd(e){return e.every((e=>e.x<0))||e.every((e=>e.x>oe))||e.every((e=>e.y<0))||e.every((e=>e.y>oe))}let ud;ql("FillExtrusionBucket",Bu,{omit:["layers","features"]});var dd={get paint(){return ud=ud||new qs({"fill-extrusion-opacity":new Os(pt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Rs(pt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Os(pt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Os(pt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ns(pt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Rs(pt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Rs(pt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Os(pt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ou extends Gs{constructor(e,s){super(e,dd,s)}createBucket(e){return new Bu(e)}queryRadius(){return ah(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:s,featureState:a,geometry:c,transform:u,pixelsToTileUnits:d,pixelPosMatrix:f}){const _=ch(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-u.bearingInRadians,d),y=this.paint.get("fill-extrusion-height").evaluate(s,a),b=this.paint.get("fill-extrusion-base").evaluate(s,a),S=function(e,s){const a=[];for(const c of e){const e=[c.x,c.y,0,1];q(e,e,s),a.push(new l(e[0]/e[3],e[1]/e[3]))}return a}(_,f),P=function(e,s,a,c){const u=[],d=[],f=c[8]*s,_=c[9]*s,y=c[10]*s,b=c[11]*s,S=c[8]*a,P=c[9]*a,M=c[10]*a,C=c[11]*a;for(const s of e){const e=[],a=[];for(const u of s){const s=u.x,d=u.y,D=c[0]*s+c[4]*d+c[12],L=c[1]*s+c[5]*d+c[13],F=c[2]*s+c[6]*d+c[14],B=c[3]*s+c[7]*d+c[15],O=F+y,V=B+b,N=D+S,j=L+P,G=F+M,Z=B+C,q=new l((D+f)/V,(L+_)/V);q.z=O/V,e.push(q);const W=new l(N/Z,j/Z);W.z=G/Z,a.push(W)}u.push(e),d.push(a)}return[u,d]}(c,b,y,f);return function(e,s,a){let l=1/0;Yc(a,s)&&(l=fd(a,s[0]));for(let c=0;ce.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Na,this.layoutVertexArray2=new $a,this.indexArray=new Ha,this.programConfigurations=new Do(e.layers,e.zoom),this.segments=new Qa,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,s,a){this.hasDependencies=iu("line",this.layers,s)||this.hasLineDasharray(this.layers);const l=this.layers[0].layout.get("line-sort-key"),c=!l.isConstant(),u=[];for(const{feature:s,id:d,index:f,sourceLayerIndex:_}of e){const e=this.layers[0]._featureFilter.needGeometry,y=qc(s,e);if(!this.layers[0]._featureFilter.filter(new Es(this.zoom),y,a))continue;const b=c?l.evaluate(y,{},a):void 0,S={id:d,properties:s.properties,type:s.type,sourceLayerIndex:_,index:f,geometry:e?y.geometry:Zc(s),patterns:{},dashes:{},sortKey:b};u.push(S)}c&&u.sort(((e,s)=>e.sortKey-s.sortKey));for(const l of u){const{geometry:c,index:u,sourceLayerIndex:d}=l;this.hasDependencies?(iu("line",this.layers,s)?ru("line",this.layers,l,{zoom:this.zoom},s):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,s),this.patternFeatures.push(l)):this.addFeature(l,c,u,a,{},{},s.subdivisionGranularity),s.featureIndex.insert(e[u].feature,c,u,d,this.index)}}update(e,s,a,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,{imagePositions:a,dashPositions:l})}addFeatures(e,s,a,l){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,s,a,l,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,yd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_d),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,s,a,l,c,u,d){const f=this.layers[0].layout,_=f.get("line-join").evaluate(e,{}),y=f.get("line-cap"),b=f.get("line-miter-limit"),S=f.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const a of s)this.addLine(a,e,_,y,b,S,l,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:c,dashPositions:u,canonical:l})}addLine(e,s,a,l,c,u,d,f){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Uu(e,d?f.line.getGranularityForZoomLevel(d.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let s=0;s=2&&e[y-1].equals(e[y-2]);)y--;let b=0;for(;b0;if(N&&s>b){const e=M.dist(C);if(e>2*S){const s=M.sub(M.sub(C)._mult(S/e)._round());this.updateDistance(C,s),this.addCurrentVertex(s,L,0,0,P),C=s}}const G=C&&D;let Z=G?a:_?"butt":l;if(G&&"round"===Z&&(Oc&&(Z="bevel"),"bevel"===Z&&(O>2&&(Z="flipbevel"),O100)d=F.mult(-1);else{const e=O*L.add(F).mag()/L.sub(F).mag();d._perp()._mult(e*(j?-1:1))}this.addCurrentVertex(M,d,0,0,P),this.addCurrentVertex(M,d.mult(-1),0,0,P)}else if("bevel"===Z||"fakeround"===Z){const e=-Math.sqrt(O*O-1),s=j?e:0,a=j?0:e;if(C&&this.addCurrentVertex(M,L,s,a,P),"fakeround"===Z){const e=Math.round(180*V/Math.PI/20);for(let s=1;s2*S){const s=M.add(D.sub(M)._mult(S/e)._round());this.updateDistance(M,s),this.addCurrentVertex(s,F,0,0,P),M=s}}}}addCurrentVertex(e,s,a,l,c,u=!1){const d=s.y*l-s.x,f=-s.y-s.x*l;this.addHalfVertex(e,s.x+s.y*a,s.y-s.x*a,u,!1,a,c),this.addHalfVertex(e,d,f,u,!0,-l,c),this.distance>vd/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,s,a,l,c,u))}addHalfVertex({x:e,y:s},a,l,c,u,d,f){const _=.5*(this.lineClips?this.scaledDistance*(vd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(c?1:0),(s<<1)+(u?1:0),Math.round(63*a)+128,Math.round(63*l)+128,1+(0===d?0:d<0?-1:1)|(63&_)<<2,_>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const y=f.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,y,this.e2),f.primitiveLength++),u?this.e2=y:this.e1=y}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,s){this.distance+=e.dist(s),this.updateScaledDistance()}hasLineDasharray(e){for(const s of e){const e=s.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,s,a,l){for(const c of e){const e=c.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;const u="round"===c.layout.get("line-cap"),d={dasharray:e.value.evaluate({zoom:a-1},s,{}),round:u},f={dasharray:e.value.evaluate({zoom:a},s,{}),round:u},_={dasharray:e.value.evaluate({zoom:a+1},s,{}),round:u},y=`${d.dasharray.join(",")},${d.round}`,b=`${f.dasharray.join(",")},${f.round}`,S=`${_.dasharray.join(",")},${_.round}`;l.dashDependencies[y]=d,l.dashDependencies[b]=f,l.dashDependencies[S]=_,s.dashes[c.id]={min:y,mid:b,max:S}}}}let bd,wd;ql("LineBucket",Yu,{omit:["layers","patternFeatures"]});var Td={get paint(){return wd=wd||new qs({"line-opacity":new Rs(pt.paint_line["line-opacity"]),"line-color":new Rs(pt.paint_line["line-color"]),"line-translate":new Os(pt.paint_line["line-translate"]),"line-translate-anchor":new Os(pt.paint_line["line-translate-anchor"]),"line-width":new Rs(pt.paint_line["line-width"]),"line-gap-width":new Rs(pt.paint_line["line-gap-width"]),"line-offset":new Rs(pt.paint_line["line-offset"]),"line-blur":new Rs(pt.paint_line["line-blur"]),"line-dasharray":new Ns(pt.paint_line["line-dasharray"]),"line-pattern":new Ns(pt.paint_line["line-pattern"]),"line-gradient":new Us(pt.paint_line["line-gradient"])})},get layout(){return bd=bd||new qs({"line-cap":new Os(pt.layout_line["line-cap"]),"line-join":new Rs(pt.layout_line["line-join"]),"line-miter-limit":new Os(pt.layout_line["line-miter-limit"]),"line-round-limit":new Os(pt.layout_line["line-round-limit"]),"line-sort-key":new Rs(pt.layout_line["line-sort-key"])})}};class Ju extends Rs{possiblyEvaluate(e,s){return s=new Es(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(e,s)}evaluate(e,s,a,l){return s=Se({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(e,s,a,l)}}let Sd;class Qu extends Gs{constructor(e,s){super(e,Td,s),this.gradientVersion=0,Sd||(Sd=new Ju(Td.paint.properties["line-width"].specification),Sd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof ar,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,s){super.recalculate(e,s),this.paint._values["line-floorwidth"]=Sd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Yu(e)}queryRadius(e){const s=e,a=Pd(sh("line-width",this,s),sh("line-gap-width",this,s)),l=sh("line-offset",this,s);return a/2+Math.abs(l)+ah(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:s,featureState:a,geometry:c,transform:u,pixelsToTileUnits:d}){const f=ch(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-u.bearingInRadians,d),_=d/2*Pd(this.paint.get("line-width").evaluate(s,a),this.paint.get("line-gap-width").evaluate(s,a)),y=this.paint.get("line-offset").evaluate(s,a);return y&&(c=function(e,s){const a=[];for(let c=0;c=3)for(let s=0;s0?s+2*e:e}const Id=_c([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=_c([{name:"a_projected_pos",components:3,type:"Float32"}],4);_c([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ed=_c([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);_c([{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 Cd=_c([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ad=_c([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Dd(e,s,a){return e.sections.forEach((e=>{e.text=function(e,s,a){const l=s.layout.get("text-transform").evaluate(a,{});return"uppercase"===l?e=e.toLocaleUpperCase():"lowercase"===l&&(e=e.toLocaleLowerCase()),cc.applyArabicShaping&&(e=cc.applyArabicShaping(e)),e}(e.text,s,a)})),e}_c([{name:"triangle",components:3,type:"Uint16"}]),_c([{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"}]),_c([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),_c([{type:"Float32",name:"offsetX"}]),_c([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),_c([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var kd=24;const Rd=4294967296,Ld=1/Rd,Fd="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class pc{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,s,a=this.length){for(;this.pos>3,c=this.pos;this.type=7&a,e(l,s,this),this.pos===c&&this.skip(a)}return s}readMessage(e,s){return this.readFields(e,s,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Rd;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Rd;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const s=this.buf;let a,l;return l=s[this.pos++],a=127&l,l<128?a:(l=s[this.pos++],a|=(127&l)<<7,l<128?a:(l=s[this.pos++],a|=(127&l)<<14,l<128?a:(l=s[this.pos++],a|=(127&l)<<21,l<128?a:(l=s[this.pos],a|=(15&l)<<28,function(e,s,a){const l=a.buf;let c,u;if(u=l[a.pos++],c=(112&u)>>4,u<128)return Bd(e,c,s);if(u=l[a.pos++],c|=(127&u)<<3,u<128)return Bd(e,c,s);if(u=l[a.pos++],c|=(127&u)<<10,u<128)return Bd(e,c,s);if(u=l[a.pos++],c|=(127&u)<<17,u<128)return Bd(e,c,s);if(u=l[a.pos++],c|=(127&u)<<24,u<128)return Bd(e,c,s);if(u=l[a.pos++],c|=(1&u)<<31,u<128)return Bd(e,c,s);throw new Error("Expected varint not more than 10 bytes")}(a,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,s=this.pos;return this.pos=e,e-s>=12&&Fd?Fd.decode(this.buf.subarray(s,e)):function(e,s,a){let l="",c=s;for(;c239?4:s>223?3:s>191?2:1;if(c+y>a)break;1===y?s<128&&(_=s):2===y?(u=e[c+1],128==(192&u)&&(_=(31&s)<<6|63&u,_<=127&&(_=null))):3===y?(u=e[c+1],d=e[c+2],128==(192&u)&&128==(192&d)&&(_=(15&s)<<12|(63&u)<<6|63&d,(_<=2047||_>=55296&&_<=57343)&&(_=null))):4===y&&(u=e[c+1],d=e[c+2],f=e[c+3],128==(192&u)&&128==(192&d)&&128==(192&f)&&(_=(15&s)<<18|(63&u)<<12|(63&d)<<6|63&f,(_<=65535||_>=1114112)&&(_=null))),null===_?(_=65533,y=1):_>65535&&(_-=65536,l+=String.fromCharCode(_>>>10&1023|55296),_=56320|1023&_),l+=String.fromCharCode(_),c+=y}return l}(this.buf,s,e)}readBytes(){const e=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,e);return this.pos=e,s}readPackedVarint(e=[],s){const a=this.readPackedEnd();for(;this.pos127;);else if(2===s)this.pos=this.readVarint()+this.pos;else if(5===s)this.pos+=4;else{if(1!==s)throw new Error(`Unimplemented type: ${s}`);this.pos+=8}}writeTag(e,s){this.writeVarint(e<<3|s)}realloc(e){let s=this.length||16;for(;s268435455||e<0?function(e,s){let a,l;if(e>=0?(a=e%4294967296|0,l=e/4294967296|0):(a=~(-e%4294967296),l=~(-e/4294967296),4294967295^a?a=a+1|0:(a=0,l=l+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(e,s,a){a.buf[a.pos++]=127&e|128,e>>>=7,a.buf[a.pos++]=127&e|128,e>>>=7,a.buf[a.pos++]=127&e|128,e>>>=7,a.buf[a.pos++]=127&e|128,a.buf[a.pos]=127&(e>>>=7)}(a,0,s),function(e,s){const a=(7&e)<<4;s.buf[s.pos++]|=a|((e>>>=3)?128:0),e&&(s.buf[s.pos++]=127&e|((e>>>=7)?128:0),e&&(s.buf[s.pos++]=127&e|((e>>>=7)?128:0),e&&(s.buf[s.pos++]=127&e|((e>>>=7)?128:0),e&&(s.buf[s.pos++]=127&e|((e>>>=7)?128:0),e&&(s.buf[s.pos++]=127&e)))))}(l,s)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const s=this.pos;this.pos=function(e,s,a){for(let l,c,u=0;u55295&&l<57344){if(!c){l>56319||u+1===s.length?(e[a++]=239,e[a++]=191,e[a++]=189):c=l;continue}if(l<56320){e[a++]=239,e[a++]=191,e[a++]=189,c=l;continue}l=c-55296<<10|l-56320|65536,c=null}else c&&(e[a++]=239,e[a++]=191,e[a++]=189,c=null);l<128?e[a++]=l:(l<2048?e[a++]=l>>6|192:(l<65536?e[a++]=l>>12|224:(e[a++]=l>>18|240,e[a++]=l>>12&63|128),e[a++]=l>>6&63|128),e[a++]=63&l|128)}return a}(this.buf,e,this.pos);const a=this.pos-s;a>=128&&Od(s,a,this),this.pos=s-1,this.writeVarint(a),this.pos+=a}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const s=e.length;this.writeVarint(s),this.realloc(s);for(let a=0;a=128&&Od(a,l,this),this.pos=a-1,this.writeVarint(l),this.pos+=l}writeMessage(e,s,a){this.writeTag(e,2),this.writeRawMessage(s,a)}writePackedVarint(e,s){s.length&&this.writeMessage(e,Vd,s)}writePackedSVarint(e,s){s.length&&this.writeMessage(e,Nd,s)}writePackedBoolean(e,s){s.length&&this.writeMessage(e,Gd,s)}writePackedFloat(e,s){s.length&&this.writeMessage(e,jd,s)}writePackedDouble(e,s){s.length&&this.writeMessage(e,Ud,s)}writePackedFixed32(e,s){s.length&&this.writeMessage(e,Zd,s)}writePackedSFixed32(e,s){s.length&&this.writeMessage(e,qd,s)}writePackedFixed64(e,s){s.length&&this.writeMessage(e,$d,s)}writePackedSFixed64(e,s){s.length&&this.writeMessage(e,Wd,s)}writeBytesField(e,s){this.writeTag(e,2),this.writeBytes(s)}writeFixed32Field(e,s){this.writeTag(e,5),this.writeFixed32(s)}writeSFixed32Field(e,s){this.writeTag(e,5),this.writeSFixed32(s)}writeFixed64Field(e,s){this.writeTag(e,1),this.writeFixed64(s)}writeSFixed64Field(e,s){this.writeTag(e,1),this.writeSFixed64(s)}writeVarintField(e,s){this.writeTag(e,0),this.writeVarint(s)}writeSVarintField(e,s){this.writeTag(e,0),this.writeSVarint(s)}writeStringField(e,s){this.writeTag(e,2),this.writeString(s)}writeFloatField(e,s){this.writeTag(e,5),this.writeFloat(s)}writeDoubleField(e,s){this.writeTag(e,1),this.writeDouble(s)}writeBooleanField(e,s){this.writeVarintField(e,+s)}}function Bd(e,s,a){return a?4294967296*s+(e>>>0):4294967296*(s>>>0)+(e>>>0)}function Od(e,s,a){const l=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));a.realloc(l);for(let s=a.pos-1;s>=e;s--)a.buf[s+l]=a.buf[s]}function Vd(e,s){for(let a=0;as.h-e.h));const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),a),h:1/0}];let c=0,u=0;for(const s of e)for(let e=l.length-1;e>=0;e--){const a=l[e];if(!(s.w>a.w||s.h>a.h)){if(s.x=a.x,s.y=a.y,u=Math.max(u,s.y+s.h),c=Math.max(c,s.x+s.w),s.w===a.w&&s.h===a.h){const s=l.pop();s&&e=0&&a>=e&&ep[this.text.charCodeAt(a)];a--)s--;this.text=this.text.substring(e,s),this.sectionIndex=this.sectionIndex.slice(e,s)}substring(e,s){const a=new Bc;return a.text=this.text.substring(e,s),a.sectionIndex=this.sectionIndex.slice(e,s),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,s)=>Math.max(e,this.sections[s].scale)),0)}getMaxImageSize(e){let s=0,a=0;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Qd(e,a,l,c,u,d,f,_,y,b,S,P,M,C,D){const L=Bc.fromFeature(e,u);let F;P===s.at.vertical&&L.verticalizePunctuation();const{processBidirectionalText:B,processStyledBidirectionalText:O}=cc;if(B&&1===L.sections.length){F=[];const e=B(L.toString(),cp(L,b,d,a,c,C));for(const s of e){const e=new Bc;e.text=s,e.sections=L.sections;for(let a=0;a=0;let y=0;for(let a=0;ay){const e=Math.ceil(u/y);c*=e/d,d=e}return{x1:l,y1:c,x2:l+u,y2:c+d}}function vp(e,s,a,l,c,u){const d=e.image;let f;if(d.content){const e=d.content,s=d.pixelRatio||1;f=[e[0]/s,e[1]/s,d.displaySize[0]-e[2]/s,d.displaySize[1]-e[3]/s]}const _=s.left*u,y=s.right*u;let b,S,P,M;"width"===a||"both"===a?(M=c[0]+_-l[3],S=c[0]+y+l[1]):(M=c[0]+(_+y-d.displaySize[0])/2,S=M+d.displaySize[0]);const C=s.top*u,D=s.bottom*u;return"height"===a||"both"===a?(b=c[1]+C-l[0],P=c[1]+D+l[2]):(b=c[1]+(C+D-d.displaySize[1])/2,P=b+d.displaySize[1]),{image:d,top:b,right:S,bottom:P,left:M,collisionPadding:f}}const Pp=128,Cp=32640;function zp(e,s){const{expression:a}=s;if("constant"===a.kind)return{kind:"constant",layoutSize:a.evaluate(new Es(e+1))};if("source"===a.kind)return{kind:"source"};{const{zoomStops:s,interpolationType:l}=a;let c=0;for(;ce.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zp(this.zoom,a["text-size"]),this.iconSizeData=zp(this.zoom,a["icon-size"]);const l=this.layers[0].layout,c=l.get("symbol-sort-key"),u=l.get("symbol-z-order");this.canOverlap="never"!==Lp(l,"text-overlap","text-allow-overlap")||"never"!==Lp(l,"icon-overlap","icon-allow-overlap")||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==u&&!c.isConstant(),this.sortFeaturesByY=("viewport-y"===u||"auto"===u&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===l.get("symbol-placement")&&(this.writingModes=l.get("text-writing-mode").map((e=>s.at[e]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID}createArrays(){this.text=new oh(new Do(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new oh(new Do(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new Da,this.lineVertexArray=new Fa,this.symbolInstances=new ka,this.textAnchorOffsets=new Pa}calculateGlyphDependencies(e,s,a,l,c){for(let u=0;u0)&&("constant"!==d.value.kind||d.value.value.length>0),b="constant"!==_.value.kind||!!_.value.value||Object.keys(_.parameters).length>0,S=u.get("symbol-sort-key");if(this.features=[],!y&&!b)return;const P=a.iconDependencies,M=a.glyphDependencies,C=a.availableImages,D=new Es(this.zoom);for(const{feature:a,id:f,index:_,sourceLayerIndex:L}of e){const e=c._featureFilter.needGeometry,F=qc(a,e);if(!c._featureFilter.filter(D,F,l))continue;let B,O;if(e||(F.geometry=Zc(a)),y){const e=c.getValueAndResolveTokens("text-field",F,l,C),s=Dt.factory(e),a=this.hasRTLText=this.hasRTLText||Gp(s);(!a||"unavailable"===cc.getRTLTextPluginStatus()||a&&cc.isParsed())&&(B=Dd(s,c,F))}if(b){const e=c.getValueAndResolveTokens("icon-image",F,l,C);O=e instanceof Lt?e:Lt.fromString(e)}if(!B&&!O)continue;const V=this.sortFeaturesByKey?S.evaluate(F,{},l):void 0;if(this.features.push({id:f,text:B,icon:O,index:_,sourceLayerIndex:L,geometry:F.geometry,properties:a.properties,type:Su.types[a.type],sortKey:V}),O&&(P[O.name]=!0),B){const e=d.evaluate(F,{},l).join(","),a="viewport"!==u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(s.at.vertical)>=0;for(const s of B.sections)if(s.image)P[s.image.name]=!0;else{const l=Ql(B.toString()),c=s.fontStack||e,u=M[c]=M[c]||{};this.calculateGlyphDependencies(s.text,u,a,this.allowVerticalPlacement,l)}}}"line"===u.get("symbol-placement")&&(this.features=function(e){const s={},a={},l=[];let c=0;function u(s){l.push(e[s]),c++}function d(e,s,c){const u=a[e];return delete a[e],a[s]=u,l[u].geometry[0].pop(),l[u].geometry[0]=l[u].geometry[0].concat(c[0]),u}function f(e,a,c){const u=s[a];return delete s[a],s[e]=u,l[u].geometry[0].shift(),l[u].geometry[0]=c[0].concat(l[u].geometry[0]),u}function _(e,s,a){const l=a?s[0][s[0].length-1]:s[0][0];return`${e}:${l.x}:${l.y}`}for(let y=0;ye.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,s)=>e.sortKey-s.sortKey))}update(e,s,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,s,this.layers,{imagePositions:a}),this.icon.programConfigurations.updatePaintArrays(e,s,this.layers,{imagePositions:a}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,s){const a=this.lineVertexArray.length;if(void 0!==e.segment){let a=e.dist(s[e.segment+1]),l=e.dist(s[e.segment]);const c={};for(let l=e.segment+1;l=0;a--)c[a]={x:s[a].x,y:s[a].y,tileUnitDistanceFromAnchor:l},a>0&&(l+=s[a-1].dist(s[a]));for(let e=0;e0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,s){const a=e.placedSymbolArray.get(s),l=a.vertexStartIndex+4*a.numGlyphs;for(let s=a.vertexStartIndex;sl[e]-l[s]||c[s]-c[e])),u}addToSortKeyRanges(e,s){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===s?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:s,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const s=this.symbolInstances.get(e);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((e,s,a)=>{e>=0&&a.indexOf(e)===s&&this.addIndicesForPlacedSymbol(this.text,e)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Wp,Xp;ql("SymbolBucket",uh,{omit:["layers","collisionBoxArray","features","compareText"]}),uh.MAX_GLYPHS=65535,uh.addDynamicAttributes=Vp;var Yp={get paint(){return Xp=Xp||new qs({"icon-opacity":new Rs(pt.paint_symbol["icon-opacity"]),"icon-color":new Rs(pt.paint_symbol["icon-color"]),"icon-halo-color":new Rs(pt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Rs(pt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Rs(pt.paint_symbol["icon-halo-blur"]),"icon-translate":new Os(pt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Os(pt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Rs(pt.paint_symbol["text-opacity"]),"text-color":new Rs(pt.paint_symbol["text-color"],{runtimeType:ui,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Rs(pt.paint_symbol["text-halo-color"]),"text-halo-width":new Rs(pt.paint_symbol["text-halo-width"]),"text-halo-blur":new Rs(pt.paint_symbol["text-halo-blur"]),"text-translate":new Os(pt.paint_symbol["text-translate"]),"text-translate-anchor":new Os(pt.paint_symbol["text-translate-anchor"])})},get layout(){return Wp=Wp||new qs({"symbol-placement":new Os(pt.layout_symbol["symbol-placement"]),"symbol-spacing":new Os(pt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Os(pt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Rs(pt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Os(pt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Os(pt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Os(pt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Os(pt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Os(pt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Os(pt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Rs(pt.layout_symbol["icon-size"]),"icon-text-fit":new Os(pt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Os(pt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Rs(pt.layout_symbol["icon-image"]),"icon-rotate":new Rs(pt.layout_symbol["icon-rotate"]),"icon-padding":new Rs(pt.layout_symbol["icon-padding"]),"icon-keep-upright":new Os(pt.layout_symbol["icon-keep-upright"]),"icon-offset":new Rs(pt.layout_symbol["icon-offset"]),"icon-anchor":new Rs(pt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Os(pt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Os(pt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Os(pt.layout_symbol["text-rotation-alignment"]),"text-field":new Rs(pt.layout_symbol["text-field"]),"text-font":new Rs(pt.layout_symbol["text-font"]),"text-size":new Rs(pt.layout_symbol["text-size"]),"text-max-width":new Rs(pt.layout_symbol["text-max-width"]),"text-line-height":new Os(pt.layout_symbol["text-line-height"]),"text-letter-spacing":new Rs(pt.layout_symbol["text-letter-spacing"]),"text-justify":new Rs(pt.layout_symbol["text-justify"]),"text-radial-offset":new Rs(pt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Os(pt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Rs(pt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Rs(pt.layout_symbol["text-anchor"]),"text-max-angle":new Os(pt.layout_symbol["text-max-angle"]),"text-writing-mode":new Os(pt.layout_symbol["text-writing-mode"]),"text-rotate":new Rs(pt.layout_symbol["text-rotate"]),"text-padding":new Os(pt.layout_symbol["text-padding"]),"text-keep-upright":new Os(pt.layout_symbol["text-keep-upright"]),"text-transform":new Rs(pt.layout_symbol["text-transform"]),"text-offset":new Rs(pt.layout_symbol["text-offset"]),"text-allow-overlap":new Os(pt.layout_symbol["text-allow-overlap"]),"text-overlap":new Os(pt.layout_symbol["text-overlap"]),"text-ignore-placement":new Os(pt.layout_symbol["text-ignore-placement"]),"text-optional":new Os(pt.layout_symbol["text-optional"])})}};class fh{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:oi,this.defaultValue=e}evaluate(e){if(e.formattedSection){const s=this.defaultValue.property.overrides;if(s&&s.hasOverride(e.formattedSection))return s.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ql("FormatSectionOverride",fh,{omit:["defaultValue"]});class dh extends Gs{constructor(e,s){super(e,Yp,s)}recalculate(e,s){if(super.recalculate(e,s),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const s=[];for(const a of e)s.indexOf(a)<0&&s.push(a);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,s,a,l){const c=this.layout.get(e).evaluate(s,{},a,l),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||ks(u.value)||!c?c:function(e,s){return s.replace(/{([^{}]+)}/g,((s,a)=>e&&a in e?String(e[a]):""))}(s.properties,c)}createBucket(e){return new uh(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Yp.paint.overridableProperties){if(!dh.hasPaintOverride(this.layout,e))continue;const s=this.paint.get(e),a=new fh(s),l=new ei(a,s.property.specification);let c=null;c="constant"===s.value.kind||"source"===s.value.kind?new ni("source",l):new ii("composite",l,s.value.zoomStops),this.paint._values[e]=new Cs(s.property,c,s.parameters)}}_handleOverridablePaintPropertyUpdate(e,s,a){return!(!this.layout||s.isDataDriven()||a.isDataDriven())&&dh.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,s){const a=e.get("text-field"),l=Yp.paint.properties[s];let c=!1;const u=e=>{for(const s of e)if(l.overrides&&l.overrides.hasOverride(s))return void(c=!0)};if("constant"===a.value.kind&&a.value.value instanceof Dt)u(a.value.value.sections);else if("source"===a.value.kind||"composite"===a.value.kind){const e=s=>{c||(s instanceof qt&&br(s.value)===_i?u(s.value.sections):s instanceof Mr?u(s.sections):s.eachChild(e))},s=a.value;s._styleExpression&&e(s._styleExpression.expression)}return c}}let Jp;var Qp={get paint(){return Jp=Jp||new qs({"background-color":new Os(pt.paint_background["background-color"]),"background-pattern":new $s(pt.paint_background["background-pattern"]),"background-opacity":new Os(pt.paint_background["background-opacity"])})}};class gh extends Gs{constructor(e,s){super(e,Qp,s)}}class xh extends Gs{constructor(e,s){super(e,{},s),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class vh{constructor(e){this._methodToThrottle=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const ef={once:!0},tf=6371008.8;class _h{constructor(e,s){if(isNaN(e)||isNaN(s))throw new Error(`Invalid LngLat object: (${e}, ${s})`);if(this.lng=+e,this.lat=+s,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _h(Te(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const s=Math.PI/180,a=this.lat*s,l=e.lat*s,c=Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos((e.lng-this.lng)*s);return tf*Math.acos(Math.min(c,1))}static convert(e){if(e instanceof _h)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new _h(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new _h(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const lf=2*Math.PI*tf;function hf(e){return lf*Math.cos(e*Math.PI/180)}function uf(e){return(180+e)/360}function df(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function pf(e,s){return e/hf(s)}function ff(e){return 360*e-180}function mf(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function _f(e,s){return e*hf(mf(s))}class Fh{constructor(e,s,a=0){this.x=+e,this.y=+s,this.z=+a}static fromLngLat(e,s=0){const a=_h.convert(e);return new Fh(uf(a.lng),df(a.lat),pf(s,a.lat))}toLngLat(){return new _h(ff(this.x),mf(this.y))}toAltitude(){return _f(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/lf*(e=mf(this.y),1/Math.cos(e*Math.PI/180));var e}}function yf(e,s,a){var l=2*Math.PI*6378137/256/Math.pow(2,a);return[e*l-2*Math.PI*6378137/2,s*l-2*Math.PI*6378137/2]}class Ph{constructor(e,s,a){if(!function(e,s,a){return!(e<0||e>25||a<0||a>=Math.pow(2,e)||s<0||s>=Math.pow(2,e))}(e,s,a))throw new Error(`x=${s}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=s,this.y=a,this.key=wf(0,e,e,s,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,s,a){const l=(u=this.y,d=this.z,f=yf(256*(c=this.x),256*(u=Math.pow(2,d)-u-1),d),_=yf(256*(c+1),256*(u+1),d),f[0]+","+f[1]+","+_[0]+","+_[1]);var c,u,d,f,_;const y=function(e,s,a){let l,c="";for(let u=e;u>0;u--)l=1<1?"@2x":"").replace(/{quadkey}/g,y).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const s=this.z-e.z;return s>0&&e.x===this.x>>s&&e.y===this.y>>s}getTilePoint(e){const s=Math.pow(2,this.z);return new l((e.x*s-this.x)*oe,(e.y*s-this.y)*oe)}toString(){return`${this.z}/${this.x}/${this.y}`}}class zh{constructor(e,s){this.wrap=e,this.canonical=s,this.key=wf(e,s.z,s.z,s.x,s.y)}}class Vh{constructor(e,s,a,l,c){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=s,this.canonical=new Ph(a,+l,+c),this.key=wf(s,e,a,l,c)}clone(){return new Vh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?new Vh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vh(e,this.wrap,e,this.canonical.x>>s,this.canonical.y>>s)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,s){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?wf(this.wrap*+s,e,this.canonical.z,this.canonical.x,this.canonical.y):wf(this.wrap*+s,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap)return!1;if(this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;const s=this.canonical.z-e.canonical.z;return!(s<0)&&e.canonical.x===this.canonical.x>>s&&e.canonical.y===this.canonical.y>>s}children(e){if(this.overscaledZ>=e)return[new Vh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,a=2*this.canonical.x,l=2*this.canonical.y;return[new Vh(s,this.wrap,s,a,l),new Vh(s,this.wrap,s,a+1,l),new Vh(s,this.wrap,s,a,l+1),new Vh(s,this.wrap,s,a+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const s=new Oh;return s.extend(e(new l(this.minX,this.minY))),s.extend(e(new l(this.maxX,this.minY))),s.extend(e(new l(this.minX,this.maxY))),s.extend(e(new l(this.maxX,this.maxY))),s}static fromPoints(e){const s=new Oh;for(const a of e)s.extend(a);return s}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Rh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let s=0;s=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Nh{constructor(e,s,a,l,c){this.type="Feature",this._vectorTileFeature=e,e._z=s,e._x=a,e._y=l,this.properties=e.properties,this.id=c}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const s in this)"_geometry"!==s&&"_vectorTileFeature"!==s&&(e[s]=this[s]);return e}}class $h{_name;dataBuffer;nullabilityBuffer;_size;constructor(e,s,a){this._name=e,this.dataBuffer=s,"number"==typeof a?this._size=a:(this.nullabilityBuffer=a,this._size=a.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Uh extends $h{}class qh extends Uh{getValueFromBuffer(e){return this.dataBuffer[e]}}class jh extends Uh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Gh extends $h{delta;constructor(e,s,a,l){super(e,s,l),this.delta=a}}class Xh extends Gh{constructor(e,s,a,l){super(e,Int32Array.of(s),a,l)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Yh extends $h{constructor(e,s,a){super(e,Int32Array.of(s),a)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Zh{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(e,s,a,l,c=4096){this._name=e,this._geometryVector=s,this._idVector=a,this._propertyVectors=l,this._extent=c}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((e=>[e.name,e])))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let s=0;for(;s>4,c<128)return 4294967296*l+(e>>>0);if(c=s[a.get()],a.increment(),l|=(127&c)<<3,c<128)return 4294967296*l+(e>>>0);if(c=s[a.get()],a.increment(),l|=(127&c)<<10,c<128)return 4294967296*l+(e>>>0);if(c=s[a.get()],a.increment(),l|=(127&c)<<17,c<128)return 4294967296*l+(e>>>0);if(c=s[a.get()],a.increment(),l|=(127&c)<<24,c<128)return 4294967296*l+(e>>>0);if(c=s[a.get()],a.increment(),l|=(1&c)<<31,c<128)return 4294967296*l+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(a,e,s)))))}function Of(e,s,a,l){throw new Error("FastPFor is not implemented yet.")}function Vf(e){return e>>>1^-(1&e)}function Nf(e){return e>>1n^-(1n&e)}function jf(e,s){let a=0n,l=0,c=s.get();for(;c=64)throw new Error("Varint too long")}return s.set(c),a}function Gf(e,s,a){const l=new Int32Array(a);let c=0;for(let a=0;a=4)for(let l=e[0];a>>1^-(1&e[0]),e[1]=e[1]>>>1^-(1&e[1]);const s=e.length/4*4;let a=2;if(s>=4)for(;a>>1^-(1&s))+e[a-2],e[a+1]=(l>>>1^-(1&l))+e[a-1],e[a+2]=(c>>>1^-(1&c))+e[a],e[a+3]=(u>>>1^-(1&u))+e[a+1]}for(;a!=e.length;a+=2)e[a]=(e[a]>>>1^-(1&e[a]))+e[a-2],e[a+1]=(e[a+1]>>>1^-(1&e[a+1]))+e[a-1]}function Xf(e,s,a){return Math.min(a,Math.max(s,e))}!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"}(Pf||(Pf={})),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(If||(If={})),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(Mf||(Mf={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(Ef||(Ef={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(Cf||(Cf={}));class bp{_physicalStreamType;_logicalStreamType;_logicalLevelTechnique1;_logicalLevelTechnique2;_physicalLevelTechnique;_numValues;_byteLength;constructor(e,s,a,l,c,u,d){this._physicalStreamType=e,this._logicalStreamType=s,this._logicalLevelTechnique1=a,this._logicalLevelTechnique2=l,this._physicalLevelTechnique=c,this._numValues=u,this._byteLength=d}static decode(e,s){const a=e[s.get()],l=Object.values(Sf)[a>>4];let c=null;switch(l){case Sf.DATA:c=new ap(Object.values(Mf)[15&a]);break;case Sf.OFFSET:c=new ap(null,Object.values(Ef)[15&a]);break;case Sf.LENGTH:c=new ap(null,null,Object.values(Cf)[15&a])}s.increment();const u=e[s.get()],d=Object.values(Pf)[u>>5],f=Object.values(Pf)[u>>2&7],_=Object.values(If)[3&u];s.increment();const y=Lf(e,s,2);return new bp(l,c,d,f,_,y[0],y[1])}get physicalStreamType(){return this._physicalStreamType}get logicalStreamType(){return this._logicalStreamType}get logicalLevelTechnique1(){return this._logicalLevelTechnique1}get logicalLevelTechnique2(){return this._logicalLevelTechnique2}get physicalLevelTechnique(){return this._physicalLevelTechnique}get numValues(){return this._numValues}get byteLength(){return this._byteLength}getDecompressedCount(){return this._numValues}}class wp extends bp{num_bits;coordinate_shift;constructor(e,s,a,l,c,u,d,f,_){super(e,s,a,l,c,u,d),this.num_bits=f,this.coordinate_shift=_}static decode(e,s){const a=bp.decode(e,s),l=Lf(e,s,2);return new wp(a.physicalStreamType,a.logicalStreamType,a.logicalLevelTechnique1,a.logicalLevelTechnique2,a.physicalLevelTechnique,a.numValues,a.byteLength,l[0],l[1])}static decodePartial(e,s,a){const l=Lf(s,a,2);return new wp(e.physicalStreamType,e.logicalStreamType,e.logicalLevelTechnique1,e.logicalLevelTechnique2,e.physicalLevelTechnique,e.numValues,e.byteLength,l[0],l[1])}numBits(){return this.num_bits}coordinateShift(){return this.coordinate_shift}}class _p extends bp{_runs;_numRleValues;constructor(e,s,a,l,c,u,d,f,_){super(e,s,a,l,c,u,d),this._runs=f,this._numRleValues=_}static decode(e,s){const a=bp.decode(e,s),l=Lf(e,s,2);return new _p(a.physicalStreamType,a.logicalStreamType,a.logicalLevelTechnique1,a.logicalLevelTechnique2,a.physicalLevelTechnique,a.numValues,a.byteLength,l[0],l[1])}static decodePartial(e,s,a){const l=Lf(s,a,2);return new _p(e.physicalStreamType,e.logicalStreamType,e.logicalLevelTechnique1,e.logicalLevelTechnique2,e.physicalLevelTechnique,e.numValues,e.byteLength,l[0],l[1])}get runs(){return this._runs}get numRleValues(){return this._numRleValues}getDecompressedCount(){return this._numRleValues}}class Sp{static decode(e,s){const a=bp.decode(e,s);return a.logicalLevelTechnique1===Pf.MORTON?wp.decodePartial(a,e,s):Pf.RLE!==a.logicalLevelTechnique1&&Pf.RLE!==a.logicalLevelTechnique2||If.NONE===a.physicalLevelTechnique?a:_p.decodePartial(a,e,s)}}!function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Af||(Af={}));class Ap{values;_size;constructor(e,s){this.values=e,this._size=s}get(e){const s=Math.floor(e/8);return 1==(this.values[s]>>e%8&1)}set(e,s){const a=Math.floor(e/8);this.values[a]=this.values[a]|(s?1:0)<>e%8&1}size(){return this._size}getBuffer(){return this.values}}class Tp{constructor(){}static decodeIntStream(e,s,a,l,c){const u=Tp.decodePhysicalLevelTechnique(e,s,a);return this.decodeIntBuffer(u,a,l,c)}static decodeLengthStreamToOffsetBuffer(e,s,a){const l=Tp.decodePhysicalLevelTechnique(e,s,a);return this.decodeLengthToOffsetBuffer(l,a)}static decodePhysicalLevelTechnique(e,s,a){const l=a.physicalLevelTechnique;if(l===If.FAST_PFOR)return Of();if(l===If.VARINT)return Lf(e,s,a.numValues);if(l===If.NONE){const l=s.get();s.add(a.byteLength);const c=e.subarray(l,s.get());return new Int32Array(c)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}static decodeConstIntStream(e,s,a,l){const c=Tp.decodePhysicalLevelTechnique(e,s,a);if(1===c.length){const e=c[0];return l?Vf(e):e}return l?function(e){return Vf(e[1])}(c):function(e){return e[1]}(c)}static decodeSequenceIntStream(e,s,a){return function(e){if(2==e.length){const s=Vf(e[1]);return[s,s]}return[Vf(e[2]),Vf(e[3])]}(Tp.decodePhysicalLevelTechnique(e,s,a))}static decodeSequenceLongStream(e,s,a){return function(e){if(2==e.length){const s=Nf(e[1]);return[s,s]}return[Nf(e[2]),Nf(e[3])]}(Ff(e,s,a.numValues))}static decodeLongStream(e,s,a,l){const c=Ff(e,s,a.numValues);return this.decodeLongBuffer(c,a,l)}static decodeLongFloat64Stream(e,s,a,l){const c=function(e,s,a){const l=new Float64Array(s);for(let c=0;c>>1^-(1&e[0]);const s=e.length/4*4;let a=1;if(s>=4)for(;a>>1^-(1&s))+e[a-1],e[a+1]=(l>>>1^-(1&l))+e[a],e[a+2]=(c>>>1^-(1&c))+e[a+1],e[a+3]=(u>>>1^-(1&u))+e[a+2]}for(;a!=e.length;++a)e[a]=(e[a]>>>1^-(1&e[a]))+e[a-1]}(e),e);case Pf.RLE:return function(e,s,a){return a?function(e,s,a){const l=new Int32Array(a);let c=0;for(let a=0;a>>1^-(1&d),l.fill(d,c,c+u),c+=u}return l}(e,s.runs,s.numRleValues):Gf(e,s.runs,s.numRleValues)}(e,s,a);case Pf.MORTON:return Wf(e),e;case Pf.COMPONENTWISE_DELTA:return l?(function(e,s,a,l){let c=e[0]>>>1^-(1&e[0]),u=e[1]>>>1^-(1&e[1]);e[0]=Xf(Math.round(c*s),a,l),e[1]=Xf(Math.round(u*s),a,l);const d=e.length/16;let f=2;if(d>=4)for(;f>>1^-(1&d))+c,b=(_>>>1^-(1&_))+u;e[f]=Xf(Math.round(y*s),a,l),e[f+1]=Xf(Math.round(b*s),a,l);const S=e[f+2],P=e[f+3];c=(S>>>1^-(1&S))+y,u=(P>>>1^-(1&P))+b,e[f+2]=Xf(Math.round(c*s),a,l),e[f+3]=Xf(Math.round(u*s),a,l)}for(;f!=e.length;f+=2)c+=e[f]>>>1^-(1&e[f]),u+=e[f+1]>>>1^-(1&e[f+1]),e[f]=Xf(Math.round(c*s),a,l),e[f+1]=Xf(Math.round(u*s),a,l)}(e,l.scale,l.min,l.max),e):(Hf(e),e);case Pf.NONE:return a&&function(e){for(let s=0;s>>1^-(1&a)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}}static decodeLongBuffer(e,s,a){switch(s.logicalLevelTechnique1){case Pf.DELTA:return s.logicalLevelTechnique2===Pf.RLE?function(e,s,a){const l=new BigInt64Array(a);let c=0,u=0n;for(let a=0;a>1n^-(1n&e[0]);const s=e.length/4*4;let a=1;if(s>=4)for(;a>1n^-(1n&s))+e[a-1],e[a+1]=(l>>1n^-(1n&l))+e[a],e[a+2]=(c>>1n^-(1n&c))+e[a+1],e[a+3]=(u>>1n^-(1n&u))+e[a+2]}for(;a!=e.length;++a)e[a]=(e[a]>>1n^-(1n&e[a]))+e[a-1]}(e),e);case Pf.RLE:return function(e,s,a){return a?function(e,s,a){const l=new BigInt64Array(a);let c=0;for(let a=0;a>1n^-(1n&d),l.fill(d,c,c+u),c+=u}return l}(e,s.runs,s.numRleValues):Zf(e,s.runs,s.numRleValues)}(e,s,a);case Pf.NONE:return a&&function(e){for(let s=0;s>1n^-(1n&a)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}}static decodeFloat64Buffer(e,s,a){switch(s.logicalLevelTechnique1){case Pf.DELTA:return s.logicalLevelTechnique2===Pf.RLE&&(e=$f(e,s.runs,s.numRleValues)),function(e){e[0]=e[0]%2==1?(e[0]+1)/-2:e[0]/2;const s=e.length/4*4;let a=1;if(s>=4)for(;a>>1^-(1&c),s[l]=s[l-1]+a}return s}(e);if(s.logicalLevelTechnique1===Pf.RLE&&s.logicalLevelTechnique2===Pf.NONE)return function(e,s,a){const l=new Int32Array(a+1);l[0]=0;let c=1,u=l[0];for(let a=0;a>>1^-(1&f);for(let e=c;e>>1^-(1&s[0]):0,l=1):a[0]=0;let c=1;for(;c!=a.length;++c)a[c]=e.get(c)?a[c-1]+(s[l]>>>1^-(1&s[l++])):a[c-1];return a}(l,e);case Pf.RLE:return function(e,s,a,l){const c=s;return a?function(e,s,a){const l=new Int32Array(e.size());let c=0;for(let u=0;u>>1^-(1&f);for(let s=c;s>>1^-(1&e)}else a[c]=0;return a}(l,e):function(e,s){const a=new Int32Array(e.size());let l=0,c=0;for(;c!=a.length;++c)a[c]=e.get(c)?s[l++]:0;return a}(l,e),e;default:throw new Error("The specified Logical level technique is not supported")}}static decodeNullableLongBuffer(e,s,a,l){switch(s.logicalLevelTechnique1){case Pf.DELTA:return s.logicalLevelTechnique2===Pf.RLE&&(e=Zf(e,s.runs,s.numRleValues)),function(e,s){const a=new BigInt64Array(e.size());let l=0;e.get(0)?(a[0]=e.get(0)?s[0]>>1n^-(1n&s[0]):0n,l=1):a[0]=0n;let c=1;for(;c!=a.length;++c)a[c]=e.get(c)?a[c-1]+(s[l]>>1n^-(1n&s[l++])):a[c-1];return a}(l,e);case Pf.RLE:return function(e,s,a,l){const c=s;return a?function(e,s,a){const l=new BigInt64Array(e.size());let c=0;for(let u=0;u>1n^-(1n&f);for(let s=c;s>1n^-(1n&e)}else a[c]=0n;return a}(l,e):function(e,s){const a=new BigInt64Array(e.size());let l=0,c=0;for(;c!=a.length;++c)a[c]=e.get(c)?s[l++]:0n;return a}(l,e),e;default:throw new Error("The specified Logical level technique is not supported")}}static getVectorType(e,s,a,l){const c=e.logicalLevelTechnique1;if(c===Pf.RLE)return 1===e.runs?Af.CONST:Af.FLAT;const u=s instanceof Ap?s.size():s;if(c===Pf.DELTA&&e.logicalLevelTechnique2===Pf.RLE){const s=e.runs,c=2;if(e.numRleValues!==u)return Af.FLAT;if(1===s)return Af.SEQUENCE;if(2===s){const s=l.get();let u;if(e.physicalLevelTechnique===If.VARINT)u=Lf(a,l,4);else{const e=l.get();u=new Int32Array(a.buffer,a.byteOffset+e,4)}if(l.set(s),u[2]===c&&u[3]===c)return Af.SEQUENCE}}return 1===e.numValues?Af.CONST:Af.FLAT}}class Ip extends Uh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Mp extends Gh{constructor(e,s,a,l){super(e,BigInt64Array.of(s),a,l)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Ep{_geometryOffsets;_partOffsets;_ringOffsets;constructor(e,s,a){this._geometryOffsets=e,this._partOffsets=s,this._ringOffsets=a}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}class kp{tileExtent;_numBits;_coordinateShift;minBound;maxBound;constructor(e,s){this._coordinateShift=e<0?Math.abs(e):0,this.tileExtent=s+this._coordinateShift,this._numBits=Math.ceil(Math.log2(this.tileExtent)),this.minBound=e,this.maxBound=s}validateCoordinates(e){if(e.xthis.maxBound||e.y>this.maxBound)throw new Error("The specified tile buffer size is currently not supported.")}numBits(){return this._numBits}coordinateShift(){return this._coordinateShift}}class Dp extends kp{encode(e){this.validateCoordinates(e);const s=e.x+this._coordinateShift,a=e.y+this._coordinateShift;let l=0;for(let e=0;e>1)-this._coordinateShift}}decodeMorton(e){let s=0;for(let a=0;a>a;return s}static decode(e,s,a){return{x:Dp.decodeMorton(e,s)-a,y:Dp.decodeMorton(e>>1,s)-a}}static decodeMorton(e,s){let a=0;for(let l=0;l>l;return a}}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}(Df||(Df={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(zf||(zf={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(Rf||(Rf={}));class Fp{createPoint(e){return[[e]]}createMultiPoint(e){return e.map((e=>[e]))}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,s){return[e,...s]}createMultiPolygon(e){return e.flat()}}function Yf(e){const s=new Array(e.numGeometries);let a=1,c=1,u=1,d=0;const f=new Fp;let _=0,y=0;const b=e.mortonSettings,S=e.topologyVector,P=S.geometryOffsets,M=S.partOffsets,C=S.ringOffsets,D=e.vertexOffsets,L=e.containsPolygonGeometry(),F=e.vertexBuffer;for(let S=0;S0&&s.push(s[0]),S.push(s)}e[s]=S,u&&y++}break;case Df.MULTIPOLYGON:{const b=u[y]-u[y-1];y++;const S=[];for(let e=0;e0&&s.push(s[0]),S.push(s)}}e[s]=S}}return e}[Symbol.iterator](){return null}}class qp extends Up{_numGeometries;_geometryType;constructor(e,s,a,l,c,u){super(a,l,c,u),this._numGeometries=e,this._geometryType=s}static create(e,s,a,l,c,u){return new qp(e,s,a,l,c,u)}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class jp extends Up{_geometryTypes;constructor(e,s,a,l,c){super(s,a,l,c),this._geometryTypes=e}static create(e,s,a,l,c){return new jp(e,s,a,l,c)}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function rm(e,s,a,l,c){const u=Sp.decode(e,a);let d=null,f=null,_=null,y=null,b=null,S=null,P=null,M=null;if(Tp.getVectorType(u,l,e,a)===Af.CONST){const C=Tp.decodeConstIntStream(e,a,u,!1);for(let l=0;la?s[u++]:1);return l}function sm(e,s,a,l){const c=new Int32Array(s[s.length-1]+1);let u=0;c[0]=u;let d=1,f=0;for(let _=0;_=12?cm.decode(e.subarray(s,a)):function(e,s,a){let l="",c=s;for(;c239?4:s>223?3:s>191?2:1;if(c+y>a)break;1===y?s<128&&(_=s):2===y?(u=e[c+1],128==(192&u)&&(_=(31&s)<<6|63&u,_<=127&&(_=null))):3===y?(u=e[c+1],d=e[c+2],128==(192&u)&&128==(192&d)&&(_=(15&s)<<12|(63&u)<<6|63&d,(_<=2047||_>=55296&&_<=57343)&&(_=null))):4===y&&(u=e[c+1],d=e[c+2],f=e[c+3],128==(192&u)&&128==(192&d)&&128==(192&f)&&(_=(15&s)<<18|(63&u)<<12|(63&d)<<6|63&f,(_<=65535||_>=1114112)&&(_=null))),null===_?(_=65533,y=1):_>65535&&(_-=65536,l+=String.fromCharCode(_>>>10&1023|55296),_=56320|1023&_),l+=String.fromCharCode(_),c+=y}return l}(e,s,a)}class rf extends $h{offsetBuffer;constructor(e,s,a,l){super(e,a,l),this.offsetBuffer=s}}class nf extends rf{textEncoder;constructor(e,s,a,l){super(e,s,a,l??s.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(e){return hm(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class sf extends rf{indexBuffer;textEncoder;constructor(e,s,a,l,c){super(e,a,l,c??s.length),this.indexBuffer=s,this.indexBuffer=s,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const s=this.indexBuffer[e];return hm(this.dataBuffer,this.offsetBuffer[s],this.offsetBuffer[s+1])}}class af extends rf{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(e,s,a,l,c,u,d){super(e,a,l,d),this.indexBuffer=s,this.symbolOffsetBuffer=c,this.symbolTableBuffer=u,this.textEncoder=new TextEncoder}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(e,s,a){const l=[],c=new Array(s.length).fill(0);for(let e=1;e1?6:4,a.type="physicalType",s.scalarType=a,s.type="scalarType",s}case 4:{const e={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=s,e}case 30:{const e={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=s,e}default:return this.mapScalarType(e)}}static columnTypeHasName(e){return e>=10}static columnTypeHasChildren(e){return 30===e}static hasStreamCount(e){if("id"===e.name)return!1;if("scalarType"===e.type){const s=e.scalarType;if("physicalType"===s.type)switch(s.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if("logicalType"===s.type)return!1}else if("complexType"===e.type){const s=e.complexType;if("physicalType"===s.type)switch(s.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}static mapScalarType(e){let s=null;switch(e){case 10:case 11:s=0;break;case 12:case 13:s=1;break;case 14:case 15:s=2;break;case 16:case 17:s=3;break;case 18:case 19:s=4;break;case 20:case 21:s=5;break;case 22:case 23:s=6;break;case 24:case 25:s=7;break;case 26:case 27:s=8;break;case 28:case 29:s=9;break;default:return null}const a={};a.nullable=!!(1&e),a.columnScope=0;const l={type:"physicalType"};return l.physicalType=s,a.type="scalarType",a.scalarType=l,a}}const pm=new TextDecoder;function fm(e,s){const a=Lf(e,s,1)[0];if(0===a)return"";const l=s.get(),c=e.subarray(l,l+a);return s.add(a),pm.decode(c)}function mm(e,s){const a=Lf(e,s,1)[0]>>>0,l=!!(4&a),c=!!(2&a),u=Lf(e,s,1)[0]>>>0,d={};if(1&a&&(d.nullable=!0),c){const c={};if(l?(c.type="logicalType",c.logicalType=u):(c.type="physicalType",c.physicalType=u),8&a){const a=Lf(e,s,1)[0]>>>0;c.children=new Array(a);for(let l=0;l>>0,l=cf.decodeColumnType(a);if(!l)throw new Error(`Unsupported column type code: ${a}`);if(cf.columnTypeHasName(a)?l.name=fm(e,s):a>=0&&a<=3?l.name="id":4===a&&(l.name="geometry"),cf.columnTypeHasChildren(a)){const a=Lf(e,s,1)[0]>>>0,c=l.complexType;c.children=new Array(a);for(let l=0;l>>0,u=Lf(e,s,1)[0]>>>0;l.columns=new Array(u);for(let a=0;athis.projectPoint(e,s,a,l)))}toGeoJSON(e,s,a){const l=this.extent*Math.pow(2,a),c=this.extent*e,u=this.extent*s,d=this.loadGeometry();let f;switch(this.type){case 1:{const e=[];for(const s of d)e.push(s[0]);const s=this.projectLine(e,c,u,l);f=1===e.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{const e=d.map((e=>this.projectLine(e,c,u,l)));f=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{const e=Pn(d),s=[];for(const a of e)s.push(a.map((e=>this.projectLine(e,c,u,l))));f=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw new Error(`unknown feature type: ${this.type}`)}const _={type:"Feature",geometry:f,properties:this.properties};return null!=this.id&&(_.id=this.id),_}loadGeometry(){const e=[];for(const s of this._featureData.geometry.coordinates){const a=[];for(const e of s)a.push(new l(e.x,e.y));e.push(a)}return e}bbox(){return[0,0,0,0]}}class xf{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new gf(this.features[e],this.extent)}}class vf{constructor(e){this.layers={};const s=function(e,s,a=!0){const l=new Hh(0),c=[];for(;l.get()>>0,d=l.get()+u;if(d>e.length)throw new Error(`Block overruns tile: ${d} > ${e.length}`);if(1!=Lf(e,l,1)[0]>>>0){l.set(d);continue}const f=gm(e,l),_=f[1],y=f[0].featureTables[0];let b=null,S=null;const P=[];let M=0;for(const c of y.columns){const u=c.name;if("id"===u){let s=null;if(c.nullable){const a=Sp.decode(e,l),c=l.get(),u=am(e,a.numValues,l);l.set(c+a.byteLength),s=new Ap(u,a.numValues)}const d=Sp.decode(e,l);M=d.getDecompressedCount(),b=ym(e,c,l,u,d,s??M,a)}else if("geometry"===u){const a=Lf(e,l,1)[0];if(0===M){const s=l.get();M=Sp.decode(e,l).getDecompressedCount(),l.set(s)}S=rm(e,a,l,M,s)}else{const s=cf.hasStreamCount(c)?Lf(e,l,1)[0]:1;if(0===s&&"scalarType"===c.type)continue;const a=um(e,l,c,s,M,void 0);a&&(Array.isArray(a)?P.push(...a):P.push(a))}}const C=new Zh(y.name,S,b,P,_);c.push(C),l.set(d)}return c}(new Uint8Array(e));this.layers=s.reduce(((e,s)=>Object.assign(Object.assign({},e),{[s.name]:new xf(s)})),{})}}class bf{constructor(e,s){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new as(oe,16,0),this.grid3D=new as(oe,16,0),this.featureIndexArray=new Va,this.promoteId=s}insert(e,s,a,l,c,u){const d=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,l,c);const f=u?this.grid3D:this.grid;for(let e=0;e=0&&l[3]>=0&&f.insert(d,l[0],l[1],l[2],l[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Eu(new pc(this.rawTileData)).layers:new vf(this.rawTileData).layers,this.sourceLayerCoder=new Rh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,s,a,c){this.loadVTLayers();const u=e.params,d=oe/e.tileSize/e.scale,f=co(u.filter,u.globalState),_=e.queryGeometry,y=e.queryPadding*d,b=Oh.fromPoints(_),S=this.grid.query(b.minX-y,b.minY-y,b.maxX+y,b.maxY+y),P=Oh.fromPoints(e.cameraQueryGeometry).expandBy(y),M=this.grid3D.query(P.minX,P.minY,P.maxX,P.maxY,((s,a,c,u)=>function(e,s,a,c,u){for(const l of e)if(s<=l.x&&a<=l.y&&c>=l.x&&u>=l.y)return!0;const d=[new l(s,a),new l(s,u),new l(c,u),new l(c,a)];if(e.length>2)for(const s of d)if(rh(e,s))return!0;for(let s=0;s(P||(P=Zc(s)),a.queryIntersectsFeature({queryGeometry:_,feature:s,featureState:l,geometry:P,zoom:this.z,transform:e.transform,pixelsToTileUnits:d,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return C}loadMatchingFeature(e,s,a,l,c,u,d,f,_,y,b){const S=this.bucketLayerIDs[s];if(u&&!S.some((e=>u.has(e))))return;const P=this.sourceLayerCoder.decode(a),M=this.vtLayers[P].feature(l);if(c.needGeometry){const e=qc(M,!0);if(!c.filter(new Es(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!c.filter(new Es(this.tileID.overscaledZ),M))return;const C=this.getId(M,P);for(let s=0;s{const d=s instanceof Ls?s.get(u):null;return d&&d.evaluate?d.evaluate(a,l,c):d}))}function vm(e,s){return s-e}function bm(e,s,a,c,u){const d=[];for(let f=0;f=c&&b.x>=c||(f.x>=c?f=new l(c,f.y+(c-f.x)/(b.x-f.x)*(b.y-f.y))._round():b.x>=c&&(b=new l(c,f.y+(c-f.x)/(b.x-f.x)*(b.y-f.y))._round()),f.y>=u&&b.y>=u||(f.y>=u?f=new l(f.x+(u-f.y)/(b.y-f.y)*(b.x-f.x),u)._round():b.y>=u&&(b=new l(f.x+(u-f.y)/(b.y-f.y)*(b.x-f.x),u)._round()),y&&f.equals(y[y.length-1])||(y=[f],d.push(y)),y.push(b)))))}}return d}function wm(e,s,a,l,c){switch(s){case 1:return function(e,s,a,l){const c=[];for(const u of e)for(const e of u){const u=0===l?e.x:e.y;u>=s&&u<=a&&c.push([e])}return c}(e,a,l,c);case 2:return Sm(e,a,l,c,!1);case 3:return Sm(e,a,l,c,!0)}return[]}function Tm(e,s,a,c,u){const d=0===c?Pm:Im;let f=[];const _=[];for(let l=0;ls&&f.push(d(y,b,s)):S>a?P=s&&(f.push(d(y,b,s)),M=!0),P>a&&S<=a&&(f.push(d(y,b,a)),M=!0),!u&&M&&(_.push(f),f=[])}const y=e.length-1,b=0===c?e[y].x:e[y].y;return b>=s&&b<=a&&f.push(e[y]),u&&f.length>0&&!f[0].equals(f[f.length-1])&&f.push(new l(f[0].x,f[0].y)),f.length>0&&_.push(f),_}function Sm(e,s,a,l,c){const u=[];for(const d of e){const e=Tm(d,s,a,l,c);e.length>0&&u.push(...e)}return u}function Pm(e,s,a){return new l(a,e.y+(a-e.x)/(s.x-e.x)*(s.y-e.y))}function Im(e,s,a){return new l(e.x+(a-e.y)/(s.y-e.y)*(s.x-e.x),a)}ql("FeatureIndex",bf,{omit:["rawTileData","sourceLayerCoder"]});class kf extends l{constructor(e,s,a,l){super(e,s),this.angle=a,void 0!==l&&(this.segment=l)}clone(){return new kf(this.x,this.y,this.angle,this.segment)}}function Mm(e,s,a,l,c){if(void 0===s.segment||0===a)return!0;let u=s,d=s.segment+1,f=0;for(;f>-a/2;){if(d--,d<0)return!1;f-=e[d].dist(u),u=e[d]}f+=e[d].dist(e[d+1]),d++;const _=[];let y=0;for(;fl;)y-=_.shift().angleDelta;if(y>c)return!1;d++,f+=s.dist(a)}return!0}function Em(e){let s=0;for(let a=0;ay){const b=(y-_)/u,S=Or.number(l.x,c.x,b),P=Or.number(l.y,c.y,b),M=new kf(S,P,c.angleTo(l),a);return M._round(),!d||Mm(e,M,f,d,s)?M:void 0}_+=u}}function zm(e,s,a,l,c,u,d,f,_){const y=Cm(l,u,d),b=Am(l,c),S=b*d,P=0===e[0].x||e[0].x===_||0===e[0].y||e[0].y===_;return s-S=0&&F<_&&B>=0&&B<_&&P-y>=0&&P+y<=b){const a=new kf(F,B,D,s);a._round(),l&&!Mm(e,a,u,l,c)||M.push(a)}}S+=C}return f||M.length||d||(M=km(e,S/2,a,l,c,u,d,!0,_)),M}function Rm(e,s,a,c){const u=[],d=e.image,f=d.pixelRatio,_=d.paddedRect.w-2,y=d.paddedRect.h-2;let b={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const S=d.stretchX||[[0,_]],P=d.stretchY||[[0,y]],M=(e,s)=>e+s[1]-s[0],C=S.reduce(M,0),D=P.reduce(M,0),L=_-C,F=y-D;let B=0,O=C,V=0,N=D,j=0,G=L,Z=0,q=F;if(d.content&&c){const s=d.content,a=s[2]-s[0],l=s[3]-s[1];(d.textFitWidth||d.textFitHeight)&&(b=xp(e)),B=Lm(S,0,s[0]),V=Lm(P,0,s[1]),O=Lm(S,s[0],s[2]),N=Lm(P,s[1],s[3]),j=s[0]-B,Z=s[1]-V,G=a-O,q=l-N}const W=b.x1,J=b.y1,Q=b.x2-W,se=b.y2-J,oe=(e,c,u,_)=>{const y=Bm(e.stretch-B,O,Q,W),b=Om(e.fixed-j,G,e.stretch,C),S=Bm(c.stretch-V,N,se,J),P=Om(c.fixed-Z,q,c.stretch,D),M=Bm(u.stretch-B,O,Q,W),L=Om(u.fixed-j,G,u.stretch,C),F=Bm(_.stretch-V,N,se,J),oe=Om(_.fixed-Z,q,_.stretch,D),ce=new l(y,S),pe=new l(M,S),fe=new l(M,F),xe=new l(y,F),ve=new l(b/f,P/f),be=new l(L/f,oe/f),we=s*Math.PI/180;if(we){const e=Math.sin(we),s=Math.cos(we),a=[s,-e,e,s];ce._matMult(a),pe._matMult(a),xe._matMult(a),fe._matMult(a)}const Te=e.stretch+e.fixed,Se=c.stretch+c.fixed;return{tl:ce,tr:pe,bl:xe,br:fe,tex:{x:d.paddedRect.x+1+Te,y:d.paddedRect.y+1+Se,w:u.stretch+u.fixed-Te,h:_.stretch+_.fixed-Se},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ve,pixelOffsetBR:be,minFontScaleX:G/f/Q,minFontScaleY:q/f/se,isSDF:a}};if(c&&(d.stretchX||d.stretchY)){const e=Fm(S,L,C),s=Fm(P,F,D);for(let a=0;a0&&(l=Math.max(10,l),this.circleDiameter=l)}else{const y=(null===(S=d.image)||void 0===S?void 0:S.content)&&(d.image.textFitWidth||d.image.textFitHeight)?xp(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};y.y1=y.y1*f-_[0],y.y2=y.y2*f+_[2],y.x1=y.x1*f-_[3],y.x2=y.x2*f+_[1];const P=d.collisionPadding;if(P&&(y.x1-=P[0]*f,y.y1-=P[1]*f,y.x2+=P[2]*f,y.y2+=P[3]*f),b){const e=new l(y.x1,y.y1),s=new l(y.x2,y.y1),a=new l(y.x1,y.y2),c=new l(y.x2,y.y2),u=b*Math.PI/180;e._rotate(u),s._rotate(u),a._rotate(u),c._rotate(u),y.x1=Math.min(e.x,s.x,a.x,c.x),y.x2=Math.max(e.x,s.x,a.x,c.x),y.y1=Math.min(e.y,s.y,a.y,c.y),y.y2=Math.max(e.y,s.y,a.y,c.y)}e.emplaceBack(s.x,s.y,y.x1,y.y1,y.x2,y.y2,a,c,u)}this.boxEndIndex=e.length}}class qf{constructor(e=[],s=(e,s)=>es?1:0){if(this.data=e,this.length=this.data.length,this.compare=s,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:s,compare:a}=this,l=s[e];for(;e>0;){const c=e-1>>1,u=s[c];if(a(l,u)>=0)break;s[e]=u,e=c}s[e]=l}_down(e){const{data:s,compare:a}=this,l=this.length>>1,c=s[e];for(;e=0)break;s[e]=s[l],e=l}s[e]=c}}function Vm(e,s=1,a=!1){const c=Oh.fromPoints(e[0]),u=Math.min(c.width(),c.height());let d=u/2;const f=new qf([],Nm),{minX:_,minY:y,maxX:b,maxY:S}=c;if(0===u)return new l(_,y);for(let s=_;sP.d||!P.d)&&(P=l,a&&console.log("found best %d after %d probes",Math.round(1e4*l.d)/1e4,M)),l.max-P.d<=s||(d=l.h/2,f.push(new jm(l.p.x-d,l.p.y-d,d,e)),f.push(new jm(l.p.x+d,l.p.y-d,d,e)),f.push(new jm(l.p.x-d,l.p.y+d,d,e)),f.push(new jm(l.p.x+d,l.p.y+d,d,e)),M+=4)}return a&&(console.log(`num probes: ${M}`),console.log(`best distance: ${P.d}`)),P.p}function Nm(e,s){return s.max-e.max}function jm(s,a,c,u){(this||e).p=new l(s,a),(this||e).h=c,(this||e).d=function(e,s){let a=!1,l=1/0;for(let c=0;ce.y!=f.y>e.y&&e.x<(f.x-c.x)*(e.y-c.y)/(f.y-c.y)+c.x&&(a=!a),l=Math.min(l,th(e,c,f))}}return(a?1:-1)*Math.sqrt(l)}((this||e).p,u),(this||e).max=(this||e).d+(this||e).h*Math.SQRT2}var Um;s.aJ=void 0,(Um=s.aJ||(s.aJ={}))[Um.center=1]="center",Um[Um.left=2]="left",Um[Um.right=3]="right",Um[Um.top=4]="top",Um[Um.bottom=5]="bottom",Um[Um["top-left"]=6]="top-left",Um[Um["top-right"]=7]="top-right",Um[Um["bottom-left"]=8]="bottom-left",Um[Um["bottom-right"]=9]="bottom-right";const Gm=Number.POSITIVE_INFINITY;function Zm(e,s){return s[1]!==Gm?function(e,s,a){let l=0,c=0;switch(s=Math.abs(s),a=Math.abs(a),e){case"top-right":case"top-left":case"top":c=a-7;break;case"bottom-right":case"bottom-left":case"bottom":c=7-a}switch(e){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,c]}(e,s[0],s[1]):function(e,s){let a=0,l=0;s<0&&(s=0);const c=s/Math.SQRT2;switch(e){case"top-right":case"top-left":l=c-7;break;case"bottom-right":case"bottom-left":l=7-c;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(e){case"top-right":case"bottom-right":a=-c;break;case"top-left":case"bottom-left":a=c;break;case"left":a=s;break;case"right":a=-s}return[a,l]}(e,s[0])}function qm(e,s,a){var l;const c=e.layout,u=null===(l=c.get("text-variable-anchor-offset"))||void 0===l?void 0:l.evaluate(s,{},a);if(u){const e=u.values,s=[];for(let a=0;ae*kd));l.startsWith("top")?c[1]-=7:l.startsWith("bottom")&&(c[1]+=7),s[a+1]=c}return new Ct(s)}const d=c.get("text-variable-anchor");if(d){let l;l=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[c.get("text-radial-offset").evaluate(s,{},a)*kd,Gm]:c.get("text-offset").evaluate(s,{},a).map((e=>e*kd));const u=[];for(const e of d)u.push(e,Zm(e,l));return new Ct(u)}return null}function $m(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Wm(e,a,l,c,u,d,f,_,y,b,S,P){let M=d.textMaxSize.evaluate(a,{});void 0===M&&(M=f);const C=e.layers[0].layout,D=C.get("icon-offset").evaluate(a,{},S),L=Xm(l.horizontal),F=f/24,B=e.tilePixelRatio*F,O=e.tilePixelRatio*M/24,V=e.tilePixelRatio*_,N=e.tilePixelRatio*C.get("symbol-spacing"),j=C.get("text-padding")*e.tilePixelRatio,G=function(e,s,a,l=1){const c=e.get("icon-padding").evaluate(s,{},a),u=c&&c.values;return[u[0]*l,u[1]*l,u[2]*l,u[3]*l]}(C,a,S,e.tilePixelRatio),Z=C.get("text-max-angle")/180*Math.PI,q="viewport"!==C.get("text-rotation-alignment")&&"point"!==C.get("symbol-placement"),W="map"===C.get("icon-rotation-alignment")&&"point"!==C.get("symbol-placement"),J=C.get("symbol-placement"),Q=N/2,se=C.get("icon-text-fit");let ce;c&&"none"!==se&&(e.allowVerticalPlacement&&l.vertical&&(ce=vp(c,l.vertical,se,C.get("icon-text-fit-padding"),D,F)),L&&(c=vp(c,L,se,C.get("icon-text-fit-padding"),D,F)));const pe=S?P.line.getGranularityForZoomLevel(S.z):1,fe=(_,P)=>{P.x<0||P.x>=oe||P.y<0||P.y>=oe||function(e,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O,V,N,j,G,Z,q){const W=e.addToLineVertexArray(a,l);let J,Q,se,oe,ce=0,pe=0,fe=0,xe=0,ve=-1,be=-1;const we={};let Te=Dc("");if(e.allowVerticalPlacement&&c.vertical){const e=_.layout.get("text-rotate").evaluate(N,{},Z)+90;se=new Uf(y,a,b,S,P,c.vertical,M,C,D,e),f&&(oe=new Uf(y,a,b,S,P,f,F,B,D,e))}if(u){const l=_.layout.get("icon-rotate").evaluate(N,{}),c="none"!==_.layout.get("icon-text-fit"),d=Rm(u,l,G,c),M=f?Rm(f,l,G,c):void 0;Q=new Uf(y,a,b,S,P,u,F,B,!1,l),ce=4*d.length;const C=e.iconSizeData;let D=null;"source"===C.kind?(D=[Pp*_.layout.get("icon-size").evaluate(N,{})],D[0]>Cp&&Le(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===C.kind&&(D=[Pp*j.compositeIconSizes[0].evaluate(N,{},Z),Pp*j.compositeIconSizes[1].evaluate(N,{},Z)],(D[0]>Cp||D[1]>Cp)&&Le(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,d,D,V,O,N,s.at.none,a,W.lineStartIndex,W.lineLength,-1,Z),ve=e.icon.placedSymbolArray.length-1,M&&(pe=4*M.length,e.addSymbols(e.icon,M,D,V,O,N,s.at.vertical,a,W.lineStartIndex,W.lineLength,-1,Z),be=e.icon.placedSymbolArray.length-1)}const Se=Object.keys(c.horizontal);for(const l of Se){const u=c.horizontal[l];if(!J){Te=Dc(u.text);const e=_.layout.get("text-rotate").evaluate(N,{},Z);J=new Uf(y,a,b,S,P,u,M,C,D,e)}const f=1===u.positionedLines.length;if(fe+=Hm(e,a,u,d,_,D,N,L,W,c.vertical?s.at.horizontal:s.at.horizontalOnly,f?Se:[l],we,ve,j,Z),f)break}c.vertical&&(xe+=Hm(e,a,c.vertical,d,_,D,N,L,W,s.at.vertical,["vertical"],we,be,j,Z));const Me=J?J.boxStartIndex:e.collisionBoxArray.length,Ee=J?J.boxEndIndex:e.collisionBoxArray.length,Ce=se?se.boxStartIndex:e.collisionBoxArray.length,Ae=se?se.boxEndIndex:e.collisionBoxArray.length,ke=Q?Q.boxStartIndex:e.collisionBoxArray.length,Fe=Q?Q.boxEndIndex:e.collisionBoxArray.length,Oe=oe?oe.boxStartIndex:e.collisionBoxArray.length,Ve=oe?oe.boxEndIndex:e.collisionBoxArray.length;let Ne=-1;const je=(e,s)=>e&&e.circleDiameter?Math.max(e.circleDiameter,s):s;Ne=je(J,Ne),Ne=je(se,Ne),Ne=je(Q,Ne),Ne=je(oe,Ne);const Ue=Ne>-1?1:0;Ue&&(Ne*=q/kd),e.glyphOffsetArray.length>=uh.MAX_GLYPHS&&Le("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==N.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,N.sortKey);const Ge=qm(_,N,Z),[Ze,qe]=function(e,a){const l=e.length,c=null==a?void 0:a.values;if((null==c?void 0:c.length)>0)for(let a=0;a=0?we.right:-1,we.center>=0?we.center:-1,we.left>=0?we.left:-1,we.vertical||-1,ve,be,Te,Me,Ee,Ce,Ae,ke,Fe,Oe,Ve,b,fe,xe,ce,pe,Ue,0,M,Ne,Ze,qe)}(e,P,_,l,c,u,ce,e.layers[0],e.collisionBoxArray,a.index,a.sourceLayerIndex,e.index,B,[j,j,j,j],q,y,V,G,W,D,a,d,b,S,f)};if("line"===J)for(const s of bm(a.geometry,0,0,oe,oe)){const a=Uu(s,pe),u=zm(a,N,Z,l.vertical||L,c,24,O,e.overscaling,oe);for(const s of u)L&&Ym(e,L.text,Q,s)||fe(a,s)}else if("line-center"===J){for(const e of a.geometry)if(e.length>1){const s=Uu(e,pe),a=Dm(s,Z,l.vertical||L,c,24,O);a&&fe(s,a)}}else if("Polygon"===a.type)for(const e of Pn(a.geometry,0)){const s=Vm(e,16);fe(Uu(e[0],pe,!0),new kf(s.x,s.y,0))}else if("LineString"===a.type)for(const e of a.geometry){const s=Uu(e,pe);fe(s,new kf(s[0].x,s[0].y,0))}else if("Point"===a.type)for(const e of a.geometry)for(const s of e)fe([s],new kf(s.x,s.y,0))}function Hm(e,s,a,c,u,d,f,_,y,b,S,P,M,C,D){const L=function(e,s,a,c,u,d,f,_){const y=c.layout.get("text-rotate").evaluate(d,{})*Math.PI/180,b=[];for(const e of s.positionedLines)for(const c of e.positionedGlyphs){if(!c.rect)continue;const d=c.rect||{};let S=4,P=!0,M=1,C=0;const D=(u||_)&&c.vertical,L=c.metrics.advance*c.scale/2;if(_&&s.verticalizable&&(C=e.lineOffset/2-(c.imageName?-(kd-c.metrics.width*c.scale)/2:(c.scale-1)*kd)),c.imageName){const e=f[c.imageName];P=e.sdf,M=e.pixelRatio,S=1/M}const F=u?[c.x+L,c.y]:[0,0];let B=u?[0,0]:[c.x+L+a[0],c.y+a[1]-C],O=[0,0];D&&(O=B,B=[0,0]);const V=c.metrics.isDoubleResolution?2:1,N=(c.metrics.left-S)*c.scale-L+B[0],j=(-c.metrics.top-S)*c.scale+B[1],G=N+d.w/V*c.scale/M,Z=j+d.h/V*c.scale/M,q=new l(N,j),W=new l(G,j),J=new l(N,Z),Q=new l(G,Z);if(D){const e=new l(-L,L- -17),s=-Math.PI/2,a=12-L,u=new l(22-a,-(c.imageName?a:0)),d=new l(...O);q._rotateAround(s,e)._add(u)._add(d),W._rotateAround(s,e)._add(u)._add(d),J._rotateAround(s,e)._add(u)._add(d),Q._rotateAround(s,e)._add(u)._add(d)}if(y){const e=Math.sin(y),s=Math.cos(y),a=[s,-e,e,s];q._matMult(a),W._matMult(a),J._matMult(a),Q._matMult(a)}const se=new l(0,0),oe=new l(0,0);b.push({tl:q,tr:W,bl:J,br:Q,tex:d,writingMode:s.writingMode,glyphOffset:F,sectionIndex:c.sectionIndex,isSDF:P,pixelOffsetTL:se,pixelOffsetBR:oe,minFontScaleX:0,minFontScaleY:0})}return b}(0,a,_,u,d,f,c,e.allowVerticalPlacement),F=e.textSizeData;let B=null;"source"===F.kind?(B=[Pp*u.layout.get("text-size").evaluate(f,{})],B[0]>Cp&&Le(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===F.kind&&(B=[Pp*C.compositeTextSizes[0].evaluate(f,{},D),Pp*C.compositeTextSizes[1].evaluate(f,{},D)],(B[0]>Cp||B[1]>Cp)&&Le(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,L,B,_,d,f,b,s,y.lineStartIndex,y.lineLength,M,D);for(const s of S)P[s]=e.text.placedSymbolArray.length-1;return 4*L.length}function Xm(e){for(const s in e)return e[s];return null}function Ym(e,s,a,l){const c=e.compareText;if(s in c){const e=c[s];for(let s=e.length-1;s>=0;s--)if(l.dist(e[s])>4;if(1!==l)throw new Error(`Got v${l} data when expected v1.`);const c=Km[15&a];if(!c)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new nd(d,u,c,e)}constructor(e,s=64,a=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const c=Km.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,f=(8-d%8)%8;if(c<0)throw new Error(`Unexpected typed array class: ${a}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+d+f),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+c]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=e)}add(e,s){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=s,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Jm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,s,a,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:u,nodeSize:d}=this,f=[0,c.length-1,0],_=[];for(;f.length;){const y=f.pop()||0,b=f.pop()||0,S=f.pop()||0;if(b-S<=d){for(let d=S;d<=b;d++){const f=u[2*d],y=u[2*d+1];f>=e&&f<=a&&y>=s&&y<=l&&_.push(c[d])}continue}const P=S+b>>1,M=u[2*P],C=u[2*P+1];M>=e&&M<=a&&C>=s&&C<=l&&_.push(c[P]),(0===y?e<=M:s<=C)&&(f.push(S),f.push(P-1),f.push(1-y)),(0===y?a>=M:l>=C)&&(f.push(P+1),f.push(b),f.push(1-y))}return _}within(e,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:u}=this,d=[0,l.length-1,0],f=[],_=a*a;for(;d.length;){const y=d.pop()||0,b=d.pop()||0,S=d.pop()||0;if(b-S<=u){for(let a=S;a<=b;a++)i_(c[2*a],c[2*a+1],e,s)<=_&&f.push(l[a]);continue}const P=S+b>>1,M=c[2*P],C=c[2*P+1];i_(M,C,e,s)<=_&&f.push(l[P]),(0===y?e-a<=M:s-a<=C)&&(d.push(S),d.push(P-1),d.push(1-y)),(0===y?e+a>=M:s+a>=C)&&(d.push(P+1),d.push(b),d.push(1-y))}return f}}function Jm(e,s,a,l,c,u){if(c-l<=a)return;const d=l+c>>1;Qm(e,s,d,l,c,u),Jm(e,s,a,l,d-1,1-u),Jm(e,s,a,d+1,c,1-u)}function Qm(e,s,a,l,c,u){for(;c>l;){if(c-l>600){const d=c-l+1,f=a-l+1,_=Math.log(d),y=.5*Math.exp(2*_/3),b=.5*Math.sqrt(_*y*(d-y)/d)*(f-d/2<0?-1:1);Qm(e,s,a,Math.max(l,Math.floor(a-f*y/d+b)),Math.min(c,Math.floor(a+(d-f)*y/d+b)),u)}const d=s[2*a+u];let f=l,_=c;for(e_(e,s,l,a),s[2*c+u]>d&&e_(e,s,l,c);f<_;){for(e_(e,s,f,_),f++,_--;s[2*f+u]d;)_--}s[2*l+u]===d?e_(e,s,l,_):(_++,e_(e,s,_,c)),_<=a&&(l=_+1),a<=_&&(c=_-1)}}function e_(e,s,a,l){t_(e,a,l),t_(s,2*a,2*l),t_(s,2*a+1,2*l+1)}function t_(e,s,a){const l=e[s];e[s]=e[a],e[a]=l}function i_(e,s,a,l){const c=e-a,u=s-l;return c*c+u*u}var r_;s.cB=void 0,(r_=s.cB||(s.cB={})).create="create",r_.load="load",r_.fullLoad="fullLoad";let n_=null,s_=[];const o_=1e3/60,a_="loadTime",l_="fullLoadTime",c_={mark(e){performance.mark(e)},frame(e){const s=e;null!=n_&&s_.push(s-n_),n_=s},clearMetrics(){n_=null,s_=[],performance.clearMeasures(a_),performance.clearMeasures(l_);for(const e in s.cB)performance.clearMarks(s.cB[e])},getPerformanceMetrics(){performance.measure(a_,s.cB.create,s.cB.load),performance.measure(l_,s.cB.create,s.cB.fullLoad);const e=performance.getEntriesByName(a_)[0].duration,a=performance.getEntriesByName(l_)[0].duration,l=s_.length,c=1/(s_.reduce(((e,s)=>e+s),0)/l/1e3),u=s_.filter((e=>e>o_)).reduce(((e,s)=>e+(s-o_)/o_),0);return{loadTime:e,fullLoadTime:a,fps:c,percentDroppedFrames:u/(l+u)*100,totalFrames:l}}};s.$=Ue,s.A=C,s.B=Ol,s.C=function([e,s,a]){return s+=90,s*=Math.PI/180,a*=Math.PI/180,{x:e*Math.cos(s)*Math.sin(a),y:e*Math.sin(s)*Math.sin(a),z:e*Math.cos(a)}},s.D=Os,s.E=ge,s.F=Or,s.G=Es,s.H=Nl,s.I=Ec,s.J=function(e){if(null==Ve){const s=e.navigator?e.navigator.userAgent:null;Ve=!!e.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Ve},s.K=class{constructor(e,s){this.target=e,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vh((()=>this.process())),this.subscription=qe(this.target,"message",(e=>this.receive(e)),!1),this.globalScope=Oe(self)?e:window}registerMessageHandler(e,s){this.messageHandlers[e]=s}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,s){return new Promise(((a,l)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),u=s?qe(s.signal,"abort",(()=>{null==u||u.unsubscribe(),delete this.resolveRejects[c];const s={id:c,type:"",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(s)}),ef):null;this.resolveRejects[c]={resolve:e=>{null==u||u.unsubscribe(),a(e)},reject:e=>{null==u||u.unsubscribe(),l(e)}};const d=[],f=Object.assign(Object.assign({},e),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Xl(e.data,d)});this.target.postMessage(f,{transfer:d})}))}receive(e){const s=e.data,a=s.id;if(!("file://"!==s.origin&&"file://"!==location.origin&&"resource://android"!==s.origin&&"resource://android"!==location.origin&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(""===s.type){delete this.tasks[a];const e=this.abortControllers[a];return delete this.abortControllers[a],void(e&&e.abort())}if(Oe(self)||s.mustQueue)return this.tasks[a]=s,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,s)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),s=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(e,s)}processTask(e,s){return a(this,void 0,void 0,(function*(){if(""===s.type){const a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;return void(s.error?a.reject(Yl(s.error)):a.resolve(Yl(s.data)))}if(!this.messageHandlers[s.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=Yl(s.data),l=new AbortController;this.abortControllers[e]=l;try{const c=yield this.messageHandlers[s.type](s.sourceMapId,a,l);this.completeTask(e,null,c)}catch(a){this.completeTask(e,a)}}))}completeTask(e,s,a){const l=[];delete this.abortControllers[e];const c={id:e,type:"",sourceMapId:this.mapId,origin:location.origin,error:s?Xl(s):null,data:Xl(a,l)};this.target.postMessage(c,{transfer:l})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},s.L=et,s.M=function(){var e=new C(16);return C!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},s.N=function(e,s,a){var l,c,u,d,f,_,y,b,S,P,M,C,D=a[0],L=a[1],F=a[2];return s===e?(e[12]=s[0]*D+s[4]*L+s[8]*F+s[12],e[13]=s[1]*D+s[5]*L+s[9]*F+s[13],e[14]=s[2]*D+s[6]*L+s[10]*F+s[14],e[15]=s[3]*D+s[7]*L+s[11]*F+s[15]):(c=s[1],u=s[2],d=s[3],f=s[4],_=s[5],y=s[6],b=s[7],S=s[8],P=s[9],M=s[10],C=s[11],e[0]=l=s[0],e[1]=c,e[2]=u,e[3]=d,e[4]=f,e[5]=_,e[6]=y,e[7]=b,e[8]=S,e[9]=P,e[10]=M,e[11]=C,e[12]=l*D+f*L+S*F+s[12],e[13]=c*D+_*L+P*F+s[13],e[14]=u*D+y*L+M*F+s[14],e[15]=d*D+b*L+C*F+s[15]),e},s.O=function(e,s,a){var l=a[0],c=a[1],u=a[2];return e[0]=s[0]*l,e[1]=s[1]*l,e[2]=s[2]*l,e[3]=s[3]*l,e[4]=s[4]*c,e[5]=s[5]*c,e[6]=s[6]*c,e[7]=s[7]*c,e[8]=s[8]*u,e[9]=s[9]*u,e[10]=s[10]*u,e[11]=s[11]*u,e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],e},s.P=l,s.Q=function(e,s,a){var l=s[0],c=s[1],u=s[2],d=s[3],f=s[4],_=s[5],y=s[6],b=s[7],S=s[8],P=s[9],M=s[10],C=s[11],D=s[12],L=s[13],F=s[14],B=s[15],O=a[0],V=a[1],N=a[2],j=a[3];return e[0]=O*l+V*f+N*S+j*D,e[1]=O*c+V*_+N*P+j*L,e[2]=O*u+V*y+N*M+j*F,e[3]=O*d+V*b+N*C+j*B,e[4]=(O=a[4])*l+(V=a[5])*f+(N=a[6])*S+(j=a[7])*D,e[5]=O*c+V*_+N*P+j*L,e[6]=O*u+V*y+N*M+j*F,e[7]=O*d+V*b+N*C+j*B,e[8]=(O=a[8])*l+(V=a[9])*f+(N=a[10])*S+(j=a[11])*D,e[9]=O*c+V*_+N*P+j*L,e[10]=O*u+V*y+N*M+j*F,e[11]=O*d+V*b+N*C+j*B,e[12]=(O=a[12])*l+(V=a[13])*f+(N=a[14])*S+(j=a[15])*D,e[13]=O*c+V*_+N*P+j*L,e[14]=O*u+V*y+N*M+j*F,e[15]=O*d+V*b+N*C+j*B,e},s.R=gl,s.S=function(e,s){const a={};for(let l=0;l!l.has(e.id)))),f.update&&(f.update=f.update.filter((e=>!l.has(e.id))));const c=new Set((null!==(a=e.add)&&void 0!==a?a:[]).map((e=>e.id)));s.remove=s.remove.filter((e=>!c.has(e)))}if(s.remove){const e=new Set(f.remove?f.remove.concat(s.remove):s.remove);f.remove=Array.from(e.values())}if(s.add){const e=f.add?f.add.concat(s.add):s.add,a=new Map(e.map((e=>[e.id,e])));f.add=Array.from(a.values())}if(s.update){const e=new Map(null===(l=f.update)||void 0===l?void 0:l.map((e=>[e.id,e])));for(const a of s.update){const s=null!==(c=e.get(a.id))&&void 0!==c?c:{id:a.id};a.newGeometry&&(s.newGeometry=a.newGeometry),a.addOrUpdateProperties&&(s.addOrUpdateProperties=(null!==(u=s.addOrUpdateProperties)&&void 0!==u?u:[]).concat(a.addOrUpdateProperties)),a.removeProperties&&(s.removeProperties=(null!==(d=s.removeProperties)&&void 0!==d?d:[]).concat(a.removeProperties)),a.removeAllProperties&&(s.removeAllProperties=!0),e.set(a.id,s)}f.update=Array.from(e.values())}return f.remove&&f.add&&(f.remove=f.remove.filter((e=>-1===f.add.findIndex((s=>s.id===e))))),f},s.a5=Fh,s.a6=Oh,s.a7=25,s.a8=Ph,s.a9=e=>{const s=window.document.createElement("video");return s.muted=!0,new Promise((a=>{s.onloadstart=()=>{a(s)};for(const a of e){const e=window.document.createElement("source");ht(a)||(s.crossOrigin="Anonymous"),e.src=a,s.appendChild(e)}}))},s.aA=Vp,s.aB=q,s.aC=function(e,s,a,c){const u=s.y-e.y,d=s.x-e.x,f=c.y-a.y,_=c.x-a.x,y=f*d-_*u;if(0===y)return null;const b=(_*(e.y-a.y)-f*(e.x-a.x))/y;return new l(e.x+b*d,e.y+b*u)},s.aD=bm,s.aE=Hc,s.aF=function(e){let s=1/0,a=1/0,l=-1/0,c=-1/0;for(const u of e)s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x),c=Math.max(c,u.y);return[s,a,l,c]},s.aG=kd,s.aH=ce,s.aI=function(e,s,a,l,c=!1){if(!a[0]&&!a[1])return[0,0];const u=c?"map"===l?-e.bearingInRadians:0:"viewport"===l?e.bearingInRadians:0;if(u){const e=Math.sin(u),s=Math.cos(u);a=[a[0]*s-a[1]*e,a[0]*e+a[1]*s]}return[c?a[0]:ce(s,a[0],e.zoom),c?a[1]:ce(s,a[1],e.zoom)]},s.aK=Lp,s.aL=$m,s.aM=hp,s.aN=nd,s.aO=_c,s.aP=au,s.aQ=Ca,s.aR=Qa,s.aS=Ha,s.aT=We,s.aU=_f,s.aV=N,s.aW=V,s.aX=function(e){var s=new C(3);return s[0]=e[0],s[1]=e[1],s[2]=e[2],s},s.aY=function(e,s,a){return e[0]=s[0]-a[0],e[1]=s[1]-a[1],e[2]=s[2]-a[2],e},s.aZ=function(e,s){var a=s[0],l=s[1],c=s[2],u=a*a+l*l+c*c;return u>0&&(u=1/Math.sqrt(u)),e[0]=s[0]*u,e[1]=s[1]*u,e[2]=s[2]*u,e},s.a_=j,s.aa=De,s.ab=function(){return Me++},s.ac=Ta,s.ad=uh,s.ae=co,s.af=qc,s.ag=Nh,s.ah=function(e){const s={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,a,l,c)=>{const u=l||c;return s[a]=!u||u.toLowerCase(),""})),s["max-age"]){const e=parseInt(s["max-age"],10);isNaN(e)?delete s["max-age"]:s["max-age"]=e}return s},s.ai=we,s.aj=85.051129,s.ak=$e,s.al=function(e){return Math.pow(2,e)},s.am=L,s.an=pf,s.ao=function(e){return Math.log(e)/Math.LN2},s.ap=function(e){var s=e[0],a=e[1];return s*s+a*a},s.aq=class{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(const e in this.data)for(const s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,a){const l=e.wrapped().key;void 0===this.data[l]&&(this.data[l]=[]);const c={value:s,timeout:void 0};if(void 0!==a&&(c.timeout=setTimeout((()=>{this.remove(e,c)}),a)),this.data[l].push(c),this.order.push(l),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){const s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;const a=e.wrapped().key,l=void 0===s?0:this.data[a].indexOf(s),c=this.data[a][l];return this.data[a].splice(l,1),c.timeout&&clearTimeout(c.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(c.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const s=[];for(const a in this.data)for(const l of this.data[a])e(l.value)||s.push(l);for(const e of s)this.remove(e.value.tileID,e)}},s.ar=function(e){if(!e.length)return new Set;const s=Math.max(...e.map((e=>e.canonical.z)));let a=1/0,l=-1/0,c=1/0,u=-1/0;const d=[];for(const f of e){const{x:e,y:_,z:y}=f.canonical,b=Math.pow(2,s-y),S=e*b,P=_*b;d.push({id:f,x:S,y:P}),Sl&&(l=S),Pu&&(u=P)}const f=new Set;for(const e of d)e.x!==a&&e.x!==l&&e.y!==c&&e.y!==u||f.add(e.id);return f},s.as=function(e,s){let a=0,l=0;if("constant"===e.kind)l=e.layoutSize;else if("source"!==e.kind){const{interpolationType:c,minZoom:u,maxZoom:d}=e,f=c?we(pr.interpolationFactor(c,s,u,d),0,1):0;"camera"===e.kind?l=Or.number(e.minSize,e.maxSize,f):a=f}return{uSizeT:a,uSize:l}},s.au=function(e,{uSize:s,uSizeT:a},{lowerSize:l,upperSize:c}){return"source"===e.kind?l/Pp:"composite"===e.kind?Or.number(l/Pp,c/Pp,a):s},s.av=function(e,s){var a=s[0],l=s[1],c=s[2],u=s[3],d=s[4],f=s[5],_=s[6],y=s[7],b=s[8],S=s[9],P=s[10],M=s[11],C=s[12],D=s[13],L=s[14],F=s[15],B=a*f-l*d,O=a*_-c*d,V=a*y-u*d,N=l*_-c*f,j=l*y-u*f,G=c*y-u*_,Z=b*D-S*C,q=b*L-P*C,W=b*F-M*C,J=S*L-P*D,Q=S*F-M*D,se=P*F-M*L,oe=B*se-O*Q+V*J+N*W-j*q+G*Z;return oe?(e[0]=(f*se-_*Q+y*J)*(oe=1/oe),e[1]=(c*Q-l*se-u*J)*oe,e[2]=(D*G-L*j+F*N)*oe,e[3]=(P*j-S*G-M*N)*oe,e[4]=(_*W-d*se-y*q)*oe,e[5]=(a*se-c*W+u*q)*oe,e[6]=(L*V-C*G-F*O)*oe,e[7]=(b*G-P*V+M*O)*oe,e[8]=(d*Q-f*W+y*Z)*oe,e[9]=(l*W-a*Q-u*Z)*oe,e[10]=(C*j-D*V+F*B)*oe,e[11]=(S*V-b*j-M*B)*oe,e[12]=(f*q-d*J-_*Z)*oe,e[13]=(a*J-l*q+c*Z)*oe,e[14]=(D*O-C*N-L*B)*oe,e[15]=(b*N-S*O+P*B)*oe,e):null},s.aw=Q,s.ax=function(e){var s=e[0],a=e[1];return Math.sqrt(s*s+a*a)},s.ay=function(e){return e[0]=0,e[1]=0,e},s.az=function(e,s,a){return e[0]=s[0]*a,e[1]=s[1]*a,e},s.b=Ne,s.b$=function(e,s){var a=Math.sin(s),l=Math.cos(s);return e[0]=l,e[1]=a,e[2]=0,e[3]=-a,e[4]=l,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},s.b0=function(e,s,a){return e[0]=s[0]*a[0],e[1]=s[1]*a[1],e[2]=s[2]*a[2],e[3]=s[3]*a[3],e},s.b1=B,s.b2=function(e,s,a){const l=s[0]*a[0]+s[1]*a[1]+s[2]*a[2];return 0===l?null:(-(e[0]*a[0]+e[1]*a[1]+e[2]*a[2])-a[3])/l},s.b3=Z,s.b4=function(e,s,a){return e[0]=s[0]*a,e[1]=s[1]*a,e[2]=s[2]*a,e[3]=s[3]*a,e},s.b5=function(e,s){return e[0]*s[0]+e[1]*s[1]+e[2]*s[2]+e[3]},s.b6=zh,s.b7=wf,s.b8=function(e,s,a,l,c){var u=1/Math.tan(s/2);if(e[0]=u/a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=c&&c!==1/0){var d=1/(l-c);e[10]=(c+l)*d,e[14]=2*c*l*d}else e[10]=-1,e[14]=-2*l;return e},s.b9=function(e){var s=new C(16);return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],s},s.bA=function(e,s,a,l){var c=[],u=[];return c[0]=s[0]-a[0],c[1]=s[1]-a[1],c[2]=s[2]-a[2],u[0]=c[0]*Math.cos(l)-c[1]*Math.sin(l),u[1]=c[0]*Math.sin(l)+c[1]*Math.cos(l),u[2]=c[2],e[0]=u[0]+a[0],e[1]=u[1]+a[1],e[2]=u[2]+a[2],e},s.bB=function(e,s,a,l){var c=[],u=[];return c[0]=s[0]-a[0],c[1]=s[1]-a[1],c[2]=s[2]-a[2],u[0]=c[0],u[1]=c[1]*Math.cos(l)-c[2]*Math.sin(l),u[2]=c[1]*Math.sin(l)+c[2]*Math.cos(l),e[0]=u[0]+a[0],e[1]=u[1]+a[1],e[2]=u[2]+a[2],e},s.bC=function(e,s,a,l){var c=[],u=[];return c[0]=s[0]-a[0],c[1]=s[1]-a[1],c[2]=s[2]-a[2],u[0]=c[2]*Math.sin(l)+c[0]*Math.cos(l),u[1]=c[1],u[2]=c[2]*Math.cos(l)-c[0]*Math.sin(l),e[0]=u[0]+a[0],e[1]=u[1]+a[1],e[2]=u[2]+a[2],e},s.bD=function(e,s,a){var l=Math.sin(a),c=Math.cos(a),u=s[0],d=s[1],f=s[2],_=s[3],y=s[8],b=s[9],S=s[10],P=s[11];return s!==e&&(e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15]),e[0]=u*c-y*l,e[1]=d*c-b*l,e[2]=f*c-S*l,e[3]=_*c-P*l,e[8]=u*l+y*c,e[9]=d*l+b*c,e[10]=f*l+S*c,e[11]=_*l+P*c,e},s.bE=function(e,s){const a=pe(e,360),l=pe(s,360),c=l-a,u=l>a?c-360:c+360;return Math.abs(c)0?d:-d},s.bH=function(e,s){const a=pe(e,2*Math.PI),l=pe(s,2*Math.PI);return Math.min(Math.abs(a-l),Math.abs(a-l+2*Math.PI),Math.abs(a-l-2*Math.PI))},s.bI=function(){const e={},s=pt.$version;for(const a in pt.$root){const l=pt.$root[a];if(l.required){let c=null;c="version"===a?s:"array"===l.type?[]:{},null!=c&&(e[a]=c)}}return e},s.bJ=nt,s.bK=ds,s.bL=function e(s,a){if(Array.isArray(s)){if(!Array.isArray(a)||s.length!==a.length)return!1;for(let l=0;l"raster"===e.type,s.bP=Ae,s.bQ=function(e,s){if(!e)return[{command:"setStyle",args:[s]}];let a=[];try{if(!_t(e.version,s.version))return[{command:"setStyle",args:[s]}];_t(e.center,s.center)||a.push({command:"setCenter",args:[s.center]}),_t(e.state,s.state)||a.push({command:"setGlobalState",args:[s.state]}),_t(e.centerAltitude,s.centerAltitude)||a.push({command:"setCenterAltitude",args:[s.centerAltitude]}),_t(e.zoom,s.zoom)||a.push({command:"setZoom",args:[s.zoom]}),_t(e.bearing,s.bearing)||a.push({command:"setBearing",args:[s.bearing]}),_t(e.pitch,s.pitch)||a.push({command:"setPitch",args:[s.pitch]}),_t(e.roll,s.roll)||a.push({command:"setRoll",args:[s.roll]}),_t(e.sprite,s.sprite)||a.push({command:"setSprite",args:[s.sprite]}),_t(e.glyphs,s.glyphs)||a.push({command:"setGlyphs",args:[s.glyphs]}),_t(e.transition,s.transition)||a.push({command:"setTransition",args:[s.transition]}),_t(e.light,s.light)||a.push({command:"setLight",args:[s.light]}),_t(e.terrain,s.terrain)||a.push({command:"setTerrain",args:[s.terrain]}),_t(e.sky,s.sky)||a.push({command:"setSky",args:[s.sky]}),_t(e.projection,s.projection)||a.push({command:"setProjection",args:[s.projection]});const l={},c=[];!function(e,s,a,l){let c;for(c in s=s||{},e=e||{})Object.prototype.hasOwnProperty.call(e,c)&&(Object.prototype.hasOwnProperty.call(s,c)||vt(c,a,l));for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&(Object.prototype.hasOwnProperty.call(e,c)?_t(e[c],s[c])||("geojson"===e[c].type&&"geojson"===s[c].type&&Rt(e,s,c)?gt(a,{command:"setGeoJSONSourceData",args:[c,s[c].data]}):Et(c,s,a,l)):yt(c,s,a))}(e.sources,s.sources,c,l);const u=[];e.layers&&e.layers.forEach((e=>{"source"in e&&l[e.source]?a.push({command:"removeLayer",args:[e.id]}):u.push(e)})),a=a.concat(c),function(e,s,a){s=s||[];const l=(e=e||[]).map(Zt),c=s.map(Zt),u=e.reduce($t,{}),d=s.reduce($t,{}),f=l.slice(),_=Object.create(null);let y,b,S,P,M;for(let e=0,s=0;eM?(c=Math.acos(u),d=Math.sin(c),f=Math.sin((1-l)*c)/d,_=Math.sin(l*c)/d):(f=1-l,_=l),e[0]=f*y+_*C,e[1]=f*b+_*D,e[2]=f*S+_*L,e[3]=f*P+_*F,e},s.bh=function(e){const s=new Float64Array(9);var a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O;S=(c=(l=e)[0])*(_=c+c),P=(u=l[1])*_,C=(d=l[2])*_,D=d*(y=u+u),F=(f=l[3])*_,B=f*y,O=f*(b=d+d),(a=s)[0]=1-(M=u*y)-(L=d*b),a[3]=P-O,a[6]=C+B,a[1]=P+O,a[4]=1-S-L,a[7]=D-F,a[2]=C-B,a[5]=D+F,a[8]=1-S-M;const V=We(-Math.asin(we(s[2],-1,1)));let N,j;return Math.hypot(s[5],s[8])<.001?(N=0,j=-We(Math.atan2(s[3],s[4]))):(N=We(0===s[5]&&0===s[8]?0:Math.atan2(s[5],s[8])),j=We(0===s[1]&&0===s[0]?0:Math.atan2(s[1],s[0]))),{roll:N,pitch:V+90,bearing:j}},s.bi=function(e,s){return e.roll==s.roll&&e.pitch==s.pitch&&e.bearing==s.bearing},s.bj=It,s.bk=go,s.bl=Vu,s.bm=Nu,s.bn=su,s.bo=fe,s.bp=xe,s.bq=Ot,s.br=function(e,s,a,l,c){return fe(l,c,we((e-s)/(a-s),0,1))},s.bs=pe,s.bt=function(){return new Float64Array(3)},s.bu=function(e,s,a,l){return e[0]=s[0]+a[0]*l,e[1]=s[1]+a[1]*l,e[2]=s[2]+a[2]*l,e},s.bv=J,s.bw=function(e,s,a){var l=a[0],c=a[1],u=a[2],d=a[3],f=s[0],_=s[1],y=s[2],b=c*y-u*_,S=u*f-l*y,P=l*_-c*f;return e[0]=f+d*(b+=b)+c*(P+=P)-u*(S+=S),e[1]=_+d*S+u*b-l*P,e[2]=y+d*P+l*S-c*b,e},s.bx=function(e,s,a){const l=(c=[e[0],e[1],e[2],s[0],s[1],s[2],a[0],a[1],a[2]])[0]*((b=c[8])*(d=c[4])-(f=c[5])*(y=c[7]))+c[1]*(-b*(u=c[3])+f*(_=c[6]))+c[2]*(y*u-d*_);var c,u,d,f,_,y,b;if(0===l)return null;const S=j([],[s[0],s[1],s[2]],[a[0],a[1],a[2]]),P=j([],[a[0],a[1],a[2]],[e[0],e[1],e[2]]),M=j([],[e[0],e[1],e[2]],[s[0],s[1],s[2]]),C=N([],S,-e[3]);return V(C,C,N([],P,-s[3])),V(C,C,N([],M,-a[3])),N(C,C,1/l),C},s.by=tf,s.bz=function(){return new Float64Array(4)},s.c=Ke,s.c$=function(e,s){const a=new Map;if(null==e);else if("Feature"===e.type)a.set(Tf(e,s),e);else for(const l of e.features)a.set(Tf(l,s),l);return a},s.c0=function(e,s,a){var l=s[0],c=s[1],u=s[2];return e[0]=l*a[0]+c*a[3]+u*a[6],e[1]=l*a[1]+c*a[4]+u*a[7],e[2]=l*a[2]+c*a[5]+u*a[8],e},s.c1=function(e,s,a,l,c,u,d){var f=1/(s-a),_=1/(l-c),y=1/(u-d);return e[0]=-2*f,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*_,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*y,e[11]=0,e[12]=(s+a)*f,e[13]=(c+l)*_,e[14]=(d+u)*y,e[15]=1,e},s.c2=class extends mo{constructor(e,s){super(e,s),this.current=new Array}set(e){if(e!=this.current){this.current=e;const s=new Float32Array(4*e.length);for(let a=0;ae*kd))}let O=f?"center":l.get("text-justify").evaluate(c,{},e.canonical);const V="point"===l.get("symbol-placement")?l.get("text-max-width").evaluate(c,{},e.canonical)*kd:1/0,N=()=>{e.bucket.allowVerticalPlacement&&Ql(u)&&(C.vertical=Qd(D,e.glyphMap,e.glyphPositions,e.imagePositions,b,V,d,L,"left",M,F,s.at.vertical,!0,P,S))};if(!f&&B){const a=new Set;if("auto"===O)for(let e=0;e=this.maxEntries){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,s)}clear(){this.map.clear()}},s.cU=Eu,s.cV=vf,s.cW=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},s.cX=function(s,l,c,u,d){return a(this||e,void 0,void 0,(function*(){if(P())try{return yield Ue(s,l,c,u,d)}catch(e){}return function(e,s,a,l,c){const u=e.width,d=e.height;Ge&&Ze||(Ge=new OffscreenCanvas(u,d),Ze=Ge.getContext("2d",{willReadFrequently:!0})),Ge.width=u,Ge.height=d,Ze.drawImage(e,0,0,u,d);const f=Ze.getImageData(s,a,l,c);return Ze.clearRect(0,0,u,d),f.data}(s,l,c,u,d)}))},s.cY=Ml,s.cZ=c,s.c_=js,s.ca=function(e,s,a){var l=s[0],c=s[1],u=s[2],d=a[3]*l+a[7]*c+a[11]*u+a[15];return e[0]=(a[0]*l+a[4]*c+a[8]*u+a[12])/(d=d||1),e[1]=(a[1]*l+a[5]*c+a[9]*u+a[13])/d,e[2]=(a[2]*l+a[6]*c+a[10]*u+a[14])/d,e},s.cb=class extends ra{},s.cc=class extends _a{},s.cd=function(e,s){return e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]&&e[3]===s[3]&&e[4]===s[4]&&e[5]===s[5]&&e[6]===s[6]&&e[7]===s[7]&&e[8]===s[8]&&e[9]===s[9]&&e[10]===s[10]&&e[11]===s[11]&&e[12]===s[12]&&e[13]===s[13]&&e[14]===s[14]&&e[15]===s[15]},s.ce=function(e,s){var a=e[0],l=e[1],c=e[2],u=e[3],d=e[4],f=e[5],_=e[6],y=e[7],b=e[8],S=e[9],P=e[10],C=e[11],D=e[12],L=e[13],F=e[14],B=e[15],O=s[0],V=s[1],N=s[2],j=s[3],G=s[4],Z=s[5],q=s[6],W=s[7],J=s[8],Q=s[9],se=s[10],oe=s[11],ce=s[12],pe=s[13],fe=s[14],xe=s[15];return Math.abs(a-O)<=M*Math.max(1,Math.abs(a),Math.abs(O))&&Math.abs(l-V)<=M*Math.max(1,Math.abs(l),Math.abs(V))&&Math.abs(c-N)<=M*Math.max(1,Math.abs(c),Math.abs(N))&&Math.abs(u-j)<=M*Math.max(1,Math.abs(u),Math.abs(j))&&Math.abs(d-G)<=M*Math.max(1,Math.abs(d),Math.abs(G))&&Math.abs(f-Z)<=M*Math.max(1,Math.abs(f),Math.abs(Z))&&Math.abs(_-q)<=M*Math.max(1,Math.abs(_),Math.abs(q))&&Math.abs(y-W)<=M*Math.max(1,Math.abs(y),Math.abs(W))&&Math.abs(b-J)<=M*Math.max(1,Math.abs(b),Math.abs(J))&&Math.abs(S-Q)<=M*Math.max(1,Math.abs(S),Math.abs(Q))&&Math.abs(P-se)<=M*Math.max(1,Math.abs(P),Math.abs(se))&&Math.abs(C-oe)<=M*Math.max(1,Math.abs(C),Math.abs(oe))&&Math.abs(D-ce)<=M*Math.max(1,Math.abs(D),Math.abs(ce))&&Math.abs(L-pe)<=M*Math.max(1,Math.abs(L),Math.abs(pe))&&Math.abs(F-fe)<=M*Math.max(1,Math.abs(F),Math.abs(fe))&&Math.abs(B-xe)<=M*Math.max(1,Math.abs(B),Math.abs(xe))},s.cf=function(e,s){return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],e},s.cg=e=>"symbol"===e.type,s.ch=e=>"circle"===e.type,s.ci=e=>"heatmap"===e.type,s.cj=e=>"line"===e.type,s.ck=e=>"fill"===e.type,s.cl=e=>"fill-extrusion"===e.type,s.cm=e=>"hillshade"===e.type,s.cn=e=>"color-relief"===e.type,s.co=e=>"background"===e.type,s.cp=e=>"custom"===e.type,s.cq=ve,s.cr=function(e,s,a){const l=se(s.x-a.x,s.y-a.y),c=se(e.x-a.x,e.y-a.y);var u,d;return We(Math.atan2(l[0]*c[1]-l[1]*c[0],(u=l)[0]*(d=c)[0]+u[1]*d[1]))},s.cs=be,s.ct=function(e,s){return Xe[s]&&(e instanceof MouseEvent||e instanceof WheelEvent)},s.cu=function(e,s){return He[s]&&"touches"in e},s.cv=function(e){return He[e]||Xe[e]},s.cw=function(e,s,a){var l=s[0],c=s[1];return e[0]=a[0]*l+a[4]*c+a[12],e[1]=a[1]*l+a[5]*c+a[13],e},s.cx=function(e,s){const{x:a,y:l}=Fh.fromLngLat(s);return!(e<0||e>25||l<0||l>=1||a<0||a>=1)},s.cy=function(e,s){return e[0]=s[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=s[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},s.cz=class extends ta{},s.d=ht,s.d0=function(e,s){if(null==e)return!0;if("Feature"===e.type)return null!=Tf(e,s);if("FeatureCollection"===e.type){const a=new Set;for(const l of e.features){const e=Tf(l,s);if(null==e)return!1;if(a.has(e))return!1;a.add(e)}return!0}return!1},s.d1=function(e,s,a){var l,c,u,d;if(s.removeAll&&e.clear(),s.remove)for(const a of s.remove)e.delete(a);if(s.add)for(const l of s.add){const s=Tf(l,a);null!=s&&e.set(s,l)}if(s.update)for(const a of s.update){let s=e.get(a.id);if(null==s)continue;const f=!a.removeAllProperties&&((null===(l=a.removeProperties)||void 0===l?void 0:l.length)>0||(null===(c=a.addOrUpdateProperties)||void 0===c?void 0:c.length)>0);if((a.newGeometry||a.removeAllProperties||f)&&(s=Object.assign({},s),e.set(a.id,s),f&&(s.properties=Object.assign({},s.properties))),a.newGeometry&&(s.geometry=a.newGeometry),a.removeAllProperties)s.properties={};else if((null===(u=a.removeProperties)||void 0===u?void 0:u.length)>0)for(const e of a.removeProperties)Object.prototype.hasOwnProperty.call(s.properties,e)&&delete s.properties[e];if((null===(d=a.addOrUpdateProperties)||void 0===d?void 0:d.length)>0)for(const{key:e,value:l}of a.addOrUpdateProperties)s.properties[e]=l}},s.d2=cc,s.e=Se,s.f=e=>a(void 0,void 0,void 0,(function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(s)}catch(e){throw new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),s.g=Qe,s.h=e=>new Promise(((s,a)=>{const l=new Image;l.onload=()=>{s(l),URL.revokeObjectURL(l.src),l.onload=null,window.requestAnimationFrame((()=>{l.src=je}))},l.onerror=()=>a(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 c=new Blob([new Uint8Array(e)],{type:"image/png"});l.src=e.byteLength?URL.createObjectURL(c):je})),s.i=Oe,s.j=(e,s)=>ct(Se(e,{type:"json"}),s),s.k=me,s.l=ye,s.m=ct,s.n=(e,s)=>ct(Se(e,{type:"arrayBuffer"}),s),s.o=function(e){return new pc(e).readFields(Hd,[])},s.p=Kd,s.q=function(e){return/[\u1100-\u11FF\u3000-\u30FF\u3131-\u318E\u31F0-\u321E\u3260-\u327E\u32D0-\u32FE\u3300-\u3357\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFF00-\uFFEF]|\uD81B[\uDFE4\uDFF2-\uDFF6]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD83C\uDE00|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},s.r=ml,s.s=qe,s.t=qs,s.u=pt,s.v=Bl,s.w=Le,s.x=Bs,s.y=Vl,s.z=Gl}));l("worker",["./shared"],(function(e){class t{constructor(e,s){this.keyCache={},e&&this.replace(e,s)}replace(e,s){this._layerConfigs={},this._layers={},this.update(e,[],s)}update(s,a,l){for(const a of s){this._layerConfigs[a.id]=a;const s=this._layers[a.id]=e.bN(a,l);s._featureFilter=e.ae(s.filter,l),this.keyCache[a.id]&&delete this.keyCache[a.id]}for(const e of a)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const c=e.cG(Object.values(this._layerConfigs),this.keyCache);for(const e of c){const s=e.map((e=>this._layers[e.id])),a=s[0];if("none"===a.visibility)continue;const l=a.source||"";let c=this.familiesBySource[l];c||(c=this.familiesBySource[l]={});const u=a.sourceLayer||"_geojsonTileLayer";let d=c[u];d||(d=c[u]=[]),d.push(s)}}}class i{constructor(s){const a={},l=[];for(const e in s){const c=s[e],u=a[e]={};for(const e in c){const s=c[+e];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const a={x:0,y:0,w:s.bitmap.width+2,h:s.bitmap.height+2};l.push(a),u[e]={rect:a,metrics:s.metrics}}}const{w:c,h:u}=e.p(l),d=new e.r({width:c||1,height:u||1});for(const l in s){const c=s[l];for(const s in c){const u=c[+s];if(!u||0===u.bitmap.width||0===u.bitmap.height)continue;const f=a[l][s].rect;e.r.copy(u.bitmap,d,{x:0,y:0},{x:f.x+1,y:f.y+1},u.bitmap)}}this.image=d,this.positions=a}}e.cH("GlyphAtlas",i);class o{constructor(s){this.tileID=new e.a0(s.tileID.overscaledZ,s.tileID.wrap,s.tileID.canonical.z,s.tileID.canonical.x,s.tileID.canonical.y),this.uid=s.uid,this.zoom=s.zoom,this.pixelRatio=s.pixelRatio,this.tileSize=s.tileSize,this.source=s.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=s.showCollisionBoxes,this.collectResourceTiming=!!s.collectResourceTiming,this.returnDependencies=!!s.returnDependencies,this.promoteId=s.promoteId,this.inFlightDependencies=[]}parse(a,l,c,u,d){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=a,this.collisionBoxArray=new e.ac;const f=new e.cI(Object.keys(a.layers).sort()),_=new e.cJ(this.tileID,this.promoteId);_.bucketLayerIDs=[];const y={},b={featureIndex:_,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:c,subdivisionGranularity:d},S=l.familiesBySource[this.source];for(const l in S){const u=a.layers[l];if(!u)continue;1===u.version&&e.w(`Vector tile source "${this.source}" layer "${l}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const d=f.encode(l),P=[];for(let e=0;ee.id))))}}const P=e.bS(b.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let M=Promise.resolve({});if(Object.keys(P).length){const e=new AbortController;this.inFlightDependencies.push(e),M=u.sendAsync({type:"GG",data:{stacks:P,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const C=Object.keys(b.iconDependencies);let D=Promise.resolve({});if(C.length){const e=new AbortController;this.inFlightDependencies.push(e),D=u.sendAsync({type:"GI",data:{icons:C,source:this.source,tileID:this.tileID,type:"icons"}},e)}const L=Object.keys(b.patternDependencies);let F=Promise.resolve({});if(L.length){const e=new AbortController;this.inFlightDependencies.push(e),F=u.sendAsync({type:"GI",data:{icons:L,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const B=b.dashDependencies;let O=Promise.resolve({});if(Object.keys(B).length){const e=new AbortController;this.inFlightDependencies.push(e),O=u.sendAsync({type:"GDA",data:{dashes:B}},e)}const[V,N,j,G]=yield Promise.all([M,D,F,O]),Z=new i(V),q=new e.cK(N,j);for(const a in y){const l=y[a];l instanceof e.ad?(s(l.layers,this.zoom,c),e.cL({bucket:l,glyphMap:V,glyphPositions:Z.positions,imageMap:N,imagePositions:q.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:b.subdivisionGranularity})):l.hasDependencies&&(l instanceof e.cM||l instanceof e.cN||l instanceof e.cO)&&(s(l.layers,this.zoom,c),l.addFeatures(b,this.tileID.canonical,q.patternPositions,G))}return this.status="done",{buckets:Object.values(y).filter((e=>!e.isEmpty())),featureIndex:_,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Z.image,imageAtlas:q,dashPositions:G,glyphMap:this.returnDependencies?V:null,iconMap:this.returnDependencies?N:null,glyphPositions:this.returnDependencies?Z.positions:null}}))}}function s(s,a,l){const c=new e.G(a);for(const e of s)e.recalculate(c,l)}class n extends e.cR{constructor(s,a){super(new e.cQ,0,a,[],[]),this.feature=s,this.type=s.type,this.properties=s.tags?s.tags:{},"id"in s&&("string"==typeof s.id?this.id=parseInt(s.id,10):"number"!=typeof s.id||isNaN(s.id)||(this.id=s.id))}loadGeometry(){const s=[],a=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const l of a){const a=[];for(const s of l)a.push(new e.P(s[0],s[1]));s.push(a)}return s}}class r extends e.cP{constructor(s,a){super(new e.cQ),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=a?a.version:1,this.extent=a?a.extent:4096,this.length=s.length,this.features=s}feature(e){return new n(this.features[e],this.extent)}}function a(e,s){s.writeVarintField(15,e.version||1),s.writeStringField(1,e.name||""),s.writeVarintField(5,e.extent||4096);const a={keys:[],values:[],keycache:{},valuecache:{}};for(let c=0;c>31}function f(e,s){const a=e.loadGeometry(),l=e.type;let c=0,f=0;for(const _ of a){let a=1;1===l&&(a=_.length),s.writeVarint(u(1,a));const y=3===l?_.length-1:_.length;for(let e=0;es.map((s=>new e.P(s.x,s.y)))))}}class p extends e.cP{constructor(s,a,l){super(new e.cQ),this.version=2,this._myFeatures=s,this.name=a,this.length=s.length,this.extent=l}feature(e){return this._myFeatures[e]}}class m{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function y(s){let l=function(s){const l=new e.cQ;return function(e,s){for(const l in e.layers)s.writeMessage(3,a,e.layers[l])}(s,l),l.finish()}(s);return 0===l.byteOffset&&l.byteLength===l.buffer.byteLength||(l=new Uint8Array(l)),{vectorTile:s,rawData:l.buffer}}function b(s,a,l){const{extent:c}=s,u=Math.pow(2,l.z-a.z),d=(l.x-a.x*u)*c,f=(l.y-a.y*u)*c,_=[];for(let a=0;a0&&_.addLayer(c)}const P=y(_);return this.overzoomedTileResultCache.set(d,P),P}reloadTile(s){return e._(this,void 0,void 0,(function*(){const a=s.uid;if(!this.loaded||!this.loaded[a])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const l=this.loaded[a];if(l.showCollisionBoxes=s.showCollisionBoxes,"parsing"===l.status){const c=yield l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,s.subdivisionGranularity);let u;if(this.fetching[a]){const{rawTileData:l,cacheControl:d,resourceTiming:f}=this.fetching[a];delete this.fetching[a],u=e.e({rawTileData:l.slice(0),encoding:s.encoding},c,d,f)}else u=c;return u}if("done"===l.status&&l.vectorTile)return l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,s.subdivisionGranularity)}))}abortTile(s){return e._(this,void 0,void 0,(function*(){const e=this.loading,a=s.uid;e&&e[a]&&e[a].abort&&(e[a].abort.abort(),delete e[a])}))}removeTile(s){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[s.uid]&&delete this.loaded[s.uid]}))}}class x{constructor(){this.loaded={}}loadTile(s){return e._(this,void 0,void 0,(function*(){const{uid:a,encoding:l,rawImageData:c,redFactor:u,greenFactor:d,blueFactor:f,baseShift:_}=s,y=c.width+2,b=c.height+2,S=e.b(c)?new e.R({width:y,height:b},yield e.cX(c,-1,-1,y,b)):c,P=new e.cY(a,S,l,u,d,f,_);return this.loaded=this.loaded||{},this.loaded[a]=P,P}))}removeTile(e){const s=this.loaded,a=e.uid;s&&s[a]&&delete s[a]}}var S,P,M=function(){if(P)return S;function e(e,a){if(0!==e.length){s(e[0],a);for(var l=1;l=Math.abs(f)?a-_+f:f-_+a,a=_}a+l>=0!=!!s&&e.reverse()}return P=1,S=function s(a,l){var c,u=a&&a.type;if("FeatureCollection"===u)for(c=0;ce},L=Math.fround||(F=new Float32Array(1),e=>(F[0]=+e,F[0]));var F;class T{constructor(e){this.options=Object.assign(Object.create(D),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:s,minZoom:a,maxZoom:l}=this.options;s&&console.time("total time");const c=`prepare ${e.length} points`;s&&console.time(c),this.points=e;const u=[];for(let s=0;s=a;e--){const a=+Date.now();d=this.trees[e]=this._createTree(this._cluster(d,e)),s&&console.log("z%d: %d clusters in %dms",e,d.numItems,+Date.now()-a)}return s&&console.timeEnd("total time"),this}getClusters(e,s){let a=((e[0]+180)%360+360)%360-180;const l=Math.max(-90,Math.min(90,e[1]));let c=180===e[2]?180:((e[2]+180)%360+360)%360-180;const u=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)a=-180,c=180;else if(a>c){const e=this.getClusters([a,l,180,u],s),d=this.getClusters([-180,l,c,u],s);return e.concat(d)}const d=this.trees[this._limitZoom(s)],f=d.range(V(a),N(u),V(c),N(l)),_=d.data,y=[];for(const e of f){const s=this.stride*e;y.push(_[s+5]>1?B(_,s,this.clusterProps):this.points[_[s+3]])}return y}getChildren(e){const s=this._getOriginId(e),a=this._getOriginZoom(e),l="No cluster with the specified id.",c=this.trees[a];if(!c)throw new Error(l);const u=c.data;if(s*this.stride>=u.length)throw new Error(l);const d=this.options.radius/(this.options.extent*Math.pow(2,a-1)),f=c.within(u[s*this.stride],u[s*this.stride+1],d),_=[];for(const s of f){const a=s*this.stride;u[a+4]===e&&_.push(u[a+5]>1?B(u,a,this.clusterProps):this.points[u[a+3]])}if(0===_.length)throw new Error(l);return _}getLeaves(e,s,a){const l=[];return this._appendLeaves(l,e,s=s||10,a=a||0,0),l}getTile(e,s,a){const l=this.trees[this._limitZoom(e)],c=Math.pow(2,e),{extent:u,radius:d}=this.options,f=d/u,_=(a-f)/c,y=(a+1+f)/c,b={features:[]};return this._addTileFeatures(l.range((s-f)/c,_,(s+1+f)/c,y),l.data,s,a,c,b),0===s&&this._addTileFeatures(l.range(1-f/c,_,1,y),l.data,c,a,c,b),s===c-1&&this._addTileFeatures(l.range(0,_,f/c,y),l.data,-1,a,c,b),b.features.length?b:null}getClusterExpansionZoom(e){let s=this._getOriginZoom(e)-1;for(;s<=this.options.maxZoom;){const a=this.getChildren(e);if(s++,1!==a.length)break;e=a[0].properties.cluster_id}return s}_appendLeaves(e,s,a,l,c){const u=this.getChildren(s);for(const s of u){const u=s.properties;if(u&&u.cluster?c+u.point_count<=l?c+=u.point_count:c=this._appendLeaves(e,u.cluster_id,a,l,c):c1;let _,y,b;if(f)_=O(s,e,this.clusterProps),y=s[e],b=s[e+1];else{const a=this.points[s[e+3]];_=a.properties;const[l,c]=a.geometry.coordinates;y=V(l),b=N(c)}const S={type:1,geometry:[[Math.round(this.options.extent*(y*c-a)),Math.round(this.options.extent*(b*c-l))]],tags:_};let P;P=f||this.options.generateId?s[e+3]:this.points[s[e+3]].id,void 0!==P&&(S.id=P),u.features.push(S)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,s){const{radius:a,extent:l,reduce:c,minPoints:u}=this.options,d=a/(l*Math.pow(2,s)),f=e.data,_=[],y=this.stride;for(let a=0;as&&(M+=f[a+5])}if(M>P&&M>=u){let e,u=l*P,d=b*P,C=-1;const D=(a/y<<5)+(s+1)+this.points.length;for(const l of S){const _=l*y;if(f[_+2]<=s)continue;f[_+2]=s;const b=f[_+5];u+=f[_]*b,d+=f[_+1]*b,f[_+4]=D,c&&(e||(e=this._map(f,a,!0),C=this.clusterProps.length,this.clusterProps.push(e)),c(e,this._map(f,_)))}f[a+4]=D,_.push(u/M,d/M,1/0,D,-1,M),c&&_.push(C)}else{for(let e=0;e1)for(const e of S){const a=e*y;if(!(f[a+2]<=s)){f[a+2]=s;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,s,a){if(e[s+5]>1){const l=this.clusterProps[e[s+6]];return a?Object.assign({},l):l}const l=this.points[e[s+3]].properties,c=this.options.map(l);return a&&c===l?Object.assign({},c):c}}function B(e,s,a){return{type:"Feature",id:e[s+3],properties:O(e,s,a),geometry:{type:"Point",coordinates:[(l=e[s],360*(l-.5)),j(e[s+1])]}};var l}function O(e,s,a){const l=e[s+5],c=l>=1e4?`${Math.round(l/1e3)}k`:l>=1e3?Math.round(l/100)/10+"k":l,u=e[s+6],d=-1===u?{}:Object.assign({},a[u]);return Object.assign(d,{cluster:!0,cluster_id:e[s+3],point_count:l,point_count_abbreviated:c})}function V(e){return e/360+.5}function N(e){const s=Math.sin(e*Math.PI/180),a=.5-.25*Math.log((1+s)/(1-s))/Math.PI;return a<0?0:a>1?1:a}function j(e){const s=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(s))/Math.PI-90}function G(e,s,a,l){let c=l;const u=s+(a-s>>1);let d,f=a-s;const _=e[s],y=e[s+1],b=e[a],S=e[a+1];for(let l=s+3;lc)d=l,c=s;else if(s===c){const e=Math.abs(l-u);el&&(d-s>3&&G(e,s,d,l),e[d+2]=c,a-d>3&&G(e,d,a,l))}function Z(e,s,a,l,c,u){let d=c-a,f=u-l;if(0!==d||0!==f){const _=((e-a)*d+(s-l)*f)/(d*d+f*f);_>1?(a=c,l=u):_>0&&(a+=d*_,l+=f*_)}return d=e-a,f=s-l,d*d+f*f}function q(e,s,a,l){const c={id:null==e?null:e,type:s,geometry:a,tags:l,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===s||"MultiPoint"===s||"LineString"===s)W(c,a);else if("Polygon"===s)W(c,a[0]);else if("MultiLineString"===s)for(const e of a)W(c,e);else if("MultiPolygon"===s)for(const e of a)W(c,e[0]);return c}function W(e,s){for(let a=0;a0&&(d+=l?(c*_-f*u)/2:Math.sqrt(Math.pow(f-c,2)+Math.pow(_-u,2))),c=f,u=_}const f=s.length-3;s[2]=1,G(s,0,f,a),s[f+2]=1,s.size=Math.abs(d),s.start=0,s.end=s.size}function oe(e,s,a,l){for(let c=0;c1?1:a}function fe(e,s,a,l,c,u,d,f){if(l/=s,u>=(a/=s)&&d=l)return null;const _=[];for(const s of e){const e=s.geometry;let u=s.type;const d=0===c?s.minX:s.minY,y=0===c?s.maxX:s.maxY;if(d>=a&&y=l)continue;let b=[];if("Point"===u||"MultiPoint"===u)xe(e,b,a,l,c);else if("LineString"===u)ve(e,b,a,l,c,!1,f.lineMetrics);else if("MultiLineString"===u)we(e,b,a,l,c,!1);else if("Polygon"===u)we(e,b,a,l,c,!0);else if("MultiPolygon"===u)for(const s of e){const e=[];we(s,e,a,l,c,!0),e.length&&b.push(e)}if(b.length){if(f.lineMetrics&&"LineString"===u){for(const e of b)_.push(q(s.id,u,e,s.tags));continue}"LineString"!==u&&"MultiLineString"!==u||(1===b.length?(u="LineString",b=b[0]):u="MultiLineString"),"Point"!==u&&"MultiPoint"!==u||(u=3===b.length?"Point":"MultiPoint"),_.push(q(s.id,u,b,s.tags))}}return _.length?_:null}function xe(e,s,a,l,c){for(let u=0;u=a&&d<=l&&Te(s,e[u],e[u+1],e[u+2])}}function ve(e,s,a,l,c,u,d){let f=be(e);const _=0===c?Se:Me;let y,b,S=e.start;for(let P=0;Pa&&(b=_(f,M,C,L,F,a),d&&(f.start=S+y*b)):B>l?O=a&&(b=_(f,M,C,L,F,a),V=!0),O>l&&B<=l&&(b=_(f,M,C,L,F,l),V=!0),!u&&V&&(d&&(f.end=S+y*b),s.push(f),f=be(e)),d&&(S+=y)}let P=e.length-3;const M=e[P],C=e[P+1],D=0===c?M:C;D>=a&&D<=l&&Te(f,M,C,e[P+2]),P=f.length-3,u&&P>=3&&(f[P]!==f[0]||f[P+1]!==f[1])&&Te(f,f[0],f[1],f[2]),f.length&&s.push(f)}function be(e){const s=[];return s.size=e.size,s.start=e.start,s.end=e.end,s}function we(e,s,a,l,c,u){for(const d of e)ve(d,s,a,l,c,u,!1)}function Te(e,s,a,l){e.push(s,a,l)}function Se(e,s,a,l,c,u){const d=(u-s)/(l-s);return Te(e,u,a+(c-a)*d,1),d}function Me(e,s,a,l,c,u){const d=(u-a)/(c-a);return Te(e,s+(l-s)*d,u,1),d}function Ee(e,s){const a=[];for(let l=0;l0&&s.size<(c?d:l))return void(a.numPoints+=s.length/3);const f=[];for(let e=0;ed)&&(a.numSimplified++,f.push(s[e],s[e+1])),a.numPoints++;c&&function(e,s){let a=0;for(let s=0,l=e.length,c=l-2;s0===s)for(let s=0,a=e.length;s24)throw new Error("maxZoom should be in the 0-24 range");if(s.promoteId&&s.generateId)throw new Error("promoteId and generateId cannot be used together.");let l=function(e,s){const a=[];if("FeatureCollection"===e.type)for(let l=0;l1&&console.time("creation"),P=this.tiles[S]=Le(e,s,a,l,_),this.tileCoords.push({z:s,x:a,y:l}),y)){y>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",s,a,l,P.numFeatures,P.numPoints,P.numSimplified),console.timeEnd("creation"));const e=`z${s}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(P.source=e,null==c){if(s===_.indexMaxZoom||P.numPoints<=_.indexMaxPoints)continue}else{if(s===_.maxZoom||s===c)continue;if(null!=c){const e=c-s;if(a!==u>>e||l!==d>>e)continue}}if(P.source=null,0===e.length)continue;y>1&&console.time("clipping");const M=.5*_.buffer/_.extent,C=.5-M,D=.5+M,L=1+M;let F=null,B=null,O=null,V=null,N=fe(e,b,a-M,a+D,0,P.minX,P.maxX,_),j=fe(e,b,a+C,a+L,0,P.minX,P.maxX,_);e=null,N&&(F=fe(N,b,l-M,l+D,1,P.minY,P.maxY,_),B=fe(N,b,l+C,l+L,1,P.minY,P.maxY,_),N=null),j&&(O=fe(j,b,l-M,l+D,1,P.minY,P.maxY,_),V=fe(j,b,l+C,l+L,1,P.minY,P.maxY,_),j=null),y>1&&console.timeEnd("clipping"),f.push(F||[],s+1,2*a,2*l),f.push(B||[],s+1,2*a,2*l+1),f.push(O||[],s+1,2*a+1,2*l),f.push(V||[],s+1,2*a+1,2*l+1)}}getTile(e,s,a){e=+e,s=+s,a=+a;const l=this.options,{extent:c,debug:u}=l;if(e<0||e>24)return null;const d=1<1&&console.log("drilling down to z%d-%d-%d",e,s,a);let _,y=e,b=s,S=a;for(;!_&&y>0;)y--,b>>=1,S>>=1,_=this.tiles[Ne(y,b,S)];return _&&_.source?(u>1&&(console.log("found parent tile z%d-%d-%d",y,b,S),console.time("drilling down")),this.splitTile(_.source,y,b,S,e,s,a),u>1&&console.timeEnd("drilling down"),this.tiles[f]?Ae(this.tiles[f],c):null):null}}function Ne(e,s,a){return 32*((1<`${e.key}: ${e.message}`)).join(", "));const c=l.features.filter((e=>a.value.evaluate({zoom:0},e)));l={type:"FeatureCollection",features:c}}return l}))}loadGeoJSON(s,a){return e._(this,void 0,void 0,(function*(){const{promoteId:l}=s;if(s.request){const c=yield e.j(s.request,a);return this._dataUpdateable=e.d0(c.data,l)?e.c$(c.data,l):void 0,c.data}if("string"==typeof s.data)try{const a=JSON.parse(s.data);return this._dataUpdateable=e.d0(a,l)?e.c$(a,l):void 0,a}catch(e){throw new Error(`Input data given to '${s.source}' is not a valid GeoJSON object.`)}if(!s.dataDiff)throw new Error(`Input data given to '${s.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${s.source}`);return e.d1(this._dataUpdateable,s.dataDiff,l),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(s){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}function je(s,a){return a.cluster?new T(function({superclusterOptions:s,clusterProperties:a}){if(!a||!s)return s;const l={},c={},u={accumulated:null,zoom:0},d={properties:null},f=Object.keys(a);for(const s of f){const[u,d]=a[s],f=e.c_(d),_=e.c_("string"==typeof u?[u,["accumulated"],["get",s]]:u);l[s]=f.value,c[s]=_.value}return s.map=e=>{d.properties=e;const s={};for(const e of f)s[e]=l[e].evaluate(u,d);return s},s.reduce=(e,s)=>{d.properties=s;for(const s of f)u.accumulated=e[s],e[s]=c[s].evaluate(u,d)},s}(a)).load(s.features):function(e,s){return new re(e,s)}(s,a.geojsonVtOptions)}class he{constructor(s){this.self=s,this.actor=new e.K(s),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,s)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=s},this.self.addProtocol=e.cE,this.self.removeProtocol=e.cF,this.self.registerRTLTextPlugin=s=>{e.d2.setMethods(s)},this.actor.registerMessageHandler("LDT",((e,s)=>this._getDEMWorkerSource(e,s.source).loadTile(s))),this.actor.registerMessageHandler("RDT",((s,a)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(s,a.source).removeTile(a)})))),this.actor.registerMessageHandler("GCEZ",((s,a)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(s,a.type,a.source).getClusterExpansionZoom(a)})))),this.actor.registerMessageHandler("GCC",((s,a)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(s,a.type,a.source).getClusterChildren(a)})))),this.actor.registerMessageHandler("GCL",((s,a)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(s,a.type,a.source).getClusterLeaves(a)})))),this.actor.registerMessageHandler("LD",((e,s)=>this._getWorkerSource(e,s.type,s.source).loadData(s))),this.actor.registerMessageHandler("GD",((e,s)=>this._getWorkerSource(e,s.type,s.source).getData())),this.actor.registerMessageHandler("LT",((e,s)=>this._getWorkerSource(e,s.type,s.source).loadTile(s))),this.actor.registerMessageHandler("RT",((e,s)=>this._getWorkerSource(e,s.type,s.source).reloadTile(s))),this.actor.registerMessageHandler("AT",((e,s)=>this._getWorkerSource(e,s.type,s.source).abortTile(s))),this.actor.registerMessageHandler("RMT",((e,s)=>this._getWorkerSource(e,s.type,s.source).removeTile(s))),this.actor.registerMessageHandler("RS",((s,a)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[s]||!this.workerSources[s][a.type]||!this.workerSources[s][a.type][a.source])return;const e=this.workerSources[s][a.type][a.source];delete this.workerSources[s][a.type][a.source],void 0!==e.removeSource&&e.removeSource(a)})))),this.actor.registerMessageHandler("RM",(s=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[s],delete this.availableImages[s],delete this.workerSources[s],delete this.demWorkerSources[s],this.globalStates.delete(s)})))),this.actor.registerMessageHandler("SR",((s,a)=>e._(this,void 0,void 0,(function*(){this.referrer=a})))),this.actor.registerMessageHandler("SRPS",((e,s)=>this._syncRTLPluginState(e,s))),this.actor.registerMessageHandler("IS",((s,a)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(a)})))),this.actor.registerMessageHandler("SI",((e,s)=>this._setImages(e,s))),this.actor.registerMessageHandler("UL",((s,a)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(s).update(a.layers,a.removedIds,this._getGlobalState(s))})))),this.actor.registerMessageHandler("UGS",((s,a)=>e._(this,void 0,void 0,(function*(){const e=this._getGlobalState(s);for(const s in a)e[s]=a[s]})))),this.actor.registerMessageHandler("SL",((s,a)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(s).replace(a,this._getGlobalState(s))}))))}_getGlobalState(e){let s=this.globalStates.get(e);return s||(s={},this.globalStates.set(e,s)),s}_setImages(s,a){return e._(this,void 0,void 0,(function*(){this.availableImages[s]=a;for(const e in this.workerSources[s]){const l=this.workerSources[s][e];for(const e in l)l[e].availableImages=a}}))}_syncRTLPluginState(s,a){return e._(this,void 0,void 0,(function*(){return yield e.d2.syncState(a,this.self.importScripts)}))}_getAvailableImages(e){let s=this.availableImages[e];return s||(s=[]),s}_getLayerIndex(e){let s=this.layerIndexes[e];return s||(s=this.layerIndexes[e]=new t),s}_getWorkerSource(e,s,a){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][s]||(this.workerSources[e][s]={}),!this.workerSources[e][s][a]){const l={sendAsync:(s,a)=>(s.targetMapId=e,this.actor.sendAsync(s,a))};switch(s){case"vector":this.workerSources[e][s][a]=new w(l,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][s][a]=new le(l,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][s][a]=new this.externalWorkerSourceTypes[s](l,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][s][a]}_getDEMWorkerSource(e,s){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][s]||(this.demWorkerSources[e][s]=new x),this.demWorkerSources[e][s]}}return e.i(self)&&(self.worker=new he(self)),he}));l("index",["exports","./shared"],(function(s,a){var l="5.12.0";function c(){var e=new a.A(4);return a.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let u,d,f;const _={frame(e,s,l){const c=requestAnimationFrame((e=>{u(),s(e)})),{unsubscribe:u}=a.s(e.signal,"abort",(()=>{u(),cancelAnimationFrame(c),l(a.c())}),!1)},frameAsync(e){return new Promise(((s,a)=>{this.frame(e,s,a)}))},getImageData(e,s=0){return this.getImageCanvasContext(e).getImageData(-s,-s,e.width+2*s,e.height+2*s)},getImageCanvasContext(e){const s=window.document.createElement("canvas"),a=s.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return s.width=e.width,s.height=e.height,a.drawImage(e,0,0,e.width,e.height),a},resolveURL:e=>(u||(u=document.createElement("a")),u.href=e,u.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==f?f:!!matchMedia&&(null==d&&(d=matchMedia("(prefers-reduced-motion: reduce)")),d.matches)},set prefersReducedMotion(e){f=e}},y=new class{constructor(){this._realTime="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function b(){return y.getCurrentTime()}class h{static testProp(e){if(!h.docStyle)return e[0];for(let s=0;s{window.removeEventListener("click",h.suppressClickInternal,!0)}),0)}static getScale(e){const s=e.getBoundingClientRect();return{x:s.width/e.offsetWidth||1,y:s.height/e.offsetHeight||1,boundingClientRect:s}}static getPoint(e,s,l){const c=s.boundingClientRect;return new a.P((l.clientX-c.left)/s.x-e.clientLeft,(l.clientY-c.top)/s.y-e.clientTop)}static mousePos(e,s){const a=h.getScale(e);return h.getPoint(e,a,s)}static touchPos(e,s){const a=[],l=h.getScale(e);for(let c=0;c{P&&L(P),P=null,D=!0},M.onerror=()=>{C=!0,P=null},M.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(s){let l,c,u,d;s.resetRequestQueue=()=>{l=[],c=0,u=0,d={}},s.addThrottleControl=e=>{const s=u++;return d[s]=e,s},s.removeThrottleControl=e=>{delete d[e],_()},s.getImage=(e,s,c=!0)=>new Promise(((u,d)=>{S.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),a.e(e,{type:"image"}),l.push({abortController:s,requestParameters:e,supportImageRefresh:c,state:"queued",onError:e=>{d(e)},onSuccess:e=>{u(e)}}),_()}));const f=s=>a._(this||e,void 0,void 0,(function*(){s.state="running";const{requestParameters:e,supportImageRefresh:l,onError:u,onSuccess:d,abortController:f}=s,b=!1===l&&!a.i(self)&&!a.g(e.url)&&(!e.headers||Object.keys(e.headers).reduce(((e,s)=>e&&"accept"===s),!0));c++;const S=b?y(e,f):a.m(e,f);try{const e=yield S;delete s.abortController,s.state="completed",e.data instanceof HTMLImageElement||a.b(e.data)?d(e):e.data&&d({data:yield(P=e.data,"function"==typeof createImageBitmap?a.f(P):a.h(P)),cacheControl:e.cacheControl,expires:e.expires})}catch(e){delete s.abortController,u(e)}finally{c--,_()}var P})),_=()=>{const e=(()=>{for(const e of Object.keys(d))if(d[e]())return!0;return!1})()?a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let s=c;s0;s++){const e=l.shift();e.abortController.signal.aborted?s--:f(e)}},y=(e,s)=>new Promise(((l,c)=>{const u=new Image,d=e.url,f=e.credentials;f&&"include"===f?u.crossOrigin="use-credentials":(f&&"same-origin"===f||!a.d(d))&&(u.crossOrigin="anonymous"),s.signal.addEventListener("abort",(()=>{u.src="",c(a.c())})),u.fetchPriority="high",u.onload=()=>{u.onerror=u.onload=null,l({data:u})},u.onerror=()=>{u.onerror=u.onload=null,s.signal.aborted||c(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."))},u.src=d}))}(F||(F={})),F.resetRequestQueue();class v{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function B(e){const s=[];if("string"==typeof e)s.push({id:"default",url:e});else if(e&&e.length>0){const a=[];for(const{id:l,url:c}of e){const e=`${l}${c}`;-1===a.indexOf(e)&&(a.push(e),s.push({id:l,url:c}))}}return s}function O(e,s,a){try{const l=new URL(e);return l.pathname+=`${s}${a}`,l.toString()}catch(s){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function V(e){const{userImage:s}=e;return!!(s&&s.render&&s.render())&&(e.data.replace(new Uint8Array(s.data.buffer)),!0)}class w extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:s}of this.requestors)s(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const s=this.images[e];if(s&&!s.data&&s.spriteData){const e=s.spriteData;s.data=new a.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),s.spriteData=null}return s}addImage(e,s){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let l=!0;const c=s.data||s.spriteData;return this._validateStretch(s.stretchX,c&&c.width)||(this.fire(new a.k(new Error(`Image "${e}" has invalid "stretchX" value`))),l=!1),this._validateStretch(s.stretchY,c&&c.height)||(this.fire(new a.k(new Error(`Image "${e}" has invalid "stretchY" value`))),l=!1),this._validateContent(s.content,s)||(this.fire(new a.k(new Error(`Image "${e}" has invalid "content" value`))),l=!1),l}_validateStretch(e,s){if(!e)return!0;let a=0;for(const l of e){if(l[0]{let l=!0;if(!this.isLoaded())for(const s of e)this.images[s]||(l=!1);this.isLoaded()||l?s(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:s})}))}_getImagesForIds(e){const s={};for(const l of e){let e=this.getImage(l);e||(this.fire(new a.l("styleimagemissing",{id:l})),e=this.getImage(l)),e?s[l]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:a.w(`Image "${l}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return s}getPixelSize(){const{width:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){const s=this.patterns[e],l=this.getImage(e);if(!l)return null;if(s&&s.position.version===l.version)return s.position;if(s)s.position.version=l.version;else{const s={w:l.data.width+2,h:l.data.height+2,x:0,y:0},c=new a.I(s,l);this.patterns[e]={bin:s,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new a.T(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const s in this.patterns)e.push(this.patterns[s].bin);const{w:s,h:l}=a.p(e),c=this.atlasImage;c.resize({width:s||1,height:l||1});for(const e in this.patterns){const{bin:s}=this.patterns[e],l=s.x+1,u=s.y+1,d=this.getImage(e).data,f=d.width,_=d.height;a.R.copy(d,c,{x:0,y:0},{x:l,y:u},{width:f,height:_}),a.R.copy(d,c,{x:0,y:_-1},{x:l,y:u-1},{width:f,height:1}),a.R.copy(d,c,{x:0,y:0},{x:l,y:u+_},{width:f,height:1}),a.R.copy(d,c,{x:f-1,y:0},{x:l-1,y:u},{width:1,height:_}),a.R.copy(d,c,{x:0,y:0},{x:l+f,y:u},{width:1,height:_})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const e=this.getImage(s);e||a.w(`Image with ID: "${s}" was not found`),V(e)&&this.updateImage(s,e)}}cloneImages(){const e={};for(const s in this.images){const a=this.images[s];e[s]=Object.assign(Object.assign({},a),{data:a.data?a.data.clone():null})}return e}}const N=1e20;function j(e,s,a,l,c,u,d,f,_){for(let y=s;y-1);_++,u[_]=f,d[_]=y,d[_+1]=N}for(let f=0,_=0;f65535)throw new Error("glyphs > 65535 not supported");const l=this.entries[e];if(l.ranges[a])return{stack:e,id:s,glyph:null};if(!l.requests[a]){const s=I.loadGlyphRange(e,a,this.url,this.requestManager);l.requests[a]=s}try{const c=yield l.requests[a];for(const e in c)l.glyphs[+e]=c[+e];return l.ranges[a]=!0,{stack:e,id:s,glyph:c[s]||null}}catch(c){const u=l.glyphs[s]=this._drawGlyph(l,e,s);return this._warnOnMissingGlyphRange(u,a,s,c),{stack:e,id:s,glyph:u}}}))}_warnOnMissingGlyphRange(e,s,l,c){const u=256*s,d=u+255,f=l.toString(16).padStart(4,"0").toUpperCase();a.w(`Unable to load glyph range ${s}, ${u}-${d}. Rendering codepoint U+${f} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&a.q(e)}_drawGlyph(e,s,l){const c=s===Z&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(l),u=c?"ideographTinySDF":"tinySDF";e[u]||(e[u]=this._createTinySDF(c?this.localIdeographFontFamily:s));const d=e[u].draw(String.fromCharCode(l));return{id:l,bitmap:new a.r({width:d.width||60,height:d.height||60},d.data),metrics:{width:d.glyphWidth/2||24,height:d.glyphHeight/2||24,left:d.glyphLeft/2+.5||0,top:d.glyphTop/2-27.5||-8,advance:d.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){const s=e?e.split(","):[];s.push("sans-serif");const a=s.map((e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`)).join(",");return new I.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:this._fontWeight(s[0]),fontStyle:this._fontStyle(s[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const s={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let a;for(const[l,c]of Object.entries(s))new RegExp(`\\b${l}\\b`,"i").test(e)&&(a=`${c}`);return a}destroy(){for(const e in this.entries){const s=this.entries[e];s.tinySDF&&(s.tinySDF=null),s.ideographTinySDF&&(s.ideographTinySDF=null),s.glyphs={},s.requests={},s.ranges={}}this.entries={}}}I.loadGlyphRange=function(s,l,c,u){return a._(this||e,void 0,void 0,(function*(){const e=256*l,d=e+255,f=u.transformRequest(c.replace("{fontstack}",s).replace("{range}",`${e}-${d}`),"Glyphs"),_=yield a.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${l}, ${e}-${d}`);const y={};for(const e of a.o(_.data))y[e.id]=e;return y}))},I.TinySDF=class{constructor({fontSize:e=24,buffer:s=3,radius:a=8,cutoff:l=.25,fontFamily:c="sans-serif",fontWeight:u="normal",fontStyle:d="normal",lang:f=null}={}){this.buffer=s,this.cutoff=l,this.radius=a,this.lang=f;const _=this.size=e+4*s,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${d} ${u} ${e}px ${c}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(e){const s=document.createElement("canvas");return s.width=s.height=e,s}draw(e){const{width:s,actualBoundingBoxAscent:a,actualBoundingBoxDescent:l,actualBoundingBoxLeft:c,actualBoundingBoxRight:u}=this.ctx.measureText(e),d=Math.ceil(a),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-c))),_=Math.min(this.size-this.buffer,d+Math.ceil(l)),y=f+2*this.buffer,b=_+2*this.buffer,S=Math.max(y*b,0),P=new Uint8ClampedArray(S),M={data:P,width:y,height:b,glyphWidth:f,glyphHeight:_,glyphTop:d,glyphLeft:0,glyphAdvance:s};if(0===f||0===_)return M;const{ctx:C,buffer:D,gridInner:L,gridOuter:F}=this;this.lang&&(C.lang=this.lang),C.clearRect(D,D,f,_),C.fillText(e,D,D+d);const B=C.getImageData(D,D,f,_);F.fill(N,0,S),L.fill(0,0,S);for(let e=0;e<_;e++)for(let s=0;s0?e*e:0,L[l]=e<0?e*e:0}}j(F,0,0,y,b,y,this.f,this.v,this.z),j(L,D,D,f,_,y,this.f,this.v,this.z);for(let e=0;e1&&(d=e[++u]);const _=Math.abs(f-d.left),y=Math.abs(f-d.right),b=Math.min(_,y);let S;const P=s/a*(l+1);if(d.isDash){const e=l-Math.abs(P);S=Math.sqrt(b*b+e*e)}else S=l-Math.sqrt(b*b+P*P);this.data[c+f]=Math.max(0,Math.min(255,S+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){const a=e[s],l=e[s+1];a.zeroLength?e.splice(s,1):l&&l.isDash===a.isDash&&(l.left=a.left,e.splice(s,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const l=this.width*this.nextRow;let c=0,u=e[c];for(let s=0;s1&&(u=e[++c]);const a=Math.abs(s-u.left),d=Math.abs(s-u.right),f=Math.min(a,d);this.data[l+s]=Math.max(0,Math.min(255,(u.isDash?f:-f)+128))}}addDash(e,s){const l=s?7:0,c=2*l+1;if(this.nextRow+c>this.height)return a.w("LineAtlas out of space"),null;let u=0;for(let s=0;s{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[J]}numActive(){return Object.keys(this.active).length}}const Q=Math.floor(_.hardwareConcurrency/2);let se,oe;function ce(){return se||(se=new k),se}k.workerCount=a.J(globalThis)?Math.max(Math.min(Q,3),1):1;class U{constructor(e,s){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=s;const l=this.workerPool.acquire(s);for(let e=0;e{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,s){for(const a of this.actors)a.registerMessageHandler(e,s)}unregisterMessageHandler(e){for(const s of this.actors)s.unregisterMessageHandler(e)}}function pe(){return oe||(oe=new U(ce(),a.L),oe.registerMessageHandler("GR",((e,s,l)=>a.m(s,l)))),oe}function fe(e,s){const l=a.M();return a.N(l,l,[1,1,0]),a.O(l,l,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?a.Q(l,l,e.calculatePosMatrix(s.toUnwrapped())):l}function xe(e,s,a,l,c,u,d){var f;const _=function(e,s,a){if(e)for(const l of e){const e=s[l];if(e&&e.source===a&&"fill-extrusion"===e.type)return!0}else for(const e in s){const l=s[e];if(l.source===a&&"fill-extrusion"===l.type)return!0}return!1}(null!==(f=null==c?void 0:c.layers)&&void 0!==f?f:null,s,e.id),y=u.maxPitchScaleFactor(),b=e.tilesIn(l,y,_);b.sort(ve);const S=[];for(const l of b)S.push({wrappedTileID:l.tileID.wrapped().key,queryResults:l.tile.queryRenderedFeatures(s,a,e.getState(),l.queryGeometry,l.cameraQueryGeometry,l.scale,c,u,y,fe(u,l.tileID),d?(e,s)=>d(l.tileID,e,s):void 0)});return function(e,s){for(const a in e)for(const l of e[a])be(l,s);return e}(function(e){const s={},a={};for(const l of e){const e=l.queryResults,c=l.wrappedTileID,u=a[c]=a[c]||{};for(const a in e){const l=e[a],c=u[a]=u[a]||{},d=s[a]=s[a]||[];for(const e of l)c[e.featureIndex]||(c[e.featureIndex]=!0,d.push(e))}}return s}(S),e)}function ve(e,s){const a=e.tileID,l=s.tileID;return a.overscaledZ-l.overscaledZ||a.canonical.y-l.canonical.y||a.wrap-l.wrap||a.canonical.x-l.canonical.x}function be(e,s){const a=e.feature,l=s.getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=l}function we(s,l,c){return a._(this||e,void 0,void 0,(function*(){let e=s;if(s.url?e=(yield a.j(l.transformRequest(s.url,"Source"),c)).data:yield _.frameAsync(c),!e)return null;const u=a.S(a.e(e,s),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in e&&e.vector_layers&&(u.vectorLayerIds=e.vector_layers.map((e=>e.id))),u}))}class ${constructor(e,s){e&&(s?this.setSouthWest(e).setNorthEast(s):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof a.U?new a.U(e.lng,e.lat):a.U.convert(e),this}setSouthWest(e){return this._sw=e instanceof a.U?new a.U(e.lng,e.lat):a.U.convert(e),this}extend(e){const s=this._sw,l=this._ne;let c,u;if(e instanceof a.U)c=e,u=e;else{if(!(e instanceof $))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend($.convert(e)):this.extend(a.U.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(a.U.convert(e)):this;if(c=e._sw,u=e._ne,!c||!u)return this}return s||l?(s.lng=Math.min(c.lng,s.lng),s.lat=Math.min(c.lat,s.lat),l.lng=Math.max(u.lng,l.lng),l.lat=Math.max(u.lat,l.lat)):(this._sw=new a.U(c.lng,c.lat),this._ne=new a.U(u.lng,u.lat)),this}getCenter(){return new a.U((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 a.U(this.getWest(),this.getNorth())}getSouthEast(){return new a.U(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:s,lat:l}=a.U.convert(e);let c=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=l&&l<=this._ne.lat&&c}intersects(e){if((e=$.convert(e)).getNorth()this.getNorth())return!1;const s=a.V(this.getWest(),-180,180),l=a.V(this.getEast(),-180,180),c=a.V(e.getWest(),-180,180),u=a.V(e.getEast(),-180,180),d=s>l,f=c>u;return!(!d||!f)||(d?u>=s||c<=l:f?l>=c||s<=u:!(c>l||us.lng?new a.U(s.lng+360,s.lat):s)}}class H{constructor(e,s,a){this.bounds=$.convert(this.validateBounds(e)),this.minzoom=s||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const s=Math.pow(2,e.z),l=Math.floor(a.X(this.bounds.getWest())*s),c=Math.floor(a.W(this.bounds.getNorth())*s),u=Math.ceil(a.X(this.bounds.getEast())*s),d=Math.ceil(a.W(this.bounds.getSouth())*s);return e.x>=l&&e.x=c&&e.y{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return a.e({},this._options)}loadTile(e){return a._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(s,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};a.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise(((s,a)=>{e.reloadPromise={resolve:s,reject:a}}))}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const s=yield e.actor.sendAsync({type:l,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,s)}catch(s){if(delete e.abortController,e.aborted)return;if(s&&404!==s.status)throw s;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const s=e.tileID.scaledTo(this.maxzoom).canonical,a=s.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:s,overzoomRequest:this.map._requestManager.transformRequest(a,"Tile")}}_afterTileLoadWorkerResponse(e,s){if(s&&s.resourceTiming&&(e.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&e.setExpiryData(s),e.loadVectorData(s,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return a._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return a._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class K extends a.E{constructor(e,s,l,c){super(),this.id=e,this.dispatcher=l,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},s),a.e(this,a.S(s,["url","scheme","tileSize"]))}load(){return a._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new a.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield we(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(a.e(this,s),s.bounds&&(this.tileBounds=new H(s.bounds,this.minzoom,this.maxzoom)),this.fire(new a.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,this.fire(new a.k(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return a.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return a._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const l=yield F.getImage(this.map._requestManager.transformRequest(s,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const s=this.map.painter.context,c=s.gl,u=l.data;e.texture=this.map.painter.getTileTexture(u.width),e.texture?e.texture.update(u,{useMipmap:!0}):(e.texture=new a.T(s,u,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}}))}abortTile(e){return a._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return a._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class Y extends K{constructor(e,s,l,c){super(e,s,l,c),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(e){return a._(this,void 0,void 0,(function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l=this.map._requestManager.transformRequest(s,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const s=yield F.getImage(l,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){const l=s.data;this.map._refreshExpiredTiles&&(s.cacheControl||s.expires)&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const c=a.b(l)&&a.Y()?l:yield this.readImageNow(l),u={type:this.type,uid:e.uid,source:this.id,rawImageData:c,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const s=yield e.actor.sendAsync({type:"LDT",data:u});e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}}))}readImageNow(e){return a._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&a.Z()){const s=e.width+2,l=e.height+2;try{return new a.R({width:s,height:l},yield a.$(e,-1,-1,s,l))}catch(e){}}return _.getImageData(e,1)}))}_getNeighboringTiles(e){const s=e.canonical,l=Math.pow(2,s.z),c=(s.x-1+l)%l,u=0===s.x?e.wrap-1:e.wrap,d=(s.x+1+l)%l,f=s.x+1===l?e.wrap+1:e.wrap,_={};return _[new a.a0(e.overscaledZ,u,s.z,c,s.y).key]={backfilled:!1},_[new a.a0(e.overscaledZ,f,s.z,d,s.y).key]={backfilled:!1},s.y>0&&(_[new a.a0(e.overscaledZ,u,s.z,c,s.y-1).key]={backfilled:!1},_[new a.a0(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},_[new a.a0(e.overscaledZ,f,s.z,d,s.y-1).key]={backfilled:!1}),s.y+1e.coordinates)).flat(1/0):e.coordinates.flat(1/0)}function Se(e){const s=new $;let a;switch(e.type){case"FeatureCollection":a=e.features.map((e=>Te(e.geometry))).flat(1/0);break;case"Feature":a=Te(e.geometry);break;default:a=Te(e)}if(0==a.length)return s;for(let e=0;e0&&a.e(u,{resourceTiming:c}),this.fire(new a.l("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new a.l("data",Object.assign(Object.assign({},u),{sourceDataType:"content",shouldReloadTileOptions:this._getShouldReloadTileOptions(s)})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new a.l("dataabort",{dataType:"source"}));this.fire(new a.k(e))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_getShouldReloadTileOptions(e){if(!e||e.removeAll)return;const{add:s=[],update:a=[],remove:l=[]}=e||{},c=new Set([...a.map((e=>e.id)),...l]);return{nextBounds:[...a.map((e=>e.newGeometry)),...s.map((e=>e.geometry))].map((e=>Se(e))),prevIds:c}}shouldReloadTile(e,{nextBounds:s,prevIds:l}){const c=e.latestFeatureIndex.loadVTLayers();for(let s=0;s{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const s=e.map(a.a5.fromLngLat);var l;return this.tileID=function(e){const s=a.a6.fromPoints(e),l=s.width(),c=s.height(),u=Math.max(l,c),d=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),f=Math.pow(2,d);return new a.a8(d,Math.floor((s.minX+s.maxX)/2*f),Math.floor((s.minY+s.maxY)/2*f))}(s),this.terrainTileRanges=this._getOverlappingTileRanges(s),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=s.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((l=this.tileCoords)[1].x-l[0].x)*(l[2].y-l[0].y)-(l[1].y-l[0].y)*(l[2].x-l[0].x)<0,this.fire(new a.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,s=e.gl;this.texture||(this.texture=new a.T(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let l=!1;for(const e in this.tiles){const s=this.tiles[e];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture,l=!0)}l&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return a._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:s,minY:l,maxX:c,maxY:u}=a.a6.fromPoints(e),d={};for(let e=0;e<=a.a7;e++){const a=Math.pow(2,e),f=Math.floor(s*a),_=Math.floor(l*a),y=Math.floor(c*a),b=Math.floor(u*a);d[e]={minTileX:f,minTileY:_,maxTileX:y,maxTileY:b}}return d}}class ie extends te{constructor(e,s,a,l){super(e,s,a,l),this.roundZoom=!0,this.type="video",this.options=s}load(){return a._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,"Source").url);try{const e=yield a.a9(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new a.k(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const s=this.video.seekable;es.end(0)?this.fire(new a.k(new a.aa(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,s=e.gl;this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let l=!1;for(const e in this.tiles){const s=this.tiles[e];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture,l=!0)}l&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ae extends te{constructor(e,s,l,c){super(e,s,l,c),s.coordinates?Array.isArray(s.coordinates)&&4===s.coordinates.length&&!s.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new a.k(new a.aa(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.k(new a.aa(`sources.${e}`,null,'missing required property "coordinates"'))),s.animate&&"boolean"!=typeof s.animate&&this.fire(new a.k(new a.aa(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?"string"==typeof s.canvas||s.canvas instanceof HTMLCanvasElement||this.fire(new a.k(new a.aa(`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 a.k(new a.aa(`sources.${e}`,null,'missing required property "canvas"'))),this.options=s,this.animate=void 0===s.animate||s.animate}load(){return a._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,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 s=this.map.painter.context,l=s.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(s,this.canvas,l.RGBA,{premultiply:!0});let c=!1;for(const e in this.tiles){const s=this.tiles[e];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture,c=!0)}c&&this.fire(new a.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Me={},Ee=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return K;case"raster-dem":return Y;case"vector":return X;case"video":return ie;case"canvas":return ae}return Me[e]},Ce="RTLPluginLoaded";class ne extends a.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=pe()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status="error",e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return a._(this,arguments,void 0,(function*(e,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=_.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return a._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new a.l(Ce))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let Ae=null;function ke(){return Ae||(Ae=new ne),Ae}var Le,Fe;!function(e){e[e.Base=0]="Base",e[e.Parent=1]="Parent"}(Le||(Le={})),function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(Fe||(Fe={}));class de{constructor(e,s){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=a.ab(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:s,fadingParentID:a,fadeEndTime:l}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=s,this.fadingParentID=a,this.fadeEndTime=l}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=b(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,s,l){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,s){const a={};if(!s)return a;for(const l of e){const e=l.layerIds.map((e=>s.getLayer(e))).filter(Boolean);if(0!==e.length){l.layers=e,l.stateDependentLayerIds&&(l.stateDependentLayers=l.stateDependentLayerIds.map((s=>e.filter((e=>e.id===s))[0])));for(const s of e)a[s.id]=l}}return a}(e.buckets,null==s?void 0:s.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const s=this.buckets[e];if(s instanceof a.ad){if(this.hasSymbolBuckets=!0,!l)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const s=this.buckets[e];if(s instanceof a.ad&&s.hasRTLText){this.hasRTLText=!0,ke().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const a=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(e).queryRadius(a))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new a.ac}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const a=this.buckets[s];a.uploadPending()&&a.upload(e)}const s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new a.T(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new a.T(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,a,l,c,u,d,f,_,y,b){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:c,scale:u,tileSize:this.tileSize,pixelPosMatrix:y,transform:f,params:d,queryPadding:this.queryPadding*_,getElevation:b},e,s,a):{}}querySourceFeatures(e,s){const l=this.latestFeatureIndex;if(!l||!l.rawTileData)return;const c=l.loadVTLayers(),u=s&&s.sourceLayer?s.sourceLayer:"",d=c._geojsonTileLayer||c[u];if(!d)return;const f=a.ae(null==s?void 0:s.filter,null==s?void 0:s.globalState),{z:_,x:y,y:b}=this.tileID.canonical,S={z:_,x:y,y:b};for(let s=0;se)a=!1;else if(s)if(this.expirationTime({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),V=[],N=[];if(e.renderWorldCopies&&f.allowWorldCopies())for(let e=1;e<=3;e++)V.push(O(-e)),V.push(O(e));for(V.push(O(0));V.length>0;){const M=V.pop(),L=M.x,O=M.y;let j=M.fullyVisible;const G={x:L,y:O,z:M.zoom},Z=f.getTileBoundingVolume(G,M.wrap,e.elevation,s);if(!j){const e=Ze(l,Z,c);if(0===e)continue;j=2===e}const q=f.distanceToTile2d(u.x,u.y,G,Z);let W=y;_&&(W=(s.calculateTileZoom||We)(e.zoom+a.ao(e.tileSize/s.tileSize),q,F,B,e.fov)),W=(s.roundZoom?Math.round:Math.floor)(W),W=Math.max(0,W);const J=Math.min(W,S);if(M.wrap=f.getWrap(d,G,M.wrap),M.zoom>=J){if(M.zoom>1),wrap:M.wrap,fullyVisible:j})}return N.sort(((e,s)=>e.distanceSq-s.distanceSq)).map((e=>e.tileID))}const Ye=a.a6.fromPoints([new a.P(0,0),new a.P(a.a3,a.a3)]);class Ie extends a.E{constructor(e,s,l){super(),this.id=e,this.dispatcher=l,this.on("data",(e=>this._dataHandler(e))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,s,a,l)=>{const c=new(Ee(s.type))(e,s,a,l);if(c.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${c.id}`);return c})(e,s,l,this),this._tiles={},this._cache=new a.aq(0,(e=>this._unloadTile(e))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new _e,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const s=this._tiles[e];if("loaded"!==s.state&&"errored"!==s.state)return!1}return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,s,l){return a._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,s,l)}catch(s){e.state="errored",404!==s.status?this._source.fire(new a.k(s,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new a.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const a=this._tiles[s];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ke).map((e=>e.key))}getRenderableIds(e){const s=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&s.push(this._tiles[a]);return e?s.sort(((e,s)=>{const l=e.tileID,c=s.tileID,u=new a.P(l.canonical.x,l.canonical.y)._rotate(-this.transform.bearingInRadians),d=new a.P(c.canonical.x,c.canonical.y)._rotate(-this.transform.bearingInRadians);return l.overscaledZ-c.overscaledZ||d.y-u.y||d.x-u.x})).map((e=>e.tileID.key)):s.map((e=>e.tileID)).sort(Ke).map((e=>e.key))}hasRenderableParent(e){const s=e.overscaledZ-1;if(s>=this._source.minzoom){const a=this.getLoadedTile(e.scaledTo(s));if(a)return this._isIdRenderable(a.tileID.key)}return!1}_isIdRenderable(e,s=!1){var a;return null===(a=this._tiles[e])||void 0===a?void 0:a.isRenderable(s)}reload(e,s=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const a in this._tiles)s&&this._source.shouldReloadTile&&!this._source.shouldReloadTile(this._tiles[a],s)||(e?this._reloadTile(a,"expired"):"errored"!==this._tiles[a].state&&this._reloadTile(a,"reloading"))}}_reloadTile(e,s){return a._(this,void 0,void 0,(function*(){const a=this._tiles[e];a&&("loading"!==a.state&&(a.state=s),yield this._loadTile(a,e,s))}))}_tileLoaded(e,s,l){e.timeAdded=b(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===l&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(s,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new a.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const s=this.getRenderableIds();for(let l=0;l1||(Math.abs(a)>1&&(1===Math.abs(a+c)?a+=c:1===Math.abs(a-c)&&(a-=c)),s.dem&&e.dem&&(e.dem.backfillBorder(s.dem,a,l),e.neighboringTiles&&e.neighboringTiles[u]&&(e.neighboringTiles[u].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,s){const a=Object.values(e),l=this._getLoadedDescendents(a),c={};for(const e of a){const a=l[e.key];if(!(null==a?void 0:a.length)){c[e.key]=e;continue}const u=e.overscaledZ+Ie.maxUnderzooming,d=a.filter((e=>e.tileID.overscaledZ<=u));if(!d.length){c[e.key]=e;continue}const f=Math.min(...d.map((e=>e.tileID.overscaledZ))),_=d.filter((e=>e.tileID.overscaledZ===f)).map((e=>e.tileID));for(const e of _)s[e.key]=e;this._areDescendentsComplete(_,f,e.overscaledZ)||(c[e.key]=e)}return c}_getLoadedDescendents(e){var s;const a={};for(const l in this._tiles){const c=this._tiles[l];if(c.hasData())for(const l of e)c.tileID.isChildOf(l)&&(a[s=l.key]||(a[s]=[])).push(c)}return a}_areDescendentsComplete(e,s,a){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===s:Math.pow(4,s-a)===e.length}getLoadedTile(e){const s=this._tiles[e.key];return(null==s?void 0:s.hasData())?s:null}updateCacheSize(e){const s=Math.ceil(e.width/this._source.tileSize)+1,l=Math.ceil(e.height/this._source.tileSize)+1,c=Math.floor(s*l*(null===this._maxTileCacheZoomLevels?a.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(u)}handleWrapJump(e){const s=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,s){const e={};for(const a in this._tiles){const l=this._tiles[a];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+s),e[l.tileID.key]=l}this._tiles=e,this._resetTileReloadTimers()}}update(e,s){if(!this._sourceLoaded||this._paused)return;let l;this.transform=e,this.terrain=s,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?l=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new a.a0(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(l=Xe(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:s,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(l=l.filter((e=>this._source.hasTile(e))))):l=[],this.usedForTerrain&&(l=this._addTerrainIdealTiles(l));const c=0===l.length&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new a.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const u=He(e,this._source),d=this._updateRetainedTiles(l,u),f=Je(this._source.type);f&&this._rasterFadeDuration>0&&!s&&this._updateFadingTiles(l,d),f?this._cleanUpRasterTiles(d):this._cleanUpVectorTiles(d)}_cleanUpRasterTiles(e){for(const s in this._tiles)e[s]||this._removeTile(s)}_cleanUpVectorTiles(e){for(const s in this._tiles){const a=this._tiles[s];e[s]?a.clearSymbolFadeHold():a.hasSymbolBuckets?a.holdingForSymbolFade()?a.symbolFadeFinished()&&this._removeTile(s):a.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(s)}}_addTerrainIdealTiles(e){const s=[];for(const a of e)if(a.canonical.z>this._source.minzoom){const e=a.scaledTo(a.canonical.z-1);s.push(e);const l=a.scaledTo(Math.max(this._source.minzoom,Math.min(a.canonical.z,5)));s.push(l)}return e.concat(s)}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){var a;const l={},c={},u=Math.max(s-Ie.maxOverzooming,this._source.minzoom);let d={};for(const s of e){const e=this._addTile(s);l[s.key]=s,e.hasData()||(d[s.key]=s)}d=this._retainLoadedChildren(d,l);for(const e in d){const s=d[e];let f=this._tiles[e],_=null==f?void 0:f.wasRequested();for(let e=s.overscaledZ-1;e>=u;--e){const u=s.scaledTo(e);if(c[u.key])break;if(c[u.key]=!0,f=this.getTile(u),!f&&_&&(f=this._addTile(u)),f){const e=f.hasData();if((e||!(null===(a=this.map)||void 0===a?void 0:a.cancelPendingTileRequestsWhileZooming)||_)&&(l[u.key]=u),_=f.wasRequested(),e)break}}}return l}_updateFadingTiles(e,s){const l=b(),c=a.ar(e);for(const a of e){const e=this._tiles[a.key];e.fadingDirection!==Fe.Departing&&0!==e.fadeOpacity||e.resetFadeLogic(),this._updateFadingAncestor(e,s,l)||this._updateFadingDescendents(e,s,l)||this._updateFadingEdge(e,c,l)||e.resetFadeLogic()}}_updateFadingAncestor(e,s,a){if(!e.hasData())return!1;const{tileID:l,fadingRole:c,fadingDirection:u,fadingParentID:d}=e;if(c===Le.Base&&u===Fe.Incoming&&d)return s[d.key]=d,!0;const f=Math.max(l.overscaledZ-this._maxFadingAncestorLevels,this._source.minzoom);for(let c=l.overscaledZ-1;c>=f;c--){const u=l.scaledTo(c),d=this.getLoadedTile(u);if(d)return e.setCrossFadeLogic({fadingRole:Le.Base,fadingDirection:Fe.Incoming,fadingParentID:d.tileID,fadeEndTime:a+this._rasterFadeDuration}),d.setCrossFadeLogic({fadingRole:Le.Parent,fadingDirection:Fe.Departing,fadeEndTime:a+this._rasterFadeDuration}),s[u.key]=u,!0}return!1}_updateFadingDescendents(e,s,a){if(!e.hasData())return!1;const l=e.tileID.children(this._source.maxzoom);let c=this._updateFadingChildren(e,l,s,a);if(c)return!0;for(const u of l){const l=u.children(this._source.maxzoom);this._updateFadingChildren(e,l,s,a)&&(c=!0)}return c}_updateFadingChildren(e,s,a,l){if(s[0].overscaledZ>=this._source.maxzoom)return!1;let c=!1;for(const u of s){const s=this.getLoadedTile(u);if(!s)continue;const{fadingRole:d,fadingDirection:f,fadingParentID:_}=s;d===Le.Base&&f===Fe.Departing&&_||(s.setCrossFadeLogic({fadingRole:Le.Base,fadingDirection:Fe.Departing,fadingParentID:e.tileID,fadeEndTime:l+this._rasterFadeDuration}),e.setCrossFadeLogic({fadingRole:Le.Parent,fadingDirection:Fe.Incoming,fadeEndTime:l+this._rasterFadeDuration})),a[u.key]=u,c=!0}return c}_updateFadingEdge(e,s,a){const l=e.tileID;return!!e.selfFading||!e.hasData()&&!!s.has(l)&&(e.setSelfFadeLogic(a+this._rasterFadeDuration),!0)}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(s.resetFadeLogic(),this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null));const l=s;return s||(s=new de(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,e.key,s.state)),s.uses++,this._tiles[e.key]=s,l||this._source.fire(new a.l("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){this._clearTileReloadTimer(e);const a=s.getExpiryTimeout();a&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),a))}_clearTileReloadTimer(e){const s=this._timers[e];s&&(clearTimeout(s),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}refreshTiles(e){for(const s in this._tiles)(this._isIdRenderable(s)||"errored"==this._tiles[s].state)&&e.some((e=>e.equals(this._tiles[s].tileID.canonical)))&&this._reloadTile(s,"expired")}_removeTile(e){const s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._clearTileReloadTimer(e),s.uses>0||(s.hasData()&&"reloading"!==s.state?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,l){const c=[],u=this.transform;if(!u)return c;const d=u.getCoveringTilesDetailsProvider().allowWorldCopies(),f=l?u.getCameraQueryGeometry(e):e,_=e=>u.screenPointToMercatorCoordinate(e,this.terrain),y=this.transformBbox(e,_,!d),b=this.transformBbox(f,_,!d),S=this.getIds(),P=a.a6.fromPoints(b);for(let e=0;ee.getTilePoint(new a.a5(s.x,s.y))));if(s.expandBy(M),s.intersects(Ye)){const s=y.map((s=>e.getTilePoint(s))),a=b.map((s=>e.getTilePoint(s)));c.push({tile:l,tileID:d?e:e.unwrapTo(0),queryGeometry:s,cameraQueryGeometry:a,scale:_})}}}return c}transformBbox(e,s,l){let c=e.map(s);if(l){const l=a.a6.fromPoints(e);l.shrinkBy(.001*Math.min(l.width(),l.height()));const u=l.map(s);a.a6.fromPoints(c).covers(u)||(c=c.map((e=>e.x>.5?new a.a5(e.x-1,e.y,e.z):e)))}return c}getVisibleCoordinates(e){const s=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));return this.transform&&this.transform.populateCache(s),s}hasTransition(){if(this._source.hasTransition())return!0;if(Je(this._source.type)&&this._rasterFadeDuration>0){const e=b();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=e)return!0}return!1}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,s,a){this._state.updateState(e=e||"_geojsonTileLayer",s,a)}removeFeatureState(e,s,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,a)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,a){const l=this._tiles[e];l&&l.setDependencies(s,a)}reloadTilesForDependencies(e,s){for(const a in this._tiles)this._tiles[a].hasDependency(e,s)&&this._reloadTile(a,"reloading");this._cache.filter((a=>!a.hasDependency(e,s)))}}function Ke(e,s){const a=Math.abs(2*e.wrap)-+(e.wrap<0),l=Math.abs(2*s.wrap)-+(s.wrap<0);return e.overscaledZ-s.overscaledZ||l-a||s.canonical.y-e.canonical.y||s.canonical.x-e.canonical.x}function Je(e){return"raster"===e||"image"===e||"video"===e}Ie.maxOverzooming=10,Ie.maxUnderzooming=3;class Re{constructor(e,s){this.reset(e,s)}reset(e,s){this.points=e||[],this._distances=[0];for(let e=1;e0?(c-d)/f:0;return this.points[u].mult(1-_).add(this.points[s].mult(_))}}function Qe(e,s){let a=!0;return"always"===e||"never"!==e&&"never"!==s||(a=!1),a}class ze{constructor(e,s,a){const l=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(s/a);for(let e=0;ethis.width||l<0||s>this.height)return[];const f=[];if(e<=0&&s<=0&&this.width<=a&&this.height<=l){if(c)return[{key:null,x1:e,y1:s,x2:a,y2:l}];for(let e=0;e0}hitTestCircle(e,s,a,l,c){const u=e-a,d=e+a,f=s-a,_=s+a;if(d<0||u>this.width||_<0||f>this.height)return!1;const y=[];return this._forEachCell(u,f,d,_,this._queryCellCircle,y,{hitTest:!0,overlapMode:l,circle:{x:e,y:s,radius:a},seenUids:{box:{},circle:{}}},c),y.length>0}_queryCell(e,s,a,l,c,u,d,f){const{seenUids:_,hitTest:y,overlapMode:b}=d,S=this.boxCells[c];if(null!==S){const c=this.bboxes;for(const d of S)if(!_.box[d]){_.box[d]=!0;const S=4*d,P=this.boxKeys[d];if(e<=c[S+2]&&s<=c[S+3]&&a>=c[S+0]&&l>=c[S+1]&&(!f||f(P))&&(!y||!Qe(b,P.overlapMode))&&(u.push({key:P,x1:c[S],y1:c[S+1],x2:c[S+2],y2:c[S+3]}),y))return!0}}const P=this.circleCells[c];if(null!==P){const c=this.circles;for(const d of P)if(!_.circle[d]){_.circle[d]=!0;const S=3*d,P=this.circleKeys[d];if(this._circleAndRectCollide(c[S],c[S+1],c[S+2],e,s,a,l)&&(!f||f(P))&&(!y||!Qe(b,P.overlapMode))){const e=c[S],s=c[S+1],a=c[S+2];if(u.push({key:P,x1:e-a,y1:s-a,x2:e+a,y2:s+a}),y)return!0}}}return!1}_queryCellCircle(e,s,a,l,c,u,d,f){const{circle:_,seenUids:y,overlapMode:b}=d,S=this.boxCells[c];if(null!==S){const e=this.bboxes;for(const s of S)if(!y.box[s]){y.box[s]=!0;const a=4*s,l=this.boxKeys[s];if(this._circleAndRectCollide(_.x,_.y,_.radius,e[a+0],e[a+1],e[a+2],e[a+3])&&(!f||f(l))&&!Qe(b,l.overlapMode))return u.push(!0),!0}}const P=this.circleCells[c];if(null!==P){const e=this.circles;for(const s of P)if(!y.circle[s]){y.circle[s]=!0;const a=3*s,l=this.circleKeys[s];if(this._circlesCollide(e[a],e[a+1],e[a+2],_.x,_.y,_.radius)&&(!f||f(l))&&!Qe(b,l.overlapMode))return u.push(!0),!0}}}_forEachCell(e,s,a,l,c,u,d,f){const _=this._convertToXCellCoord(e),y=this._convertToYCellCoord(s),b=this._convertToXCellCoord(a),S=this._convertToYCellCoord(l);for(let P=_;P<=b;P++)for(let _=y;_<=S;_++)if(c.call(this,e,s,a,l,this.xCellCount*_+P,u,d,f))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,s,a,l,c,u){const d=l-e,f=c-s,_=a+u;return _*_>d*d+f*f}_circleAndRectCollide(e,s,a,l,c,u,d){const f=(u-l)/2,_=Math.abs(e-(l+f));if(_>f+a)return!1;const y=(d-c)/2,b=Math.abs(s-(c+y));if(b>y+a)return!1;if(_<=f||b<=y)return!0;const S=_-f,P=b-y;return S*S+P*P<=a*a}}function et(e,s,l){const u=a.M();if(!e){const{vecSouth:e,vecEast:a}=ct(s),l=c();l[0]=a[0],l[1]=a[1],l[2]=e[0],l[3]=e[1],d=l,(P=(_=(f=l)[0])*(S=f[3])-(b=f[2])*(y=f[1]))&&(d[0]=S*(P=1/P),d[1]=-y*P,d[2]=-b*P,d[3]=_*P),u[0]=l[0],u[1]=l[1],u[4]=l[2],u[5]=l[3]}var d,f,_,y,b,S,P;return a.O(u,u,[1/l,1/l,1]),u}function nt(e,s,l,c){if(e){const e=a.M();if(!s){const{vecSouth:s,vecEast:a}=ct(l);e[0]=a[0],e[1]=a[1],e[4]=s[0],e[5]=s[1]}return a.O(e,e,[c,c,1]),e}return l.pixelsToClipSpaceMatrix}function ct(e){const s=Math.cos(e.rollInRadians),l=Math.sin(e.rollInRadians),c=Math.cos(e.pitchInRadians),u=Math.cos(e.bearingInRadians),d=Math.sin(e.bearingInRadians),f=a.aw();f[0]=-u*c*l-d*s,f[1]=-d*c*l+u*s;const _=a.ax(f);_<1e-9?a.ay(f):a.az(f,f,1/_);const y=a.aw();y[0]=u*c*s-d*l,y[1]=d*c*s+u*l;const b=a.ax(y);return b<1e-9?a.ay(y):a.az(y,y,1/b),{vecEast:y,vecSouth:f}}function ht(e,s,l,c){let u;c?(u=[e,s,c(e,s),1],a.aB(u,u,l)):(u=[e,s,0,1],li(u,u,l));const d=u[3];return{point:new a.P(u[0]/d,u[1]/d),signedDistanceFromCamera:d,isOccluded:!1}}function ut(e,s){return.5+e/s*.5}function dt(e,s){return e.x>=-s[0]&&e.x<=s[0]&&e.y>=-s[1]&&e.y<=s[1]}function pt(e,s,l,c,u,d,f,_,y,b,S,P,M){const C=l?e.textSizeData:e.iconSizeData,D=a.as(C,s.transform.zoom),L=[256/s.width*2+1,256/s.height*2+1],F=l?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;F.clear();const B=e.lineVertexArray,O=l?e.text.placedSymbolArray:e.icon.placedSymbolArray,V=s.transform.width/s.transform.height;let N=!1;for(let l=0;lMath.abs(l.x-s.x)*c?{useVertical:!0}:(e===a.at.vertical?s.yl.x)?{needsFlipping:!0}:null}function _t(e){const{projectionContext:s,pitchedLabelPlaneMatrixInverse:l,symbol:c,fontSize:u,flip:d,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:S}=e,P=u/24,M=c.lineOffsetX*P,C=c.lineOffsetY*P;let D;if(c.numGlyphs>1){const e=c.glyphStartIndex+c.numGlyphs,a=c.lineStartIndex,u=c.lineStartIndex+c.lineLength,y=ft(P,_,M,C,d,c,S,s);if(!y)return{notEnoughRoom:!0};const L=Et(y.first.point.x,y.first.point.y,s,l),F=Et(y.last.point.x,y.last.point.y,s,l);if(f&&!d){const e=mt(c.writingMode,L,F,b);if(e)return e}D=[y.first];for(let l=c.glyphStartIndex+1;l0?f.point:gt(s.tileAnchorPoint,d,e,1,s),y=Et(e.x,e.y,s,l),S=Et(_.x,_.y,s,l),P=mt(c.writingMode,y,S,b);if(P)return P}const e=$t(P*_.getoffsetX(c.glyphStartIndex),M,C,d,c.segment,c.lineStartIndex,c.lineStartIndex+c.lineLength,s,S);if(!e||s.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};D=[e]}for(const e of D)a.aA(y,e.point,e.angle);return{}}function gt(e,s,a,l,c){const u=e.add(e.sub(s)._unit()),d=vt(u.x,u.y,c).point,f=a.sub(d);return a.add(f._mult(l/f.mag()))}function yt(e,s,l){const c=s.projectionCache;if(c.projections[e])return c.projections[e];const u=new a.P(s.lineVertexArray.getx(e),s.lineVertexArray.gety(e)),d=vt(u.x,u.y,s);if(d.signedDistanceFromCamera>0)return c.projections[e]=d.point,c.anyProjectionOccluded=c.anyProjectionOccluded||d.isOccluded,d.point;const f=e-l.direction;return gt(0===l.distanceFromAnchor?s.tileAnchorPoint:new a.P(s.lineVertexArray.getx(f),s.lineVertexArray.gety(f)),u,l.previousVertex,l.absOffsetX-l.distanceFromAnchor+1,s)}function vt(e,s,a){const l=e+a.translation[0],c=s+a.translation[1];let u;return a.pitchWithMap?(u=ht(l,c,a.pitchedLabelPlaneMatrix,a.getElevation),u.isOccluded=!1):(u=a.transform.projectTileCoordinates(l,c,a.unwrappedTileID,a.getElevation),u.point.x=(.5*u.point.x+.5)*a.width,u.point.y=(.5*-u.point.y+.5)*a.height),u}function Et(e,s,l,c){if(l.pitchWithMap){const u=[e,s,0,1];return a.aB(u,u,c),l.transform.projectTileCoordinates(u[0]/u[3],u[1]/u[3],l.unwrappedTileID,l.getElevation).point}return{x:e/l.width*2-1,y:1-s/l.height*2}}function Rt(e,s,a){return a.transform.projectTileCoordinates(e,s,a.unwrappedTileID,a.getElevation)}function Vt(e,s,a){return e._unit()._perp()._mult(s*a)}function Zt(e,s,l,c,u,d,f,_,y){if(_.projectionCache.offsets[e])return _.projectionCache.offsets[e];const b=l.add(s);if(e+y.direction=u)return _.projectionCache.offsets[e]=b,b;const S=yt(e+y.direction,_,y),P=Vt(S.sub(l),f,y.direction),M=l.add(P),C=S.add(P);return _.projectionCache.offsets[e]=a.aC(d,b,M,C)||b,_.projectionCache.offsets[e]}function $t(e,s,a,l,c,u,d,f,_){const y=l?e-s:e+s;let b=y>0?1:-1,S=0;l&&(b*=-1,S=Math.PI),b<0&&(S+=Math.PI);let P,M=b>0?u+c:u+c+1;f.projectionCache.cachedAnchorPoint?P=f.projectionCache.cachedAnchorPoint:(P=vt(f.tileAnchorPoint.x,f.tileAnchorPoint.y,f).point,f.projectionCache.cachedAnchorPoint=P);let C,D,L=P,F=P,B=0,O=0;const V=Math.abs(y),N=[];let j;for(;B+O<=V;){if(M+=b,M=d)return null;B+=O,F=L,D=C;const e={absOffsetX:V,direction:b,distanceFromAnchor:B,previousVertex:F};if(L=yt(M,f,e),0===a)N.push(F),j=L.sub(F);else{let s;const l=L.sub(F);s=0===l.mag()?Vt(yt(M+b,f,e).sub(L),a,b):Vt(l,a,b),D||(D=F.add(s)),C=Zt(M,s,L,u,d,D,a,f,e),N.push(D),j=C.sub(D)}O=j.mag()}const G=j._mult((V-B)/O)._add(D||F),Z=S+Math.atan2(L.y-F.y,L.x-F.x);return N.push(G),{point:G,angle:_?Z:0,path:N}}const ti=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function oi(e,s){for(let a=0;a=1;e--)M.push(d.path[e]);for(let e=1;ee.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let L=[];if(M.length>0){const e=M[0].clone(),s=M[0].clone();for(let a=1;a=l.x&&s.x<=c.x&&e.y>=l.y&&s.y<=c.y?[M]:s.xc.x||s.yc.y?[]:a.aD([M],l.x,l.y,c.x,c.y)}for(const a of L){u.reset(a,.25*s);let l=0;l=u.length<=.5*s?1:Math.ceil(u.paddedLength/C)+1;for(let a=0;a{const a=ht(e.x,e.y,l,s.getElevation),c=s.transform.projectTileCoordinates(a.point.x,a.point.y,s.unwrappedTileID,s.getElevation);return c.point.x=(.5*c.point.x+.5)*s.width,c.point.y=(.5*-c.point.y+.5)*s.height,c}))}(e,s);return function(e){let s=0,a=0,l=0,c=0;for(let u=0;ua&&(a=c,s=l));return e.slice(s,s+a)}(l)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const s=[],l=new a.a6;for(const c of e){const e=new a.P(c.x+ci,c.y+ci);l.extend(e),s.push(e)}const{minX:c,minY:u,maxX:d,maxY:f}=l,_=this.grid.query(c,u,d,f).concat(this.ignoredGrid.query(c,u,d,f)),y={},b={};for(const e of _){const l=e.key;if(void 0===y[l.bucketInstanceId]&&(y[l.bucketInstanceId]={}),y[l.bucketInstanceId][l.featureIndex])continue;const c=[new a.P(e.x1,e.y1),new a.P(e.x2,e.y1),new a.P(e.x2,e.y2),new a.P(e.x1,e.y2)];a.aE(s,c)&&(y[l.bucketInstanceId][l.featureIndex]=!0,void 0===b[l.bucketInstanceId]&&(b[l.bucketInstanceId]=[]),b[l.bucketInstanceId].push(l.featureIndex))}return b}insertCollisionBox(e,s,a,l,c,u){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:c,collisionGroupID:u,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,a,l,c,u){const d=a?this.ignoredGrid:this.grid,f={bucketInstanceId:l,featureIndex:c,collisionGroupID:u,overlapMode:s};for(let s=0;s=this.screenRightBoundary||lthis.screenBottomBoundary}isInsideGrid(e,s,a,l){return a>=0&&e=0&&sthis.projectAndGetPerspectiveRatio(e.x,e.y,c,y,S)));se=e.some((e=>!e.isOccluded)),Q=e.map((e=>new a.P(e.x,e.y)))}else se=!0;return{box:a.aF(Q),allPointsOccluded:!se}}}class it{constructor(e,s,a,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):l&&a?1:0,this.placed=a}isHidden(){return 0===this.opacity&&!this.placed}}class at{constructor(e,s,a,l,c){this.text=new it(e?e.text:null,s,a,c),this.icon=new it(e?e.icon:null,s,l,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rt{constructor(e,s,a){this.text=e,this.icon=s,this.skipFade=a}}class ot{constructor(e,s,a,l,c){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=a,this.bucketIndex=l,this.tileID=c}}class st{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:e=>e.collisionGroupID===s}}return this.collisionGroups[e]}}function hi(e,s,l,c,u){const{horizontalAlign:d,verticalAlign:f}=a.aM(e);return new a.P(-(d-.5)*s+c[0]*u,-(f-.5)*l+c[1]*u)}class lt{constructor(e,s,a,l,c){this.transform=e.clone(),this.terrain=s,this.collisionIndex=new tt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new st(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=c,c&&(c.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const s=this.terrain;return s?(a,l)=>s.getElevation(e,a,l):null}getBucketParts(e,s,l,c){const u=l.getBucket(s),d=l.latestFeatureIndex;if(!u||!d||s.id!==u.layerIds[0])return;const f=l.collisionBoxArray,_=u.layers[0].layout,y=u.layers[0].paint,b=Math.pow(2,this.transform.zoom-l.tileID.overscaledZ),S=l.tileSize/a.a3,P=l.tileID.toUnwrapped(),M="map"===_.get("text-rotation-alignment"),C=a.aH(l,1,this.transform.zoom),D=a.aI(this.collisionIndex.transform,l,y.get("text-translate"),y.get("text-translate-anchor")),L=a.aI(this.collisionIndex.transform,l,y.get("icon-translate"),y.get("icon-translate-anchor")),F=et(M,this.transform,C);this.retainedQueryData[u.bucketInstanceId]=new ot(u.bucketInstanceId,d,u.sourceLayerIndex,u.index,l.tileID);const B={bucket:u,layout:_,translationText:D,translationIcon:L,unwrappedTileID:P,pitchedLabelPlaneMatrix:F,scale:b,textPixelRatio:S,holdingForFade:l.holdingForSymbolFade(),collisionBoxArray:f,partiallyEvaluatedTextSize:a.as(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(c)for(const s of u.sortKeyRanges){const{sortKey:a,symbolInstanceStart:l,symbolInstanceEnd:c}=s;e.push({sortKey:a,symbolInstanceStart:l,symbolInstanceEnd:c,parameters:B})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:B})}attemptAnchorPlacement(e,s,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B,O,V){const N=a.aJ[e.textAnchor],j=[e.textOffset0,e.textOffset1],G=hi(N,l,c,j,u),Z=this.collisionIndex.placeCollisionBox(s,P,_,y,b,f,d,L,S.predicate,O,G,V);if((!B||this.collisionIndex.placeCollisionBox(B,P,_,y,b,f,d,F,S.predicate,O,G,V).placeable)&&Z.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID].text&&(e=this.prevPlacement.variableOffsets[M.crossTileID].anchor),0===M.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[M.crossTileID]={textOffset:j,width:l,height:c,anchor:N,textBoxScale:u,prevAnchor:e},this.markUsedJustification(C,N,M,D),C.allowVerticalPlacement&&(this.markUsedOrientation(C,D,M),this.placedOrientations[M.crossTileID]=D),{shift:G,placedGlyphBoxes:Z}}}placeLayerBucketPart(e,s,l){const{bucket:c,layout:u,translationText:d,translationIcon:f,unwrappedTileID:_,pitchedLabelPlaneMatrix:y,textPixelRatio:b,holdingForFade:S,collisionBoxArray:P,partiallyEvaluatedTextSize:M,collisionGroup:C}=e.parameters,D=u.get("text-optional"),L=u.get("icon-optional"),F=a.aK(u,"text-overlap","text-allow-overlap"),B="always"===F,O=a.aK(u,"icon-overlap","icon-allow-overlap"),V="always"===O,N="map"===u.get("text-rotation-alignment"),j="map"===u.get("text-pitch-alignment"),G="none"!==u.get("icon-text-fit"),Z="viewport-y"===u.get("symbol-z-order"),q=B&&(V||!c.hasIconData()||L),W=V&&(B||!c.hasTextData()||D);!c.collisionArrays&&P&&c.deserializeCollisionBoxes(P);const J=this.retainedQueryData[c.bucketInstanceId].tileID,Q=this._getTerrainElevationFunc(J),se=this.transform.getFastPathSimpleProjectionMatrix(J),oe=(e,P,V)=>{var Z,oe;if(s[e.crossTileID])return;if(S)return void(this.placements[e.crossTileID]=new rt(!1,!1,!1));let ce=!1,pe=!1,fe=!0,xe=null,ve={box:null,placeable:!1,offscreen:null,occluded:!1},be={placeable:!1},we=null,Te=null,Se=null,Me=0,Ee=0,Ce=0;P.textFeatureIndex?Me=P.textFeatureIndex:e.useRuntimeCollisionCircles&&(Me=e.featureIndex),P.verticalTextFeatureIndex&&(Ee=P.verticalTextFeatureIndex);const Ae=P.textBox;if(Ae){const s=s=>{let l=a.at.horizontal;if(c.allowVerticalPlacement&&!s&&this.prevPlacement){const s=this.prevPlacement.placedOrientations[e.crossTileID];s&&(this.placedOrientations[e.crossTileID]=s,l=s,this.markUsedOrientation(c,l,e))}return l},u=(s,l)=>{if(c.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&P.verticalTextBox){for(const e of c.writingModes)if(e===a.at.vertical?(ve=l(),be=ve):ve=s(),ve&&ve.placeable)break}else ve=s()},y=e.textAnchorOffsetStartIndex,S=e.textAnchorOffsetEndIndex;if(S===y){const l=(s,a)=>{const l=this.collisionIndex.placeCollisionBox(s,F,b,J,_,j,N,d,C.predicate,Q,void 0,se);return l&&l.placeable&&(this.markUsedOrientation(c,a,e),this.placedOrientations[e.crossTileID]=a),l};u((()=>l(Ae,a.at.horizontal)),(()=>{const s=P.verticalTextBox;return c.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&s?l(s,a.at.vertical):{box:null,offscreen:null}})),s(ve&&ve.placeable)}else{let M=a.aJ[null===(oe=null===(Z=this.prevPlacement)||void 0===Z?void 0:Z.variableOffsets[e.crossTileID])||void 0===oe?void 0:oe.anchor];const D=(s,a,u)=>{const P=s.x2-s.x1,D=s.y2-s.y1,L=e.textBoxScale,B=G&&"never"===O?a:null;let V=null,Z="never"===F?1:2,q="never";M&&Z++;for(let a=0;aD(Ae,P.iconBox,a.at.horizontal)),(()=>{const s=P.verticalTextBox;return c.allowVerticalPlacement&&(!ve||!ve.placeable)&&e.numVerticalGlyphVertices>0&&s?D(s,P.verticalIconBox,a.at.vertical):{box:null,occluded:!0,offscreen:null}})),ve&&(ce=ve.placeable,fe=ve.offscreen);const L=s(ve&&ve.placeable);if(!ce&&this.prevPlacement){const s=this.prevPlacement.variableOffsets[e.crossTileID];s&&(this.variableOffsets[e.crossTileID]=s,this.markUsedJustification(c,s.anchor,e,L))}}}if(we=ve,ce=we&&we.placeable,fe=we&&we.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){const s=c.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),f=a.au(c.textSizeData,M,s),b=u.get("text-padding");Te=this.collisionIndex.placeCollisionCircles(F,s,c.lineVertexArray,c.glyphOffsetArray,f,_,y,l,j,C.predicate,e.collisionCircleDiameter,b,d,Q),Te.circles.length&&Te.collisionDetected&&!l&&a.w("Collisions detected, but collision boxes are not shown"),ce=B||Te.circles.length>0&&!Te.collisionDetected,fe=fe&&Te.offscreen}if(P.iconFeatureIndex&&(Ce=P.iconFeatureIndex),P.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,O,b,J,_,j,N,f,C.predicate,Q,G&&xe?xe:void 0,se);be&&be.placeable&&P.verticalIconBox?(Se=e(P.verticalIconBox),pe=Se.placeable):(Se=e(P.iconBox),pe=Se.placeable),fe=fe&&Se.offscreen}const ke=D||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,Le=L||0===e.numIconVertices;ke||Le?Le?ke||(pe=pe&&ce):ce=pe&&ce:pe=ce=pe&&ce;const Fe=pe&&Se.placeable;if(ce&&we.placeable&&this.collisionIndex.insertCollisionBox(we.box,F,u.get("text-ignore-placement"),c.bucketInstanceId,be&&be.placeable&&Ee?Ee:Me,C.ID),Fe&&this.collisionIndex.insertCollisionBox(Se.box,O,u.get("icon-ignore-placement"),c.bucketInstanceId,Ce,C.ID),Te&&ce&&this.collisionIndex.insertCollisionCircles(Te.circles,F,u.get("text-ignore-placement"),c.bucketInstanceId,Me,C.ID),l&&this.storeCollisionData(c.bucketInstanceId,V,P,we,Se,Te),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===c.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new rt((ce||q)&&!(null==we?void 0:we.occluded),(pe||W)&&!(null==Se?void 0:Se.occluded),fe||c.justReloaded),s[e.crossTileID]=!0};if(Z){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const s=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=s.length-1;e>=0;--e){const a=s[e];oe(c.symbolInstances.get(a),c.collisionArrays[a],a)}}else for(let s=e.symbolInstanceStart;s=0&&(e.text.placedSymbolArray.get(s).crossTileID=u>=0&&s!==u?0:l.crossTileID)}markUsedOrientation(e,s,l){const c=s===a.at.horizontal||s===a.at.horizontalOnly?s:0,u=s===a.at.vertical?s:0,d=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex];for(const s of d)e.text.placedSymbolArray.get(s).placedOrientation=c;l.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(l.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let a=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const l=s?s.symbolFadeChange(e):1,c=s?s.opacities:{},u=s?s.variableOffsets:{},d=s?s.placedOrientations:{};for(const e in this.placements){const s=this.placements[e],u=c[e];u?(this.opacities[e]=new at(u,l,s.text,s.icon),a=a||s.text!==u.text.placed||s.icon!==u.icon.placed):(this.opacities[e]=new at(null,l,s.text,s.icon,s.skipFade),a=a||s.text||s.icon)}for(const e in c){const s=c[e];if(!this.opacities[e]){const c=new at(s,l,!1,!1);c.isHidden()||(this.opacities[e]=c,a=a||s.text.placed||s.icon.placed)}}for(const e in u)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=u[e]);for(const e in d)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=d[e]);if(s&&void 0===s.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){const a={};for(const l of s){const s=l.getBucket(e);s&&l.latestFeatureIndex&&e.id===s.layerIds[0]&&this.updateBucketOpacities(s,l.tileID,a,l.collisionBoxArray)}}updateBucketOpacities(e,s,l,c){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const u=e.layers[0],d=u.layout,f=new at(null,0,!1,!1,!0),_=d.get("text-allow-overlap"),y=d.get("icon-allow-overlap"),b=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S="map"===d.get("text-rotation-alignment"),P="map"===d.get("text-pitch-alignment"),M="none"!==d.get("icon-text-fit"),C=new at(null,0,_&&(y||!e.hasIconData()||d.get("icon-optional")),y&&(_||!e.hasTextData()||d.get("text-optional")),!0);!e.collisionArrays&&c&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(c);const D=(e,s,a)=>{for(let l=0;l0,B=this.placedOrientations[c.crossTileID],O=B===a.at.vertical,V=B===a.at.horizontal||B===a.at.horizontalOnly;if(u>0||d>0){const s=wi(y.text);D(e.text,u,O?Ii:s),D(e.text,d,V?Ii:s);const a=y.text.isHidden();[c.rightJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.leftJustifiedTextSymbolIndex].forEach((s=>{s>=0&&(e.text.placedSymbolArray.get(s).hidden=a||O?1:0)})),c.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).hidden=a||V?1:0);const l=this.variableOffsets[c.crossTileID];l&&this.markUsedJustification(e,l.anchor,c,B);const f=this.placedOrientations[c.crossTileID];f&&(this.markUsedJustification(e,"left",c,f),this.markUsedOrientation(e,f,c))}if(F){const s=wi(y.icon),a=!(M&&c.verticalPlacedIconSymbolIndex&&O);c.placedIconSymbolIndex>=0&&(D(e.icon,c.numIconVertices,a?s:Ii),e.icon.placedSymbolArray.get(c.placedIconSymbolIndex).hidden=y.icon.isHidden()),c.verticalPlacedIconSymbolIndex>=0&&(D(e.icon,c.numVerticalIconVertices,a?Ii:s),e.icon.placedSymbolArray.get(c.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}const N=L&&L.has(s)?L.get(s):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const l=e.collisionArrays[s];if(l){let s=new a.P(0,0);if(l.textBox||l.verticalTextBox){let a=!0;if(b){const e=this.variableOffsets[_];e?(s=hi(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),S&&s._rotate(P?-this.transform.bearingInRadians:this.transform.bearingInRadians)):a=!1}if(l.textBox||l.verticalTextBox){let c;l.textBox&&(c=O),l.verticalTextBox&&(c=V),ui(e.textCollisionBox.collisionVertexArray,y.text.placed,!a||c,N.text,s.x,s.y)}}if(l.iconBox||l.verticalIconBox){const a=Boolean(!V&&l.verticalIconBox);let c;l.iconBox&&(c=a),l.verticalIconBox&&(c=!a),ui(e.iconCollisionBox.collisionVertexArray,y.icon.placed,c,N.icon,M?s.x:0,M?s.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function ui(e,s,a,l,c,u){l&&0!==l.length||(l=[0,0,0,0]);const d=l[0]-ci,f=l[1]-ci,_=l[2]-ci,y=l[3]-ci;e.emplaceBack(s?1:0,a?1:0,c||0,u||0,d,f),e.emplaceBack(s?1:0,a?1:0,c||0,u||0,_,f),e.emplaceBack(s?1:0,a?1:0,c||0,u||0,_,y),e.emplaceBack(s?1:0,a?1:0,c||0,u||0,d,y)}const di=Math.pow(2,25),pi=Math.pow(2,24),fi=Math.pow(2,17),mi=Math.pow(2,16),_i=Math.pow(2,9),xi=Math.pow(2,8),bi=Math.pow(2,1);function wi(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const s=e.placed?1:0,a=Math.floor(127*e.opacity);return a*di+s*pi+a*fi+s*mi+a*_i+s*xi+a*bi+s}const Ii=0;class xt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,s,a,l,c){const u=this._bucketParts;for(;this._currentTileIndexe.sortKey-s.sortKey)));this._currentPartIndex!this._forceFullPlacement&&b()-l>2;for(;this._currentPlacementIndex>=0;){const l=s[e[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new xt(l)),this._inProgressLayer.continuePlacement(a[l.source],this.placement,this._showCollisionBoxes,l,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ei=512/a.a3/2;class wt{constructor(e,s,l){this.tileID=e,this.bucketInstanceId=l,this._symbolsByKey={};const c=new Map;for(let e=0;e({x:Math.floor(e.anchorX*Ei),y:Math.floor(e.anchorY*Ei)}))),crossTileIDs:s.map((e=>e.crossTileID))};if(l.positions.length>128){const e=new a.aN(l.positions.length,16,Uint16Array);for(const{x:s,y:a}of l.positions)e.add(s,a);e.finish(),delete l.positions,l.index=e}this._symbolsByKey[e]=l}}getScaledCoordinates(e,s){const{x:l,y:c,z:u}=this.tileID.canonical,{x:d,y:f,z:_}=s.canonical,y=Ei/Math.pow(2,_-u),b=(f*a.a3+e.anchorY)*y,S=c*a.a3*Ei;return{x:Math.floor((d*a.a3+e.anchorX)*y-l*a.a3*Ei),y:Math.floor(b-S)}}findMatches(e,s,a){const l=this.tileID.canonical.ze))}}class Tt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Pt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const s=Math.round((e-this.lng)/360);if(0!==s)for(const e in this.indexes){const a=this.indexes[e],l={};for(const e in a){const c=a[e];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+s),l[c.tileID.key]=c}this.indexes[e]=l}this.lng=e}addBucket(e,s,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;ee.overscaledZ)for(const a in c){const u=c[a];u.tileID.isChildOf(e)&&u.findMatches(s.symbolInstances,e,l)}else{const u=c[e.scaledTo(Number(a)).key];u&&u.findMatches(s.symbolInstances,e,l)}}for(let e=0;e{s[e]=!0}));for(const e in this.layerIndexes)s[e]||delete this.layerIndexes[e]}}var Ai="void main() {fragColor=vec4(1.0);}";const zi={prelude:Ri("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Ri("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Ri("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:Ri("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Ri("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Ri("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:Ri(Ai,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Ri("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Ri("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Ri("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ri("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Ri("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Ri("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Ri(Ai,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Ri("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Ri("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Ri("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Ri("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:Ri("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:Ri("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:Ri("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ri("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Ri("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Ri("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Ri("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Ri("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Ri("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma 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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma 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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_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;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Ri("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Ri("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:Ri("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:Ri("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:Ri("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Ri("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Ri("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Ri("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Ri("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Ri("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Ri(e,s){const a=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,l=s.match(/in ([\w]+) ([\w]+)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),u=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=u?u.concat(c):c,f={};return{fragmentSource:e=e.replace(a,((e,s,a,l,c)=>(f[c]=!0,"define"===s?`\n#ifndef HAS_UNIFORM_u_${c}\nin ${a} ${l} ${c};\n#else\nuniform ${a} ${l} u_${c};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${c}\n ${a} ${l} ${c} = u_${c};\n#endif\n`))),vertexSource:s=s.replace(a,((e,s,a,l,c)=>{const u="float"===l?"vec2":"vec4",d=c.match(/color/)?"color":u;return f[c]?"define"===s?`\n#ifndef HAS_UNIFORM_u_${c}\nuniform lowp float u_${c}_t;\nin ${a} ${u} a_${c};\nout ${a} ${l} ${c};\n#else\nuniform ${a} ${l} u_${c};\n#endif\n`:"vec4"===d?`\n#ifndef HAS_UNIFORM_u_${c}\n ${c} = a_${c};\n#else\n ${a} ${l} ${c} = u_${c};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${c}\n ${c} = unpack_mix_${d}(a_${c}, u_${c}_t);\n#else\n ${a} ${l} ${c} = u_${c};\n#endif\n`:"define"===s?`\n#ifndef HAS_UNIFORM_u_${c}\nuniform lowp float u_${c}_t;\nin ${a} ${u} a_${c};\n#else\nuniform ${a} ${l} u_${c};\n#endif\n`:"vec4"===d?`\n#ifndef HAS_UNIFORM_u_${c}\n ${a} ${l} ${c} = a_${c};\n#else\n ${a} ${l} ${c} = u_${c};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${c}\n ${a} ${l} ${c} = unpack_mix_${d}(a_${c}, u_${c}_t);\n#else\n ${a} ${l} ${c} = u_${c};\n#endif\n`})),staticAttributes:l,staticUniforms:d}}class St{constructor(e,s,a){this.vertexBuffer=e,this.indexBuffer=s,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Li=a.aO([{name:"a_pos",type:"Int16",components:2}]);const Fi="#define PROJECTION_MERCATOR",Bi="mercator";class At{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Bi}get shaderDefine(){return Fi}get shaderPreludeCode(){return zi.projectionMercator}get vertexShaderPreludeCode(){return zi.projectionMercator.vertexSource}get subdivisionGranularity(){return a.aP.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,s,l,c,u){if(this._cachedMesh)return this._cachedMesh;const d=new a.aQ;d.emplaceBack(0,0),d.emplaceBack(a.a3,0),d.emplaceBack(0,a.a3),d.emplaceBack(a.a3,a.a3);const f=e.createVertexBuffer(d,Li.members),_=a.aR.simpleSegment(0,0,4,2),y=new a.aS;y.emplaceBack(1,0,2),y.emplaceBack(1,2,3);const b=e.createIndexBuffer(y);return this._cachedMesh=new St(f,b,_),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Lt{constructor(e=0,s=0,a=0,l=0){if(isNaN(e)||e<0||isNaN(s)||s<0||isNaN(a)||a<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=s,this.left=a,this.right=l}interpolate(e,s,l){return null!=s.top&&null!=e.top&&(this.top=a.F.number(e.top,s.top,l)),null!=s.bottom&&null!=e.bottom&&(this.bottom=a.F.number(e.bottom,s.bottom,l)),null!=s.left&&null!=e.left&&(this.left=a.F.number(e.left,s.left,l)),null!=s.right&&null!=e.right&&(this.right=a.F.number(e.right,s.right,l)),this}getCenter(e,s){const l=a.ai((this.left+e-this.right)/2,0,e),c=a.ai((this.top+s-this.bottom)/2,0,s);return new a.P(l,c)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Lt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Oi(e,s){if(!e.renderWorldCopies||e.lngRange)return;const a=s.lng-e.center.lng;s.lng+=a>180?-360:a<-180?360:0}function Vi(e){return Math.max(0,Math.floor(e))}class Bt{constructor(e,s){var l;this.applyConstrain=(e,s)=>null!==this._constrainOverride?this._constrainOverride(e,s):this._callbacks.defaultConstrain(e,s),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===(null==s?void 0:s.renderWorldCopies)||!!(null==s?void 0:s.renderWorldCopies),this._minZoom=(null==s?void 0:s.minZoom)||0,this._maxZoom=(null==s?void 0:s.maxZoom)||22,this._minPitch=null==(null==s?void 0:s.minPitch)?0:null==s?void 0:s.minPitch,this._maxPitch=null==(null==s?void 0:s.maxPitch)?60:null==s?void 0:s.maxPitch,this._constrainOverride=null!==(l=null==s?void 0:s.constrainOverride)&&void 0!==l?l:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new a.U(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Vi(this._zoom),this._scale=a.al(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Lt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,s,l){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Vi(this._zoom),this._scale=a.al(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Lt(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!l&&e.autoCalculateNearFarZ,s&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const s=a.V(e,-180,180)*Math.PI/180;var l,u,d,f,_,y,b,S,P;this._bearingInRadians!==s&&(this._unmodified=!1,this._bearingInRadians=s,this._calcMatrices(),this._rotationMatrix=c(),l=this._rotationMatrix,d=-this._bearingInRadians,f=(u=this._rotationMatrix)[0],_=u[1],y=u[2],b=u[3],S=Math.sin(d),P=Math.cos(d),l[0]=f*P+y*S,l[1]=_*P+b*S,l[2]=f*-S+y*P,l[3]=_*-S+b*P)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const s=a.ai(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==s&&(this._unmodified=!1,this._pitchInRadians=s,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const s=e/180*Math.PI;this._rollInRadians!==s&&(this._unmodified=!1,this._rollInRadians=s,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return a.aT(this._fovInRadians)}setFov(e){e=a.ai(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=a.ak(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const s=this.applyConstrain(this._center,e).zoom;this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this._tileZoom=Math.max(0,Math.floor(s)),this._scale=a.al(s),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,s){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=s,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,s,a){this._unmodified=!1,this._edgeInsets.interpolate(e,s,a),this.constrainInternal(),this._calcMatrices()}resize(e,s,a=!0){this._width=e,this._height=s,a&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new $([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-a.aj,a.aj])}getCameraQueryGeometry(e,s){if(1===s.length)return[s[0],e];{const{minX:l,minY:c,maxX:u,maxY:d}=a.a6.fromPoints(s).extend(e);return[new a.P(l,c),new a.P(u,c),new a.P(u,d),new a.P(l,d),new a.P(l,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:s,zoom:a}=this.applyConstrain(this.center,this.zoom);this.setCenter(s),this.setZoom(a),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=a.am(new Float64Array(16));a.O(e,e,[this._width/2,-this._height/2,1]),a.N(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=a.am(new Float64Array(16)),a.O(e,e,[1,-1,1]),a.N(e,e,[-1,-1,0]),a.O(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,s,l,c){const u=void 0!==l?l:this.bearing,d=c=void 0!==c?c:this.pitch,f=a.a5.fromLngLat(e,s),_=-Math.cos(a.ak(d)),y=Math.sin(a.ak(d)),b=y*Math.sin(a.ak(u)),S=-y*Math.cos(a.ak(u));let P=this.elevation;const M=s-P;let C;_*M>=0||Math.abs(_)<.1?(C=1e4,P=s+C*_):C=-M/_;let D,L,F=a.aU(1,f.y),B=0;do{if(B+=1,B>10)break;L=C/F,D=new a.a5(f.x+b*L,f.y+S*L),F=1/D.meterInMercatorCoordinateUnits()}while(Math.abs(C-L*F)>1e-12);return{center:D.toLngLat(),elevation:P,zoom:a.ao(this.height/2/Math.tan(this.fovInRadians/2)/L/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const s=a.an(1,this.center.lat)*this.worldSize,l=this.cameraToCenterDistance/s,c=a.a5.fromLngLat(this.center,this.elevation),u=Ge(this.center,this.elevation,this.pitch,this.bearing,l);this._elevation=e;const d=this.calculateCenterFromCameraLngLatAlt(u.toLngLat(),a.aU(u.z,c.y),this.bearing,this.pitch);this._elevation=d.elevation,this._center=d.center,this.setZoom(d.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=a.an(1,this.center.lat)*this.worldSize;return Ge(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const s=e.canonical.z>=0?1<this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]0?(s+=e[l]*this.min[l],a+=e[l]*this.max[l]):(a+=e[l]*this.min[l],s+=e[l]*this.max[l]);return s>=0?2:a<0?0:1}}class jt{distanceToTile2d(e,s,a,l){const c=l.distanceX([e,s]),u=l.distanceY([e,s]);return Math.hypot(c,u)}getWrap(e,s,a){return a}getTileBoundingVolume(e,s,l,c){var u,d;let f=0,_=0;if(null==c?void 0:c.terrain){const y=new a.a0(e.z,s,e.z,e.x,e.y),b=c.terrain.getMinMaxElevation(y);f=null!==(u=b.minElevation)&&void 0!==u?u:Math.min(0,l),_=null!==(d=b.maxElevation)&&void 0!==d?d:Math.max(0,l)}const y=1<c}allowWorldCopies(){return!0}prepareNextFrame(){}}class Ut{constructor(e,s,a){this.points=e,this.planes=s,this.aabb=a}static fromInvProjectionMatrix(e,s=1,l=0,c,u){const d=u?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],f=Math.pow(2,l),_=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((l=>function(e,s,l,c){const u=a.aB([],e,s),d=1/u[3]/l*c;return a.b0(u,u,[d,d,1/u[3],d])}(l,e,s,f)));c&&function(e,s,l,c){const u=c?4:0,d=c?0:4;let f=0;const _=[],y=[];for(let s=0;s<4;s++){const l=a.aY([],e[s+d],e[s+u]),c=a.b1(l);a.aV(l,l,1/c),_.push(c),y.push(l)}for(let s=0;s<4;s++){const c=a.b2(e[s+u],y[s],l);f=null!==c&&c>=0?Math.max(f,c):Math.max(f,_[s])}const b=function(e,s){const l=a.aY([],e[s[0]],e[s[1]]),c=a.aY([],e[s[2]],e[s[1]]),u=[0,0,0,0];return a.aZ(u,a.a_([],l,c)),u[3]=-a.a$(u,e[s[0]]),u}(e,s),S=function(e,s){const l=a.b3(e),c=a.b4([],e,1/l),u=a.aY([],s,a.aV([],c,a.a$(s,c))),d=a.b3(u);if(d>0){const e=Math.sqrt(1-c[3]*c[3]),l=a.aV([],c,-c[3]),f=a.aW([],l,a.aV([],u,e/d));return a.b5(s,f)}return null}(l,b);if(null!==S){const e=S/a.a$(y[0],b);f=Math.min(f,e)}for(let s=0;s<4;s++){const a=Math.min(f,_[s]);e[s+d]=[e[s+u][0]+y[s][0]*a,e[s+u][1]+y[s][1]*a,e[s+u][2]+y[s][2]*a,1]}}(_,d[0],c,u);const y=d.map((e=>{const s=a.aY([],_[e[0]],_[e[1]]),l=a.aY([],_[e[2]],_[e[1]]),c=a.aZ([],a.a_([],s,l)),u=-a.a$(c,_[e[1]]);return c.concat(u)})),b=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],S=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of _)for(let s=0;s<3;s++)b[s]=Math.min(b[s],e[s]),S[s]=Math.max(S[s],e[s]);return new Ut(_,y,new Ot(b,S))}}class Nt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,s,a){return this._helper.interpolatePadding(e,s,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,s,a=!0){this._helper.resize(e,s,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,s){this._helper.overrideNearFarZ(e,s)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,s){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,s)=>{s=a.ai(+s,this.minZoom,this.maxZoom);const l={center:new a.U(e.lng,e.lat),zoom:s};let c=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===c){const e=180-1e-10;c=[-e,e]}const u=this.tileSize*a.al(l.zoom);let d=0,f=u,_=0,y=u,b=0,S=0;const{x:P,y:M}=this.size;if(this._helper._latRange){const e=this._helper._latRange;d=a.W(e[1])*u,f=a.W(e[0])*u,f-df&&(F=f-e)}if(c){const e=(_+y)/2;let s=C;this._helper._renderWorldCopies&&(s=a.V(C,e-u/2,e+u/2));const l=P/2;s-l<_&&(L=_+l),s+l>y&&(L=y-l)}if(void 0!==L||void 0!==F){const e=new a.P(null!=L?L:C,null!=F?F:D);l.center=Ne(u,e).wrap()}return l},this.applyConstrain=(e,s)=>this._helper.applyConstrain(e,s),this._helper=new Bt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,s)=>this.defaultConstrain(e,s)},e),this._coveringTilesDetailsProvider=new jt}clone(){const e=new Nt;return e.apply(this),e}apply(e,s,a){this._helper.apply(e,s,a)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const s=[new a.b6(0,e)];if(this._helper._renderWorldCopies){const l=this.screenPointToMercatorCoordinate(new a.P(0,0)),c=this.screenPointToMercatorCoordinate(new a.P(this._helper._width,0)),u=this.screenPointToMercatorCoordinate(new a.P(this._helper._width,this._helper._height)),d=this.screenPointToMercatorCoordinate(new a.P(0,this._helper._height)),f=Math.floor(Math.min(l.x,c.x,u.x,d.x)),_=Math.floor(Math.max(l.x,c.x,u.x,d.x)),y=1;for(let l=f-y;l<=_+y;l++)0!==l&&s.push(new a.b6(l,e))}return s}getCameraFrustum(){return Ut.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const s=this.screenPointToLocation(this.centerPoint,e),a=e?e.getElevationForLngLatZoom(s,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(e,s){const l=a.an(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(s,l),u=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,l),d=a.a5.fromLngLat(e),f=new a.a5(d.x-(c.x-u.x),d.y-(c.y-u.y));this.setCenter(null==f?void 0:f.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,s){return s?this.coordinatePoint(a.a5.fromLngLat(e),s.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(a.a5.fromLngLat(e))}screenPointToLocation(e,s){var a;return null===(a=this.screenPointToMercatorCoordinate(e,s))||void 0===a?void 0:a.toLngLat()}screenPointToMercatorCoordinate(e,s){if(s){const a=s.pointCoordinate(e);if(null!=a)return a}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,s){const l=s||0,c=[e.x,e.y,0,1],u=[e.x,e.y,1,1];a.aB(c,c,this._pixelMatrixInverse),a.aB(u,u,this._pixelMatrixInverse);const d=c[3],f=u[3],_=c[1]/d,y=u[1]/f,b=c[2]/d,S=u[2]/f,P=b===S?0:(l-b)/(S-b);return new a.a5(a.F.number(c[0]/d,u[0]/f,P)/this.worldSize,a.F.number(_,y,P)/this.worldSize,l)}coordinatePoint(e,s=0,l=this._pixelMatrix){const c=[e.x*this.worldSize,e.y*this.worldSize,s,1];return a.aB(c,c,l),new a.P(c[0]/c[3],c[1]/c[3])}getBounds(){const e=Math.max(0,this._helper._height/2-je(this));return(new $).extend(this.screenPointToLocation(new a.P(0,e))).extend(this.screenPointToLocation(new a.P(this._helper._width,e))).extend(this.screenPointToLocation(new a.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new a.P(0,this._helper._height)))}isPointOnMapSurface(e,s){return s?null!=s.pointCoordinate(e):e.y>this.height/2-je(this)}calculatePosMatrix(e,s=!1,l){var c;const u=null!==(c=e.key)&&void 0!==c?c:a.b7(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),d=s?this._alignedPosMatrixCache:this._posMatrixCache;if(d.has(u)){const e=d.get(u);return l?e.f32:e.f64}const f=Ue(e,this.worldSize);a.Q(f,s?this._alignedProjMatrix:this._viewProjMatrix,f);const _={f64:f,f32:new Float32Array(f)};return d.set(u,_),l?_.f32:_.f64}calculateFogMatrix(e){const s=e.key,l=this._fogMatrixCacheF32;if(l.has(s))return l.get(s);const c=Ue(e,this.worldSize);return a.Q(c,this._fogMatrix,c),l.set(s,new Float32Array(c)),l.get(s)}calculateCenterFromCameraLngLatAlt(e,s,a,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,s,a,l)}_calculateNearFarZIfNeeded(e,s,l){if(!this._helper.autoCalculateNearFarZ)return;const c=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),u=e-c*this._helper._pixelPerMeter/Math.cos(s),d=c<0?u:e,f=Math.PI/2+this.pitchInRadians,_=a.ak(this.fov)*(Math.abs(Math.cos(a.ak(this.roll)))*this.height+Math.abs(Math.sin(a.ak(this.roll)))*this.width)/this.height*(.5+l.y/this.height),y=Math.sin(_)*d/Math.sin(a.ai(Math.PI-f-_,.01,Math.PI-.01)),b=je(this),S=Math.atan(b/this._helper.cameraToCenterDistance),P=a.ak(.75),M=S>P?2*S*(.5+l.y/(2*b)):P,C=Math.sin(M)*d/Math.sin(a.ai(Math.PI-f-M,.01,Math.PI-.01)),D=Math.min(y,C);this._helper._farZ=1.01*(Math.cos(Math.PI/2-s)*D+d),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,s=Ve(this.worldSize,this.center),l=s.x,c=s.y;this._helper._pixelPerMeter=a.an(1,this.center.lat)*this.worldSize;const u=a.ak(Math.min(this.pitch,Oe)),d=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(u));let f;this._calculateNearFarZIfNeeded(d,u,e),f=new Float64Array(16),a.b8(f,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),a.av(this._invProjMatrix,f),f[8]=2*-e.x/this._helper._width,f[9]=2*e.y/this._helper._height,this._projectionMatrix=a.b9(f),a.O(f,f,[1,-1,1]),a.N(f,f,[0,0,-this._helper.cameraToCenterDistance]),a.ba(f,f,-this.rollInRadians),a.bb(f,f,this.pitchInRadians),a.ba(f,f,-this.bearingInRadians),a.N(f,f,[-l,-c,0]),this._mercatorMatrix=a.O([],f,[this.worldSize,this.worldSize,this.worldSize]),a.O(f,f,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=a.Q(new Float64Array(16),this.clipSpaceToPixelsMatrix,f),a.N(f,f,[0,0,-this.elevation]),this._viewProjMatrix=f,this._invViewProjMatrix=a.av([],f);const _=[0,0,-1,1];a.aB(_,_,this._invViewProjMatrix),this._cameraPosition=[_[0]/_[3],_[1]/_[3],_[2]/_[3]],this._fogMatrix=new Float64Array(16),a.b8(this._fogMatrix,this.fovInRadians,this.width/this.height,d,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,a.O(this._fogMatrix,this._fogMatrix,[1,-1,1]),a.N(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),a.ba(this._fogMatrix,this._fogMatrix,-this.rollInRadians),a.bb(this._fogMatrix,this._fogMatrix,this.pitchInRadians),a.ba(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),a.N(this._fogMatrix,this._fogMatrix,[-l,-c,0]),a.O(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),a.N(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=a.Q(new Float64Array(16),this.clipSpaceToPixelsMatrix,f);const y=this._helper._width%2/2,b=this._helper._height%2/2,S=Math.cos(this.bearingInRadians),P=Math.sin(-this.bearingInRadians),M=l-Math.round(l)+S*y+P*b,C=c-Math.round(c)+S*b+P*y,D=new Float64Array(f);if(a.N(D,D,[M>.5?M-1:M,C>.5?C-1:C,0]),this._alignedProjMatrix=D,f=a.av(new Float64Array(16),this._pixelMatrix),!f)throw new Error("failed to invert matrix");this._pixelMatrixInverse=f,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new a.P(0,0)),s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.aB(s,s,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=a.an(1,this.center.lat)*this.worldSize;return Ge(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,s){const l=a.a5.fromLngLat(e),c=[l.x*this.worldSize,l.y*this.worldSize,s,1];return a.aB(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(e){const{overscaledTileID:s,aligned:l,applyTerrainMatrix:c}=e,u=this._helper.getMercatorTileCoordinates(s),d=s?this.calculatePosMatrix(s,l,!0):null;let f;return f=s&&s.terrainRttPosMatrix32f&&c?s.terrainRttPosMatrix32f:d||a.bc(),{mainMatrix:f,tileMercatorCoords:u,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:f}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,s,a){return 1}transformLightDirection(e){return a.aX(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,s,l,c){const u=this.calculatePosMatrix(l);let d;c?(d=[e,s,c(e,s),1],a.aB(d,d,u)):(d=[e,s,0,1],li(d,d,u));const f=d[3];return{point:new a.P(d[0]/f,d[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}populateCache(e){for(const s of e)this.calculatePosMatrix(s)}getMatrixForModel(e,s){const l=a.a5.fromLngLat(e,s),c=l.meterInMercatorCoordinateUnits(),u=a.bd();return a.N(u,u,[l.x,l.y,l.z]),a.ba(u,u,Math.PI),a.bb(u,u,Math.PI/2),a.O(u,u,[-c,c,c]),u}getProjectionDataForCustomLayer(e=!0){const s=new a.a0(0,0,0,0,0),l=this.getProjectionData({overscaledTileID:s,applyGlobeMatrix:e}),c=Ue(s,this.worldSize);a.Q(c,this._viewProjMatrix,c),l.tileMercatorCoords=[0,0,1,1];const u=[a.a3,a.a3,this.worldSize/this._helper.pixelsPerMeter],d=a.be();return a.O(d,c,u),l.fallbackMatrix=d,l.mainMatrix=d,l}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Ni(){a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function ji(e){if(e.useSlerp)if(e.k<1){const s=a.bf(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),l=a.bf(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),c=new Float64Array(4);a.bg(c,s,l,e.k);const u=a.bh(c);e.tr.setRoll(u.roll),e.tr.setPitch(u.pitch),e.tr.setBearing(u.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(a.F.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(a.F.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(a.F.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Ui(e,s,l,c,u){const d=u.padding,f=Ve(u.worldSize,l.getNorthWest()),_=Ve(u.worldSize,l.getNorthEast()),y=Ve(u.worldSize,l.getSouthEast()),b=Ve(u.worldSize,l.getSouthWest()),S=a.ak(-c),P=f.rotate(S),M=_.rotate(S),C=y.rotate(S),D=b.rotate(S),L=new a.P(Math.max(P.x,M.x,D.x,C.x),Math.max(P.y,M.y,D.y,C.y)),F=new a.P(Math.min(P.x,M.x,D.x,C.x),Math.min(P.y,M.y,D.y,C.y)),B=L.sub(F),O=(u.width-(d.left+d.right+s.left+s.right))/B.x,V=(u.height-(d.top+d.bottom+s.top+s.bottom))/B.y;if(V<0||O<0)return void Ni();const N=Math.min(a.ao(u.scale*Math.min(O,V)),e.maxZoom),j=a.P.convert(e.offset),G=new a.P((s.left-s.right)/2,(s.top-s.bottom)/2).rotate(a.ak(c)),Z=j.add(G).mult(u.scale/a.al(N));return{center:Ne(u.worldSize,f.add(y).div(2).sub(Z)),zoom:N,bearing:c}}class Wt{get useGlobeControls(){return!1}handlePanInertia(e,s){const a=e.mag(),l=Math.abs(je(s));return{easingOffset:e.mult(Math.min(.75*l/a,1)),easingCenter:s.center}}handleMapControlsRollPitchBearingZoom(e,s){e.bearingDelta&&s.setBearing(s.bearing+e.bearingDelta),e.pitchDelta&&s.setPitch(s.pitch+e.pitchDelta),e.rollDelta&&s.setRoll(s.roll+e.rollDelta),e.zoomDelta&&s.setZoom(s.zoom+e.zoomDelta)}handleMapControlsPan(e,s,a){e.around.distSqr(s.centerPoint)<.01||s.setLocationAtPoint(a,e.around)}cameraForBoxAndBearing(e,s,a,l,c){return Ui(e,s,a,l,c)}handleJumpToCenterZoom(e,s){e.zoom!==(void 0!==s.zoom?+s.zoom:e.zoom)&&e.setZoom(+s.zoom),void 0!==s.center&&e.setCenter(a.U.convert(s.center))}handleEaseTo(e,s){const l=e.zoom,c=e.padding,u={roll:e.roll,pitch:e.pitch,bearing:e.bearing},d={roll:void 0===s.roll?e.roll:s.roll,pitch:void 0===s.pitch?e.pitch:s.pitch,bearing:void 0===s.bearing?e.bearing:s.bearing},f=void 0!==s.zoom,_=!e.isPaddingEqual(s.padding);let y=!1;const b=f?+s.zoom:e.zoom;let S=e.centerPoint.add(s.offsetAsPoint);const P=e.screenPointToLocation(S),{center:M,zoom:C}=e.applyConstrain(a.U.convert(s.center||P),null!=b?b:l);Oi(e,M);const D=Ve(e.worldSize,P),L=Ve(e.worldSize,M).sub(D),F=a.al(C-l);return y=C!==l,{easeFunc:f=>{if(y&&e.setZoom(a.F.number(l,C,f)),a.bi(u,d)||ji({startEulerAngles:u,endEulerAngles:d,tr:e,k:f,useSlerp:u.roll!=d.roll}),_&&(e.interpolatePadding(c,s.padding,f),S=e.centerPoint.add(s.offsetAsPoint)),s.around)e.setLocationAtPoint(s.around,s.aroundPoint);else{const s=a.al(e.zoom-l),c=C>l?Math.min(2,F):Math.max(.5,F),u=Math.pow(c,1-f),d=Ne(e.worldSize,D.add(L.mult(f*u)).mult(s));e.setLocationAtPoint(e.renderWorldCopies?d.wrap():d,S)}},isZooming:y,elevationCenter:M}}handleFlyTo(e,s){const l=void 0!==s.zoom,c=e.zoom,u=e.applyConstrain(a.U.convert(s.center||s.locationAtOffset),l?+s.zoom:c),d=u.center,f=u.zoom;Oi(e,d);const _=Ve(e.worldSize,s.locationAtOffset),y=Ve(e.worldSize,d).sub(_),b=y.mag(),S=a.al(f-c);let P;if(void 0!==s.minZoom){const l=Math.min(+s.minZoom,c,f),u=e.applyConstrain(d,l).zoom;P=a.al(u-c)}return{easeFunc:(s,l,u,b)=>{e.setZoom(1===s?f:c+a.ao(l));const S=1===s?d:Ne(e.worldSize,_.add(y.mult(u)).mult(l));e.setLocationAtPoint(e.renderWorldCopies?S.wrap():S,b)},scaleOfZoom:S,targetCenter:d,scaleOfMinZoom:P,pixelPathLength:b}}}class qt{constructor(e,s,a){this.blendFunction=e,this.blendColor=s,this.mask=a}}qt.Replace=[1,0],qt.disabled=new qt(qt.Replace,a.bj.transparent,[!1,!1,!1,!1]),qt.unblended=new qt(qt.Replace,a.bj.transparent,[!0,!0,!0,!0]),qt.alphaBlended=new qt([1,771],a.bj.transparent,[!0,!0,!0,!0]);const Gi=2305;class Ht{constructor(e,s,a){this.enable=e,this.mode=s,this.frontFace=a}}Ht.disabled=new Ht(!1,1029,Gi),Ht.backCCW=new Ht(!0,1029,Gi),Ht.frontCCW=new Ht(!0,1028,Gi);class Xt{constructor(e,s,a){this.func=e,this.mask=s,this.range=a}}Xt.ReadOnly=!1,Xt.ReadWrite=!0,Xt.disabled=new Xt(519,Xt.ReadOnly,[0,1]);const Zi=7680;class Yt{constructor(e,s,a,l,c,u){this.test=e,this.ref=s,this.mask=a,this.fail=l,this.depthFail=c,this.pass=u}}Yt.disabled=new Yt({func:519,mask:0},0,0,Zi,Zi,Zi);const qi=new WeakMap;function $i(e){var s;if(qi.has(e))return qi.get(e);{const a=null===(s=e.getParameter(e.VERSION))||void 0===s?void 0:s.startsWith("WebGL 2.0");return qi.set(e,a),a}}class ei{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const s=e.context,l=s.gl;this._texFormat=l.RGBA,this._texType=l.UNSIGNED_BYTE;const c=new a.aQ;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const u=new a.aS;u.emplaceBack(0,1,2),this._fullscreenTriangle=new St(s.createVertexBuffer(c,Li.members),s.createIndexBuffer(u),a.aR.simpleSegment(0,0,c.length,u.length)),this._resultBuffer=new Uint8Array(4),s.activeTexture.set(l.TEXTURE1);const d=l.createTexture();l.bindTexture(l.TEXTURE_2D,d),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.texImage2D(l.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=s.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(d),$i(l)&&(this._pbo=l.createBuffer(),l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.bufferData(l.PIXEL_PACK_BUFFER,4,l.STREAM_READ),l.bindBuffer(l.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,s){const a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,s),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,s=e.gl;e.activeTexture.set(s.TEXTURE1),s.bindTexture(s.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,s){const l=this._cachedRenderContext.context,c=l.gl;if(this._bindFramebuffer(),l.viewport.set([0,0,this._texWidth,this._texHeight]),l.clear({color:a.bj.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(l,c.TRIANGLES,Xt.disabled,Yt.disabled,qt.unblended,Ht.disabled,((e,s)=>({u_input:e,u_output_expected:s}))(e,s),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&$i(c)){c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.readBuffer(c.COLOR_ATTACHMENT0),c.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);const e=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&$i(e)){const s=e.clientWaitSync(this._readbackQueue.sync,0,0);if(s===e.WAIT_FAILED)return a.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(s===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ei._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let s=0;return s+=e[0]/256,s+=e[1]/65536,s+=e[2]/16777216,e[3]<127&&(s=-s),s/128}}const Wi=a.a3/128;function Hi(e,s){const l=void 0!==e.granularity?Math.max(e.granularity,1):1,c=l+(e.generateBorders?2:0),u=l+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),d=c+1,f=u+1,_=e.generateBorders?-1:0,y=e.generateBorders||e.extendToNorthPole?-1:0,b=l+(e.generateBorders?1:0),S=l+(e.generateBorders||e.extendToSouthPole?1:0),P=d*f,M=c*u*6,C=d*f>65536;if(C&&"16bit"===s)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const D=C||"32bit"===s,L=new Int16Array(2*P);let F=0;for(let s=y;s<=S;s++)for(let c=_;c<=b;c++){let u=c/l*a.a3;-1===c&&(u=-Wi),c===l+1&&(u=a.a3+Wi);let d=s/l*a.a3;-1===s&&(d=e.extendToNorthPole?a.bl:-Wi),s===l+1&&(d=e.extendToSouthPole?a.bm:a.a3+Wi),L[F++]=u,L[F++]=d}const B=D?new Uint32Array(M):new Uint16Array(M);let O=0;for(let e=0;e0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,s,a,l,c){return this.currentProjection.getMeshFromTileID(e,s,a,l,c)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function Ki(e){const s=sr(e.worldSize,e.center.lat);return 2*Math.PI*s}function Ji(e,s,l,c,u){const d=1/(1<1e-6){const c=e[0]/l,u=Math.acos(e[2]/l),d=(c>0?u:-u)/Math.PI*180;return new a.U(a.V(d,-180,180),s)}return new a.U(0,s)}function lr(e){return Math.cos(e*Math.PI/180)}function cr(e,s){const l=lr(e),c=lr(s);return a.ao(c/l)}function hr(e,s){const l=e.rotate(s.bearingInRadians),c=s.zoom+cr(s.center.lat,0),u=a.bo(1/lr(s.center.lat),1/lr(Math.min(Math.abs(s.center.lat),60)),a.br(c,7,3,0,1)),d=360/Ki({worldSize:s.worldSize,center:{lat:s.center.lat}});return new a.U(s.center.lng-l.x*d*u,a.ai(s.center.lat+l.y*d,-a.aj,a.aj))}function ur(e){const s=.5*e,a=Math.sin(s),l=Math.cos(s);return Math.log(a+l)-Math.log(l-a)}function dr(e,s,l,c){const u=e.lat+l*c;if(Math.abs(l)>1){const d=(Math.sign(e.lat+l)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,f=Math.abs(e.lat+l)*Math.PI/180,_=ur(d+c*(f-d)),y=ur(d),b=ur(f);return new a.U(e.lng+s*((_-y)/(b-y)),u)}return new a.U(e.lng+s*c,u)}class gi{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,s,a,l){const c=`${e.z}_${e.x}_${e.y}_${(null==l?void 0:l.terrain)?"t":""}`,u=this._cache.get(c);if(u)return u;const d=this._cachePrevious.get(c);if(d)return this._cache.set(c,d),d;const f=this._boundingVolumeFactory(e,s,a,l);return this._cache.set(c,f),this._hadAnyChanges=!0,f}}class vi{constructor(e,s,a,l){this.min=a,this.max=l,this.points=e,this.planes=s}static fromAabb(e,s){const a=[];for(let l=0;l<8;l++)a.push([1&~l?e[0]:s[0],1==(l>>1&1)?s[1]:e[1],1==(l>>2&1)?s[2]:e[2]]);return new vi(a,[[-1,0,0,s[0]],[1,0,0,-e[0]],[0,-1,0,s[1]],[0,1,0,-e[1]],[0,0,-1,s[2]],[0,0,1,-e[2]]],e,s)}static fromCenterSizeAngles(e,s,l){const c=a.bv([],l[0],l[1],l[2]),u=a.bw([],[s[0],0,0],c),d=a.bw([],[0,s[1],0],c),f=a.bw([],[0,0,s[2]],c),_=[...e],y=[...e];for(let s=0;s<8;s++)for(let a=0;a<3;a++){const l=e[a]+u[a]*(1&~s?-1:1)+d[a]*(1==(s>>1&1)?1:-1)+f[a]*(1==(s>>2&1)?1:-1);_[a]=Math.min(_[a],l),y[a]=Math.max(y[a],l)}const b=[];for(let s=0;s<8;s++){const l=[...e];a.aW(l,l,a.aV([],u,1&~s?-1:1)),a.aW(l,l,a.aV([],d,1==(s>>1&1)?1:-1)),a.aW(l,l,a.aV([],f,1==(s>>2&1)?1:-1)),b.push(l)}return new vi(b,[[...u,-a.a$(u,b[0])],[...d,-a.a$(d,b[0])],[...f,-a.a$(f,b[0])],[-u[0],-u[1],-u[2],-a.a$(u,b[7])],[-d[0],-d[1],-d[2],-a.a$(d,b[7])],[-f[0],-f[1],-f[2],-a.a$(f,b[7])]],_,y)}intersectsFrustum(e){let s=!0;const a=this.points.length,l=this.planes.length,c=e.planes.length,u=e.points.length;for(let l=0;l=0&&u++}if(0===u)return 0;u=0&&l++}if(0===l)return 0}return 1}intersectsPlane(e){const s=this.points.length;let a=0;for(let l=0;l=0&&a++}return a===s?2:0===a?0:1}}function fr(e,s,a){const l=e-s;return l<0?-l:Math.max(0,l-a)}function mr(e,s,a,l,c){const u=e-a;let d;return d=u<0?Math.min(-u,1+u-c):u>1?Math.min(Math.max(u-c,0),1-u):0,Math.max(d,fr(s,l,c))}class yi{constructor(){this._boundingVolumeCache=new gi(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,s,a,l){const c=1<4}allowWorldCopies(){return!1}getTileBoundingVolume(e,s,a,l){return this._boundingVolumeCache.getTileBoundingVolume(e,s,a,l)}_computeTileBoundingVolume(e,s,l,c){var u,d;let f=0,_=0;if(null==c?void 0:c.terrain){const y=new a.a0(e.z,s,e.z,e.x,e.y),b=c.terrain.getMinMaxElevation(y);f=null!==(u=b.minElevation)&&void 0!==u?u:Math.min(0,l),_=null!==(d=b.maxElevation)&&void 0!==d?d:Math.max(0,l)}if(f/=a.by,_/=a.by,f+=1,_+=1,e.z<=0)return vi.fromAabb([-_,-_,-_],[_,_,_]);if(1===e.z)return vi.fromAabb([0===e.x?-_:0,0===e.y?0:-_,-_],[0===e.x?0:_,0===e.y?_:0,_]);{const s=[Ji(0,0,e.x,e.y,e.z),Ji(a.a3,0,e.x,e.y,e.z),Ji(a.a3,a.a3,e.x,e.y,e.z),Ji(0,a.a3,e.x,e.y,e.z)],l=[];for(const e of s)l.push(a.aV([],e,_));if(_!==f)for(const e of s)l.push(a.aV([],e,f));0===e.y&&l.push([0,1,0]),e.y===(1<=(1<{const l=a.ai(e.lat,-a.aj,a.aj),c=a.ai(+s,this.minZoom+cr(0,l),this.maxZoom);return{center:new a.U(e.lng,l),zoom:c}},this.applyConstrain=(e,s)=>this._helper.applyConstrain(e,s),this._helper=new Bt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,s)=>this.defaultConstrain(e,s)},e),this._coveringTilesDetailsProvider=new yi}clone(){const e=new Ti;return e.apply(this),e}apply(e,s){this._globeLatitudeErrorCorrectionRadians=s||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=a.bt();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:s,applyGlobeMatrix:a}=e,l=this._helper.getMercatorTileCoordinates(s);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:l,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const s=this.pitchInRadians,l=this.cameraToCenterDistance/e,c=Math.sin(s)*l,u=Math.cos(s)*l+1,d=1/Math.sqrt(c*c+u*u)*1;let f=-c,_=u;const y=Math.sqrt(f*f+_*_);f/=y,_/=y;const b=[0,f,_];a.bA(b,b,[0,0,0],-this.bearingInRadians),a.bB(b,b,[0,0,0],-1*this.center.lat*Math.PI/180),a.bC(b,b,[0,0,0],this.center.lng*Math.PI/180);const S=1/a.b1(b);return a.aV(b,b,S),[...b,-d*S]}isLocationOccluded(e){return!this.isSurfacePointVisible(Qi(e))}transformLightDirection(e){const s=this._helper._center.lng*Math.PI/180,l=this._helper._center.lat*Math.PI/180,c=Math.cos(l),u=[Math.sin(s)*c,Math.sin(l),Math.cos(s)*c],d=[u[2],0,-u[0]],f=[0,0,0];a.a_(f,d,u),a.aZ(d,d),a.aZ(f,f);const _=[0,0,0];return a.aZ(_,[d[0]*e[0]+f[0]*e[1]+u[0]*e[2],d[1]*e[0]+f[1]*e[1]+u[1]*e[2],d[2]*e[0]+f[2]*e[1]+u[2]*e[2]]),_}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,s,l){const c=function(e,s,l){const c=1/(1<u&&(u=s),l<_&&(_=l),l>f&&(f=l)}const b=[y.lng+d,y.lat+_,y.lng+u,y.lat+f];return this.isSurfacePointOnScreen([0,1,0])&&(b[3]=90,b[0]=-180,b[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(b[1]=-90,b[0]=-180,b[2]=180),new $(b)}calculateCenterFromCameraLngLatAlt(e,s,a,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,s,a,l)}setLocationAtPoint(e,s){const l=Qi(this.unprojectScreenPoint(s)),c=Qi(e),u=a.bt();a.bF(u);const d=a.bt();a.bC(d,l,u,-this.center.lng*Math.PI/180),a.bB(d,d,u,this.center.lat*Math.PI/180);const f=c[0]*c[0]+c[2]*c[2],_=d[0]*d[0];if(f<_)return;const y=Math.sqrt(f-_),b=-y,S=a.bG(c[0],c[2],d[0],y),P=a.bG(c[0],c[2],d[0],b),M=a.bt();a.bC(M,c,u,-S);const C=a.bG(M[1],M[2],d[1],d[2]),D=a.bt();a.bC(D,c,u,-P);const L=a.bG(D[1],D[2],d[1],d[2]),F=.5*Math.PI,B=C>=-F&&C<=F,O=L>=-F&&L<=F;let V,N;if(B&&O){const e=this.center.lng*Math.PI/180,s=this.center.lat*Math.PI/180;a.bH(S,e)+a.bH(C,s)=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const s=a.bz();return a.aB(s,[...e,1],this._globeViewProjMatrixNoCorrection),s[0]/=s[3],s[1]/=s[3],s[2]/=s[3],s[0]>-1&&s[0]<1&&s[1]>-1&&s[1]<1&&s[2]>-1&&s[2]<1}rayPlanetIntersection(e,s){const l=a.a$(e,s),c=a.bt(),u=a.bt();a.aV(u,s,l),a.aY(c,e,u);const d=1-a.a$(c,c);if(d<0)return null;const f=a.a$(e,e)-1,_=-l+(l<0?1:-1)*Math.sqrt(d),y=f/_,b=_;return{tMin:Math.min(y,b),tMax:Math.max(y,b)}}unprojectScreenPoint(e){const s=this._cameraPosition,l=this.getRayDirectionFromPixel(e),c=this.rayPlanetIntersection(s,l);if(c){const e=a.bt();a.aW(e,s,[l[0]*c.tMin,l[1]*c.tMin,l[2]*c.tMin]);const u=a.bt();return a.aZ(u,e),or(u)}const u=this._cachedClippingPlane,d=u[0]*l[0]+u[1]*l[1]+u[2]*l[2],f=-a.b5(u,s)/d,_=a.bt();if(f>0)a.aW(_,s,[l[0]*f,l[1]*f,l[2]*f]);else{const e=a.bt();a.aW(e,s,[2*l[0],2*l[1],2*l[2]]);const c=a.b5(this._cachedClippingPlane,e);a.aY(_,e,[this._cachedClippingPlane[0]*c,this._cachedClippingPlane[1]*c,this._cachedClippingPlane[2]*c])}const y=function(e){const s=a.bt();return s[0]=e[0]*-e[3],s[1]=e[1]*-e[3],s[2]=e[2]*-e[3],{center:s,radius:Math.sqrt(1-e[3]*e[3])}}(u);return or(function(e,s,l){const c=a.bt();a.aY(c,l,e);const u=a.bt();return a.bu(u,e,c,s/a.b3(c)),u}(y.center,y.radius,_))}getMatrixForModel(e,s){const l=a.U.convert(e),c=1/a.by,u=a.bd();return a.bD(u,u,l.lng/180*Math.PI),a.bb(u,u,-l.lat/180*Math.PI),a.N(u,u,[0,0,1+s/a.by]),a.bb(u,u,.5*Math.PI),a.O(u,u,[c,c,c]),u}getProjectionDataForCustomLayer(e=!0){const s=this.getProjectionData({overscaledTileID:new a.a0(0,0,0,0,0),applyGlobeMatrix:e});return s.tileMercatorCoords=[0,0,1,1],s}getFastPathSimpleProjectionMatrix(e){}}class Pi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,s,a){return this._helper.interpolatePadding(e,s,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,s,a=!0){this._helper.resize(e,s,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,s){this._helper.overrideNearFarZ(e,s)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,s){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=s,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,s)=>this.currentTransform.defaultConstrain(e,s),this.applyConstrain=(e,s)=>this._helper.applyConstrain(e,s),this._helper=new Bt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,s)=>this.defaultConstrain(e,s)},e),this._globeness=1,this._mercatorTransform=new Nt,this._verticalPerspectiveTransform=new Ti}clone(){const e=new Pi;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const s=this._mercatorTransform.getProjectionData(e),a=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:s.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:s.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return a.bo(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return a.bo(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,s,l){const c=this._mercatorTransform.getPitchedTextCorrection(e,s,l),u=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,s,l);return a.bo(c,u,this._globeness)}projectTileCoordinates(e,s,a,l){return this.currentTransform.projectTileCoordinates(e,s,a,l)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,s){return this.currentTransform.lngLatToCameraDepth(e,s)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,s,a,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,s,a,l)}setLocationAtPoint(e,s){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,s),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,s),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,s){return this.currentTransform.locationToScreenPoint(e,s)}screenPointToMercatorCoordinate(e,s){return this.currentTransform.screenPointToMercatorCoordinate(e,s)}screenPointToLocation(e,s){return this.currentTransform.screenPointToLocation(e,s)}isPointOnMapSurface(e,s){return this.currentTransform.isPointOnMapSurface(e,s)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,s){return this.currentTransform.getMatrixForModel(e,s)}getProjectionDataForCustomLayer(e=!0){const s=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return s;const a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return a.fallbackMatrix=s.mainMatrix,a}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Mi{get useGlobeControls(){return!0}handlePanInertia(e,s){const l=hr(e,s);return Math.abs(l.lng-s.center.lng)>180&&(l.lng=s.center.lng+179.5*Math.sign(l.lng-s.center.lng)),{easingCenter:l,easingOffset:new a.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,s){const l=e.around,c=s.screenPointToLocation(l);e.bearingDelta&&s.setBearing(s.bearing+e.bearingDelta),e.pitchDelta&&s.setPitch(s.pitch+e.pitchDelta),e.rollDelta&&s.setRoll(s.roll+e.rollDelta);const u=s.zoom;e.zoomDelta&&s.setZoom(s.zoom+e.zoomDelta);const d=s.zoom-u;if(0===d)return;const f=a.bE(s.center.lng,c.lng),_=f/(Math.abs(f/180)+1),y=a.bE(s.center.lat,c.lat),b=s.getRayDirectionFromPixel(l),S=s.cameraPosition,P=-1*a.a$(S,b),M=a.bt();a.aW(M,S,[b[0]*P,b[1]*P,b[2]*P]);const C=a.b1(M)-1,D=Math.exp(.5*-Math.max(C-.3,0)),L=sr(s.worldSize,s.center.lat)/Math.min(s.width,s.height),F=a.br(L,.9,.5,1,.25),B=(1-a.al(-d))*Math.min(D,F),O=s.center.lat,V=s.zoom,N=new a.U(s.center.lng+_*B,a.ai(s.center.lat+y*B,-a.aj,a.aj));s.setLocationAtPoint(c,l);const j=s.center,G=a.br(Math.abs(f),45,85,0,1),Z=a.br(L,.75,.35,0,1),q=Math.pow(Math.max(G,Z),.25),W=a.bE(j.lng,N.lng),J=a.bE(j.lat,N.lat);s.setCenter(new a.U(j.lng+W*q,j.lat+J*q).wrap()),s.setZoom(V+cr(O,s.center.lat))}handleMapControlsPan(e,s,a){if(!e.panDelta)return;const l=s.center.lat,c=s.zoom;s.setCenter(hr(e.panDelta,s).wrap()),s.setZoom(c+cr(l,s.center.lat))}cameraForBoxAndBearing(e,s,l,c,u){const d=Ui(e,s,l,c,u),f=s.left/u.width*2-1,_=(u.width-s.right)/u.width*2-1,y=s.top/u.height*-2+1,b=(u.height-s.bottom)/u.height*-2+1,S=a.bE(l.getWest(),l.getEast())<0,P=S?l.getEast():l.getWest(),M=S?l.getWest():l.getEast(),C=Math.max(l.getNorth(),l.getSouth()),D=Math.min(l.getNorth(),l.getSouth()),L=P+.5*a.bE(P,M),F=C+.5*a.bE(C,D),B=u.clone();B.setCenter(d.center),B.setBearing(d.bearing),B.setPitch(0),B.setRoll(0),B.setZoom(d.zoom);const O=B.modelViewProjectionMatrix,V=[Qi(l.getNorthWest()),Qi(l.getNorthEast()),Qi(l.getSouthWest()),Qi(l.getSouthEast()),Qi(new a.U(M,F)),Qi(new a.U(P,F)),Qi(new a.U(L,C)),Qi(new a.U(L,D))],N=Qi(d.center);let j=Number.POSITIVE_INFINITY;for(const e of V)f<0&&(j=Mi.getLesserNonNegativeNonNull(j,Mi.solveVectorScale(e,N,O,"x",f))),_>0&&(j=Mi.getLesserNonNegativeNonNull(j,Mi.solveVectorScale(e,N,O,"x",_))),y>0&&(j=Mi.getLesserNonNegativeNonNull(j,Mi.solveVectorScale(e,N,O,"y",y))),b<0&&(j=Mi.getLesserNonNegativeNonNull(j,Mi.solveVectorScale(e,N,O,"y",b)));if(Number.isFinite(j)&&0!==j)return d.zoom=B.zoom+a.ao(j),d;Ni()}handleJumpToCenterZoom(e,s){const l=e.center.lat,c=e.applyConstrain(s.center?a.U.convert(s.center):e.center,e.zoom).center;e.setCenter(c.wrap());const u=void 0!==s.zoom?+s.zoom:e.zoom+cr(l,c.lat);e.zoom!==u&&e.setZoom(u)}handleEaseTo(e,s){const l=e.zoom,c=e.center,u=e.padding,d={roll:e.roll,pitch:e.pitch,bearing:e.bearing},f={roll:void 0===s.roll?e.roll:s.roll,pitch:void 0===s.pitch?e.pitch:s.pitch,bearing:void 0===s.bearing?e.bearing:s.bearing},_=void 0!==s.zoom,y=!e.isPaddingEqual(s.padding);let b=!1;const S=s.center?a.U.convert(s.center):c,P=e.applyConstrain(S,l).center;Oi(e,P);const M=e.clone();M.setCenter(P),M.setZoom(_?+s.zoom:l+cr(c.lat,S.lat)),M.setBearing(s.bearing);const C=new a.P(a.ai(e.centerPoint.x+s.offsetAsPoint.x,0,e.width),a.ai(e.centerPoint.y+s.offsetAsPoint.y,0,e.height));M.setLocationAtPoint(P,C);const D=(s.offset&&s.offsetAsPoint.mag())>0?M.center:P,L=_?+s.zoom:l+cr(c.lat,D.lat),F=l+cr(c.lat,0),B=L+cr(D.lat,0),O=a.bE(c.lng,D.lng),V=a.bE(c.lat,D.lat),N=a.al(B-F);return b=L!==l,{easeFunc:l=>{if(a.bi(d,f)||ji({startEulerAngles:d,endEulerAngles:f,tr:e,k:l,useSlerp:d.roll!=f.roll}),y&&e.interpolatePadding(u,s.padding,l),s.around)a.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(s.around,s.aroundPoint);else{const s=B>F?Math.min(2,N):Math.max(.5,N),a=Math.pow(s,1-l),u=dr(c,O,V,l*a);e.setCenter(u.wrap())}if(b){const s=a.F.number(F,B,l)+cr(0,e.center.lat);e.setZoom(s)}},isZooming:b,elevationCenter:D}}handleFlyTo(e,s){const l=void 0!==s.zoom,c=e.center,u=e.zoom,d=e.padding,f=!e.isPaddingEqual(s.padding),_=e.applyConstrain(a.U.convert(s.center||s.locationAtOffset),u).center,y=l?+s.zoom:e.zoom+cr(e.center.lat,_.lat),b=e.clone();b.setCenter(_),b.setZoom(y),b.setBearing(s.bearing);const S=new a.P(a.ai(e.centerPoint.x+s.offsetAsPoint.x,0,e.width),a.ai(e.centerPoint.y+s.offsetAsPoint.y,0,e.height));b.setLocationAtPoint(_,S);const P=b.center;Oi(e,P);const M=function(e,s,l){const c=Qi(s),u=Qi(l),d=a.a$(c,u),f=Math.acos(d),_=Ki(e);return f/(2*Math.PI)*_}(e,c,P),C=u+cr(c.lat,0),D=y+cr(P.lat,0),L=a.al(D-C);let F;if("number"==typeof s.minZoom){const l=+s.minZoom+cr(P.lat,0),c=Math.min(l,C,D)+cr(0,P.lat),u=e.applyConstrain(P,c).zoom+cr(P.lat,0);F=a.al(u-C)}const B=a.bE(c.lng,P.lng),O=a.bE(c.lat,P.lat);return{easeFunc:(l,u,_,b)=>{const S=dr(c,B,O,_);f&&e.interpolatePadding(d,s.padding,l);const M=1===l?P:S;e.setCenter(M.wrap());const D=C+a.ao(u);e.setZoom(1===l?y:D+cr(0,M.lat))},scaleOfZoom:L,targetCenter:P,scaleOfMinZoom:F,pixelPathLength:M}}static solveVectorScale(e,s,a,l,c){const u="x"===l?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],d=[a[3],a[7],a[11],a[15]],f=e[0]*u[0]+e[1]*u[1]+e[2]*u[2],_=e[0]*d[0]+e[1]*d[1]+e[2]*d[2],y=s[0]*u[0]+s[1]*u[1]+s[2]*u[2],b=s[0]*d[0]+s[1]*d[1]+s[2]*d[2];return y+c*_===f+c*b||d[3]*(f-y)+u[3]*(b-_)+f*b==y*_?null:(y+u[3]-c*b-c*d[3])/(y-f-c*b+c*_)}static getLesserNonNegativeNonNull(e,s){return null!==s&&s>=0&&sa.z(e,s&&s.filter((e=>"source.canvas"!==e.identifier))),xr=a.bI();class Si extends a.E{constructor(e,s={}){var l,c;super(),this._rtlPluginLoaded=()=>{for(const e in this.tileManagers){const s=this.tileManagers[e].getSource().type;"vector"!==s&&"geojson"!==s||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new U(ce(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((e,s)=>this.getGlyphs(e,s))),this.dispatcher.registerMessageHandler("GI",((e,s)=>this.getImages(e,s))),this.dispatcher.registerMessageHandler("GDA",((e,s)=>this.getDashes(e,s))),this.imageManager=new w,this.imageManager.setEventedParent(this);const u=(null===(l=e._container)||void 0===l?void 0:l.lang)||"undefined"!=typeof document&&(null===(c=document.documentElement)||void 0===c?void 0:c.lang)||void 0;this.glyphManager=new I(e._requestManager,s.localIdeographFontFamily,u),this.lineAtlas=new A(256,512),this.crossTileSymbolIndex=new Mt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",a.bJ()),ke().on(Ce,this._rtlPluginLoaded),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const s=this.tileManagers[e.sourceId];if(!s)return;const a=s.getSource();if(a&&a.vectorLayerIds)for(const e in this._layers){const s=this._layers[e];s.source===a.id&&this._validateLayer(s)}}))}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new a.bK,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,s){var l,c,u;this._checkLoaded();const d=null===s?null!==(u=null===(c=null===(l=this.stylesheet.state)||void 0===l?void 0:l[e])||void 0===c?void 0:c.default)&&void 0!==u?u:null:s;if(a.bL(d,this._globalState[e]))return this;this._globalState[e]=d,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const s=[];for(const l in e)!a.bL(this._globalState[l],e[l].default)&&(s.push(l),this._globalState[l]=e[l].default);this._applyGlobalStateChanges(s)}_applyGlobalStateChanges(e){if(0===e.length)return;const s=new Set,a={};for(const l of e){a[l]=this._globalState[l];for(const e in this._layers){const a=this._layers[e],c=a.getLayoutAffectingGlobalStateRefs(),u=a.getPaintAffectingGlobalStateRefs();if(c.has(l)&&s.add(a.source),u.has(l))for(const{name:e,value:s}of u.get(l))this._updatePaintProperty(a,e,s)}}this.dispatcher.broadcast("UGS",a);for(const e in this.tileManagers)s.has(e)&&(this._reloadSource(e),this._changed=!0)}loadURL(e,s={},l){this.fire(new a.l("dataloading",{dataType:"style"})),s.validate="boolean"!=typeof s.validate||s.validate;const c=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const u=this._loadStyleRequest;a.j(c,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,s,l)})).catch((e=>{this._loadStyleRequest=null,e&&!u.signal.aborted&&this.fire(new a.k(e))}))}loadJSON(e,s={},l){this.fire(new a.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,_.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,s.validate=!1!==s.validate,this._load(e,s,l)})).catch((()=>{}))}loadEmpty(){this.fire(new a.l("dataloading",{dataType:"style"})),this._load(xr,{validate:!1})}_load(e,s,l){var c,u;let d=s.transformStyle?s.transformStyle(l,e):e;if(!s.validate||!gr(this,a.B(d))){d=Object.assign({},d),this._loaded=!0,this.stylesheet=d;for(const e in d.sources)this.addSource(e,d.sources[e],{validate:!1});d.sprite?this._loadSprite(d.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(d.glyphs),this._createLayers(),this.light=new R(this.stylesheet.light),this._setProjectionInternal((null===(c=this.stylesheet.projection)||void 0===c?void 0:c.type)||"mercator"),this.sky=new z(this.stylesheet.sky),this.map.setTerrain(null!==(u=this.stylesheet.terrain)&&void 0!==u?u:null),this.fire(new a.l("data",{dataType:"style"})),this.fire(new a.l("style.load"))}}_createLayers(){var e,s,l;const c=a.bM(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",c),this._order=c.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(const e of c){const c=a.bN(e,this._globalState);if(c.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=c,a.bO(c)&&this.tileManagers[c.source]){const a=null!==(l=null===(s=e.paint)||void 0===s?void 0:s["raster-fade-duration"])&&void 0!==l?l:c.paint.get("raster-fade-duration");this.tileManagers[c.source].setRasterFadeDuration(a)}}}_loadSprite(e,s=!1,l=void 0){let c;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,s,l,c){return a._(this,void 0,void 0,(function*(){const u=B(e),d=l>1?"@2x":"",f={},y={};for(const{id:e,url:l}of u){const u=s.transformRequest(O(l,d,".json"),"SpriteJSON");f[e]=a.j(u,c);const _=s.transformRequest(O(l,d,".png"),"SpriteImage");y[e]=F.getImage(_,c)}return yield Promise.all([...Object.values(f),...Object.values(y)]),function(e,s){return a._(this,void 0,void 0,(function*(){const a={};for(const l in e){a[l]={};const c=_.getImageCanvasContext((yield s[l]).data),u=(yield e[l]).data;for(const e in u){const{width:s,height:d,x:f,y:_,sdf:y,pixelRatio:b,stretchX:S,stretchY:P,content:M,textFitWidth:C,textFitHeight:D}=u[e];a[l][e]={data:null,pixelRatio:b,sdf:y,stretchX:S,stretchY:P,content:M,textFitWidth:C,textFitHeight:D,spriteData:{width:s,height:d,x:f,y:_,context:c}}}}return a}))}(f,y)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(const a in e){this._spritesImagesIds[a]=[];const l=this._spritesImagesIds[a]?this._spritesImagesIds[a].filter((s=>!(s in e))):[];for(const e of l)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const l in e[a]){const c="default"===a?l:`${a}:${l}`;this._spritesImagesIds[a].push(c),c in this.imageManager.images?this.imageManager.updateImage(c,e[a][l],!1):this.imageManager.addImage(c,e[a][l]),s&&(this._changedImages[c]=!0)}}})).catch((e=>{this._spriteRequest=null,c=e,this.fire(new a.k(c))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"})),l&&l(c)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}_validateLayer(e){const s=this.tileManagers[e.source];if(!s)return;const l=e.sourceLayer;if(!l)return;const c=s.getSource();("geojson"===c.type||c.vectorLayerIds&&-1===c.vectorLayerIds.indexOf(l))&&this.fire(new a.k(new Error(`Source layer "${l}" does not exist on source "${c.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,s=!1){const l=this._serializedAllLayers();if(!e||0===e.length)return Object.values(s?a.bP(l):l);const c=[];for(const u of e)if(l[u]){const e=s?a.bP(l[u]):l[u];c.push(e)}return c}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const s=Object.keys(this._layers);for(const a of s){const s=this._layers[a];"custom"!==s.type&&(e[a]=s.serialize())}return e}hasTransitions(){var e,s,a;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(s=this.sky)||void 0===s?void 0:s.hasTransition())return!0;if(null===(a=this.projection)||void 0===a?void 0:a.hasTransition())return!0;for(const e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const s=this._changed;if(s){const s=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(s.length||a.length)&&this._updateWorkerLayers(s,a);for(const e in this._updatedSources){const s=this._updatedSources[e];if("reload"===s)this._reloadSource(e);else{if("clear"!==s)throw new Error(`Invalid action ${s}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const l={};for(const e in this.tileManagers){const s=this.tileManagers[e];l[e]=s.used,s.used=!1}for(const s of this._order){const a=this._layers[s];a.recalculate(e,this._availableImages),!a.isHidden(e.zoom)&&a.source&&(this.tileManagers[a.source].used=!0)}for(const e in l){const s=this.tileManagers[e];!!l[e]!=!!s.used&&s.fire(new a.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,s&&this.fire(new a.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const s in this.tileManagers)this.tileManagers[s].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,s){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,s={}){var l;this._checkLoaded();const c=this.serialize();if(e=s.transformStyle?s.transformStyle(c,e):e,(null===(l=s.validate)||void 0===l||l)&&gr(this,a.B(e)))return!1;(e=a.bP(e)).layers=a.bM(e.layers);const u=a.bQ(c,e),d=this._getOperationsToPerform(u);if(d.unimplemented.length>0)throw new Error(`Unimplemented: ${d.unimplemented.join(", ")}.`);if(0===d.operations.length)return!1;for(const e of d.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const s=[],a=[];for(const l of e)switch(l.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":s.push((()=>this.addLayer.apply(this,l.args)));break;case"removeLayer":s.push((()=>this.removeLayer.apply(this,l.args)));break;case"setPaintProperty":s.push((()=>this.setPaintProperty.apply(this,l.args)));break;case"setLayoutProperty":s.push((()=>this.setLayoutProperty.apply(this,l.args)));break;case"setFilter":s.push((()=>this.setFilter.apply(this,l.args)));break;case"addSource":s.push((()=>this.addSource.apply(this,l.args)));break;case"removeSource":s.push((()=>this.removeSource.apply(this,l.args)));break;case"setLayerZoomRange":s.push((()=>this.setLayerZoomRange.apply(this,l.args)));break;case"setLight":s.push((()=>this.setLight.apply(this,l.args)));break;case"setGeoJSONSourceData":s.push((()=>this.setGeoJSONSourceData.apply(this,l.args)));break;case"setGlyphs":s.push((()=>this.setGlyphs.apply(this,l.args)));break;case"setSprite":s.push((()=>this.setSprite.apply(this,l.args)));break;case"setTerrain":s.push((()=>this.map.setTerrain.apply(this,l.args)));break;case"setSky":s.push((()=>this.setSky.apply(this,l.args)));break;case"setProjection":this.setProjection.apply(this,l.args);break;case"setGlobalState":s.push((()=>this.setGlobalState.apply(this,l.args)));break;case"setTransition":s.push((()=>{}));break;default:a.push(l.command)}return{operations:s,unimplemented:a}}addImage(e,s){if(this.getImage(e))return this.fire(new a.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,s),this._afterImageUpdated(e)}updateImage(e,s){this.imageManager.updateImage(e,s)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new a.k(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("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,s,l={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(a.B.source,`sources.${e}`,s,null,l))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const c=this.tileManagers[e]=new Ie(e,s,this.dispatcher);c.style=this,c.setEventedParent(this,(()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:e}))),c.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===e)return this.fire(new a.k(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));const s=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],s.fire(new a.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,s){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);const a=this.tileManagers[e].getSource();if("geojson"!==a.type)throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(s),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,s,l={}){this._checkLoaded();const c=e.id;if(this.getLayer(c))return void this.fire(new a.k(new Error(`Layer "${c}" already exists on this map.`)));let u;if("custom"===e.type){if(gr(this,a.bR(e)))return;u=a.bN(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(c,e.source),e=a.bP(e),e=a.e(e,{source:c})),this._validate(a.B.layer,`layers.${c}`,e,{arrayIndex:-1},l))return;u=a.bN(e,this._globalState),this._validateLayer(u),u.setEventedParent(this,{layer:{id:c}})}const d=s?this._order.indexOf(s):this._order.length;if(s&&-1===d)this.fire(new a.k(new Error(`Cannot add layer "${c}" before non-existing layer "${s}".`)));else{if(this._order.splice(d,0,c),this._layerOrderChanged=!0,this._layers[c]=u,this._removedLayers[c]&&u.source&&"custom"!==u.type){const e=this._removedLayers[c];delete this._removedLayers[c],e.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.tileManagers[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,s){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new a.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===s)return;const l=this._order.indexOf(e);this._order.splice(l,1);const c=s?this._order.indexOf(s):this._order.length;s&&-1===c?this.fire(new a.k(new Error(`Cannot move layer "${e}" before non-existing layer "${s}".`))):(this._order.splice(c,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const s=this._layers[e];if(!s)return void this.fire(new a.k(new Error(`Cannot remove non-existing layer "${e}".`)));s.setEventedParent(null);const l=this._order.indexOf(e);this._order.splice(l,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=s,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],s.onRemove&&s.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,s,l){this._checkLoaded();const c=this.getLayer(e);c?c.minzoom===s&&c.maxzoom===l||(null!=s&&(c.minzoom=s),null!=l&&(c.maxzoom=l),this._updateLayer(c)):this.fire(new a.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,s,l={}){this._checkLoaded();const c=this.getLayer(e);if(c){if(!a.bL(c.filter,s))return null==s?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(a.B.filter,`layers.${c.id}.filter`,s,null,l)||(c.setFilter(a.bP(s)),this._updateLayer(c)))}else this.fire(new a.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return a.bP(this.getLayer(e).filter)}setLayoutProperty(e,s,l,c={}){this._checkLoaded();const u=this.getLayer(e);u?a.bL(u.getLayoutProperty(s),l)||(u.setLayoutProperty(s,l,c),this._updateLayer(u)):this.fire(new a.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,s){const l=this.getLayer(e);if(l)return l.getLayoutProperty(s);this.fire(new a.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,s,l,c={}){this._checkLoaded();const u=this.getLayer(e);u?a.bL(u.getPaintProperty(s),l)||this._updatePaintProperty(u,s,l,c):this.fire(new a.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,s,l,c={}){e.setPaintProperty(s,l,c)&&this._updateLayer(e),a.bO(e)&&"raster-fade-duration"===s&&this.tileManagers[e.source].setRasterFadeDuration(l),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,s){return this.getLayer(e).getPaintProperty(s)}setFeatureState(e,s){this._checkLoaded();const l=e.source,c=e.sourceLayer,u=this.tileManagers[l];if(void 0===u)return void this.fire(new a.k(new Error(`The source '${l}' does not exist in the map's style.`)));const d=u.getSource().type;"geojson"===d&&c?this.fire(new a.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==d||c?(void 0===e.id&&this.fire(new a.k(new Error("The feature id parameter must be provided."))),u.setFeatureState(c,e.id,s)):this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,s){this._checkLoaded();const l=e.source,c=this.tileManagers[l];if(void 0===c)return void this.fire(new a.k(new Error(`The source '${l}' does not exist in the map's style.`)));const u=c.getSource().type,d="vector"===u?e.sourceLayer:void 0;"vector"!==u||d?s&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new a.k(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(d,e.id,s):this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const s=e.source,l=e.sourceLayer,c=this.tileManagers[s];if(void 0!==c)return"vector"!==c.getSource().type||l?(void 0===e.id&&this.fire(new a.k(new Error("The feature id parameter must be provided."))),c.getFeatureState(l,e.id)):void this.fire(new a.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.k(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=a.bS(this.tileManagers,(e=>e.serialize())),s=this._serializeByIds(this._order,!0),l=this.map.getTerrain()||void 0,c=this.stylesheet;return a.bT({version:c.version,name:c.name,metadata:c.metadata,light:c.light,sky:c.sky,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,projection:c.projection,sources:e,layers:s,terrain:l},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const s=e=>"fill-extrusion"===this._layers[e].type,a={},l=[];for(let c=this._order.length-1;c>=0;c--){const u=this._order[c];if(s(u)){a[u]=c;for(const s of e){const e=s[u];if(e)for(const s of e)l.push(s)}}}l.sort(((e,s)=>s.intersectionZ-e.intersectionZ));const c=[];for(let u=this._order.length-1;u>=0;u--){const d=this._order[u];if(s(d))for(let e=l.length-1;e>=0;e--){const s=l[e].feature;if(a[s.layer.id]this.map.terrain.getElevation(e,s,a):void 0));return this.placement&&u.push(function(e,s,a,l,c,u,d){const f={},_=u.queryRenderedSymbols(l),y=[];for(const e of Object.keys(_).map(Number))y.push(d[e]);y.sort(ve);for(const a of y){const l=a.featureIndex.lookupSymbolFeatures(_[a.bucketInstanceId],s,a.bucketIndex,a.sourceLayerIndex,{filterSpec:c.filter,globalState:c.globalState},c.layers,c.availableImages,e);for(const e in l){const s=f[e]=f[e]||[],c=l[e];c.sort(((e,s)=>{const l=a.featureSortOrder;if(l){const a=l.indexOf(e.featureIndex);return l.indexOf(s.featureIndex)-a}return s.featureIndex-e.featureIndex}));for(const e of c)s.push(e)}}return function(e,s,a){for(const l in e)for(const c of e[l])be(c,a[s[l].source]);return e}(f,e,a)}(this._layers,d,this.tileManagers,e,_,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,s){(null==s?void 0:s.filter)&&this._validate(a.B.filter,"querySourceFeatures.filter",s.filter,null,s);const l=this.tileManagers[e];return l?function(e,s){const a=e.getRenderableIds().map((s=>e.getTileByID(s))),l=[],c={};for(let e=0;ee.getTileByID(s))).sort(((e,s)=>s.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(s.tileID)?-1:1)))}const l=this.crossTileSymbolIndex.addLayer(a,f[a.source],e.center.lng);u=u||l}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||0===a)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(b(),e.zoom))&&(this.pauseablePlacement=new bt(e,this.map.terrain,this._order,c,s,a,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,f),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(b()),d=!0),u&&this.pauseablePlacement.placement.setStale()),d||u)for(const e of this._order){const s=this._layers[e];"symbol"===s.type&&this.placement.updateLayerOpacities(s,f[s.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(b())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,s){return a._(this,void 0,void 0,(function*(){const e=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const a=this.tileManagers[s.source];return a&&a.setDependencies(s.tileID.key,s.type,s.icons),e}))}getGlyphs(e,s){return a._(this,void 0,void 0,(function*(){const e=yield this.glyphManager.getGlyphs(s.stacks),a=this.tileManagers[s.source];return a&&a.setDependencies(s.tileID.key,s.type,[""]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,s={}){this._checkLoaded(),e&&this._validate(a.B.glyphs,"glyphs",e,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,s){return a._(this,void 0,void 0,(function*(){const e={};for(const[a,l]of Object.entries(s.dashes))e[a]=this.lineAtlas.getDash(l.dasharray,l.round);return e}))}addSprite(e,s,l={},c){this._checkLoaded();const u=[{id:e,url:s}],d=[...B(this.stylesheet.sprite),...u];this._validate(a.B.sprite,"sprite",d,null,l)||(this.stylesheet.sprite=d,this._loadSprite(u,!0,c))}removeSprite(e){this._checkLoaded();const s=B(this.stylesheet.sprite);if(s.find((s=>s.id===e))){if(this._spritesImagesIds[e])for(const s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;s.splice(s.findIndex((s=>s.id===e)),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.l("data",{dataType:"style"}))}else this.fire(new a.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return B(this.stylesheet.sprite)}setSprite(e,s={},l){this._checkLoaded(),e&&this._validate(a.B.sprite,"sprite",e,null,s)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,l):(this._unloadSprite(),l&&l(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const s=this.tileManagers[e];if(s.setEventedParent(null),s._tiles){for(const e in s._tiles)s._tiles[e].unloadVectorData();s._tiles={}}s._cache.reset(),s.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const s=this._layers[e];s.setEventedParent(null),s.onRemove&&s.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var vr=a.aO([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Di{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,s,a,l,c,u,d,f,_){this.context=e;let y=this.boundPaintVertexBuffers.length!==l.length;for(let e=0;!y&&e({u_texture:0,u_ele_delta:e,u_fog_matrix:s,u_fog_color:l?l.properties.get("fog-color"):a.bj.white,u_fog_ground_blend:l?l.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?0:l?l.calculateFogBlendOpacity(c):0,u_horizon_color:l?l.properties.get("horizon-color"):a.bj.white,u_horizon_fog_blend:l?l.properties.get("horizon-fog-blend"):1,u_is_globe_mode:u?1:0}),wr={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Sr(e){const s=[];for(let a=0;a({u_depth:new a.bU(e,s.u_depth),u_terrain:new a.bU(e,s.u_terrain),u_terrain_dim:new a.bk(e,s.u_terrain_dim),u_terrain_matrix:new a.bW(e,s.u_terrain_matrix),u_terrain_unpack:new a.bX(e,s.u_terrain_unpack),u_terrain_exaggeration:new a.bk(e,s.u_terrain_exaggeration)}))(e,q),this.projectionUniforms=((e,s)=>({u_projection_matrix:new a.bW(e,s.u_projection_matrix),u_projection_tile_mercator_coords:new a.bX(e,s.u_projection_tile_mercator_coords),u_projection_clipping_plane:new a.bX(e,s.u_projection_clipping_plane),u_projection_transition:new a.bk(e,s.u_projection_transition),u_projection_fallback_matrix:new a.bW(e,s.u_projection_fallback_matrix)}))(e,q),this.binderUniforms=l?l.getUniforms(e,q):[]}draw(e,s,a,l,c,u,d,f,_,y,b,S,P,M,C,D,L,F,B){const O=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(l),e.setColorMode(c),e.setCullFace(u),f){e.activeTexture.set(O.TEXTURE2),O.bindTexture(O.TEXTURE_2D,f.depthTexture),e.activeTexture.set(O.TEXTURE3),O.bindTexture(O.TEXTURE_2D,f.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(f[e])}if(_)for(const e in _)this.projectionUniforms[wr[e]].set(_[e]);if(d)for(const e in this.fixedUniforms)this.fixedUniforms[e].set(d[e]);D&&D.setUniforms(e,this.binderUniforms,M,{zoom:C});let V=0;switch(s){case O.LINES:V=2;break;case O.TRIANGLES:V=3;break;case O.LINE_STRIP:V=1}for(const a of P.get()){const l=a.vaos||(a.vaos={});(l[y]||(l[y]=new Di)).bind(e,this,b,D?D.getPaintVertexBuffers():[],S,a.vertexOffset,L,F,B),O.drawElements(s,a.primitiveLength*V,O.UNSIGNED_SHORT,a.primitiveOffset*V*2)}}}function Pr(e,s,l){const c=1/a.aH(l,1,s.transform.tileZoom),u=Math.pow(2,l.tileID.overscaledZ),d=l.tileSize*Math.pow(2,s.transform.tileZoom)/u,f=d*(l.tileID.canonical.x+l.tileID.wrap*u),_=d*l.tileID.canonical.y;return{u_image:0,u_texsize:l.imageAtlasTexture.size,u_scale:[c,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Cr=(e,s,l,c)=>{const u=e.style.light,d=u.properties.get("position"),f=[d.x,d.y,d.z],_=a.b_();"viewport"===u.properties.get("anchor")&&a.b$(_,e.transform.bearingInRadians),a.c0(f,f,_);const y=e.transform.transformLightDirection(f),b=u.properties.get("color");return{u_lightpos:f,u_lightpos_globe:y,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+s,u_opacity:l,u_fill_translate:c}},Ar=(e,s,l,c,u,d,f)=>a.e(Cr(e,s,l,c),Pr(d,e,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Dr=(e,s,l,c)=>a.e(Pr(s,e,l),{u_fill_translate:c}),zr=(e,s)=>({u_world:e,u_fill_translate:s}),Rr=(e,s,l,c,u)=>a.e(Dr(e,s,l,u),{u_world:c}),Lr=(e,s,l,c,u)=>{const d=e.transform;let f,_,y=0;if("map"===l.paint.get("circle-pitch-alignment")){const e=a.aH(s,1,d.zoom);f=!0,_=[e,e],y=e/(a.a3*Math.pow(2,s.tileID.overscaledZ))*2*Math.PI*u}else f=!1,_=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+("map"===l.paint.get("circle-pitch-scale")),u_pitch_with_map:+f,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:y,u_translate:c}},Fr=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),Br=e=>({u_viewport_size:[e.width,e.height]}),Or=(e,s=1)=>({u_color:e,u_overlay:0,u_overlay_scale:s}),Vr=(e,s,l,c)=>{const u=a.aH(e,1,s)/(a.a3*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*c;return{u_extrude_scale:a.aH(e,1,s),u_intensity:l,u_globe_extrude_scale:u}},Ur=(e,s,l,c)=>{const u=a.M();a.c1(u,0,e.width,e.height,0,0,1);const d=e.context.gl;return{u_matrix:u,u_world:[d.drawingBufferWidth,d.drawingBufferHeight],u_image:l,u_color_ramp:c,u_opacity:s.paint.get("heatmap-opacity")}},Gr=(e,s,a)=>{const l=a.paint.get("hillshade-accent-color");let c;switch(a.paint.get("hillshade-method")){case"basic":c=4;break;case"combined":c=1;break;case"igor":c=2;break;case"multidirectional":c=3;break;default:c=0}const u=a.getIlluminationProperties();for(let s=0;s{const l=s.stride,c=a.M();return a.c1(c,0,a.a3,-a.a3,0,0,1),a.N(c,c,[0,-a.a3,0]),{u_matrix:c,u_image:1,u_dimension:[l,l],u_zoom:e.overscaledZ,u_unpack:s.getUnpackVector()}};function $r(e,s){const l=Math.pow(2,s.canonical.z),c=s.canonical.y;return[new a.a5(0,c/l).toLngLat().lat,new a.a5(0,(c+1)/l).toLngLat().lat]}const Wr=(e,s,a=0)=>({u_image:0,u_unpack:s.getUnpackVector(),u_dimension:[s.stride,s.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:a,u_opacity:e.paint.get("color-relief-opacity")}),Xr=(e,s,l,c)=>{const u=e.transform;return{u_translation:sn(e,s,l),u_ratio:c/a.aH(s,1,u.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Kr=(e,s,l,c,u)=>a.e(Xr(e,s,l,c),{u_image:0,u_image_height:u}),en=(e,s,l,c,u)=>{const d=e.transform,f=nn(s,d);return{u_translation:sn(e,s,l),u_texsize:s.imageAtlasTexture.size,u_ratio:c/a.aH(s,1,d.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[f,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},tn=(e,s,l,c,u)=>{const d=nn(s,e.transform);return a.e(Xr(e,s,l,c),{u_tileratio:d,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image:0,u_mix:u.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},rn=(e,s,l,c,u,d)=>{const f=nn(s,e.transform);return a.e(Xr(e,s,l,c),{u_image:0,u_image_height:d,u_tileratio:f,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image_dash:1,u_mix:u.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function nn(e,s){return 1/a.aH(e,1,s.tileZoom)}function sn(e,s,l){return a.aI(e.transform,s,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}const on=(e,s,a,l,c)=>{return{u_tl_parent:e,u_scale_parent:s,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(d=l.paint.get("raster-saturation"),d>0?1-1/(1.001-d):-d),u_contrast_factor:(u=l.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:ln(l.paint.get("raster-hue-rotate")),u_coords_top:[c[0].x,c[0].y,c[1].x,c[1].y],u_coords_bottom:[c[3].x,c[3].y,c[2].x,c[2].y]};var u,d};function ln(e){e*=Math.PI/180;const s=Math.sin(e),a=Math.cos(e);return[(2*a+1)/3,(-Math.sqrt(3)*s-a+1)/3,(Math.sqrt(3)*s-a+1)/3]}const cn=(e,s,a,l,c,u,d,f,_,y,b,S,P)=>{const M=d.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:M.cameraToCenterDistance,u_pitch:M.pitch/360*2*Math.PI,u_rotate_symbol:+a,u_aspect_ratio:M.width/M.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+b,u_pitch_with_map:+l,u_is_along_line:c,u_is_variable_anchor:u,u_texsize:S,u_texture:0,u_translation:y,u_pitched_scale:P}},hn=(e,s,l,c,u,d,f,_,y,b,S,P,M,C)=>{const D=f.transform;return a.e(cn(e,s,l,c,u,d,f,_,y,b,S,P,C),{u_gamma_scale:c?Math.cos(D.pitch*Math.PI/180)*D.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},un=(e,s,l,c,u,d,f,_,y,b,S,P,M)=>a.e(hn(e,s,l,c,u,d,f,_,y,b,!0,S,0,M),{u_texsize_icon:P,u_texture_icon:1}),dn=(e,s)=>({u_opacity:e,u_color:s}),pn=(e,s,l,c,u)=>a.e(function(e,s,l,c){const u=l.imageManager.getPattern(e.from.toString()),d=l.imageManager.getPattern(e.to.toString()),{width:f,height:_}=l.imageManager.getPixelSize(),y=Math.pow(2,c.tileID.overscaledZ),b=c.tileSize*Math.pow(2,l.transform.tileZoom)/y,S=b*(c.tileID.canonical.x+c.tileID.wrap*y),P=b*c.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:u.tl,u_pattern_br_a:u.br,u_pattern_tl_b:d.tl,u_pattern_br_b:d.br,u_texsize:[f,_],u_mix:s.t,u_pattern_size_a:u.displaySize,u_pattern_size_b:d.displaySize,u_scale_a:s.fromScale,u_scale_b:s.toScale,u_tile_units_to_pixels:1/a.aH(c,1,l.transform.tileZoom),u_pixel_coord_upper:[S>>16,P>>16],u_pixel_coord_lower:[65535&S,65535&P]}}(l,u,s,c),{u_opacity:e}),fn=(e,s)=>{},mn={fillExtrusion:(e,s)=>({u_lightpos:new a.bY(e,s.u_lightpos),u_lightpos_globe:new a.bY(e,s.u_lightpos_globe),u_lightintensity:new a.bk(e,s.u_lightintensity),u_lightcolor:new a.bY(e,s.u_lightcolor),u_vertical_gradient:new a.bk(e,s.u_vertical_gradient),u_opacity:new a.bk(e,s.u_opacity),u_fill_translate:new a.bZ(e,s.u_fill_translate)}),fillExtrusionPattern:(e,s)=>({u_lightpos:new a.bY(e,s.u_lightpos),u_lightpos_globe:new a.bY(e,s.u_lightpos_globe),u_lightintensity:new a.bk(e,s.u_lightintensity),u_lightcolor:new a.bY(e,s.u_lightcolor),u_vertical_gradient:new a.bk(e,s.u_vertical_gradient),u_height_factor:new a.bk(e,s.u_height_factor),u_opacity:new a.bk(e,s.u_opacity),u_fill_translate:new a.bZ(e,s.u_fill_translate),u_image:new a.bU(e,s.u_image),u_texsize:new a.bZ(e,s.u_texsize),u_pixel_coord_upper:new a.bZ(e,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.bZ(e,s.u_pixel_coord_lower),u_scale:new a.bY(e,s.u_scale),u_fade:new a.bk(e,s.u_fade)}),fill:(e,s)=>({u_fill_translate:new a.bZ(e,s.u_fill_translate)}),fillPattern:(e,s)=>({u_image:new a.bU(e,s.u_image),u_texsize:new a.bZ(e,s.u_texsize),u_pixel_coord_upper:new a.bZ(e,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.bZ(e,s.u_pixel_coord_lower),u_scale:new a.bY(e,s.u_scale),u_fade:new a.bk(e,s.u_fade),u_fill_translate:new a.bZ(e,s.u_fill_translate)}),fillOutline:(e,s)=>({u_world:new a.bZ(e,s.u_world),u_fill_translate:new a.bZ(e,s.u_fill_translate)}),fillOutlinePattern:(e,s)=>({u_world:new a.bZ(e,s.u_world),u_image:new a.bU(e,s.u_image),u_texsize:new a.bZ(e,s.u_texsize),u_pixel_coord_upper:new a.bZ(e,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.bZ(e,s.u_pixel_coord_lower),u_scale:new a.bY(e,s.u_scale),u_fade:new a.bk(e,s.u_fade),u_fill_translate:new a.bZ(e,s.u_fill_translate)}),circle:(e,s)=>({u_camera_to_center_distance:new a.bk(e,s.u_camera_to_center_distance),u_scale_with_map:new a.bU(e,s.u_scale_with_map),u_pitch_with_map:new a.bU(e,s.u_pitch_with_map),u_extrude_scale:new a.bZ(e,s.u_extrude_scale),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_globe_extrude_scale:new a.bk(e,s.u_globe_extrude_scale),u_translate:new a.bZ(e,s.u_translate)}),collisionBox:(e,s)=>({u_pixel_extrude_scale:new a.bZ(e,s.u_pixel_extrude_scale)}),collisionCircle:(e,s)=>({u_viewport_size:new a.bZ(e,s.u_viewport_size)}),debug:(e,s)=>({u_color:new a.bV(e,s.u_color),u_overlay:new a.bU(e,s.u_overlay),u_overlay_scale:new a.bk(e,s.u_overlay_scale)}),depth:fn,clippingMask:fn,heatmap:(e,s)=>({u_extrude_scale:new a.bk(e,s.u_extrude_scale),u_intensity:new a.bk(e,s.u_intensity),u_globe_extrude_scale:new a.bk(e,s.u_globe_extrude_scale)}),heatmapTexture:(e,s)=>({u_matrix:new a.bW(e,s.u_matrix),u_world:new a.bZ(e,s.u_world),u_image:new a.bU(e,s.u_image),u_color_ramp:new a.bU(e,s.u_color_ramp),u_opacity:new a.bk(e,s.u_opacity)}),hillshade:(e,s)=>({u_image:new a.bU(e,s.u_image),u_latrange:new a.bZ(e,s.u_latrange),u_exaggeration:new a.bk(e,s.u_exaggeration),u_altitudes:new a.c3(e,s.u_altitudes),u_azimuths:new a.c3(e,s.u_azimuths),u_accent:new a.bV(e,s.u_accent),u_method:new a.bU(e,s.u_method),u_shadows:new a.c2(e,s.u_shadows),u_highlights:new a.c2(e,s.u_highlights)}),hillshadePrepare:(e,s)=>({u_matrix:new a.bW(e,s.u_matrix),u_image:new a.bU(e,s.u_image),u_dimension:new a.bZ(e,s.u_dimension),u_zoom:new a.bk(e,s.u_zoom),u_unpack:new a.bX(e,s.u_unpack)}),colorRelief:(e,s)=>({u_image:new a.bU(e,s.u_image),u_unpack:new a.bX(e,s.u_unpack),u_dimension:new a.bZ(e,s.u_dimension),u_elevation_stops:new a.bU(e,s.u_elevation_stops),u_color_stops:new a.bU(e,s.u_color_stops),u_color_ramp_size:new a.bU(e,s.u_color_ramp_size),u_opacity:new a.bk(e,s.u_opacity)}),line:(e,s)=>({u_translation:new a.bZ(e,s.u_translation),u_ratio:new a.bk(e,s.u_ratio),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_units_to_pixels:new a.bZ(e,s.u_units_to_pixels)}),lineGradient:(e,s)=>({u_translation:new a.bZ(e,s.u_translation),u_ratio:new a.bk(e,s.u_ratio),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_units_to_pixels:new a.bZ(e,s.u_units_to_pixels),u_image:new a.bU(e,s.u_image),u_image_height:new a.bk(e,s.u_image_height)}),linePattern:(e,s)=>({u_translation:new a.bZ(e,s.u_translation),u_texsize:new a.bZ(e,s.u_texsize),u_ratio:new a.bk(e,s.u_ratio),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_image:new a.bU(e,s.u_image),u_units_to_pixels:new a.bZ(e,s.u_units_to_pixels),u_scale:new a.bY(e,s.u_scale),u_fade:new a.bk(e,s.u_fade)}),lineSDF:(e,s)=>({u_translation:new a.bZ(e,s.u_translation),u_ratio:new a.bk(e,s.u_ratio),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_units_to_pixels:new a.bZ(e,s.u_units_to_pixels),u_image:new a.bU(e,s.u_image),u_mix:new a.bk(e,s.u_mix),u_tileratio:new a.bk(e,s.u_tileratio),u_crossfade_from:new a.bk(e,s.u_crossfade_from),u_crossfade_to:new a.bk(e,s.u_crossfade_to),u_lineatlas_width:new a.bk(e,s.u_lineatlas_width),u_lineatlas_height:new a.bk(e,s.u_lineatlas_height)}),lineGradientSDF:(e,s)=>({u_translation:new a.bZ(e,s.u_translation),u_ratio:new a.bk(e,s.u_ratio),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_units_to_pixels:new a.bZ(e,s.u_units_to_pixels),u_image:new a.bU(e,s.u_image),u_image_height:new a.bk(e,s.u_image_height),u_tileratio:new a.bk(e,s.u_tileratio),u_crossfade_from:new a.bk(e,s.u_crossfade_from),u_crossfade_to:new a.bk(e,s.u_crossfade_to),u_image_dash:new a.bU(e,s.u_image_dash),u_mix:new a.bk(e,s.u_mix),u_lineatlas_width:new a.bk(e,s.u_lineatlas_width),u_lineatlas_height:new a.bk(e,s.u_lineatlas_height)}),raster:(e,s)=>({u_tl_parent:new a.bZ(e,s.u_tl_parent),u_scale_parent:new a.bk(e,s.u_scale_parent),u_buffer_scale:new a.bk(e,s.u_buffer_scale),u_fade_t:new a.bk(e,s.u_fade_t),u_opacity:new a.bk(e,s.u_opacity),u_image0:new a.bU(e,s.u_image0),u_image1:new a.bU(e,s.u_image1),u_brightness_low:new a.bk(e,s.u_brightness_low),u_brightness_high:new a.bk(e,s.u_brightness_high),u_saturation_factor:new a.bk(e,s.u_saturation_factor),u_contrast_factor:new a.bk(e,s.u_contrast_factor),u_spin_weights:new a.bY(e,s.u_spin_weights),u_coords_top:new a.bX(e,s.u_coords_top),u_coords_bottom:new a.bX(e,s.u_coords_bottom)}),symbolIcon:(e,s)=>({u_is_size_zoom_constant:new a.bU(e,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bU(e,s.u_is_size_feature_constant),u_size_t:new a.bk(e,s.u_size_t),u_size:new a.bk(e,s.u_size),u_camera_to_center_distance:new a.bk(e,s.u_camera_to_center_distance),u_pitch:new a.bk(e,s.u_pitch),u_rotate_symbol:new a.bU(e,s.u_rotate_symbol),u_aspect_ratio:new a.bk(e,s.u_aspect_ratio),u_fade_change:new a.bk(e,s.u_fade_change),u_label_plane_matrix:new a.bW(e,s.u_label_plane_matrix),u_coord_matrix:new a.bW(e,s.u_coord_matrix),u_is_text:new a.bU(e,s.u_is_text),u_pitch_with_map:new a.bU(e,s.u_pitch_with_map),u_is_along_line:new a.bU(e,s.u_is_along_line),u_is_variable_anchor:new a.bU(e,s.u_is_variable_anchor),u_texsize:new a.bZ(e,s.u_texsize),u_texture:new a.bU(e,s.u_texture),u_translation:new a.bZ(e,s.u_translation),u_pitched_scale:new a.bk(e,s.u_pitched_scale)}),symbolSDF:(e,s)=>({u_is_size_zoom_constant:new a.bU(e,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bU(e,s.u_is_size_feature_constant),u_size_t:new a.bk(e,s.u_size_t),u_size:new a.bk(e,s.u_size),u_camera_to_center_distance:new a.bk(e,s.u_camera_to_center_distance),u_pitch:new a.bk(e,s.u_pitch),u_rotate_symbol:new a.bU(e,s.u_rotate_symbol),u_aspect_ratio:new a.bk(e,s.u_aspect_ratio),u_fade_change:new a.bk(e,s.u_fade_change),u_label_plane_matrix:new a.bW(e,s.u_label_plane_matrix),u_coord_matrix:new a.bW(e,s.u_coord_matrix),u_is_text:new a.bU(e,s.u_is_text),u_pitch_with_map:new a.bU(e,s.u_pitch_with_map),u_is_along_line:new a.bU(e,s.u_is_along_line),u_is_variable_anchor:new a.bU(e,s.u_is_variable_anchor),u_texsize:new a.bZ(e,s.u_texsize),u_texture:new a.bU(e,s.u_texture),u_gamma_scale:new a.bk(e,s.u_gamma_scale),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_is_halo:new a.bU(e,s.u_is_halo),u_translation:new a.bZ(e,s.u_translation),u_pitched_scale:new a.bk(e,s.u_pitched_scale)}),symbolTextAndIcon:(e,s)=>({u_is_size_zoom_constant:new a.bU(e,s.u_is_size_zoom_constant),u_is_size_feature_constant:new a.bU(e,s.u_is_size_feature_constant),u_size_t:new a.bk(e,s.u_size_t),u_size:new a.bk(e,s.u_size),u_camera_to_center_distance:new a.bk(e,s.u_camera_to_center_distance),u_pitch:new a.bk(e,s.u_pitch),u_rotate_symbol:new a.bU(e,s.u_rotate_symbol),u_aspect_ratio:new a.bk(e,s.u_aspect_ratio),u_fade_change:new a.bk(e,s.u_fade_change),u_label_plane_matrix:new a.bW(e,s.u_label_plane_matrix),u_coord_matrix:new a.bW(e,s.u_coord_matrix),u_is_text:new a.bU(e,s.u_is_text),u_pitch_with_map:new a.bU(e,s.u_pitch_with_map),u_is_along_line:new a.bU(e,s.u_is_along_line),u_is_variable_anchor:new a.bU(e,s.u_is_variable_anchor),u_texsize:new a.bZ(e,s.u_texsize),u_texsize_icon:new a.bZ(e,s.u_texsize_icon),u_texture:new a.bU(e,s.u_texture),u_texture_icon:new a.bU(e,s.u_texture_icon),u_gamma_scale:new a.bk(e,s.u_gamma_scale),u_device_pixel_ratio:new a.bk(e,s.u_device_pixel_ratio),u_is_halo:new a.bU(e,s.u_is_halo),u_translation:new a.bZ(e,s.u_translation),u_pitched_scale:new a.bk(e,s.u_pitched_scale)}),background:(e,s)=>({u_opacity:new a.bk(e,s.u_opacity),u_color:new a.bV(e,s.u_color)}),backgroundPattern:(e,s)=>({u_opacity:new a.bk(e,s.u_opacity),u_image:new a.bU(e,s.u_image),u_pattern_tl_a:new a.bZ(e,s.u_pattern_tl_a),u_pattern_br_a:new a.bZ(e,s.u_pattern_br_a),u_pattern_tl_b:new a.bZ(e,s.u_pattern_tl_b),u_pattern_br_b:new a.bZ(e,s.u_pattern_br_b),u_texsize:new a.bZ(e,s.u_texsize),u_mix:new a.bk(e,s.u_mix),u_pattern_size_a:new a.bZ(e,s.u_pattern_size_a),u_pattern_size_b:new a.bZ(e,s.u_pattern_size_b),u_scale_a:new a.bk(e,s.u_scale_a),u_scale_b:new a.bk(e,s.u_scale_b),u_pixel_coord_upper:new a.bZ(e,s.u_pixel_coord_upper),u_pixel_coord_lower:new a.bZ(e,s.u_pixel_coord_lower),u_tile_units_to_pixels:new a.bk(e,s.u_tile_units_to_pixels)}),terrain:(e,s)=>({u_texture:new a.bU(e,s.u_texture),u_ele_delta:new a.bk(e,s.u_ele_delta),u_fog_matrix:new a.bW(e,s.u_fog_matrix),u_fog_color:new a.bV(e,s.u_fog_color),u_fog_ground_blend:new a.bk(e,s.u_fog_ground_blend),u_fog_ground_blend_opacity:new a.bk(e,s.u_fog_ground_blend_opacity),u_horizon_color:new a.bV(e,s.u_horizon_color),u_horizon_fog_blend:new a.bk(e,s.u_horizon_fog_blend),u_is_globe_mode:new a.bk(e,s.u_is_globe_mode)}),terrainDepth:(e,s)=>({u_ele_delta:new a.bk(e,s.u_ele_delta)}),terrainCoords:(e,s)=>({u_texture:new a.bU(e,s.u_texture),u_terrain_coords_id:new a.bk(e,s.u_terrain_coords_id),u_ele_delta:new a.bk(e,s.u_ele_delta)}),projectionErrorMeasurement:(e,s)=>({u_input:new a.bk(e,s.u_input),u_output_expected:new a.bk(e,s.u_output_expected)}),atmosphere:(e,s)=>({u_sun_pos:new a.bY(e,s.u_sun_pos),u_atmosphere_blend:new a.bk(e,s.u_atmosphere_blend),u_globe_position:new a.bY(e,s.u_globe_position),u_globe_radius:new a.bk(e,s.u_globe_radius),u_inv_proj_matrix:new a.bW(e,s.u_inv_proj_matrix)}),sky:(e,s)=>({u_sky_color:new a.bV(e,s.u_sky_color),u_horizon_color:new a.bV(e,s.u_horizon_color),u_horizon:new a.bZ(e,s.u_horizon),u_horizon_normal:new a.bZ(e,s.u_horizon_normal),u_sky_horizon_blend:new a.bk(e,s.u_sky_horizon_blend),u_sky_blend:new a.bk(e,s.u_sky_blend)})};class pa{constructor(e,s,a){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=Boolean(a),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const _n={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class fa{constructor(e,s,a,l){this.length=s.length,this.attributes=a,this.itemSize=s.bytesPerElement,this.dynamicDraw=l,this.context=e;const c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let a=0;a0&&(b.push({circleArray:L,circleOffset:P,coord:M}),S+=L.length/4,P=S),D&&y.draw(d,_.LINES,Xt.disabled,Yt.disabled,e.colorModeForRenderPass(),Ht.disabled,Fr(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(M),f.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),l.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,null,e.transform.zoom,null,null,D.collisionVertexBuffer)}if(!u||!b.length)return;const M=e.useProgram("collisionCircle"),C=new a.c4;C.resize(4*S),C._trim();let D=0;for(const e of b)for(let s=0;s=0&&(L[F.associatedIconIndex]={shiftedAnchor:Q,angle:se})}else oi(F.numGlyphs,C)}if(y){D.clear();const s=e.icon.placedSymbolArray;for(let e=0;ee.style.map.terrain.getElevation(_,s,a):null,a="map"===l.layout.get("text-rotation-alignment");pt(y,e,u,Te,Se,B,b,a,_.toUnwrapped(),L.width,L.height,Ee,s)}const Le=u&&Z||ke,Fe=O||Le?vn:B?Te:e.transform.clipSpaceToPixelsMatrix,Oe=C&&0!==l.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1);let Ve;Ve=C?y.iconsInText?un(G.kind,se,V,B,O,Le,e,Fe,Me,Ee,ce,ve,W):hn(G.kind,se,V,B,O,Le,e,Fe,Me,Ee,u,ce,0,W):cn(G.kind,se,V,B,O,Le,e,Fe,Me,Ee,u,ce,W);const Ne={program:Q,buffers:S,uniformValues:Ve,projectionData:Ce,atlasTexture:pe,atlasTextureIcon:be,atlasInterpolation:fe,atlasInterpolationIcon:xe,isSDF:C,hasHalo:Oe};if(N&&y.canOverlap){j=!0;const e=S.segments.get();for(const s of e)q.push({segments:new a.aR([s]),sortKey:s.sortKey,state:Ne,terrainData:oe})}else q.push({segments:S.segments,sortKey:0,state:Ne,terrainData:oe})}j&&q.sort(((e,s)=>e.sortKey-s.sortKey));for(const s of q){const a=s.state;if(C.activeTexture.set(D.TEXTURE0),a.atlasTexture.bind(a.atlasInterpolation,D.CLAMP_TO_EDGE),a.atlasTextureIcon&&(C.activeTexture.set(D.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,D.CLAMP_TO_EDGE)),a.isSDF){const c=a.uniformValues;a.hasHalo&&(c.u_is_halo=1,In(a.buffers,s.segments,l,e,a.program,G,S,P,c,a.projectionData,s.terrainData)),c.u_is_halo=0}In(a.buffers,s.segments,l,e,a.program,G,S,P,a.uniformValues,a.projectionData,s.terrainData)}}function In(e,s,a,l,c,u,d,f,_,y,b){const S=l.context;c.draw(S,S.gl.TRIANGLES,u,d,f,Ht.backCCW,_,b,y,a.id,e.layoutVertexBuffer,e.indexBuffer,s,a.paint,l.transform.zoom,e.programConfigurations.get(a.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Mn(e,s,l,c,u){const d=e.context,f=d.gl,_=Yt.disabled,y=new qt([f.ONE,f.ONE],a.bj.transparent,[!0,!0,!0,!0]),b=s.getBucket(l);if(!b)return;const S=c.key;let P=l.heatmapFbos.get(S);P||(P=An(d,s.tileSize,s.tileSize),l.heatmapFbos.set(S,P)),d.bindFramebuffer.set(P.framebuffer),d.viewport.set([0,0,s.tileSize,s.tileSize]),d.clear({color:a.bj.transparent});const M=b.programConfigurations.get(l.id),C=e.useProgram("heatmap",M,!u),D=e.transform.getProjectionData({overscaledTileID:s.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),L=e.style.map.terrain.getTerrainData(c);C.draw(d,f.TRIANGLES,Xt.disabled,_,y,Ht.disabled,Vr(s,e.transform.zoom,l.paint.get("heatmap-intensity"),1),L,D,l.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,l.paint,e.transform.zoom,M)}function Cn(e,s,a,l,c){const u=e.context,d=u.gl,f=e.transform;u.setColorMode(e.colorModeForRenderPass());const _=Dn(u,s),y=a.key,b=s.heatmapFbos.get(y);if(!b)return;u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,b.colorAttachment.get()),u.activeTexture.set(d.TEXTURE1),_.bind(d.LINEAR,d.CLAMP_TO_EDGE);const S=f.getProjectionData({overscaledTileID:a,applyTerrainMatrix:c,applyGlobeMatrix:!l});e.useProgram("heatmapTexture").draw(u,d.TRIANGLES,Xt.disabled,Yt.disabled,e.colorModeForRenderPass(),Ht.disabled,Ur(e,s,0,1),null,S,s.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,s.paint,f.zoom),b.destroy(),s.heatmapFbos.delete(y)}function An(e,s,a){var l,c;const u=e.gl,d=u.createTexture();u.bindTexture(u.TEXTURE_2D,d),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);const f=null!==(l=e.HALF_FLOAT)&&void 0!==l?l:u.UNSIGNED_BYTE,_=null!==(c=e.RGBA16F)&&void 0!==c?c:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,_,s,a,0,u.RGBA,f,null);const y=e.createFramebuffer(s,a,!1,!1);return y.colorAttachment.set(d),y}function Dn(e,s){return s.colorRampTexture||(s.colorRampTexture=new a.T(e,s.colorRamp,e.gl.RGBA)),s.colorRampTexture}function zn(e,s,l,c,u,d,f,_){let y=256;if(u.stepInterpolant){const c=s.getSource().maxzoom,u=f.canonical.z===c?Math.ceil(1<20&&P.texParameterf(P.TEXTURE_2D,S.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,S.extTextureFilterAnisotropicMax);const se=e.style.map.terrain&&e.style.map.terrain.getTerrainData(j),oe=C.getProjectionData({overscaledTileID:j,aligned:F,applyGlobeMatrix:!y,applyTerrainMatrix:!0}),ce=on(J,W,Q.fadeMix,a,f),pe=D.getMeshFromTileID(S,j.canonical,u,d,"raster");M.draw(S,P.TRIANGLES,l,c?c[j.overscaledZ]:Yt.disabled,L,_?Ht.frontCCW:Ht.backCCW,ce,se,oe,a.id,pe.vertexBuffer,pe.indexBuffer,pe.segments)}}function $n(e,s,l,c){const u={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===l||c)return u;if(e.fadingParentID){const c=s.getLoadedTile(e.fadingParentID);if(!c)return u;const d=Math.pow(2,c.tileID.overscaledZ-e.tileID.overscaledZ),f=[e.tileID.canonical.x*d%1,e.tileID.canonical.y*d%1],_=function(e,s,l){const c=b(),u=(c-s.timeAdded)/l,d=e.fadingDirection===Fe.Incoming,f=a.ai((c-e.timeAdded)/l,0,1),_=a.ai(1-u,0,1),y=d?f:_;return{tileOpacity:y,parentTileOpacity:d?_:f,fadeMix:{opacity:1,mix:1-y}}}(e,c,l);return{parentTile:c,parentScaleBy:d,parentTopLeft:f,fadeValues:_}}if(e.selfFading){const s=function(e,s){const l=(b()-e.timeAdded)/s,c=a.ai(l,0,1);return{tileOpacity:c,fadeMix:{opacity:c,mix:0}}}(e,l);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:s}}return u}const Wn=new a.bj(1,0,0,1),Hn=new a.bj(0,1,0,1),Xn=new a.bj(0,0,1,1),Yn=new a.bj(1,0,1,1),Kn=new a.bj(0,1,1,1);function Jn(e,s,a,l){es(e,0,s+a/2,e.transform.width,a,l)}function Qn(e,s,a,l){es(e,s-a/2,0,a,e.transform.height,l)}function es(e,s,a,l,c,u){const d=e.context,f=d.gl;f.enable(f.SCISSOR_TEST),f.scissor(s*e.pixelRatio,a*e.pixelRatio,l*e.pixelRatio,c*e.pixelRatio),d.clear({color:u}),f.disable(f.SCISSOR_TEST)}function ts(e,s,l){const c=e.context,u=c.gl,d=e.useProgram("debug"),f=Xt.disabled,_=Yt.disabled,y=e.colorModeForRenderPass(),b="$debug",S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);c.activeTexture.set(u.TEXTURE0);const P=s.getTileByID(l.key).latestRawTileData,M=Math.floor((P&&P.byteLength||0)/1024),C=s.getTile(l).tileSize,D=512/Math.min(C,512)*(l.overscaledZ/e.transform.zoom)*.5;let L=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(L+=` => ${l.overscaledZ}`),function(e,s){e.initDebugOverlayCanvas();const a=e.debugOverlayCanvas,l=e.context.gl,c=e.debugOverlayCanvas.getContext("2d");c.clearRect(0,0,a.width,a.height),c.shadowColor="white",c.shadowBlur=2,c.lineWidth=1.5,c.strokeStyle="white",c.textBaseline="top",c.font="bold 36px Open Sans, sans-serif",c.fillText(s,5,5),c.strokeText(s,5,5),e.debugOverlayTexture.update(a),e.debugOverlayTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE)}(e,`${L} ${M}kB`);const F=e.transform.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});d.draw(c,u.TRIANGLES,f,_,qt.alphaBlended,Ht.disabled,Or(a.bj.transparent,D),null,F,b,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),d.draw(c,u.LINE_STRIP,f,_,y,Ht.disabled,Or(a.bj.red),S,F,b,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function is(e,s,a,l){const{isRenderingGlobe:c}=l,u=e.context,d=u.gl,f=e.transform,_=e.colorModeForRenderPass(),y=e.getDepthModeFor3D(),b=e.useProgram("terrain");u.bindFramebuffer.set(null),u.viewport.set([0,0,e.width,e.height]);for(const l of a){const a=s.getTerrainMesh(l.tileID),S=e.renderToTexture.getTexture(l),P=s.getTerrainData(l.tileID);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,S.texture);const M=s.getMeshFrameDelta(f.zoom),C=f.calculateFogMatrix(l.tileID.toUnwrapped()),D=br(M,C,e.style.sky,f.pitch,c),L=f.getProjectionData({overscaledTileID:l.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});b.draw(u,d.TRIANGLES,y,Yt.disabled,_,Ht.backCCW,D,P,L,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}}function ns(e,s){if(!s.mesh){const l=new a.aQ;l.emplaceBack(-1,-1),l.emplaceBack(1,-1),l.emplaceBack(1,1),l.emplaceBack(-1,1);const c=new a.aS;c.emplaceBack(0,1,2),c.emplaceBack(0,2,3),s.mesh=new St(e.createVertexBuffer(l,Li.members),e.createIndexBuffer(c),a.aR.simpleSegment(0,0,l.length,c.length))}return s.mesh}class jr{constructor(e,s){this.context=new tr(e),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.am(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ie.maxUnderzooming+Ie.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Mt}resize(e,s,a){if(this.width=Math.floor(e*a),this.height=Math.floor(s*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const e=this.context,s=new a.aQ;s.emplaceBack(0,0),s.emplaceBack(a.a3,0),s.emplaceBack(0,a.a3),s.emplaceBack(a.a3,a.a3),this.tileExtentBuffer=e.createVertexBuffer(s,Li.members),this.tileExtentSegments=a.aR.simpleSegment(0,0,4,2);const l=new a.aQ;l.emplaceBack(0,0),l.emplaceBack(a.a3,0),l.emplaceBack(0,a.a3),l.emplaceBack(a.a3,a.a3),this.debugBuffer=e.createVertexBuffer(l,Li.members),this.debugSegments=a.aR.simpleSegment(0,0,4,5);const c=new a.cb;c.emplaceBack(0,0,0,0),c.emplaceBack(a.a3,0,a.a3,0),c.emplaceBack(0,a.a3,0,a.a3),c.emplaceBack(a.a3,a.a3,a.a3,a.a3),this.rasterBoundsBuffer=e.createVertexBuffer(c,vr.members),this.rasterBoundsSegments=a.aR.simpleSegment(0,0,4,2);const u=new a.aQ;u.emplaceBack(0,0),u.emplaceBack(a.a3,0),u.emplaceBack(0,a.a3),u.emplaceBack(a.a3,a.a3),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(u,Li.members),this.rasterBoundsSegmentsPosOnly=a.aR.simpleSegment(0,0,4,5);const d=new a.aQ;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(d,Li.members),this.viewportSegments=a.aR.simpleSegment(0,0,4,2);const f=new a.cc;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(f);const _=new a.aS;_.emplaceBack(1,0,2),_.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);const y=this.context.gl;this.stencilClearMode=new Yt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO),this.tileExtentMesh=new St(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,s=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const l=a.M();a.c1(l,0,this.width,this.height,0,0,1),a.O(l,l,[s.drawingBufferWidth,s.drawingBufferHeight,0]);const c={mainMatrix:l,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:l};this.useProgram("clippingMask",null,!0).draw(e,s.TRIANGLES,Xt.disabled,this.stencilClearMode,qt.disabled,Ht.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s,a){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source,this.nextStencilID+s.length>256&&this.clearStencil();const l=this.context;l.setColorMode(qt.disabled),l.setDepthMode(Xt.disabled);const c={};for(const e of s)c[e.key]=this.nextStencilID++;this._renderTileMasks(c,s,a,!0),this._renderTileMasks(c,s,a,!1),this._tileClippingMaskIDs=c}_renderTileMasks(e,s,a,l){const c=this.context,u=c.gl,d=this.style.projection,f=this.transform,_=this.useProgram("clippingMask");for(const y of s){const s=e[y.key],b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(y),S=d.getMeshFromTileID(this.context,y.canonical,l,!0,"stencil"),P=f.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!a,applyTerrainMatrix:!0});_.draw(c,u.TRIANGLES,Xt.disabled,new Yt({func:u.ALWAYS,mask:0},s,255,u.KEEP,u.KEEP,u.REPLACE),qt.disabled,a?Ht.disabled:Ht.backCCW,null,b,P,"$clipping",S.vertexBuffer,S.indexBuffer,S.segments)}}_renderTilesDepthBuffer(){const e=this.context,s=e.gl,a=this.style.projection,l=this.transform,c=this.useProgram("depth"),u=this.getDepthModeFor3D(),d=Xe(l,{tileSize:l.tileSize});for(const f of d){const d=this.style.map.terrain&&this.style.map.terrain.getTerrainData(f),_=a.getMeshFromTileID(this.context,f.canonical,!0,!0,"raster"),y=l.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!0,applyTerrainMatrix:!0});c.draw(e,s.TRIANGLES,u,Yt.disabled,qt.disabled,Ht.backCCW,null,d,y,"$clipping",_.vertexBuffer,_.indexBuffer,_.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,s=this.context.gl;return new Yt({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){const s=this.context.gl;return new Yt({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const s=this.context.gl,a=e.sort(((e,s)=>s.overscaledZ-e.overscaledZ)),l=a[a.length-1].overscaledZ,c=a[0].overscaledZ-l+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();const e={};for(let a=0;as.overscaledZ-e.overscaledZ)),l=a[a.length-1].overscaledZ,c=a[0].overscaledZ-l+1;if(this.clearStencil(),c>1){const e={},u={};for(let a=0;a0};for(const e in d){const s=d[e];s.used&&s.prepare(this.context),f[e]=s.getVisibleCoordinates(!1),_[e]=f[e].slice().reverse(),y[e]=s.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;ethis.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?a.bj.black:a.bj.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,s){const a=e.context,l=a.gl,c=((e,s,a)=>{const l=Math.cos(s.rollInRadians),c=Math.sin(s.rollInRadians),u=je(s),d=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(s.width/2-u*c)*a,(s.height/2+u*l)*a],u_horizon_normal:[-c,l],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*s.height/2*a,u_sky_blend:d}})(s,e.style.map.transform,e.pixelRatio),u=new Xt(l.LEQUAL,Xt.ReadWrite,[0,1]),d=Yt.disabled,f=e.colorModeForRenderPass(),_=e.useProgram("sky"),y=ns(a,s);_.draw(a,l.TRIANGLES,u,d,f,Ht.disabled,c,null,void 0,"sky",y.vertexBuffer,y.indexBuffer,y.segments)}(this,this.style.sky),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[u[this.currentLayer]],s=d[e.source],a=f[e.source];this._renderTileClippingMasks(e,a,!1),this.renderLayer(this,s,e,a,S)}this.renderPass="translucent";let P=!1;for(this.currentLayer=0;this.currentLayer({u_sun_pos:e,u_atmosphere_blend:s,u_globe_position:a,u_globe_radius:l,u_inv_proj_matrix:c}))(y,S,[C[0],C[1],C[2]],P,M),L=ns(c,s);d.draw(c,u.TRIANGLES,f,Yt.disabled,qt.alphaBlended,Ht.disabled,D,null,null,"atmosphere",L.vertexBuffer,L.indexBuffer,L.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,s){let a=null;const l=Object.values(e._layers).flatMap((a=>a.source&&!a.isHidden(s)?[e.tileManagers[a.source]]:[])),c=l.filter((e=>"vector"===e.getSource().type)),u=l.filter((e=>"vector"!==e.getSource().type)),d=e=>{(!a||a.getSource().maxzoomd(e))),a||u.forEach((e=>d(e))),a}(this.style,this.transform.zoom);e&&function(e,s,a){for(let l=0;lS.getElevation(u,e,s):null;Tn(d,P,M,y,b,L,s,C,F,a.aI(b,e,f,_),u.toUnwrapped(),l)}}}(c,e,l,s,l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),u),0!==l.paint.get("icon-opacity").constantOr(1)&&Pn(e,s,l,c,!1,l.paint.get("icon-translate"),l.paint.get("icon-translate-anchor"),l.layout.get("icon-rotation-alignment"),l.layout.get("icon-pitch-alignment"),l.layout.get("icon-keep-upright"),_,y,f),0!==l.paint.get("text-opacity").constantOr(1)&&Pn(e,s,l,c,!0,l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),l.layout.get("text-keep-upright"),_,y,f),s.map.showCollisionBoxes&&(xn(e,s,l,c,!0),xn(e,s,l,c,!1))}(e,s,l,c,this.style.placement.variableOffsets,u):a.ch(l)?function(e,s,l,c,u){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:d}=u,f=l.paint.get("circle-opacity"),_=l.paint.get("circle-stroke-width"),y=l.paint.get("circle-stroke-opacity"),b=!l.layout.get("circle-sort-key").isConstant();if(0===f.constantOr(1)&&(0===_.constantOr(1)||0===y.constantOr(1)))return;const S=e.context,P=S.gl,M=e.transform,C=e.getDepthModeForSublayer(0,Xt.ReadOnly),D=Yt.disabled,L=e.colorModeForRenderPass(),F=[],B=M.getCircleRadiusCorrection();for(let u=0;ue.sortKey-s.sortKey));for(const s of F){const{programConfiguration:a,program:c,layoutVertexBuffer:u,indexBuffer:d,uniformValues:f,terrainData:_,projectionData:y}=s.state;c.draw(S,P.TRIANGLES,C,D,L,Ht.backCCW,f,_,y,l.id,u,d,s.segments,l.paint,e.transform.zoom,a)}}(e,s,l,c,u):a.ci(l)?function(e,s,l,c,u){if(0===l.paint.get("heatmap-opacity"))return;const d=e.context,{isRenderingToTexture:f,isRenderingGlobe:_}=u;if(e.style.map.terrain){for(const a of c){const c=s.getTile(a);s.hasRenderableParent(a)||("offscreen"===e.renderPass?Mn(e,c,l,a,_):"translucent"===e.renderPass&&Cn(e,l,a,f,_))}d.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,s,l,c){const u=e.context,d=u.gl,f=e.transform,_=Yt.disabled,y=new qt([d.ONE,d.ONE],a.bj.transparent,[!0,!0,!0,!0]);(function(e,s,l){const c=e.gl;e.activeTexture.set(c.TEXTURE1),e.viewport.set([0,0,s.width/4,s.height/4]);let u=l.heatmapFbos.get(a.c7);u?(c.bindTexture(c.TEXTURE_2D,u.colorAttachment.get()),e.bindFramebuffer.set(u.framebuffer)):(u=An(e,s.width/4,s.height/4),l.heatmapFbos.set(a.c7,u))})(u,e,l),u.clear({color:a.bj.transparent});for(let a=0;a0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const s=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!s||!a}useProgram(e,s,a=!1,l=[]){this.cache=this.cache||{};const c=!!this.style.map.terrain,u=this.style.projection,d=a?zi.projectionMercator:u.shaderPreludeCode,f=a?Fi:u.shaderDefine,_=e+(s?s.cacheKey:"")+`/${a?Bi:u.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(c?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[_]||(this.cache[_]=new ki(this.context,zi[e],s,mn[e],this._showOverdrawInspector,c,d,f,l)),this.cache[_]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,s;if(this._tileTextures){for(const e in this._tileTextures){const s=this._tileTextures[e];if(s)for(const e of s)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(s=this.tileExtentMesh.indexBuffer)||void 0===s||s.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const e in this.cache){const s=this.cache[e];s&&s.program&&this.context.gl.deleteProgram(s.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:s}=this.context.gl;return this.width!==e||this.height!==s}}function ss(s,a){let l,c=!1,u=null,d=null;const f=()=>{u=null,c&&(s.apply(d,l),u=setTimeout(f,a),c=!1)};return(...s)=>(c=!0,d=this||e,l=s,u||f(),u)}class Nr{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let s;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(s=e)})),(s&&s[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:s,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const s=e.join("/");let a=s;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${s}`);let l=window.location.hash.replace(a,"");l.startsWith("#&")?l=l.slice(0,1)+l.slice(2):"#"===l&&(l="");let c=window.location.href.replace(/(#.+)?$/,l);c=c.replace("&&","&"),window.history.replaceState(window.history.state,null,c)},this._updateHash=ss(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const s=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,l=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,l),u=Math.round(s.lng*c)/c,d=Math.round(s.lat*c)/c,f=this._map.getBearing(),_=this._map.getPitch();let y="";if(y+=e?`/${u}/${d}/${a}`:`${a}/${d}/${u}`,(f||_)&&(y+="/"+Math.round(10*f)/10),_&&(y+=`/${Math.round(_)}`),this._hashName){const e=this._hashName;let s=!1;const a=window.location.hash.slice(1).split("&").map((a=>{const l=a.split("=")[0];return l===e?(s=!0,`${l}=${y}`):a})).filter((e=>e));return s||a.push(`${e}=${y}`),`#${a.join("&")}`}return`#${y}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new a.U(+e[2],+e[1])}catch(e){return!1}const s=+e[0],l=+(e[3]||0),c=+(e[4]||0);return s>=this._map.getMinZoom()&&s<=this._map.getMaxZoom()&&l>=-180&&l<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const os={linearity:.3,easing:a.cq(0,0,.3,1)},ls=a.e({deceleration:2500,maxSpeed:1400},os),hs=a.e({deceleration:20,maxSpeed:1400},os),us=a.e({deceleration:1e3,maxSpeed:360},os),ps=a.e({deceleration:1e3,maxSpeed:90},os),fs=a.e({deceleration:1e3,maxSpeed:360},os);class Hr{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:b(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,s=b();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,roll:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)s.zoom+=e.zoomDelta||0,s.bearing+=e.bearingDelta||0,s.pitch+=e.pitchDelta||0,s.roll+=e.rollDelta||0,e.panDelta&&s.pan._add(e.panDelta),e.around&&(s.around=e.around),e.pinchAround&&(s.pinchAround=e.pinchAround);const l=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(s.pan.mag()){const u=_s(s.pan.mag(),l,a.e({},ls,e||{})),d=s.pan.mult(u.amount/s.pan.mag()),f=this._map.cameraHelper.handlePanInertia(d,this._map.transform);c.center=f.easingCenter,c.offset=f.easingOffset,ms(c,u)}if(s.zoom){const e=_s(s.zoom,l,hs);c.zoom=this._map.transform.zoom+e.amount,ms(c,e)}if(s.bearing){const e=_s(s.bearing,l,us);c.bearing=this._map.transform.bearing+a.ai(e.amount,-179,179),ms(c,e)}if(s.pitch){const e=_s(s.pitch,l,ps);c.pitch=this._map.transform.pitch+e.amount,ms(c,e)}if(s.roll){const e=_s(s.roll,l,fs);c.roll=this._map.transform.roll+a.ai(e.amount,-179,179),ms(c,e)}if(c.zoom||c.bearing){const e=void 0===s.pinchAround?s.around:s.pinchAround;c.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),a.e(c,{noMoveStart:!0})}}function ms(e,s){(!e.duration||e.durations.unproject(e))),f=u.reduce(((e,s,a,l)=>e.add(s.div(l.length))),new a.P(0,0));super(e,{points:u,point:f,lngLats:d,lngLat:s.unproject(f),originalEvent:l}),this._defaultPrevented=!1}}class Jr extends a.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class eo{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Jr(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new Yr(e.type,this._map,e))}mouseup(e){this._map.fire(new Yr(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Yr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Yr(e.type,this._map,e))}mouseover(e){this._map.fire(new Yr(e.type,this._map,e))}mouseout(e){this._map.fire(new Yr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Qr(e.type,this._map,e))}touchmove(e){this._map.fire(new Qr(e.type,this._map,e))}touchend(e){this._map.fire(new Qr(e.type,this._map,e))}touchcancel(e){this._map.fire(new Qr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Yr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Yr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Yr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(a.P.convert(e),this._map.terrain)}}class ao{constructor(e,s){this._map=e,this._tr=new io(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&0===e.button&&(h.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;const a=s;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)e.fitScreenCoordinates(l,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(h.remove(this._box),this._box=null),h.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new a.l(e,{originalEvent:s}))}}function gs(e,s){if(e.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${s.length}`);const a={};for(let l=0;lthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),l.length===this.numTouches&&(this.centroid=function(e){const s=new a.P(0,0);for(const a of e)s._add(a);return s.div(e.length)}(s),this.touches=gs(l,s)))}touchmove(e,s,a){if(this.aborted||!this.centroid)return;const l=gs(a,s);for(const e in this.touches){const s=l[e];(!s||s.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,s,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===a.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class so{constructor(e){this.singleTap=new oo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,a){this.singleTap.touchstart(e,s,a)}touchmove(e,s,a){this.singleTap.touchmove(e,s,a)}touchend(e,s,a){const l=this.singleTap.touchend(e,s,a);if(l){const s=e.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(l)<30;if(s&&a||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class no{constructor(e){this._tr=new io(e),this._zoomIn=new so({numTouches:1,numTaps:2}),this._zoomOut=new so({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,a){this._zoomIn.touchstart(e,s,a),this._zoomOut.touchstart(e,s,a)}touchmove(e,s,a){this._zoomIn.touchmove(e,s,a),this._zoomOut.touchmove(e,s,a)}touchend(e,s,a){const l=this._zoomIn.touchend(e,s,a),c=this._zoomOut.touchend(e,s,a),u=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:u.zoom+1,around:u.unproject(l)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:u.zoom-1,around:u.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lo{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const s=this._moveFunction(...e);if(s.bearingDelta||s.pitchDelta||s.rollDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(e,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(s)?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,s){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(s)?s[0]:s;return!this._moved&&l.dist(a)!0}),s=new po){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=s}_executeRelevantHandler(e,s,a){return e instanceof MouseEvent?s(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?a(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.startMove(e)),(e=>this.oneFingerTouchMoveStateManager.startMove(e)))}endMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.endMove(e)),(e=>this.oneFingerTouchMoveStateManager.endMove(e)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}const bs=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class go{constructor(e,s){this._clickTolerance=e.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,s,a){return this._calculateTransform(e,s,a)}touchmove(e,s,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,s,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,s,a){this._calculateTransform(e,s,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,l){l.length>0&&(this._active=!0);const c=gs(l,s),u=new a.P(0,0),d=new a.P(0,0);let f=0;for(const e in c){const s=c[e],a=this._touches[e];a&&(u._add(s),d._add(s.sub(a)),f++,c[e]=s)}if(this._touches=c,this._shouldBePrevented(f)||!d.mag())return;const _=d.div(f);return this._sum._add(_),this._sum.mag()Math.abs(e.x)}class Mo extends vo{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,s,a){super.touchstart(e,s,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,Is(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,c,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,s,a){if(void 0!==this._valid)return this._valid;const l=e.mag()>=2,c=s.mag()>=2;if(!l&&!c)return;if(!l||!c)return void 0===this._firstMove&&(this._firstMove=a),a-this._firstMove<100&&void 0;const u=e.y>0==s.y>0;return Is(e)&&Is(s)&&u}}const Ms={panStep:100,bearingStep:15,pitchStep:10};class Io{constructor(e){this._tr=new io(e);const s=Ms;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,a=0,l=0,c=0,u=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),u=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),u=1);break;default:return}return this._rotationDisabled&&(a=0,l=0),{cameraAnimation:d=>{const f=this._tr;d.easeTo({duration:300,easeId:"keyboardHandler",easing:As,zoom:s?Math.round(f.zoom)+s*(e.shiftKey?2:1):f.zoom,bearing:f.bearing+a*this._bearingStep,pitch:f.pitch+l*this._pitchStep,offset:[-c*this._panStep,-u*this._panStep],center:f.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function As(e){return e*(2-e)}const ks=4.000244140625,js=1/450;class Do{constructor(e,s){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new io(e),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=js}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const a=b(),l=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==s&&s%ks==0?this._type="wheel":0!==s&&Math.abs(s)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_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 s=h.mousePos(this._map.getCanvas(),e),l=this._tr;this._aroundPoint=this._aroundCenter?l.transform.locationToScreenPoint(a.U.convert(l.center)):s,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const s=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=s),"number"==typeof this._targetZoom&&(this._targetZoom+=s)}if(0!==this._delta){const s="wheel"===this._type&&Math.abs(this._delta)>ks?this._wheelZoomRate:this._defaultZoomRate;let l=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&0!==l&&(l=1/l);const c="number"!=typeof this._targetZoom?e.scale:a.al(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),a.ao(c*l)).zoom,"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,l=this._startZoom,c=this._easing;let u,d=!1;if("wheel"===this._type&&l&&c){const e=b()-this._lastWheelEventTime,f=Math.min((e+5)/200,1),_=c(f);u=a.F.number(l,s,_),f<1?this._frameId||(this._frameId=!0):d=!0}else u=s,d=!0;return this._active=!0,d&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=u,{noInertia:!0,needsRenderFrame:!d,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=a.cs;if(this._prevEase){const e=this._prevEase,l=(b()-e.start)/e.duration,c=e.easing(l+.01)-e.easing(l),u=.27/Math.sqrt(c*c+1e-4)*.01,d=Math.sqrt(.0729-u*u);s=a.cq(u,d,.25,1)}return this._prevEase={start:b(),duration:e,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class zo{constructor(e,s){this._clickZoom=e,this._tapZoom=s}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 Ao{constructor(e){this._tr=new io(e),this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Lo{constructor(){this._tap=new so({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,s,a){if(!this._swipePoint)if(this._tapTime){const l=s[0],c=e.timeStamp-this._tapTime<500,u=this._tapPoint.dist(l)<30;c&&u?a.length>0&&(this._swipePoint=l,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,s,a)}touchmove(e,s,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const l=s[0],c=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,s,a)}touchend(e,s,a){if(this._tapTime)this._swipePoint&&0===a.length&&this.reset();else{const l=this._tap.touchend(e,s,a);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ko{constructor(e,s,a){this._el=e,this._mousePan=s,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Fo{constructor(e,s,a,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=s,this._mousePitch=a,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Bo{constructor(e,s,a,l){this._el=e,this._touchZoom=s,this._touchRotate=a,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Oo{constructor(e,s){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=h.create("div","maplibregl-cooperative-gesture-screen",e);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=s,this._container.appendChild(l);const c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=a,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(h.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,s){this._enabled&&(this._map.fire(new a.l("cooperativegestureprevented",{gestureType:e,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ws=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Uo extends a.l{}function Hs(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Zo{constructor(e,s){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,s)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const l="renderFrame"===e.type?void 0:e,c={needsRenderFrame:!1},u={},d={};for(const{handlerName:f,handler:_,allowed:y}of this._handlers){if(!_.isEnabled())continue;let b;if(this._blockedByActive(d,y,f))_.reset();else if(_[s||e.type]){if(a.ct(e,s||e.type)){const a=h.mousePos(this._map.getCanvas(),e);b=_[s||e.type](e,a)}else if(a.cu(e,s||e.type)){const a=this._getMapTouches(e.touches),l=h.touchPos(this._map.getCanvas(),a);b=_[s||e.type](e,l,a)}else a.cv(s||e.type)||(b=_[s||e.type](e));this.mergeHandlerResult(c,u,b,f,l),b&&b.needsRenderFrame&&this._triggerRenderFrame()}(b||_.isActive())&&(d[f]=_)}const f={};for(const e in this._previousActiveHandlers)d[e]||(f[e]=l);this._previousActiveHandlers=d,(Object.keys(f).length||Hs(c))&&(this._changes.push([c,u,f]),this._triggerRenderFrame()),(Object.keys(d).length||Hs(c))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:_}=c;_&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],_(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Hr(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,s,a]of this._listeners)h.addEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(const[e,s,a]of this._listeners)h.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const s=this._map,l=s.getCanvasContainer();this._add("mapEvent",new eo(s,e));const c=s.boxZoom=new ao(s,e);this._add("boxZoom",c),e.interactive&&e.boxZoom&&c.enable();const u=s.cooperativeGestures=new Oo(s,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();const d=new no(s),f=new Ao(s);s.doubleClickZoom=new zo(f,d),this._add("tapZoom",d),this._add("clickZoom",f),e.interactive&&e.doubleClickZoom&&s.doubleClickZoom.enable();const _=new Lo;this._add("tapDragZoom",_);const y=s.touchPitch=new Mo(s);this._add("touchPitch",y),e.interactive&&e.touchPitch&&s.touchPitch.enable(e.touchPitch);const b=()=>s.project(s.getCenter()),S=function({enable:e,clickTolerance:s,aroundCenter:l=!0,minPixelCenterThreshold:c=100,rotateDegreesPerPixelMoved:u=.8},d){const f=new _o({checkCorrectEvent:e=>0===h.mouseButton(e)&&e.ctrlKey||2===h.mouseButton(e)&&!e.ctrlKey});return new lo({clickTolerance:s,move:(e,s)=>{const f=d();if(l&&Math.abs(f.y-e.y)>c)return{bearingDelta:a.cr(new a.P(e.x,s.y),s,f)};let _=(s.x-e.x)*u;return l&&s.y0===h.mouseButton(e)&&e.ctrlKey||2===h.mouseButton(e)});return new lo({clickTolerance:s,move:(e,s)=>({pitchDelta:(s.y-e.y)*a}),moveStateManager:l,enable:e,assignEvents:bs})}(e),M=function({enable:e,clickTolerance:s,rollDegreesPerPixelMoved:a=.3},l){const c=new _o({checkCorrectEvent:e=>2===h.mouseButton(e)&&e.ctrlKey});return new lo({clickTolerance:s,move:(e,s)=>{const c=l();let u=(s.x-e.x)*a;return s.y0===h.mouseButton(e)&&!e.ctrlKey});return new lo({clickTolerance:s,move:(e,s)=>({around:s,panDelta:s.sub(e)}),activateOnStart:!0,moveStateManager:a,enable:e,assignEvents:bs})}(e),D=new go(e,s);s.dragPan=new ko(l,C,D),this._add("mousePan",C),this._add("touchPan",D,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&s.dragPan.enable(e.dragPan);const L=new To,F=new yo;s.touchZoomRotate=new Bo(l,F,L,_),this._add("touchRotate",L,["touchPan","touchZoom"]),this._add("touchZoom",F,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&s.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new to(s));const B=s.scrollZoom=new Do(s,(()=>this._triggerRenderFrame()));this._add("scrollZoom",B,["mousePan"]),e.interactive&&e.scrollZoom&&s.scrollZoom.enable(e.scrollZoom);const O=s.keyboard=new Io(s);this._add("keyboard",O),e.interactive&&e.keyboard&&s.keyboard.enable()}_add(e,s,a){this._handlers.push({handlerName:e,handler:s,allowed:a}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ws(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,s,a){for(const l in e)if(l!==a&&(!s||s.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const s=[];for(const a of e)this._el.contains(a.target)&&s.push(a);return s}mergeHandlerResult(e,s,l,c,u){if(!l)return;a.e(e,l);const d={handlerName:c,originalEvent:l.originalEvent||u};void 0!==l.zoomDelta&&(s.zoom=d),void 0!==l.panDelta&&(s.drag=d),void 0!==l.rollDelta&&(s.roll=d),void 0!==l.pitchDelta&&(s.pitch=d),void 0!==l.bearingDelta&&(s.rotate=d)}_applyChanges(){const e={},s={},l={};for(const[c,u,d]of this._changes)c.panDelta&&(e.panDelta=(e.panDelta||new a.P(0,0))._add(c.panDelta)),c.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+c.pitchDelta),c.rollDelta&&(e.rollDelta=(e.rollDelta||0)+c.rollDelta),void 0!==c.around&&(e.around=c.around),void 0!==c.pinchAround&&(e.pinchAround=c.pinchAround),c.noInertia&&(e.noInertia=c.noInertia),a.e(s,u),a.e(l,d);this._updateMapTransform(e,s,l),this._changes=[]}_updateMapTransform(e,s,a){const l=this._map,c=l._getTransformForUpdate(),u=l.terrain;if(!(Hs(e)||u&&this._terrainMovement))return this._fireEvents(s,a,!0);l._stop(!0);let{panDelta:d,zoomDelta:f,bearingDelta:_,pitchDelta:y,rollDelta:b,around:S,pinchAround:P}=e;void 0!==P&&(S=P),S=S||l.transform.centerPoint,u&&!c.isPointOnMapSurface(S)&&(S=c.centerPoint);const M={panDelta:d,zoomDelta:f,rollDelta:b,pitchDelta:y,bearingDelta:_,around:S};this._map.cameraHelper.useGlobeControls&&!c.isPointOnMapSurface(S)&&(S=c.centerPoint);const C=S.distSqr(c.centerPoint)<.01?c.center:c.screenPointToLocation(d?S.sub(d):S);this._handleMapControls({terrain:u,tr:c,deltasForHelper:M,preZoomAroundLoc:C,combinedEventsInProgress:s,panDelta:d}),l._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,a,!0)}_handleMapControls({terrain:e,tr:s,deltasForHelper:a,preZoomAroundLoc:l,combinedEventsInProgress:c,panDelta:u}){const d=this._map.cameraHelper;if(d.handleMapControlsRollPitchBearingZoom(a,s),e)return d.useGlobeControls?(this._terrainMovement||!c.drag&&!c.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void d.handleMapControlsPan(a,s,l)):this._terrainMovement||!c.drag&&!c.zoom?void(c.drag&&this._terrainMovement&&u?s.setCenter(s.screenPointToLocation(s.centerPoint.sub(u))):d.handleMapControlsPan(a,s,l)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void d.handleMapControlsPan(a,s,l));d.handleMapControlsPan(a,s,l)}_fireEvents(e,s,l){const c=Ws(this._eventsInProgress),u=Ws(e),d={};for(const s in e){const{originalEvent:a}=e[s];this._eventsInProgress[s]||(d[`${s}start`]=a),this._eventsInProgress[s]=e[s]}!c&&u&&this._fireEvent("movestart",u.originalEvent);for(const e in d)this._fireEvent(e,d[e]);u&&this._fireEvent("move",u.originalEvent);for(const s in e){const{originalEvent:a}=e[s];this._fireEvent(s,a)}const f={};let y;for(const e in this._eventsInProgress){const{handlerName:a,originalEvent:l}=this._eventsInProgress[e];this._handlersById[a].isActive()||(delete this._eventsInProgress[e],y=s[a]||l,f[`${e}end`]=y)}for(const e in f)this._fireEvent(e,f[e]);const b=Ws(this._eventsInProgress),S=(c||u)&&!b;if(S&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(l&&S){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),s=e=>0!==e&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Uo("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Go extends a.E{constructor(e,s,a){super(),this._renderFrameCallback=()=>{const e=Math.min((b()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=a.bearingSnap,this.cameraHelper=s,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,s){e.apply(this.transform),this.transform=e,this.cameraHelper=s}getCenter(){return new a.U(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,s){return this.jumpTo({elevation:e},s),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,s,l){return e=a.P.convert(e).mult(-1),this.panTo(this.transform.center,a.e({offset:e},s),l)}panTo(e,s,l){return this.easeTo(a.e({center:e},s),l)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,l){return this.easeTo(a.e({zoom:e},s),l)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,s){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new a.l("movestart",s)).fire(new a.l("move",s)).fire(new a.l("moveend",s))),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,l){return this.easeTo(a.e({bearing:e},s),l)}resetNorth(e,s){return this.rotateTo(0,a.e({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(a.e({bearing:0,pitch:0,roll:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing()){L.easeFunc(a),this.terrain&&!e.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(l),this._fireMoveEvents(s)}),(a=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s,a)}),e),this}_prepareEase(e,s,l={}){this._moving=!0,s||l.moving||this.fire(new a.l("movestart",e)),this._zooming&&!l.zooming&&this.fire(new a.l("zoomstart",e)),this._rotating&&!l.rotating&&this.fire(new a.l("rotatestart",e)),this._pitching&&!l.pitching&&this.fire(new a.l("pitchstart",e)),this._rolling&&!l.rolling&&this.fire(new a.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&s!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(s-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=s}this.transform.setElevation(a.F.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const s=e.getCameraLngLat(),a=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(s,e.zoom):0;if(athis._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&s.push((e=>this.transformCameraUpdate(e))),!s.length)return;const a=e.clone();for(const e of s){const s=a.clone(),{center:l,zoom:c,roll:u,pitch:d,bearing:f,elevation:_}=e(s);l&&s.setCenter(l),void 0!==_&&s.setElevation(_),void 0!==c&&s.setZoom(c),void 0!==u&&s.setRoll(u),void 0!==d&&s.setPitch(d),void 0!==f&&s.setBearing(f),a.apply(s)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new a.l("move",e)),this._zooming&&this.fire(new a.l("zoom",e)),this._rotating&&this.fire(new a.l("rotate",e)),this._pitching&&this.fire(new a.l("pitch",e)),this._rolling&&this.fire(new a.l("roll",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const l=this._zooming,c=this._rotating,u=this._pitching,d=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,l&&this.fire(new a.l("zoomend",e)),c&&this.fire(new a.l("rotateend",e)),u&&this.fire(new a.l("pitchend",e)),d&&this.fire(new a.l("rollend",e)),this.fire(new a.l("moveend",e))}flyTo(e,s){if(!e.essential&&_.prefersReducedMotion){const l=a.S(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(l,s)}this.stop(),e=a.e({offset:[0,0],speed:1.2,curve:1.42,easing:a.cs},e);const l=this._getTransformForUpdate(),c=l.bearing,u=l.pitch,d=l.roll,f=l.padding,y="bearing"in e?this._normalizeBearing(e.bearing,c):c,b="pitch"in e?+e.pitch:u,S="roll"in e?this._normalizeBearing(e.roll,d):d,P="padding"in e?e.padding:l.padding,M=a.P.convert(e.offset);let C=l.centerPoint.add(M);const D=l.screenPointToLocation(C),L=this.cameraHelper.handleFlyTo(l,{bearing:y,pitch:b,roll:S,padding:P,locationAtOffset:D,offsetAsPoint:M,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let F=e.curve;const B=Math.max(l.width,l.height),O=B/L.scaleOfZoom,V=L.pixelPathLength;"number"==typeof L.scaleOfMinZoom&&(F=Math.sqrt(B/L.scaleOfMinZoom/V*2));const N=F*F;function j(e){const s=(O*O-B*B+(e?-1:1)*N*N*V*V)/(2*(e?O:B)*N*V);return Math.log(Math.sqrt(s*s+1)-s)}function G(e){return(Math.exp(e)-Math.exp(-e))/2}function Z(e){return(Math.exp(e)+Math.exp(-e))/2}const q=j(!1);let W=function(e){return Z(q)/Z(q+F*e)},J=function(e){return B*((Z(q)*(G(s=q+F*e)/Z(s))-G(q))/N)/V;var s},Q=(j(!0)-q)/F;if(Math.abs(V)<2e-6||!isFinite(Q)){if(Math.abs(B-O)<1e-6)return this.easeTo(e,s);const a=O0,W=e=>Math.exp(a*F*e)}return e.duration="duration"in e?+e.duration:1e3*Q/("screenSpeed"in e?+e.screenSpeed/F:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=c!==y,this._pitching=b!==u,this._rolling=S!==d,this._padding=!l.isPaddingEqual(P),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(L.targetCenter),this._ease((_=>{const D=_*Q,F=1/W(D),B=J(D);this._rotating&&l.setBearing(a.F.number(c,y,_)),this._pitching&&l.setPitch(a.F.number(u,b,_)),this._rolling&&l.setRoll(a.F.number(d,S,_)),this._padding&&(l.interpolatePadding(f,P,_),C=l.centerPoint.add(M)),L.easeFunc(_,F,B,C),this.terrain&&!e.freezeElevation&&this._updateElevation(_),this._applyUpdatedTransform(l),this._fireMoveEvents(s)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,s)}return e||null===(a=this.handlers)||void 0===a||a.stop(!1),this}_ease(e,s,a){!1===a.animate||0===a.duration?(e(1),s()):(this._easeStart=b(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,s){e=a.V(e,-180,180);const l=Math.abs(e-s);return Math.abs(e-360-s)MapLibre'};class Wo{constructor(e=Xs){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=h.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=h.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=h.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){h.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,s){const a=this._map._getUIString(`AttributionControl.${s}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const s=this._map.style.tileManagers;for(const a in s){const l=s[a];if(l.used||l.usedForTerrain){const s=l.getSource();s.attribution&&e.indexOf(s.attribution)<0&&e.push(s.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,s)=>e.length-s.length)),e=e.filter(((s,a)=>{for(let l=a+1;l=0)return!1;return!0}));const a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=h.sanitize(a),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class qo{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const s=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=h.create("div","maplibregl-ctrl");const s=h.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){h.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class $o{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){const s=this._currentlyRunning,a=s?this._queue.concat(s):this._queue;for(const s of a)if(s.id===e)return void(s.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const a of s)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ys=a.aO([{name:"a_pos3d",type:"Int16",components:3}]);class Xo extends a.E{constructor(e){super(),this._lastTilesetChange=b(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,s){this.tileManager.update(e,s),this._renderableTilesKeys=[];const l={};for(const c of Xe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s,calculateTileZoom:this.tileManager._source.calculateTileZoom}))l[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),a.c1(c.terrainRttPosMatrix32f,0,a.a3,a.a3,0,0,1),this._tiles[c.key]=new de(c,this.tileSize),this._lastTilesetChange=b());for(const e in this._tiles)l[e]||delete this._tiles[e]}freeRtt(e){for(const s in this._tiles){const a=this._tiles[s];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,s){return s?this._getTerrainCoordsForTileRanges(e,s):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const s={};for(const l of this._renderableTilesKeys){const c=this._tiles[l].tileID,u=e.clone(),d=a.be();if(c.canonical.equals(e.canonical))a.c1(d,0,a.a3,a.a3,0,0,1);else if(c.canonical.isChildOf(e.canonical)){const s=c.canonical.z-e.canonical.z,l=c.canonical.x-(c.canonical.x>>s<>s<>s;a.c1(d,0,f,f,0,0,1),a.N(d,d,[-l*f,-u*f,0])}else{if(!e.canonical.isChildOf(c.canonical))continue;{const s=e.canonical.z-c.canonical.z,l=e.canonical.x-(e.canonical.x>>s<>s<>s;a.c1(d,0,a.a3,a.a3,0,0,1),a.N(d,d,[l*f,u*f,0]),a.O(d,d,[1/2**s,1/2**s,0])}}u.terrainRttPosMatrix32f=new Float32Array(d),s[l]=u}return s}_getTerrainCoordsForTileRanges(e,s){const l={};for(const c of this._renderableTilesKeys){const u=this._tiles[c].tileID;if(!this._isWithinTileRanges(u,s))continue;const d=e.clone(),f=a.be();if(u.canonical.z===e.canonical.z){const s=e.canonical.x-u.canonical.x,l=e.canonical.y-u.canonical.y;a.c1(f,0,a.a3,a.a3,0,0,1),a.N(f,f,[s*a.a3,l*a.a3,0])}else if(u.canonical.z>e.canonical.z){const s=u.canonical.z-e.canonical.z,l=u.canonical.x-(u.canonical.x>>s<>s<>s),_=e.canonical.y-(u.canonical.y>>s),y=a.a3>>s;a.c1(f,0,y,y,0,0,1),a.N(f,f,[-l*y+d*a.a3,-c*y+_*a.a3,0])}else{const s=e.canonical.z-u.canonical.z,l=e.canonical.x-(e.canonical.x>>s<>s<>s)-u.canonical.x,_=(e.canonical.y>>s)-u.canonical.y,y=a.a3<a.maxzoom&&(l=a.maxzoom),l=a.minzoom&&(!c||!c.dem);)c=this.tileManager.getTileByID(e.scaledTo(l--).key);return c}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,s){return s[e.canonical.z]&&e.canonical.x>=s[e.canonical.z].minTileX&&e.canonical.x<=s[e.canonical.z].maxTileX&&e.canonical.y>=s[e.canonical.z].minTileY&&e.canonical.y<=s[e.canonical.z].maxTileY}}class Ko{constructor(e,s,a){this._meshCache={},this.painter=e,this.tileManager=new Xo(s),this.options=a,this.exaggeration="number"==typeof a.exaggeration?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,s,l,c=a.a3){var u;if(!(s>=0&&s=0&&le.canonical.z&&(e.canonical.z>=l?c=e.canonical.z-l:a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const u=e.canonical.x-(e.canonical.x>>c<>c<>8<<4|e>>8,s[a+3]=0;const l=new a.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),c=new a.T(e,l,e.gl.RGBA,{premultiply:!1});return c.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const s=new Uint8Array(4),l=this.painter.context,c=l.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),d=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),f=Math.round(this.painter.height/devicePixelRatio);l.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(u,f-d-1,1,1,c.RGBA,c.UNSIGNED_BYTE,s),l.bindFramebuffer.set(null);const _=s[0]+(s[2]>>4<<8),y=s[1]+((15&s[2])<<8),b=this.coordsIndex[255-s[3]],S=b&&this.tileManager.getTileByID(b);if(!S)return null;const P=this._coordsTextureSize,M=(1<0,c=l&&0===e.canonical.y,u=l&&e.canonical.y===(1<e.id!==s)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse))}}const Qs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Jo{constructor(e,s){this.painter=e,this.terrain=s,this.pool=new Yo(e.context,30,s.tileManager.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter((a=>!e._layers[a].isHidden(s))),this._coordsAscending={};for(const s in e.tileManagers){this._coordsAscending[s]={};const a=e.tileManagers[s].getVisibleCoordinates(),l=e.tileManagers[s].getSource(),c=l instanceof te?l.terrainTileRanges:null;for(const e of a){const a=this.terrain.tileManager.getTerrainCoords(e,c);for(const e in a)this._coordsAscending[s][e]||(this._coordsAscending[s][e]=[]),this._coordsAscending[s][e].push(a[e])}}this._coordsAscendingStr={};for(const s of e._order){const a=e._layers[s],l=a.source;if(Qs[a.type]&&!this._coordsAscendingStr[l]){this._coordsAscendingStr[l]={};for(const e in this._coordsAscending[l])this._coordsAscendingStr[l][e]=this._coordsAscending[l][e].map((e=>e.key)).sort().join()}}for(const e of this._renderableTiles)for(const s in this._coordsAscendingStr){const a=this._coordsAscendingStr[s][e.tileID.key];a&&a!==e.rttCoords[s]&&(e.rtt=[])}}renderLayer(e,s){if(e.isHidden(this.painter.transform.zoom))return!1;const l=Object.assign(Object.assign({},s),{isRenderingToTexture:!0}),c=e.type,u=this.painter,d=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Qs[c]&&(this._prevType&&Qs[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(e.id),!d))return!0;if(Qs[this._prevType]||Qs[c]&&d){this._prevType=c;const e=this._stacks.length-1,s=this._stacks[e]||[];for(const c of this._renderableTiles){if(this.pool.isFull()&&(is(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(c),c.rtt[e]){const s=this.pool.getObjectForId(c.rtt[e].id);if(s.stamp===c.rtt[e].stamp){this.pool.useObject(s);continue}}const d=this.pool.getOrCreateFreeObject();this.pool.useObject(d),this.pool.stampObject(d),c.rtt[e]={id:d.id,stamp:d.stamp},u.context.bindFramebuffer.set(d.fbo.framebuffer),u.context.clear({color:a.bj.transparent,stencil:0}),u.currentStencilSource=void 0;for(let e=0;e{this.startMove(e,h.mousePos(this.element,e)),h.addEventListener(window,"mousemove",this.mousemove),h.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,h.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=h.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),h.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),h.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=h.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=s;const c=new mo;this._rotatePitchHandler=new lo({clickTolerance:3,move:(e,c)=>{const u=s.getBoundingClientRect(),d=new a.P((u.bottom-u.top)/2,(u.right-u.left)/2);return{bearingDelta:a.cr(new a.P(e.x,c.y),c,d),pitchDelta:l?-.5*(c.y-e.y):void 0}},moveStateManager:c,enable:!0,assignEvents:()=>{}}),this.map=e,h.addEventListener(s,"mousedown",this.mousedown),h.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),h.addEventListener(s,"touchcancel",this.reset)}startMove(e,s){this._rotatePitchHandler.dragStart(e,s),h.disableDrag()}move(e,s){const a=this.map,{bearingDelta:l,pitchDelta:c}=this._rotatePitchHandler.dragMove(e,s)||{};l&&a.setBearing(a.getBearing()+l),c&&a.setPitch(a.getPitch()+c)}off(){const e=this.element;h.removeEventListener(e,"mousedown",this.mousedown),h.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),h.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),h.removeEventListener(window,"touchend",this.touchend),h.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){h.enableDrag(),h.removeEventListener(window,"mousemove",this.mousemove),h.removeEventListener(window,"mouseup",this.mouseup),h.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),h.removeEventListener(window,"touchend",this.touchend)}}let bo;function wo(e,s,l,c=!1){if(c||!l.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const u=new a.U(e.lng,e.lat);if(e=new a.U(e.lng,e.lat),s){const c=new a.U(e.lng-360,e.lat),u=new a.U(e.lng+360,e.lat),d=l.locationToScreenPoint(e).distSqr(s);l.locationToScreenPoint(c).distSqr(s)180;){const s=l.locationToScreenPoint(e);if(s.x>=0&&s.y>=0&&s.x<=l.width&&s.y<=l.height)break;e.lng>l.center.lng?e.lng-=360:e.lng+=360}return e.lng!==u.lng&&l.isPointOnMapSurface(l.locationToScreenPoint(e))?e:u}const Po={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 Co(e,s,a){const l=e.classList;for(const e in Po)l.remove(`maplibregl-${a}-anchor-${e}`);l.add(`maplibregl-${a}-anchor-${s}`)}class cs extends a.E{constructor(e){if(super(),this._onKeyPress=e=>{const s=e.code,a=e.charCode||e.keyCode;"Space"!==s&&"Enter"!==s&&32!==a&&13!==a||this.togglePopup()},this._onMapClick=e=>{const s=e.originalEvent.target,a=this._element;this._popup&&(s===a||a.contains(s))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!s)&&this._map.once("render",this._update),this._lngLat=wo(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let a="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?a=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(a=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let l="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?l="rotateX(0deg)":"map"===this._pitchAlignment&&(l=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),h.setTransform(this._element,`${Po[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${l} ${a}`),_.frameAsync(new AbortController).then((()=>{this._updateOpacity(e&&"moveend"===e.type)})).catch((()=>{}))},this._onMove=e=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=s}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 a.l("dragstart"))),this.fire(new a.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new a.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&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._subpixelPositioning=e&&e.subpixelPositioning||!1,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,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=a.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=h.create("div");const s=h.createNS("http://www.w3.org/2000/svg","svg"),l=41,c=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${l}px`),s.setAttributeNS(null,"width",`${c}px`),s.setAttributeNS(null,"viewBox",`0 0 ${c} ${l}`);const u=h.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");const d=h.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"fill-rule","nonzero");const f=h.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(3.0, 29.0)"),f.setAttributeNS(null,"fill","#000000");const _=[{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 e of _){const s=h.createNS("http://www.w3.org/2000/svg","ellipse");s.setAttributeNS(null,"opacity","0.04"),s.setAttributeNS(null,"cx","10.5"),s.setAttributeNS(null,"cy","5.80029008"),s.setAttributeNS(null,"rx",e.rx),s.setAttributeNS(null,"ry",e.ry),f.appendChild(s)}const y=h.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill",this._color);const b=h.createNS("http://www.w3.org/2000/svg","path");b.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"),y.appendChild(b);const S=h.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const P=h.createNS("http://www.w3.org/2000/svg","path");P.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"),S.appendChild(P);const M=h.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(6.0, 7.0)"),M.setAttributeNS(null,"fill","#FFFFFF");const C=h.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(8.0, 8.0)");const D=h.createNS("http://www.w3.org/2000/svg","circle");D.setAttributeNS(null,"fill","#000000"),D.setAttributeNS(null,"opacity","0.25"),D.setAttributeNS(null,"cx","5.5"),D.setAttributeNS(null,"cy","5.5"),D.setAttributeNS(null,"r","5.4999962");const L=h.createNS("http://www.w3.org/2000/svg","circle");L.setAttributeNS(null,"fill","#FFFFFF"),L.setAttributeNS(null,"cx","5.5"),L.setAttributeNS(null,"cy","5.5"),L.setAttributeNS(null,"r","5.4999962"),C.appendChild(D),C.appendChild(L),d.appendChild(f),d.appendChild(y),d.appendChild(S),d.appendChild(M),d.appendChild(C),s.appendChild(d),s.setAttributeNS(null,"height",l*this._scale+"px"),s.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(s),this._offset=a.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),Co(this._element,this._anchor,"marker"),e&&e.className)for(const s of e.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),h.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=a.U.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const s=38.1,a=13.5,l=Math.abs(a)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-s],"bottom-left":[l,-1*(s-a+l)],"bottom-right":[-l,-1*(s-a+l)],left:[a,-1*(s-a)],right:[-a,-1*(s-a)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var s,l;const c=null===(s=this._map)||void 0===s?void 0:s.terrain,u=this._map.transform.isLocationOccluded(this._lngLat);if(!c||u){const e=u?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const d=this._map,f=d.terrain.depthAtPoint(this._pos),_=d.terrain.getElevationForLngLatZoom(this._lngLat,d.transform.tileZoom);if(d.transform.lngLatToCameraDepth(this._lngLat,_)-f<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/d.transform.pixelsPerMeter,b=Math.sin(d.getPitch()*Math.PI/180)*y,S=d.terrain.depthAtPoint(new a.P(this._pos.x,this._pos.y-this._offset.y)),P=d.transform.lngLatToCameraDepth(this._lngLat,_+b)-S>.006;(null===(l=this._popup)||void 0===l?void 0:l.isOpen())&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=a.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,s){return(void 0===this._opacity||void 0===e&&void 0===s)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==s&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const Vo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let No=0,jo=!1;const Ho={maxWidth:100,unit:"metric"};function Qo(e,s,a){const l=a&&a.maxWidth||100,c=e._container.clientHeight/2,u=e._container.clientWidth/2,d=e.unproject([u-l/2,c]),f=e.unproject([u+l/2,c]),_=Math.round(e.project(f).x-e.project(d).x),y=Math.min(l,_,e._container.clientWidth),b=d.distanceTo(f);if(a&&"imperial"===a.unit){const a=3.2808*b;a>5280?Ja(s,y,a/5280,e._getUIString("ScaleControl.Miles")):Ja(s,y,a,e._getUIString("ScaleControl.Feet"))}else a&&"nautical"===a.unit?Ja(s,y,b/1852,e._getUIString("ScaleControl.NauticalMiles")):b>=1e3?Ja(s,y,b/1e3,e._getUIString("ScaleControl.Kilometers")):Ja(s,y,b,e._getUIString("ScaleControl.Meters"))}function Ja(e,s,a,l){const c=function(e){const s=Math.pow(10,`${Math.floor(e)}`.length-1);let a=e/s;return a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(e){const s=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*s)/s}(a),s*a}(a);e.style.width=s*(c/a)+"px",e.innerHTML=`${c} ${l}`}const el={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},tl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function il(e){if(e){if("number"==typeof e){const s=Math.round(Math.abs(e)/Math.SQRT2);return{center:new a.P(0,0),top:new a.P(0,e),"top-left":new a.P(s,s),"top-right":new a.P(-s,s),bottom:new a.P(0,-e),"bottom-left":new a.P(s,-s),"bottom-right":new a.P(-s,-s),left:new a.P(e,0),right:new a.P(-e,0)}}if(e instanceof a.P||Array.isArray(e)){const s=a.P.convert(e);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:a.P.convert(e.center||[0,0]),top:a.P.convert(e.top||[0,0]),"top-left":a.P.convert(e["top-left"]||[0,0]),"top-right":a.P.convert(e["top-right"]||[0,0]),bottom:a.P.convert(e.bottom||[0,0]),"bottom-left":a.P.convert(e["bottom-left"]||[0,0]),"bottom-right":a.P.convert(e["bottom-right"]||[0,0]),left:a.P.convert(e.left||[0,0]),right:a.P.convert(e.right||[0,0])}}return il(new a.P(0,0))}const rl=l;s.AJAXError=a.cD,s.Event=a.l,s.Evented=a.E,s.LngLat=a.U,s.MercatorCoordinate=a.a5,s.Point=a.P,s.addProtocol=a.cE,s.config=a.a,s.removeProtocol=a.cF,s.AttributionControl=Wo,s.BoxZoomHandler=ao,s.CanvasSource=ae,s.CooperativeGesturesHandler=Oo,s.DoubleClickZoomHandler=zo,s.DragPanHandler=ko,s.DragRotateHandler=Fo,s.EdgeInsets=Lt,s.FullscreenControl=class extends a.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==s?void 0:s.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:a.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=h.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){h.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=h.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);h.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new a.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new a.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},s.GeoJSONSource=ee,s.GeolocateControl=class extends a.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new a.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new a.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const s=new a.U(e.coords.longitude,e.coords.latitude),l=e.coords.accuracy,c=this._map.getBearing(),u=a.e({bearing:c},this.options.fitBoundsOptions),d=$.fromLngLat(s,l);this._map.fitBounds(d,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const s=new a.U(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&jo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new a.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=h.create("button","maplibregl-ctrl-geolocate",this._container),h.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){a.w("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 e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=h.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new cs({element:this._dotElement}),this._circleElement=h.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new cs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{const s=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||s||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new a.l("trackuserlocationend")),this.fire(new a.l("userlocationlostfocus")))}))}},this.options=a.e({},Vo,e)}onAdd(e){return this._map=e,this._container=h.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return a._(this,arguments,void 0,(function*(e=!1){if(void 0!==bo&&!e)return bo;if(void 0===window.navigator.permissions)return bo=!!window.navigator.geolocation,bo;try{const e=yield window.navigator.permissions.query({name:"geolocation"});bo="denied"!==e.state}catch(e){bo=!!window.navigator.geolocation}return bo}))}().then((e=>this._finishSetupUI(e))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),h.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,No=0,jo=!1}_isOutOfMapMaxBounds(e){const s=this._map.getMaxBounds(),a=e.coords;return s&&(a.longitudes.getEast()||a.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;const s=this._map.project(e),a=this._map.unproject([s.x+100,s.y]),l=e.distanceTo(a)/100,c=2*this._accuracy/l;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}px`}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":No--,jo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new a.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.l("trackuserlocationstart")),this.fire(new a.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),No++,No>1?(e={maximumAge:6e5,timeout:0},jo=!0):(e=this.options.positionOptions,jo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},s.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const s=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==s&&s?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=h.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=h.create("button","maplibregl-ctrl-globe",this._container),h.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){h.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},s.Hash=Nr,s.ImageSource=te,s.KeyboardHandler=Io,s.LngLatBounds=$,s.LogoControl=qo,s.Map=class extends Go{constructor(e){var s,l;a.cA.mark(a.cB.create);const c=Object.assign(Object.assign(Object.assign({},uo),e),{canvasContextAttributes:Object.assign(Object.assign({},uo.canvasContextAttributes),e.canvasContextAttributes)});if(null!=c.minZoom&&null!=c.maxZoom&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=c.minPitch&&null!=c.maxPitch&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=c.minPitch&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=c.maxPitch&&c.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const u=new Nt,d=new Wt;if(void 0!==c.minZoom&&u.setMinZoom(c.minZoom),void 0!==c.maxZoom&&u.setMaxZoom(c.maxZoom),void 0!==c.minPitch&&u.setMinPitch(c.minPitch),void 0!==c.maxPitch&&u.setMaxPitch(c.maxPitch),void 0!==c.renderWorldCopies&&u.setRenderWorldCopies(c.renderWorldCopies),null!==c.transformConstrain&&u.setConstrainOverride(c.transformConstrain),super(u,d,{bearingSnap:c.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new $o,this._controls=[],this._mapId=a.ab(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(const[s]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${s}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new a.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._setupPainter(),this.resize(),this._update(),this.fire(new a.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},c.canvasContextAttributes),this._trackResize=!0===c.trackResize,this._bearingSnap=c.bearingSnap,this._centerClampedToGround=c.centerClampedToGround,this._refreshExpiredTiles=!0===c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=!0===c.crossSourceCollisions,this._collectResourceTiming=!0===c.collectResourceTiming,this._locale=Object.assign(Object.assign({},ro),c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this._zoomLevelsToOverscale=c.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=c.transformCameraUpdate,this.transformConstrain=c.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===c.cancelPendingTileRequestsWhileZooming,void 0!==c.reduceMotion&&(_.prefersReducedMotion=c.reduceMotion),this._imageQueueHandle=F.addThrottleControl((()=>this.isMoving())),this._requestManager=new v(c.transformRequest),"string"==typeof c.container){if(this._container=document.getElementById(c.container),!this._container)throw new Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(c.maxBounds&&this.setMaxBounds(c.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let e=!1;const s=ss((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50);this._resizeObserver=new ResizeObserver((a=>{e?s(a):e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Zo(this,c),this._hash=c.hash&&new Nr("string"==typeof c.hash&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,elevation:c.elevation,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,roll:c.roll}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,a.e({},c.fitBoundsOptions,{duration:0}))));const f="string"==typeof c.style||!("globe"===(null===(l=null===(s=c.style)||void 0===s?void 0:s.projection)||void 0===l?void 0:l.type));this.resize(null,f),this._localIdeographFontFamily=c.localIdeographFontFamily,this._validateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new Wo("boolean"==typeof c.attributionControl?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new qo,c.logoPosition),this.on("style.load",(()=>{if(f||this._resizeTransform(),this.transform.unmodified){const e=a.S(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new a.l(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new a.l(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new a.l("sourcedataabort",e))}))}_getMapId(){return this._mapId}setGlobalStateProperty(e,s){return this.style.setGlobalStateProperty(e,s),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,s){if(void 0===s&&(s=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new a.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const l=e.onAdd(this);this._controls.push(e);const c=this._controlPositions[s];return-1!==s.indexOf("bottom")?c.insertBefore(l,c.firstChild):c.appendChild(l),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new a.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(e);return s>-1&&this._controls.splice(s,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}coveringTiles(e){return Xe(this.transform,e)}calculateCameraOptionsFromTo(e,s,a,l){return null==l&&this.terrain&&(l=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,s,a,l)}resize(e,s=!0){const[l,c]=this._containerDimensions(),u=this._getClampedPixelRatio(l,c);if(this._resizeCanvas(l,c,u),this.painter.resize(l,c,u),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const s=this._getClampedPixelRatio(l,c);this._resizeCanvas(l,c,s),this.painter.resize(l,c,s)}this._resizeTransform(s);const d=!this._moving;return d&&(this.stop(),this.fire(new a.l("movestart",e)).fire(new a.l("move",e))),this.fire(new a.l("resize",e)),d&&this.fire(new a.l("moveend",e)),this}_resizeTransform(e=!0){var s;const[a,l]=this._containerDimensions();this.transform.resize(a,l,e),null===(s=this._requestedCameraState)||void 0===s||s.resize(a,l,e)}_getClampedPixelRatio(e,s){const{0:a,1:l}=this._maxCanvasSize,c=this.getPixelRatio(),u=e*c,d=s*c;return Math.min(u>a?a/u:1,d>l?l/d:1)*c}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds($.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(a.U.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(a.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,s,a){if("mouseenter"===e||"mouseover"===e){let l=!1;const c=c=>{const u=s.filter((e=>this.getLayer(e))),d=0!==u.length?this.queryRenderedFeatures(c.point,{layers:u}):[];d.length?l||(l=!0,a.call(this,new Yr(e,this,c.originalEvent,{features:d}))):l=!1};return{layers:s,listener:a,delegates:{mousemove:c,mouseout:()=>{l=!1}}}}if("mouseleave"===e||"mouseout"===e){let l=!1;const c=c=>{const u=s.filter((e=>this.getLayer(e)));(0!==u.length?this.queryRenderedFeatures(c.point,{layers:u}):[]).length?l=!0:l&&(l=!1,a.call(this,new Yr(e,this,c.originalEvent)))},u=s=>{l&&(l=!1,a.call(this,new Yr(e,this,s.originalEvent)))};return{layers:s,listener:a,delegates:{mousemove:c,mouseout:u}}}{const l=e=>{const l=s.filter((e=>this.getLayer(e))),c=0!==l.length?this.queryRenderedFeatures(e.point,{layers:l}):[];c.length&&(e.features=c,a.call(this,e),delete e.features)};return{layers:s,listener:a,delegates:{[e]:l}}}}_saveDelegatedListener(e,s){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(s)}_removeDelegatedListener(e,s,a){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const l=this._delegatedListeners[e];for(let e=0;es.includes(e)))){for(const e in c.delegates)this.off(e,c.delegates[e]);return void l.splice(e,1)}}}on(e,s,a){if(void 0===a)return super.on(e,s);const l="string"==typeof s?[s]:s,c=this._createDelegatedListener(e,l,a);this._saveDelegatedListener(e,c);for(const e in c.delegates)this.on(e,c.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,l,a)}}}once(e,s,a){if(void 0===a)return super.once(e,s);const l="string"==typeof s?[s]:s,c=this._createDelegatedListener(e,l,a);for(const s in c.delegates){const u=c.delegates[s];c.delegates[s]=(...s)=>{this._removeDelegatedListener(e,l,a),u(...s)}}this._saveDelegatedListener(e,c);for(const e in c.delegates)this.once(e,c.delegates[e]);return this}off(e,s,a){return void 0===a?super.off(e,s):(this._removeDelegatedListener(e,"string"==typeof s?[s]:s,a),this)}queryRenderedFeatures(e,s){if(!this.style)return[];let l;const c=e instanceof a.P||Array.isArray(e),u=c?e:[[0,0],[this.transform.width,this.transform.height]];if(s=s||(c?{}:e)||{},u instanceof a.P||"number"==typeof u[0])l=[a.P.convert(u)];else{const e=a.P.convert(u[0]),s=a.P.convert(u[1]);l=[e,new a.P(s.x,e.y),s,new a.P(e.x,s.y),e]}return this.style.queryRenderedFeatures(l,s,this.transform)}querySourceFeatures(e,s){return this.style.querySourceFeatures(e,s)}setStyle(e,s){return!1!==(s=a.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},s)).diff&&s.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,s),this):(this._localIdeographFontFamily=s.localIdeographFontFamily,this._updateStyle(e,s))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const s=this._locale[e];if(null==s)throw new Error(`Missing UI string '${e}'`);return s}_updateStyle(e,s){var a,l;if(s.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,s)));const c=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Si(this,s||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,s,c):this.style.loadJSON(e,s,c),this):(null===(l=null===(a=this.style)||void 0===a?void 0:a.projection)||void 0===l||l.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Si(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,s){if("string"==typeof e){const l=this._requestManager.transformRequest(e,"Style");a.j(l,new AbortController).then((e=>{this._updateDiff(e.data,s)})).catch((e=>{e&&this.fire(new a.k(e))}))}else"object"==typeof e&&this._updateDiff(e,s)}_updateDiff(e,s){try{this.style.setState(e,s)&&this._update(!0)}catch(l){a.w(`Unable to perform style diff: ${l.message||l.error||l}. Rebuilding the style from scratch.`),this._updateStyle(e,s)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():a.w("There is no style added to the map.")}addSource(e,s){return this._lazyInitEmptyStyle(),this.style.addSource(e,s),this._update(!0)}isSourceLoaded(e){const s=this.style&&this.style.tileManagers[e];if(void 0!==s)return s.loaded();this.fire(new a.k(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const s=this.style.tileManagers[e.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&s.reload();for(const s in this.style._layers){const l=this.style._layers[s];"hillshade"===l.type&&l.source===e.source&&a.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===l.type&&l.source===e.source&&a.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Ko(this.painter,s,e),this.painter.renderToTexture=new Jo(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=s=>{var a;"style"===s.dataType?this.terrain.tileManager.freeRtt():"source"===s.dataType&&s.tile&&(s.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(a=s.source)||void 0===a?void 0:a.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new a.l("terrain",{terrain:e})),this}getTerrain(){var e,s;return null!==(s=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==s?s:null}areTilesLoaded(){const e=this.style&&this.style.tileManagers;for(const s in e){const a=e[s]._tiles;for(const e in a){const s=a[e];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,s,a){if(a){const l=this.getSource(a);if(!l)throw new Error(`There is no source with ID "${a}", cannot set LOD parameters`);l.calculateTileZoom=$e(Math.max(1,e),Math.max(1,s))}else for(const a in this.style.tileManagers)this.style.tileManagers[a].getSource().calculateTileZoom=$e(Math.max(1,e),Math.max(1,s));return this._update(!0),this}refreshTiles(e,s){const l=this.style.tileManagers[e];if(!l)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===s?l.reload(!0):l.refreshTiles(s.map((e=>new a.a8(e.z,e.x,e.y))))}addImage(e,s,l={}){const{pixelRatio:c=1,sdf:u=!1,stretchX:d,stretchY:f,content:y,textFitWidth:b,textFitHeight:S}=l;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||a.b(s))){if(void 0===s.width||void 0===s.height)return this.fire(new a.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:_,data:P}=s,M=s;return this.style.addImage(e,{data:new a.R({width:l,height:_},new Uint8Array(P)),pixelRatio:c,stretchX:d,stretchY:f,content:y,textFitWidth:b,textFitHeight:S,sdf:u,version:0,userImage:M}),M.onAdd&&M.onAdd(this,e),this}}{const{width:l,height:P,data:M}=_.getImageData(s);this.style.addImage(e,{data:new a.R({width:l,height:P},M),pixelRatio:c,stretchX:d,stretchY:f,content:y,textFitWidth:b,textFitHeight:S,sdf:u,version:0})}}updateImage(e,s){const l=this.style.getImage(e);if(!l)return this.fire(new a.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const c=s instanceof HTMLImageElement||a.b(s)?_.getImageData(s):s,{width:u,height:d,data:f}=c;if(void 0===u||void 0===d)return this.fire(new a.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(u!==l.data.width||d!==l.data.height)return this.fire(new a.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(s instanceof HTMLImageElement||a.b(s));return l.data.replace(f,y),this.style.updateImage(e,l),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new a.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return F.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,s){return this._lazyInitEmptyStyle(),this.style.addLayer(e,s),this._update(!0)}moveLayer(e,s){return this.style.moveLayer(e,s),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,s,a){return this.style.setLayerZoomRange(e,s,a),this._update(!0)}setFilter(e,s,a={}){return this.style.setFilter(e,s,a),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,s,a,l={}){return this.style.setPaintProperty(e,s,a,l),this._update(!0)}getPaintProperty(e,s){return this.style.getPaintProperty(e,s)}setLayoutProperty(e,s,a,l={}){return this.style.setLayoutProperty(e,s,a,l),this._update(!0)}getLayoutProperty(e,s){return this.style.getLayoutProperty(e,s)}setGlyphs(e,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,s,a={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,s,a,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,s,(e=>{e||this._update(!0)})),this}setLight(e,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,s),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,s={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,s),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,s){return this.style.setFeatureState(e,s),this._update()}removeFeatureState(e,s){return this.style.removeFeatureState(e,s),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,s=0;return this._container&&(e=this._container.clientWidth||400,s=this._container.clientHeight||300),[e,s]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const s=this._canvasContainer=h.create("div","maplibregl-canvas-container",e);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=h.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const a=this._containerDimensions(),l=this._getClampedPixelRatio(a[0],a[1]);this._resizeCanvas(a[0],a[1],l);const c=this._controlContainer=h.create("div","maplibregl-control-container",e),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{u[e]=h.create("div",`maplibregl-ctrl-${e} `,c)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,s,a){this._canvas.width=Math.floor(a*e),this._canvas.height=Math.floor(a*s),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let s=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{s={requestedAttributes:e},a&&(s.statusMessage=a.statusMessage,s.type=a.type)}),{once:!0});let a=null;if(a=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!a){const e="Failed to initialize WebGL";throw s?(s.message=e,new Error(JSON.stringify(s))):new Error(e)}this.painter=new jr(a,this.transform),S.testSupport(a)}migrateProjection(e,s){super.migrateProjection(e,s),this.painter.transform=e,this.fire(new a.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var s,l,c,u,d;const f=this._idleTriggered?this._fadeDuration:0,_=(null===(s=this.style.projection)||void 0===s?void 0:s.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let y=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,s=b();this.style.zoomHistory.update(e,s);const l=new a.G(e,{now:s,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=l.crossFadingFactor();1===c&&c===this._crossFadingFactor||(y=!0,this._crossFadingFactor=c),this.style.update(l)}const S=(null===(l=this.style.projection)||void 0===l?void 0:l.transitionState)>0!==_;null===(c=this.style.projection)||void 0===c||c.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(u=this.style.projection)||void 0===u?void 0:u.transitionState,null===(d=this.style.projection)||void 0===d?void 0:d.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||S)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,S),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new a.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.cA.mark(a.cB.load),this.fire(new a.l("load"))),this.style&&(this.style.hasTransitions()||y)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,a.cA.mark(a.cB.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),F.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==s?void 0:s.loseContext)&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),h.remove(this._canvasContainer),h.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),a.cA.clearMetrics(),this._removed=!0,this.fire(new a.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,_.frame(this._frameRequest,(e=>{a.cA.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!a.cC(e)&&!function(e){return e.message===gn}(e))throw e}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return co}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},s.MapMouseEvent=Yr,s.MapTouchEvent=Qr,s.MapWheelEvent=Jr,s.Marker=cs,s.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),s=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,s)=>{const a=this._map._getUIString(`NavigationControl.${s}`);e.title=a,e.setAttribute("aria-label",a)},this.options=a.e({},fo,e),this._container=h.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),h.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),h.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=h.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new rs(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){h.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,s){const a=h.create("button",e,this._container);return a.type="button",a.addEventListener("click",s),a}},s.Popup=class extends a.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&h.remove(this._content),this._container&&(h.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new a.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=h.create("div","maplibregl-popup",this._map.getContainer()),this._tip=h.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=wo(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const s=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor;const l=il(this.options.offset);if(!a){const e=this._container.offsetWidth,c=this._container.offsetHeight;let u;u=s.y+l.bottom.ythis._map.transform.height-c?["bottom"]:[],s.xthis._map.transform.width-e/2&&u.push("right"),a=0===u.length?"bottom":u.join("-")}let c=s.add(l[a]);this.options.subpixelPositioning||(c=c.round()),h.setTransform(this._container,`${Po[a]} translate(${c.x}px,${c.y}px)`),Co(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=a.e(Object.create(el),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new a.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=a.U.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const s=document.createDocumentFragment(),a=document.createElement("body");let l;for(a.innerHTML=e;l=a.firstChild,l;)s.appendChild(l);return this.setDOMContent(s)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=h.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=h.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(tl);e&&e.focus()}},s.RasterDEMTileSource=Y,s.RasterTileSource=K,s.ScaleControl=class{constructor(e){this._onMove=()=>{Qo(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Qo(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ho),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=h.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){h.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},s.ScrollZoomHandler=Do,s.Style=Si,s.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=h.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=h.create("button","maplibregl-ctrl-terrain",this._container),h.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){h.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},s.TwoFingersTouchPitchHandler=Mo,s.TwoFingersTouchRotateHandler=To,s.TwoFingersTouchZoomHandler=yo,s.TwoFingersTouchZoomRotateHandler=Bo,s.VectorTileSource=X,s.VideoSource=ie,s.addSourceType=(e,s)=>a._(void 0,void 0,void 0,(function*(){if(Ee(e))throw new Error(`A source type called "${e}" already exists.`);((e,s)=>{Me[e]=s})(e,s)})),s.clearPrewarmedResources=function(){const e=se;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(J),se=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()"))},s.createTileMesh=Hi,s.getMaxParallelImageRequests=function(){return a.a.MAX_PARALLEL_IMAGE_REQUESTS},s.getRTLTextPluginStatus=function(){return ke().getRTLTextPluginStatus()},s.getVersion=function(){return rl},s.getWorkerCount=function(){return k.workerCount},s.getWorkerUrl=function(){return a.a.WORKER_URL},s.importScriptInWorkers=function(e){return pe().broadcast("IS",e)},s.isTimeFrozen=function(){return y.isFrozen()},s.now=b,s.prewarm=function(){ce().acquire(J)},s.restoreNow=function(){y.restoreNow()},s.setMaxParallelImageRequests=function(e){a.a.MAX_PARALLEL_IMAGE_REQUESTS=e},s.setNow=function(e){y.setNow(e)},s.setRTLTextPlugin=function(e,s){return ke().setRTLTextPlugin(e,s)},s.setWorkerCount=function(e){k.workerCount=e},s.setWorkerUrl=function(e){a.a.WORKER_URL=e}}));var c=s;return c}));var a=s;export{a as default}; +