diff --git a/assets/shiny-example.gif b/assets/shiny-example.gif new file mode 100644 index 00000000..053b3578 Binary files /dev/null and b/assets/shiny-example.gif differ diff --git a/docs/ecosystem/geoarrow.md b/docs/ecosystem/geoarrow.md new file mode 100644 index 00000000..632e0350 --- /dev/null +++ b/docs/ecosystem/geoarrow.md @@ -0,0 +1,24 @@ +# GeoArrow + +[GeoArrow](https://geoarrow.org/) is an in-memory data structure for storing vector geospatial data and associated attributes. Lonboard uses GeoArrow internally and is the [primary reason why Lonboard is fast](../how-it-works.md#how-is-it-so-fast). + +There's a burgeoning ecosystem of Python libraries that use GeoArrow internally. Creating Lonboard `Layer` objects from GeoArrow tables is the fastest way to visualize data, as no conversions are needed on the Python side. + +## geoarrow-rust + +[geoarrow-rust](https://geoarrow.org/geoarrow-rs/python/latest/) is a Python library implementing the GeoArrow specification with efficient spatial operations. This library has "rust" in the name because it is implemented based on the [GeoArrow Rust implementation](https://geoarrow.org/geoarrow-rs/). + +```py +from geoarrow.rust.core import GeoTable, read_geojson +from lonboard import Map, PathLayer + +path = "/path/to/file.geojson" +geo_table = read_geojson(path) + +# Assuming the GeoJSON contains LineString or MultiLineString data +layer = PathLayer(table=geo_table) +m = Map(layer) +m +``` + +Refer to the [geoarrow-rust](https://geoarrow.org/geoarrow-rs/python/latest/) documentation for more information. diff --git a/docs/ecosystem/geopandas.md b/docs/ecosystem/geopandas.md new file mode 100644 index 00000000..90a8137b --- /dev/null +++ b/docs/ecosystem/geopandas.md @@ -0,0 +1,23 @@ +# GeoPandas + +[GeoPandas](https://geopandas.org/en/stable/) extends the Pandas data frame library to allow spatial operations on geospatial data. + +All relevant Lonboard layer classes have a [`from_geopandas`](../api/layers/base-layer.md#lonboard.BaseArrowLayer.from_geopandas) method for `GeoDataFrame` input. + +Some layer types, such as [`BitmapLayer`](../api/layers/bitmap-layer.md), don't have a `from_geopandas` method because the rendering isn't relevant to GeoPandas (i.e. GeoPandas doesn't store image data). + +## Example + +```py +import geodatasets +import geopandas as gpd +from lonboard import Map, SolidPolygonLayer + +# New York City boroughs +gdf = gpd.read_file(geodatasets.get_path('nybb')) +layer = SolidPolygonLayer.from_geopandas( + gdf, + get_fill_color=[255, 0, 0], +) +m = Map(layer) +``` diff --git a/docs/ecosystem/index.md b/docs/ecosystem/index.md new file mode 100644 index 00000000..def37038 --- /dev/null +++ b/docs/ecosystem/index.md @@ -0,0 +1,5 @@ +# Ecosystem + +Lonboard aims to both integrate closely in the existing Python geospatial ecosystem and be future proof for the next generation of Python geospatial libraries. + +The pages in this section outline various integrations. If there's a library you think Lonboard should integrate with or you want to document existing compatibility, [create an issue](https://github.com/developmentseed/lonboard/issues/new) to discuss. diff --git a/docs/ecosystem/jupyter-widgets.md b/docs/ecosystem/jupyter-widgets.md new file mode 100644 index 00000000..9bf4dc18 --- /dev/null +++ b/docs/ecosystem/jupyter-widgets.md @@ -0,0 +1,5 @@ +# Jupyter Widgets + +[Jupyter Widgets](https://ipywidgets.readthedocs.io/en/stable/) are interactive browser controls for Jupyter notebooks. While Lonboard's classes are themselves widgets, Jupyter Widgets' design means that widgets integrate with other widgets seamlessly. + +For example, the `ipywidgets` Python library [includes many core widgets](https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20List.html) like sliders, dropdowns, color pickers, and file upload elements. Then you can [_link widgets together_](https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Events.html#linking-widgets). This means that your widget-based slider or chart can create events that change the display of a Lonboard map based on user input events. diff --git a/docs/ecosystem/panel.md b/docs/ecosystem/panel.md new file mode 100644 index 00000000..e5d86ad0 --- /dev/null +++ b/docs/ecosystem/panel.md @@ -0,0 +1,108 @@ +# Panel + +[Panel](https://panel.holoviz.org/) is a tool to build interactive web applications and dashboards using Python code. + +Panel [has been reported to work](https://github.com/developmentseed/lonboard/issues/262) with Lonboard. However, it appears that Panel [does not support reactive updates](https://github.com/holoviz/panel/issues/5921) in the same way that [Shiny](./shiny) does, so the map will necessarily be recreated from scratch on every update. + +## Example + +This example was written by [@MarcSkovMadsen](https://github.com/MarcSkovMadsen) in [issue #262](https://github.com/developmentseed/lonboard/issues/262). + +```py +"""Panel data app based on https://developmentseed.org/lonboard/latest/examples/north-america-roads/""" +# pip install panel colorcet ipywidgets_bokeh geopandas palettable lonboard +import colorcet as cc +import geopandas as gpd + +from lonboard import Map, PathLayer +from lonboard.colormap import apply_continuous_cmap +from palettable.palette import Palette + +import panel as pn + +url = "https://naciscdn.org/naturalearth/10m/cultural/ne_10m_roads_north_america.zip" +path = "ne_10m_roads_north_america.zip" + +try: + gdf = pn.state.as_cached( + "ne_10m_roads_north_america", gpd.read_file, filename=path, engine="pyogrio" + ) +except: + gdf = pn.state.as_cached( + "ne_10m_roads_north_america", gpd.read_file, filename=url, engine="pyogrio" + ) + +state_options = sorted(state for state in gdf["state"].unique() if state) + + +def to_rgb(hex: str) -> list: + h = hex.strip("#") + return list(int(h[i : i + 2], 16) for i in (0, 2, 4)) + + +def to_palette(cmap) -> Palette: + """Returns the ColorCet colormap as a palettable Palette""" + colors = [to_rgb(item) for item in cmap] + return Palette(name="colorcet", map_type="colorcet", colors=colors) + + +def create_map(state="California", cmap=cc.fire, alpha=0.8): + palette = to_palette(cmap) + data = gdf[gdf["state"] == state] + layer = PathLayer.from_geopandas(data, width_min_pixels=0.8) + normalized_scale_rank = (data["scalerank"] - 3) / 9 + layer.get_color = apply_continuous_cmap(normalized_scale_rank, palette, alpha=alpha) + map_ = Map(layers=[layer], _height=650) + return map_ + + +description = """# lonboard + +A Python library for **fast, interactive geospatial vector data visualization** in Jupyter (and Panel). + +By utilizing new technologies like `GeoArrow` and `GeoParquet` in conjunction with GPU-based map rendering, lonboard aims to enable visualizing large geospatial datasets interactively through a simple interface.""" + + +# THE PANEL APP +pn.extension("ipywidgets") +state = pn.widgets.Select( + value="California", + options=state_options, + width=150, + name="State", + sizing_mode="stretch_width", +) +cmap = pn.widgets.ColorMap( + value=cc.fire, + options=cc.palette, + ncols=3, + swatch_width=100, + name="cmap by Colorcet", + sizing_mode="stretch_width", +) +alpha = pn.widgets.FloatSlider( + value=0.8, start=0, end=1, name="Alpha", min_width=100, sizing_mode="stretch_width" +) +logo = pn.pane.Image( + "https://github.com/developmentseed/lonboard/raw/main/assets/dalle-lonboard.jpg" +) +def title(state): + return f"# North America Roads: {state}" + +settings = pn.Column(state, cmap, alpha) +description = pn.Column(pn.pane.Markdown(description, margin=5), logo) +component = pn.Column( + pn.bind(title, state=state), + pn.panel( + pn.bind(create_map, state=state, cmap=cmap, alpha=alpha.param.value_throttled), + sizing_mode="stretch_both", + ), + sizing_mode="stretch_both", +) +pn.template.FastListTemplate( + logo="https://panel.holoviz.org/_static/logo_horizontal_dark_theme.png", + title="Works with LonBoard", + main=[component], + sidebar=[description, settings], +).servable() +``` diff --git a/docs/ecosystem/shiny.md b/docs/ecosystem/shiny.md new file mode 100644 index 00000000..ab5ee204 --- /dev/null +++ b/docs/ecosystem/shiny.md @@ -0,0 +1,39 @@ +# Shiny + +[Shiny](https://shiny.posit.co/py/) is a tool to build interactive web applications and dashboards using Python code. Shiny [integrates with Jupyter Widgets](https://shiny.posit.co/py/docs/jupyter-widgets.html), which means that Lonboard is supported out-of-the-box. + +Pay attention to the ["Efficient updates"](https://shiny.posit.co/py/docs/jupyter-widgets.html#efficient-updates) section of the Shiny documentation. This is the most efficient way to create a reactive map. Take care to not recreate the `Map` widget from scratch on updates, as that will send data from Python to the browser anew. + + +## Example + +![](../assets/shiny-example.gif) + +```py +import geopandas as gpd +from shiny import reactive +from shiny.express import input, ui +from shinywidgets import render_widget + +from lonboard import Map, ScatterplotLayer + +colors = { + "Red": [200, 0, 0], + "Green": [0, 200, 0], + "Blue": [0, 0, 200], +} + +ui.input_select("color_select", "Color", choices=list(colors.keys())) + + +@render_widget +def map(): + gdf = gpd.read_file(gpd.datasets.get_path("naturalearth_cities")) + layer = ScatterplotLayer.from_geopandas(gdf, radius_min_pixels=2) + return Map(layer) + + +@reactive.effect +def set_fill_color(): + map.widget.layers[0].get_fill_color = colors[input.color_select()] +``` diff --git a/examples/layers/bitmap-layer.ipynb b/examples/layers/bitmap-layer.ipynb deleted file mode 100644 index 243f992e..00000000 --- a/examples/layers/bitmap-layer.ipynb +++ /dev/null @@ -1,141 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "1267676d-8306-4979-9936-424073f07638", - "metadata": {}, - "outputs": [], - "source": [ - "from lonboard import BitmapLayer, Map" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "4668a4fc-96df-4659-9142-5fd0980c0c95", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1171da289af34fde8408e9ca242e1d3f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(layers=[BitmapLayer(bounds=[-122.519, 37.7045, -122.355, 37.829], image='https://raw.githubusercontent.com…" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "layer = BitmapLayer(\n", - " image='https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png',\n", - " bounds=[-122.5190, 37.7045, -122.355, 37.829]\n", - ")\n", - "m = Map(layer)\n", - "m" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f5a3a150-f917-476c-bd1d-31c2d40a5a65", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "lonboard", - "language": "python", - "name": "lonboard" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": { - "106d00e6a1e2489d8c5fe2103ef444fb": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "WidgetModel", - "state": { - "_layer_type": "bitmap", - "_view_module": null, - "_view_module_version": "", - "auto_highlight": false, - "bounds": [ - -122.519, - 37.7045, - -122.355, - 37.829 - ], - "desaturate": 0, - "extensions": [], - "image": "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-districts.png", - "opacity": 1, - "pickable": true, - "selected_index": null, - "visible": true - } - }, - "1171da289af34fde8408e9ca242e1d3f": { - "model_module": "anywidget", - "model_module_version": "0.9.0", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "lonboard._map.Map", - "_css": ".lonboard-tooltip{font-family:var(--jp-ui-font-family);font-size:var(--jp-ui-font-size1)}.lonboard-tooltip table{border-collapse:collapse}.lonboard-tooltip table tr:nth-child(odd){background-color:#fff}.lonboard-tooltip table tr:nth-child(2n){background-color:#f1f1f1}.lonboard-tooltip td{border:1px solid rgb(204,204,204);padding:5px}.lonboard-tooltip td:first-child{font-weight:450}\n", - "_esm": "var SK=Object.create;var MC=Object.defineProperty;var TK=Object.getOwnPropertyDescriptor;var MK=Object.getOwnPropertyNames;var EK=Object.getPrototypeOf,PK=Object.prototype.hasOwnProperty;var Nr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mA=(e,t)=>{for(var r in t)MC(e,r,{get:t[r],enumerable:!0})},IK=(e,t,r,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let n of MK(t))!PK.call(e,n)&&n!==r&&MC(e,n,{get:()=>t[n],enumerable:!(i=TK(t,n))||i.enumerable});return e};var bi=(e,t,r)=>(r=e!=null?SK(EK(e)):{},IK(t||!e||!e.__esModule?MC(r,\"default\",{value:e,enumerable:!0}):r,e));var ZF=Nr(wi=>{\"use strict\";var jx=Symbol.for(\"react.element\"),CK=Symbol.for(\"react.portal\"),LK=Symbol.for(\"react.fragment\"),kK=Symbol.for(\"react.strict_mode\"),RK=Symbol.for(\"react.profiler\"),DK=Symbol.for(\"react.provider\"),OK=Symbol.for(\"react.context\"),BK=Symbol.for(\"react.forward_ref\"),FK=Symbol.for(\"react.suspense\"),zK=Symbol.for(\"react.memo\"),NK=Symbol.for(\"react.lazy\"),FF=Symbol.iterator;function UK(e){return e===null||typeof e!=\"object\"?null:(e=FF&&e[FF]||e[\"@@iterator\"],typeof e==\"function\"?e:null)}var UF={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},VF=Object.assign,jF={};function y_(e,t,r){this.props=e,this.context=t,this.refs=jF,this.updater=r||UF}y_.prototype.isReactComponent={};y_.prototype.setState=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"&&e!=null)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,e,t,\"setState\")};y_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,\"forceUpdate\")};function GF(){}GF.prototype=y_.prototype;function PC(e,t,r){this.props=e,this.context=t,this.refs=jF,this.updater=r||UF}var IC=PC.prototype=new GF;IC.constructor=PC;VF(IC,y_.prototype);IC.isPureReactComponent=!0;var zF=Array.isArray,WF=Object.prototype.hasOwnProperty,CC={current:null},HF={key:!0,ref:!0,__self:!0,__source:!0};function qF(e,t,r){var i,n={},s=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=\"\"+t.key),t)WF.call(t,i)&&!HF.hasOwnProperty(i)&&(n[i]=t[i]);var c=arguments.length-2;if(c===1)n.children=r;else if(1{\"use strict\";YF.exports=ZF()});var n5=Nr(zn=>{\"use strict\";function OC(e,t){var r=e.length;e.push(t);t:for(;0>>1,n=e[i];if(0>>1;ieT(c,r))deT(_,c)?(e[i]=_,e[d]=r,i=d):(e[i]=c,e[o]=r,i=o);else if(deT(_,r))e[i]=_,e[d]=r,i=d;else break t}}return t}function eT(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance==\"object\"&&typeof performance.now==\"function\"?($F=performance,zn.unstable_now=function(){return $F.now()}):(kC=Date,QF=kC.now(),zn.unstable_now=function(){return kC.now()-QF});var $F,kC,QF,Bf=[],gA=[],HK=1,Eu=null,qa=3,nT=!1,f0=!1,Wx=!1,JF=typeof setTimeout==\"function\"?setTimeout:null,t5=typeof clearTimeout==\"function\"?clearTimeout:null,XF=typeof setImmediate<\"u\"?setImmediate:null;typeof navigator<\"u\"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function BC(e){for(var t=vh(gA);t!==null;){if(t.callback===null)iT(gA);else if(t.startTime<=e)iT(gA),t.sortIndex=t.expirationTime,OC(Bf,t);else break;t=vh(gA)}}function FC(e){if(Wx=!1,BC(e),!f0)if(vh(Bf)!==null)f0=!0,NC(zC);else{var t=vh(gA);t!==null&&UC(FC,t.startTime-e)}}function zC(e,t){f0=!1,Wx&&(Wx=!1,t5(Hx),Hx=-1),nT=!0;var r=qa;try{for(BC(t),Eu=vh(Bf);Eu!==null&&(!(Eu.expirationTime>t)||e&&!i5());){var i=Eu.callback;if(typeof i==\"function\"){Eu.callback=null,qa=Eu.priorityLevel;var n=i(Eu.expirationTime<=t);t=zn.unstable_now(),typeof n==\"function\"?Eu.callback=n:Eu===vh(Bf)&&iT(Bf),BC(t)}else iT(Bf);Eu=vh(Bf)}if(Eu!==null)var s=!0;else{var o=vh(gA);o!==null&&UC(FC,o.startTime-t),s=!1}return s}finally{Eu=null,qa=r,nT=!1}}var sT=!1,rT=null,Hx=-1,e5=5,r5=-1;function i5(){return!(zn.unstable_now()-r5e||125i?(e.sortIndex=r,OC(gA,e),vh(Bf)===null&&e===vh(gA)&&(Wx?(t5(Hx),Hx=-1):Wx=!0,UC(FC,r-i))):(e.sortIndex=n,OC(Bf,e),f0||nT||(f0=!0,NC(zC))),e};zn.unstable_shouldYield=i5;zn.unstable_wrapCallback=function(e){var t=qa;return function(){var r=qa;qa=t;try{return e.apply(this,arguments)}finally{qa=r}}}});var o5=Nr((Uxt,s5)=>{\"use strict\";s5.exports=n5()});var f8=Nr(qc=>{\"use strict\";var dz=Yi(),Wc=o5();function Me(e){for(var t=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+e,r=1;r\"u\"||typeof window.document>\"u\"||typeof window.document.createElement>\"u\"),cL=Object.prototype.hasOwnProperty,qK=/^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$/,a5={},l5={};function ZK(e){return cL.call(l5,e)?!0:cL.call(a5,e)?!1:qK.test(e)?l5[e]=!0:(a5[e]=!0,!1)}function YK(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case\"function\":case\"symbol\":return!0;case\"boolean\":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!==\"data-\"&&e!==\"aria-\");default:return!1}}function $K(e,t,r,i){if(t===null||typeof t>\"u\"||YK(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function xl(e,t,r,i,n,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var va={};\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(e){va[e]=new xl(e,0,!1,e,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(e){var t=e[0];va[t]=new xl(t,1,!1,e[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(e){va[e]=new xl(e,2,!1,e.toLowerCase(),null,!1,!1)});[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(e){va[e]=new xl(e,2,!1,e,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(e){va[e]=new xl(e,3,!1,e.toLowerCase(),null,!1,!1)});[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(e){va[e]=new xl(e,3,!0,e,null,!1,!1)});[\"capture\",\"download\"].forEach(function(e){va[e]=new xl(e,4,!1,e,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(e){va[e]=new xl(e,6,!1,e,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(e){va[e]=new xl(e,5,!1,e.toLowerCase(),null,!1,!1)});var ek=/[\\-:]([a-z])/g;function rk(e){return e[1].toUpperCase()}\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(e){var t=e.replace(ek,rk);va[t]=new xl(t,1,!1,e,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(e){var t=e.replace(ek,rk);va[t]=new xl(t,1,!1,e,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(e){var t=e.replace(ek,rk);va[t]=new xl(t,1,!1,e,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(e){va[e]=new xl(e,1,!1,e.toLowerCase(),null,!1,!1)});va.xlinkHref=new xl(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(e){va[e]=new xl(e,1,!1,e.toLowerCase(),null,!0,!0)});function ik(e,t,r,i){var n=va.hasOwnProperty(t)?va[t]:null;(n!==null?n.type!==0:i||!(2c||n[o]!==s[c]){var d=`\n`+n[o].replace(\" at new \",\" at \");return e.displayName&&d.includes(\"\")&&(d=d.replace(\"\",e.displayName)),d}while(1<=o&&0<=c);break}}}finally{jC=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:\"\")?t1(e):\"\"}function QK(e){switch(e.tag){case 5:return t1(e.type);case 16:return t1(\"Lazy\");case 13:return t1(\"Suspense\");case 19:return t1(\"SuspenseList\");case 0:case 2:case 15:return e=GC(e.type,!1),e;case 11:return e=GC(e.type.render,!1),e;case 1:return e=GC(e.type,!0),e;default:return\"\"}}function dL(e){if(e==null)return null;if(typeof e==\"function\")return e.displayName||e.name||null;if(typeof e==\"string\")return e;switch(e){case w_:return\"Fragment\";case b_:return\"Portal\";case uL:return\"Profiler\";case nk:return\"StrictMode\";case hL:return\"Suspense\";case fL:return\"SuspenseList\"}if(typeof e==\"object\")switch(e.$$typeof){case mz:return(e.displayName||\"Context\")+\".Consumer\";case Az:return(e._context.displayName||\"Context\")+\".Provider\";case sk:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||\"\",e=e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\"),e;case ok:return t=e.displayName||null,t!==null?t:dL(e.type)||\"Memo\";case yA:t=e._payload,e=e._init;try{return dL(e(t))}catch{}}return null}function XK(e){var t=e.type;switch(e.tag){case 24:return\"Cache\";case 9:return(t.displayName||\"Context\")+\".Consumer\";case 10:return(t._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return e=t.render,e=e.displayName||e.name||\"\",t.displayName||(e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return t;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return dL(t);case 8:return t===nk?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";case 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==\"function\")return t.displayName||t.name||null;if(typeof t==\"string\")return t}return null}function RA(e){switch(typeof e){case\"boolean\":case\"number\":case\"string\":case\"undefined\":return e;case\"object\":return e;default:return\"\"}}function _z(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===\"input\"&&(t===\"checkbox\"||t===\"radio\")}function KK(e){var t=_z(e)?\"checked\":\"value\",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=\"\"+e[t];if(!e.hasOwnProperty(t)&&typeof r<\"u\"&&typeof r.get==\"function\"&&typeof r.set==\"function\"){var n=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(o){i=\"\"+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=\"\"+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function aT(e){e._valueTracker||(e._valueTracker=KK(e))}function yz(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i=\"\";return e&&(i=_z(e)?e.checked?\"true\":\"false\":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function OT(e){if(e=e||(typeof document<\"u\"?document:void 0),typeof e>\"u\")return null;try{return e.activeElement||e.body}catch{return e.body}}function pL(e,t){var r=t.checked;return As({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function u5(e,t){var r=t.defaultValue==null?\"\":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=RA(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type===\"checkbox\"||t.type===\"radio\"?t.checked!=null:t.value!=null}}function vz(e,t){t=t.checked,t!=null&&ik(e,\"checked\",t,!1)}function AL(e,t){vz(e,t);var r=RA(t.value),i=t.type;if(r!=null)i===\"number\"?(r===0&&e.value===\"\"||e.value!=r)&&(e.value=\"\"+r):e.value!==\"\"+r&&(e.value=\"\"+r);else if(i===\"submit\"||i===\"reset\"){e.removeAttribute(\"value\");return}t.hasOwnProperty(\"value\")?mL(e,t.type,r):t.hasOwnProperty(\"defaultValue\")&&mL(e,t.type,RA(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function h5(e,t,r){if(t.hasOwnProperty(\"value\")||t.hasOwnProperty(\"defaultValue\")){var i=t.type;if(!(i!==\"submit\"&&i!==\"reset\"||t.value!==void 0&&t.value!==null))return;t=\"\"+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==\"\"&&(e.name=\"\"),e.defaultChecked=!!e._wrapperState.initialChecked,r!==\"\"&&(e.name=r)}function mL(e,t,r){(t!==\"number\"||OT(e.ownerDocument)!==e)&&(r==null?e.defaultValue=\"\"+e._wrapperState.initialValue:e.defaultValue!==\"\"+r&&(e.defaultValue=\"\"+r))}var e1=Array.isArray;function D_(e,t,r,i){if(e=e.options,t){t={};for(var n=0;n\"+t.valueOf().toString()+\"\",t=lT.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function p1(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var n1={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},JK=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(n1).forEach(function(e){JK.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),n1[t]=n1[e]})});function Sz(e,t,r){return t==null||typeof t==\"boolean\"||t===\"\"?\"\":r||typeof t!=\"number\"||t===0||n1.hasOwnProperty(e)&&n1[e]?(\"\"+t).trim():t+\"px\"}function Tz(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf(\"--\")===0,n=Sz(r,t[r],i);r===\"float\"&&(r=\"cssFloat\"),i?e.setProperty(r,n):e[r]=n}}var tJ=As({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yL(e,t){if(t){if(tJ[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Me(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Me(60));if(typeof t.dangerouslySetInnerHTML!=\"object\"||!(\"__html\"in t.dangerouslySetInnerHTML))throw Error(Me(61))}if(t.style!=null&&typeof t.style!=\"object\")throw Error(Me(62))}}function vL(e,t){if(e.indexOf(\"-\")===-1)return typeof t.is==\"string\";switch(e){case\"annotation-xml\":case\"color-profile\":case\"font-face\":case\"font-face-src\":case\"font-face-uri\":case\"font-face-format\":case\"font-face-name\":case\"missing-glyph\":return!1;default:return!0}}var xL=null;function ak(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bL=null,O_=null,B_=null;function p5(e){if(e=k1(e)){if(typeof bL!=\"function\")throw Error(Me(280));var t=e.stateNode;t&&(t=cM(t),bL(e.stateNode,e.type,t))}}function Mz(e){O_?B_?B_.push(e):B_=[e]:O_=e}function Ez(){if(O_){var e=O_,t=B_;if(B_=O_=null,p5(e),t)for(e=0;e>>=0,e===0?32:31-(hJ(e)/fJ|0)|0}var cT=64,uT=4194304;function r1(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function NT(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,n=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var c=o&~n;c!==0?i=r1(c):(s&=o,s!==0&&(i=r1(s)))}else o=r&~n,o!==0?i=r1(o):s!==0&&(i=r1(s));if(i===0)return 0;if(t!==0&&t!==i&&!(t&n)&&(n=i&-i,s=t&-t,n>=s||n===16&&(s&4194240)!==0))return t;if(i&4&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0r;r++)t.push(e);return t}function C1(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Th(t),e[t]=r}function mJ(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=o1),w5=\" \",S5=!1;function Zz(e,t){switch(e){case\"keyup\":return WJ.indexOf(t.keyCode)!==-1;case\"keydown\":return t.keyCode!==229;case\"keypress\":case\"mousedown\":case\"focusout\":return!0;default:return!1}}function Yz(e){return e=e.detail,typeof e==\"object\"&&\"data\"in e?e.data:null}var S_=!1;function qJ(e,t){switch(e){case\"compositionend\":return Yz(t);case\"keypress\":return t.which!==32?null:(S5=!0,w5);case\"textInput\":return e=t.data,e===w5&&S5?null:e;default:return null}}function ZJ(e,t){if(S_)return e===\"compositionend\"||!Ak&&Zz(e,t)?(e=Hz(),MT=fk=wA=null,S_=!1,e):null;switch(e){case\"paste\":return null;case\"keypress\":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=i}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=E5(r)}}function Kz(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kz(e,t.parentNode):\"contains\"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jz(){for(var e=window,t=OT();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href==\"string\"}catch{r=!1}if(r)e=t.contentWindow;else break;t=OT(e.document)}return t}function mk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===\"input\"&&(e.type===\"text\"||e.type===\"search\"||e.type===\"tel\"||e.type===\"url\"||e.type===\"password\")||t===\"textarea\"||e.contentEditable===\"true\")}function rtt(e){var t=Jz(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&Kz(r.ownerDocument.documentElement,r)){if(i!==null&&mk(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),\"selectionStart\"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=r.textContent.length,s=Math.min(i.start,n);i=i.end===void 0?s:Math.min(i.end,n),!e.extend&&s>i&&(n=i,i=s,s=n),n=P5(r,s);var o=P5(r,i);n&&o&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),s>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus==\"function\"&&r.focus(),r=0;r=document.documentMode,T_=null,PL=null,l1=null,IL=!1;function I5(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;IL||T_==null||T_!==OT(i)||(i=T_,\"selectionStart\"in i&&mk(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),l1&&v1(l1,i)||(l1=i,i=jT(PL,\"onSelect\"),0P_||(e.current=OL[P_],OL[P_]=null,P_--)}function Nn(e,t){P_++,OL[P_]=e.current,e.current=t}var DA={},Qa=BA(DA),Hl=BA(!1),v0=DA;function V_(e,t){var r=e.type.contextTypes;if(!r)return DA;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n={},s;for(s in r)n[s]=t[s];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function ql(e){return e=e.childContextTypes,e!=null}function WT(){Qn(Hl),Qn(Qa)}function z5(e,t,r){if(Qa.current!==DA)throw Error(Me(168));Nn(Qa,t),Nn(Hl,r)}function lN(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=\"function\")return r;i=i.getChildContext();for(var n in i)if(!(n in t))throw Error(Me(108,XK(e)||\"Unknown\",n));return As({},r,i)}function HT(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||DA,v0=Qa.current,Nn(Qa,e),Nn(Hl,Hl.current),!0}function N5(e,t,r){var i=e.stateNode;if(!i)throw Error(Me(169));r?(e=lN(e,t,v0),i.__reactInternalMemoizedMergedChildContext=e,Qn(Hl),Qn(Qa),Nn(Qa,e)):Qn(Hl),Nn(Hl,r)}var jd=null,uM=!1,tL=!1;function cN(e){jd===null?jd=[e]:jd.push(e)}function ftt(e){uM=!0,cN(e)}function FA(){if(!tL&&jd!==null){tL=!0;var e=0,t=un;try{var r=jd;for(un=1;e>=o,n-=o,Gd=1<<32-Th(t)+n|r<te?(oe=Yt,Yt=null):oe=Yt.sibling;var ae=R(Z,Yt,J[te],ht);if(ae===null){Yt===null&&(Yt=oe);break}e&&Yt&&ae.alternate===null&&t(Z,Yt),K=s(ae,K,te),Ot===null?Tt=ae:Ot.sibling=ae,Ot=ae,Yt=oe}if(te===J.length)return r(Z,Yt),ss&&d0(Z,te),Tt;if(Yt===null){for(;tete?(oe=Yt,Yt=null):oe=Yt.sibling;var ke=R(Z,Yt,ae.value,ht);if(ke===null){Yt===null&&(Yt=oe);break}e&&Yt&&ke.alternate===null&&t(Z,Yt),K=s(ke,K,te),Ot===null?Tt=ke:Ot.sibling=ke,Ot=ke,Yt=oe}if(ae.done)return r(Z,Yt),ss&&d0(Z,te),Tt;if(Yt===null){for(;!ae.done;te++,ae=J.next())ae=I(Z,ae.value,ht),ae!==null&&(K=s(ae,K,te),Ot===null?Tt=ae:Ot.sibling=ae,Ot=ae);return ss&&d0(Z,te),Tt}for(Yt=i(Z,Yt);!ae.done;te++,ae=J.next())ae=N(Yt,Z,te,ae.value,ht),ae!==null&&(e&&ae.alternate!==null&&Yt.delete(ae.key===null?te:ae.key),K=s(ae,K,te),Ot===null?Tt=ae:Ot.sibling=ae,Ot=ae);return e&&Yt.forEach(function(or){return t(Z,or)}),ss&&d0(Z,te),Tt}function it(Z,K,J,ht){if(typeof J==\"object\"&&J!==null&&J.type===w_&&J.key===null&&(J=J.props.children),typeof J==\"object\"&&J!==null){switch(J.$$typeof){case oT:t:{for(var Tt=J.key,Ot=K;Ot!==null;){if(Ot.key===Tt){if(Tt=J.type,Tt===w_){if(Ot.tag===7){r(Z,Ot.sibling),K=n(Ot,J.props.children),K.return=Z,Z=K;break t}}else if(Ot.elementType===Tt||typeof Tt==\"object\"&&Tt!==null&&Tt.$$typeof===yA&&q5(Tt)===Ot.type){r(Z,Ot.sibling),K=n(Ot,J.props),K.ref=Qx(Z,Ot,J),K.return=Z,Z=K;break t}r(Z,Ot);break}else t(Z,Ot);Ot=Ot.sibling}J.type===w_?(K=y0(J.props.children,Z.mode,ht,J.key),K.return=Z,Z=K):(ht=DT(J.type,J.key,J.props,null,Z.mode,ht),ht.ref=Qx(Z,K,J),ht.return=Z,Z=ht)}return o(Z);case b_:t:{for(Ot=J.key;K!==null;){if(K.key===Ot)if(K.tag===4&&K.stateNode.containerInfo===J.containerInfo&&K.stateNode.implementation===J.implementation){r(Z,K.sibling),K=n(K,J.children||[]),K.return=Z,Z=K;break t}else{r(Z,K);break}else t(Z,K);K=K.sibling}K=lL(J,Z.mode,ht),K.return=Z,Z=K}return o(Z);case yA:return Ot=J._init,it(Z,K,Ot(J._payload),ht)}if(e1(J))return j(Z,K,J,ht);if(qx(J))return Y(Z,K,J,ht);xT(Z,J)}return typeof J==\"string\"&&J!==\"\"||typeof J==\"number\"?(J=\"\"+J,K!==null&&K.tag===6?(r(Z,K.sibling),K=n(K,J),K.return=Z,Z=K):(r(Z,K),K=aL(J,Z.mode,ht),K.return=Z,Z=K),o(Z)):r(Z,K)}return it}var G_=gN(!0),_N=gN(!1),R1={},Vf=BA(R1),S1=BA(R1),T1=BA(R1);function g0(e){if(e===R1)throw Error(Me(174));return e}function Tk(e,t){switch(Nn(T1,t),Nn(S1,e),Nn(Vf,R1),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_L(null,\"\");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_L(t,e)}Qn(Vf),Nn(Vf,t)}function W_(){Qn(Vf),Qn(S1),Qn(T1)}function yN(e){g0(T1.current);var t=g0(Vf.current),r=_L(t,e.type);t!==r&&(Nn(S1,e),Nn(Vf,r))}function Mk(e){S1.current===e&&(Qn(Vf),Qn(S1))}var ds=BA(0);function XT(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data===\"$?\"||r.data===\"$!\"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var eL=[];function Ek(){for(var e=0;er?r:4,e(!0);var i=rL.transition;rL.transition={};try{e(!1),t()}finally{un=r,rL.transition=i}}function ON(){return Ru().memoizedState}function mtt(e,t,r){var i=LA(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},BN(e))FN(t,r);else if(r=dN(e,t,r,i),r!==null){var n=vl();Mh(r,e,i,n),zN(r,t,i)}}function gtt(e,t,r){var i=LA(e),n={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(BN(e))FN(t,n);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,c=s(o,r);if(n.hasEagerState=!0,n.eagerState=c,Eh(c,o)){var d=t.interleaved;d===null?(n.next=n,wk(t)):(n.next=d.next,d.next=n),t.interleaved=n;return}}catch{}finally{}r=dN(e,t,n,i),r!==null&&(n=vl(),Mh(r,e,i,n),zN(r,t,i))}}function BN(e){var t=e.alternate;return e===ps||t!==null&&t===ps}function FN(e,t){c1=KT=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function zN(e,t,r){if(r&4194240){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,ck(e,r)}}var JT={readContext:ku,useCallback:Za,useContext:Za,useEffect:Za,useImperativeHandle:Za,useInsertionEffect:Za,useLayoutEffect:Za,useMemo:Za,useReducer:Za,useRef:Za,useState:Za,useDebugValue:Za,useDeferredValue:Za,useTransition:Za,useMutableSource:Za,useSyncExternalStore:Za,useId:Za,unstable_isNewReconciler:!1},_tt={readContext:ku,useCallback:function(e,t){return zf().memoizedState=[e,t===void 0?null:t],e},useContext:ku,useEffect:Y5,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,CT(4194308,4,CN.bind(null,t,e),r)},useLayoutEffect:function(e,t){return CT(4194308,4,e,t)},useInsertionEffect:function(e,t){return CT(4,2,e,t)},useMemo:function(e,t){var r=zf();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=zf();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=mtt.bind(null,ps,e),[i.memoizedState,e]},useRef:function(e){var t=zf();return e={current:e},t.memoizedState=e},useState:Z5,useDebugValue:kk,useDeferredValue:function(e){return zf().memoizedState=e},useTransition:function(){var e=Z5(!1),t=e[0];return e=Att.bind(null,e[1]),zf().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=ps,n=zf();if(ss){if(r===void 0)throw Error(Me(407));r=r()}else{if(r=t(),ta===null)throw Error(Me(349));b0&30||bN(i,t,r)}n.memoizedState=r;var s={value:r,getSnapshot:t};return n.queue=s,Y5(SN.bind(null,i,s,e),[e]),i.flags|=2048,P1(9,wN.bind(null,i,s,r,t),void 0,null),r},useId:function(){var e=zf(),t=ta.identifierPrefix;if(ss){var r=Wd,i=Gd;r=(i&~(1<<32-Th(i)-1)).toString(32)+r,t=\":\"+t+\"R\"+r,r=M1++,0<\\/script>\",e=e.removeChild(e.firstChild)):typeof i.is==\"string\"?e=o.createElement(r,{is:i.is}):(e=o.createElement(r),r===\"select\"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,r),e[Nf]=t,e[w1]=i,ZN(e,t,!1,!1),t.stateNode=e;t:{switch(o=vL(r,i),r){case\"dialog\":$n(\"cancel\",e),$n(\"close\",e),n=i;break;case\"iframe\":case\"object\":case\"embed\":$n(\"load\",e),n=i;break;case\"video\":case\"audio\":for(n=0;nq_&&(t.flags|=128,i=!0,Xx(s,!1),t.lanes=4194304)}else{if(!i)if(e=XT(o),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Xx(s,!0),s.tail===null&&s.tailMode===\"hidden\"&&!o.alternate&&!ss)return Ya(t),null}else 2*Qs()-s.renderingStartTime>q_&&r!==1073741824&&(t.flags|=128,i=!0,Xx(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Qs(),t.sibling=null,r=ds.current,Nn(ds,i?r&1|2:r&1),t):(Ya(t),null);case 22:case 23:return zk(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Vc&1073741824&&(Ya(t),t.subtreeFlags&6&&(t.flags|=8192)):Ya(t),null;case 24:return null;case 25:return null}throw Error(Me(156,t.tag))}function Mtt(e,t){switch(_k(t),t.tag){case 1:return ql(t.type)&&WT(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return W_(),Qn(Hl),Qn(Qa),Ek(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mk(t),null;case 13:if(Qn(ds),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Me(340));j_()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qn(ds),null;case 4:return W_(),null;case 10:return bk(t.type._context),null;case 22:case 23:return zk(),null;case 24:return null;default:return null}}var wT=!1,$a=!1,Ett=typeof WeakSet==\"function\"?WeakSet:Set,ar=null;function k_(e,t){var r=e.ref;if(r!==null)if(typeof r==\"function\")try{r(null)}catch(i){Rs(e,t,i)}else r.current=null}function ZL(e,t,r){try{r()}catch(i){Rs(e,t,i)}}var iz=!1;function Ptt(e,t){if(CL=UT,e=Jz(),mk(e)){if(\"selectionStart\"in e)var r={start:e.selectionStart,end:e.selectionEnd};else t:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var n=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break t}var o=0,c=-1,d=-1,_=0,w=0,I=e,R=null;e:for(;;){for(var N;I!==r||n!==0&&I.nodeType!==3||(c=o+n),I!==s||i!==0&&I.nodeType!==3||(d=o+i),I.nodeType===3&&(o+=I.nodeValue.length),(N=I.firstChild)!==null;)R=I,I=N;for(;;){if(I===e)break e;if(R===r&&++_===n&&(c=o),R===s&&++w===i&&(d=o),(N=I.nextSibling)!==null)break;I=R,R=I.parentNode}I=N}r=c===-1||d===-1?null:{start:c,end:d}}else r=null}r=r||{start:0,end:0}}else r=null;for(LL={focusedElem:e,selectionRange:r},UT=!1,ar=t;ar!==null;)if(t=ar,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ar=e;else for(;ar!==null;){t=ar;try{var j=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(j!==null){var Y=j.memoizedProps,it=j.memoizedState,Z=t.stateNode,K=Z.getSnapshotBeforeUpdate(t.elementType===t.type?Y:bh(t.type,Y),it);Z.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var J=t.stateNode.containerInfo;J.nodeType===1?J.textContent=\"\":J.nodeType===9&&J.documentElement&&J.removeChild(J.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Me(163))}}catch(ht){Rs(t,t.return,ht)}if(e=t.sibling,e!==null){e.return=t.return,ar=e;break}ar=t.return}return j=iz,iz=!1,j}function u1(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&e)===e){var s=n.destroy;n.destroy=void 0,s!==void 0&&ZL(t,r,s)}n=n.next}while(n!==i)}}function dM(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function YL(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t==\"function\"?t(e):t.current=e}}function QN(e){var t=e.alternate;t!==null&&(e.alternate=null,QN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nf],delete t[w1],delete t[DL],delete t[utt],delete t[htt])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function XN(e){return e.tag===5||e.tag===3||e.tag===4}function nz(e){t:for(;;){for(;e.sibling===null;){if(e.return===null||XN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue t;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $L(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=GT));else if(i!==4&&(e=e.child,e!==null))for($L(e,t,r),e=e.sibling;e!==null;)$L(e,t,r),e=e.sibling}function QL(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(QL(e,t,r),e=e.sibling;e!==null;)QL(e,t,r),e=e.sibling}var _a=null,wh=!1;function _A(e,t,r){for(r=r.child;r!==null;)KN(e,t,r),r=r.sibling}function KN(e,t,r){if(Uf&&typeof Uf.onCommitFiberUnmount==\"function\")try{Uf.onCommitFiberUnmount(sM,r)}catch{}switch(r.tag){case 5:$a||k_(r,t);case 6:var i=_a,n=wh;_a=null,_A(e,t,r),_a=i,wh=n,_a!==null&&(wh?(e=_a,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):_a.removeChild(r.stateNode));break;case 18:_a!==null&&(wh?(e=_a,r=r.stateNode,e.nodeType===8?JC(e.parentNode,r):e.nodeType===1&&JC(e,r),_1(e)):JC(_a,r.stateNode));break;case 4:i=_a,n=wh,_a=r.stateNode.containerInfo,wh=!0,_A(e,t,r),_a=i,wh=n;break;case 0:case 11:case 14:case 15:if(!$a&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){n=i=i.next;do{var s=n,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ZL(r,t,o),n=n.next}while(n!==i)}_A(e,t,r);break;case 1:if(!$a&&(k_(r,t),i=r.stateNode,typeof i.componentWillUnmount==\"function\"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(c){Rs(r,t,c)}_A(e,t,r);break;case 21:_A(e,t,r);break;case 22:r.mode&1?($a=(i=$a)||r.memoizedState!==null,_A(e,t,r),$a=i):_A(e,t,r);break;default:_A(e,t,r)}}function sz(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Ett),t.forEach(function(i){var n=Ftt.bind(null,e,i);r.has(i)||(r.add(i),i.then(n,n))})}}function xh(e,t){var r=t.deletions;if(r!==null)for(var i=0;in&&(n=o),i&=~s}if(i=n,i=Qs()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ctt(i/1960))-i,10e?16:e,SA===null)var i=!1;else{if(e=SA,SA=null,rM=0,zi&6)throw Error(Me(331));var n=zi;for(zi|=4,ar=e.current;ar!==null;){var s=ar,o=s.child;if(ar.flags&16){var c=s.deletions;if(c!==null){for(var d=0;dQs()-Bk?_0(e,0):Ok|=r),Zl(e,t)}function o8(e,t){t===0&&(e.mode&1?(t=uT,uT<<=1,!(uT&130023424)&&(uT=4194304)):t=1);var r=vl();e=Yd(e,t),e!==null&&(C1(e,t,r),Zl(e,r))}function Btt(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),o8(e,r)}function Ftt(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;n!==null&&(r=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(Me(314))}i!==null&&i.delete(t),o8(e,r)}var a8;a8=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Hl.current)Wl=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Wl=!1,Stt(e,t,r);Wl=!!(e.flags&131072)}else Wl=!1,ss&&t.flags&1048576&&uN(t,ZT,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;LT(e,t),e=t.pendingProps;var n=V_(t,Qa.current);z_(t,r),n=Ik(null,t,i,e,n,r);var s=Ck();return t.flags|=1,typeof n==\"object\"&&n!==null&&typeof n.render==\"function\"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ql(i)?(s=!0,HT(t)):s=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,Sk(t),n.updater=hM,t.stateNode=n,n._reactInternals=t,UL(t,i,e,r),t=GL(null,t,i,!0,s,r)):(t.tag=0,ss&&s&&gk(t),yl(null,t,n,r),t=t.child),t;case 16:i=t.elementType;t:{switch(LT(e,t),e=t.pendingProps,n=i._init,i=n(i._payload),t.type=i,n=t.tag=Ntt(i),e=bh(i,e),n){case 0:t=jL(null,t,i,e,r);break t;case 1:t=tz(null,t,i,e,r);break t;case 11:t=K5(null,t,i,e,r);break t;case 14:t=J5(null,t,i,bh(i.type,e),r);break t}throw Error(Me(306,i,\"\"))}return t;case 0:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:bh(i,n),jL(e,t,i,n,r);case 1:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:bh(i,n),tz(e,t,i,n,r);case 3:t:{if(WN(t),e===null)throw Error(Me(387));i=t.pendingProps,s=t.memoizedState,n=s.element,pN(e,t),QT(t,i,null,r);var o=t.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){n=H_(Error(Me(423)),t),t=ez(e,t,i,r,n);break t}else if(i!==n){n=H_(Error(Me(424)),t),t=ez(e,t,i,r,n);break t}else for(jc=PA(t.stateNode.containerInfo.firstChild),Gc=t,ss=!0,Sh=null,r=_N(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(j_(),i===n){t=$d(e,t,r);break t}yl(e,t,i,r)}t=t.child}return t;case 5:return yN(t),e===null&&FL(t),i=t.type,n=t.pendingProps,s=e!==null?e.memoizedProps:null,o=n.children,kL(i,n)?o=null:s!==null&&kL(i,s)&&(t.flags|=32),GN(e,t),yl(e,t,o,r),t.child;case 6:return e===null&&FL(t),null;case 13:return HN(e,t,r);case 4:return Tk(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=G_(t,null,i,r):yl(e,t,i,r),t.child;case 11:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:bh(i,n),K5(e,t,i,n,r);case 7:return yl(e,t,t.pendingProps,r),t.child;case 8:return yl(e,t,t.pendingProps.children,r),t.child;case 12:return yl(e,t,t.pendingProps.children,r),t.child;case 10:t:{if(i=t.type._context,n=t.pendingProps,s=t.memoizedProps,o=n.value,Nn(YT,i._currentValue),i._currentValue=o,s!==null)if(Eh(s.value,o)){if(s.children===n.children&&!Hl.current){t=$d(e,t,r);break t}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var c=s.dependencies;if(c!==null){o=s.child;for(var d=c.firstContext;d!==null;){if(d.context===i){if(s.tag===1){d=Hd(-1,r&-r),d.tag=2;var _=s.updateQueue;if(_!==null){_=_.shared;var w=_.pending;w===null?d.next=d:(d.next=w.next,w.next=d),_.pending=d}}s.lanes|=r,d=s.alternate,d!==null&&(d.lanes|=r),zL(s.return,r,t),c.lanes|=r;break}d=d.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Me(341));o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),zL(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}yl(e,t,n.children,r),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,z_(t,r),n=ku(n),i=i(n),t.flags|=1,yl(e,t,i,r),t.child;case 14:return i=t.type,n=bh(i,t.pendingProps),n=bh(i.type,n),J5(e,t,i,n,r);case 15:return VN(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:bh(i,n),LT(e,t),t.tag=1,ql(i)?(e=!0,HT(t)):e=!1,z_(t,r),mN(t,i,n),UL(t,i,n,r),GL(null,t,i,!0,e,r);case 19:return qN(e,t,r);case 22:return jN(e,t,r)}throw Error(Me(156,t.tag))};function l8(e,t){return Dz(e,t)}function ztt(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cu(e,t,r,i){return new ztt(e,t,r,i)}function Uk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ntt(e){if(typeof e==\"function\")return Uk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sk)return 11;if(e===ok)return 14}return 2}function kA(e,t){var r=e.alternate;return r===null?(r=Cu(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function DT(e,t,r,i,n,s){var o=2;if(i=e,typeof e==\"function\")Uk(e)&&(o=1);else if(typeof e==\"string\")o=5;else t:switch(e){case w_:return y0(r.children,n,s,t);case nk:o=8,n|=8;break;case uL:return e=Cu(12,r,t,n|2),e.elementType=uL,e.lanes=s,e;case hL:return e=Cu(13,r,t,n),e.elementType=hL,e.lanes=s,e;case fL:return e=Cu(19,r,t,n),e.elementType=fL,e.lanes=s,e;case gz:return AM(r,n,s,t);default:if(typeof e==\"object\"&&e!==null)switch(e.$$typeof){case Az:o=10;break t;case mz:o=9;break t;case sk:o=11;break t;case ok:o=14;break t;case yA:o=16,i=null;break t}throw Error(Me(130,e==null?e:typeof e,\"\"))}return t=Cu(o,r,t,n),t.elementType=e,t.type=i,t.lanes=s,t}function y0(e,t,r,i){return e=Cu(7,e,i,t),e.lanes=r,e}function AM(e,t,r,i){return e=Cu(22,e,i,t),e.elementType=gz,e.lanes=r,e.stateNode={isHidden:!1},e}function aL(e,t,r){return e=Cu(6,e,null,t),e.lanes=r,e}function lL(e,t,r){return t=Cu(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Utt(e,t,r,i,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=HC(0),this.expirationTimes=HC(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=HC(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function Vk(e,t,r,i,n,s,o,c,d){return e=new Utt(e,t,r,c,d),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Cu(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sk(s),e}function Vtt(e,t,r){var i=3{\"use strict\";function d8(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>\"u\"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=\"function\"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d8)}catch(e){console.error(e)}}d8(),p8.exports=f8()});var m8=Nr(Hk=>{\"use strict\";var A8=vM();Hk.createRoot=A8.createRoot,Hk.hydrateRoot=A8.hydrateRoot;var Gxt});var k8=Nr((r4,i4)=>{(function(e,t){typeof r4==\"object\"&&typeof i4<\"u\"?i4.exports=t():(e=typeof globalThis<\"u\"?globalThis:e||self,e.maplibregl=t())})(r4,function(){\"use strict\";var e={},t={};function r(n,s,o){if(t[n]=o,n===\"index\"){var c=\"var sharedModule = {}; (\"+t.shared+\")(sharedModule); (\"+t.worker+\")(sharedModule);\",d={};return t.shared(d),t.index(e,d),typeof window<\"u\"&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([c],{type:\"text/javascript\"}))),e}}r(\"shared\",[\"exports\"],function(n){\"use strict\";function s(u,a,h,A){return new(h||(h=Promise))(function(x,E){function P(V){try{B(A.next(V))}catch(q){E(q)}}function D(V){try{B(A.throw(V))}catch(q){E(q)}}function B(V){var q;V.done?x(V.value):(q=V.value,q instanceof h?q:new h(function(Q){Q(q)})).then(P,D)}B((A=A.apply(u,a||[])).next())})}function o(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,\"default\")?u.default:u}typeof SuppressedError==\"function\"&&SuppressedError;var c=d;function d(u,a){this.x=u,this.y=a}d.prototype={clone:function(){return new d(this.x,this.y)},add:function(u){return this.clone()._add(u)},sub:function(u){return this.clone()._sub(u)},multByPoint:function(u){return this.clone()._multByPoint(u)},divByPoint:function(u){return this.clone()._divByPoint(u)},mult:function(u){return this.clone()._mult(u)},div:function(u){return this.clone()._div(u)},rotate:function(u){return this.clone()._rotate(u)},rotateAround:function(u,a){return this.clone()._rotateAround(u,a)},matMult:function(u){return this.clone()._matMult(u)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(u){return this.x===u.x&&this.y===u.y},dist:function(u){return Math.sqrt(this.distSqr(u))},distSqr:function(u){var a=u.x-this.x,h=u.y-this.y;return a*a+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith:function(u){return this.angleWithSep(u.x,u.y)},angleWithSep:function(u,a){return Math.atan2(this.x*a-this.y*u,this.x*u+this.y*a)},_matMult:function(u){var a=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=a,this},_add:function(u){return this.x+=u.x,this.y+=u.y,this},_sub:function(u){return this.x-=u.x,this.y-=u.y,this},_mult:function(u){return this.x*=u,this.y*=u,this},_div:function(u){return this.x/=u,this.y/=u,this},_multByPoint:function(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint:function(u){return this.x/=u.x,this.y/=u.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var u=this.y;return this.y=this.x,this.x=-u,this},_rotate:function(u){var a=Math.cos(u),h=Math.sin(u),A=h*this.x+a*this.y;return this.x=a*this.x-h*this.y,this.y=A,this},_rotateAround:function(u,a){var h=Math.cos(u),A=Math.sin(u),x=a.y+A*(this.x-a.x)+h*(this.y-a.y);return this.x=a.x+h*(this.x-a.x)-A*(this.y-a.y),this.y=x,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},d.convert=function(u){return u instanceof d?u:Array.isArray(u)?new d(u[0],u[1]):u};var _=o(c),w=I;function I(u,a,h,A){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*a,this.by=3*(A-a)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=a,this.p2x=h,this.p2y=A}I.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,a){if(a===void 0&&(a=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,A=0;A<8;A++){var x=this.sampleCurveX(h)-u;if(Math.abs(x)x?P=h:D=h,h=.5*(D-P)+P;return h},solve:function(u,a){return this.sampleCurveY(this.solveCurveX(u,a))}};var R=o(w);let N,j;function Y(){return N==null&&(N=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),N}function it(){if(j==null&&(j=!1,Y())){let a=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(a){for(let A=0;A<5*5;A++){let x=4*A;a.fillStyle=`rgb(${x},${x+1},${x+2})`,a.fillRect(A%5,Math.floor(A/5),1,1)}let h=a.getImageData(0,0,5,5).data;for(let A=0;A<5*5*4;A++)if(A%4!=3&&h[A]!==A){j=!0;break}}}return j||!1}function Z(u,a,h,A){let x=new R(u,a,h,A);return function(E){return x.solve(E)}}let K=Z(.25,.1,.25,1);function J(u,a,h){return Math.min(h,Math.max(a,u))}function ht(u,a,h){let A=h-a,x=((u-a)%A+A)%A+a;return x===a?h:x}function Tt(u,...a){for(let h of a)for(let A in h)u[A]=h[A];return u}let Ot=1;function Yt(u,a,h){let A={};for(let x in u)A[x]=a.call(h||this,u[x],x,u);return A}function te(u,a,h){let A={};for(let x in u)a.call(h||this,u[x],x,u)&&(A[x]=u[x]);return A}function oe(u){return Array.isArray(u)?u.map(oe):typeof u==\"object\"&&u?Yt(u,oe):u}let ae={};function ke(u){ae[u]||(typeof console<\"u\"&&console.warn(u),ae[u]=!0)}function or(u,a,h){return(h.y-u.y)*(a.x-u.x)>(a.y-u.y)*(h.x-u.x)}function cr(u){let a=0;for(let h,A,x=0,E=u.length,P=E-1;x\"u\")throw new Error(\"VideoFrame not supported\");let E=new VideoFrame(u,{timestamp:0});try{let P=E?.format;if(!P||!P.startsWith(\"BGR\")&&!P.startsWith(\"RGB\"))throw new Error(`Unrecognized format ${P}`);let D=P.startsWith(\"BGR\"),B=new Uint8ClampedArray(A*x*4);if(yield E.copyTo(B,function(V,q,Q,rt,ot){let lt=4*Math.max(-q,0),pt=(Math.max(0,Q)-Q)*rt*4+lt,xt=4*rt,Mt=Math.max(0,q),Vt=Math.max(0,Q);return{rect:{x:Mt,y:Vt,width:Math.min(V.width,q+rt)-Mt,height:Math.min(V.height,Q+ot)-Vt},layout:[{offset:pt,stride:xt}]}}(u,a,h,A,x)),D)for(let V=0;VLr(self)?self.worker&&self.worker.referrer:(window.location.protocol===\"blob:\"?window.parent:window).location.href,Bi=function(u,a){if(/:\\/\\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){let A=Ca(u.url);if(A)return A(u,a);if(Lr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:\"getResource\",data:u,targetMapId:Vo},a)}if(!(/^file:/.test(h=u.url)||/^file:/.test(vo())&&!/^\\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,\"signal\"))return function(A,x){return s(this,void 0,void 0,function*(){let E=new Request(A.url,{method:A.method||\"GET\",body:A.body,credentials:A.credentials,headers:A.headers,cache:A.cache,referrer:vo(),signal:x.signal});A.type===\"json\"&&E.headers.set(\"Accept\",\"application/json\");let P=yield fetch(E);if(!P.ok){let V=yield P.blob();throw new Li(P.status,P.statusText,A.url,V)}let D=A.type===\"arrayBuffer\"||A.type===\"image\"?P.arrayBuffer():A.type===\"json\"?P.json():P.text(),B=yield D;if(x.signal.aborted)throw aa();return{data:B,cacheControl:P.headers.get(\"Cache-Control\"),expires:P.headers.get(\"Expires\")}})}(u,a);if(Lr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:\"getResource\",data:u,mustQueue:!0,targetMapId:Vo},a)}var h;return function(A,x){return new Promise((E,P)=>{let D=new XMLHttpRequest;D.open(A.method||\"GET\",A.url,!0),A.type!==\"arrayBuffer\"&&A.type!==\"image\"||(D.responseType=\"arraybuffer\");for(let B in A.headers)D.setRequestHeader(B,A.headers[B]);A.type===\"json\"&&(D.responseType=\"text\",D.setRequestHeader(\"Accept\",\"application/json\")),D.withCredentials=A.credentials===\"include\",D.onerror=()=>{P(new Error(D.statusText))},D.onload=()=>{if(!x.signal.aborted)if((D.status>=200&&D.status<300||D.status===0)&&D.response!==null){let B=D.response;if(A.type===\"json\")try{B=JSON.parse(D.response)}catch(V){return void P(V)}E({data:B,cacheControl:D.getResponseHeader(\"Cache-Control\"),expires:D.getResponseHeader(\"Expires\")})}else{let B=new Blob([D.response],{type:D.getResponseHeader(\"Content-Type\")});P(new Li(D.status,D.statusText,A.url,B))}},x.signal.addEventListener(\"abort\",()=>{D.abort(),P(aa())}),D.send(A.body)})}(u,a)};function cs(u){if(!u||u.indexOf(\"://\")<=0||u.indexOf(\"data:image/\")===0||u.indexOf(\"blob:\")===0)return!0;let a=new URL(u),h=window.location;return a.protocol===h.protocol&&a.host===h.host}function jo(u,a,h){h[u]&&h[u].indexOf(a)!==-1||(h[u]=h[u]||[],h[u].push(a))}function Go(u,a,h){if(h&&h[u]){let A=h[u].indexOf(a);A!==-1&&h[u].splice(A,1)}}class Wo{constructor(a,h={}){Tt(this,h),this.type=a}}class ln extends Wo{constructor(a,h={}){super(\"error\",Tt({error:a},h))}}class la{on(a,h){return this._listeners=this._listeners||{},jo(a,h,this._listeners),this}off(a,h){return Go(a,h,this._listeners),Go(a,h,this._oneTimeListeners),this}once(a,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},jo(a,h,this._oneTimeListeners),this):new Promise(A=>this.once(a,A))}fire(a,h){typeof a==\"string\"&&(a=new Wo(a,h||{}));let A=a.type;if(this.listens(A)){a.target=this;let x=this._listeners&&this._listeners[A]?this._listeners[A].slice():[];for(let D of x)D.call(this,a);let E=this._oneTimeListeners&&this._oneTimeListeners[A]?this._oneTimeListeners[A].slice():[];for(let D of E)Go(A,D,this._oneTimeListeners),D.call(this,a);let P=this._eventedParent;P&&(Tt(a,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),P.fire(a))}else a instanceof ln&&console.error(a.error);return this}listens(a){return this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a)}setEventedParent(a,h){return this._eventedParent=a,this._eventedParentData=h,this}}var Jt={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},light:{type:\"light\"},sky:{type:\"sky\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},transition:{type:\"transition\"},layers:{required:!0,type:\"array\",value:\"layer\"}},sources:{\"*\":{type:\"source\"}},source:[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_geojson\",\"source_video\",\"source_image\"],source_vector:{type:{required:!0,type:\"enum\",values:{vector:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},attribution:{type:\"string\"},promoteId:{type:\"promoteId\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster:{type:{required:!0,type:\"enum\",values:{raster:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},attribution:{type:\"string\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster_dem:{type:{required:!0,type:\"enum\",values:{\"raster-dem\":{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},attribution:{type:\"string\"},encoding:{type:\"enum\",values:{terrarium:{},mapbox:{},custom:{}},default:\"mapbox\"},redFactor:{type:\"number\",default:1},blueFactor:{type:\"number\",default:1},greenFactor:{type:\"number\",default:1},baseShift:{type:\"number\",default:0},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_geojson:{type:{required:!0,type:\"enum\",values:{geojson:{}}},data:{required:!0,type:\"*\"},maxzoom:{type:\"number\",default:18},attribution:{type:\"string\"},buffer:{type:\"number\",default:128,maximum:512,minimum:0},filter:{type:\"*\"},tolerance:{type:\"number\",default:.375},cluster:{type:\"boolean\",default:!1},clusterRadius:{type:\"number\",default:50,minimum:0},clusterMaxZoom:{type:\"number\"},clusterMinPoints:{type:\"number\"},clusterProperties:{type:\"*\"},lineMetrics:{type:\"boolean\",default:!1},generateId:{type:\"boolean\",default:!1},promoteId:{type:\"promoteId\"}},source_video:{type:{required:!0,type:\"enum\",values:{video:{}}},urls:{required:!0,type:\"array\",value:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},source_image:{type:{required:!0,type:\"enum\",values:{image:{}}},url:{required:!0,type:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},layer:{id:{type:\"string\",required:!0},type:{type:\"enum\",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},\"fill-extrusion\":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:\"*\"},source:{type:\"string\"},\"source-layer\":{type:\"string\"},minzoom:{type:\"number\",minimum:0,maximum:24},maxzoom:{type:\"number\",minimum:0,maximum:24},filter:{type:\"filter\"},layout:{type:\"layout\"},paint:{type:\"paint\"}},layout:[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_hillshade\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_fill:{\"fill-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_circle:{\"circle-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_symbol:{\"symbol-placement\":{type:\"enum\",values:{point:{},line:{},\"line-center\":{}},default:\"point\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{type:\"number\",default:250,minimum:1,units:\"pixels\",requires:[{\"symbol-placement\":\"line\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{type:\"boolean\",default:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{type:\"enum\",values:{auto:{},\"viewport-y\":{},source:{}},default:\"auto\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"!\":\"icon-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{type:\"boolean\",default:!1,requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-size\":{type:\"number\",default:1,minimum:0,units:\"factor of the original icon size\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{type:\"enum\",values:{none:{},width:{},height:{},both:{}},default:\"none\",requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-text-fit-padding\":{type:\"array\",value:\"number\",length:4,default:[0,0,0,0],units:\"pixels\",requires:[\"icon-image\",\"text-field\",{\"icon-text-fit\":[\"both\",\"width\",\"height\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{type:\"resolvedImage\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{type:\"padding\",default:[2],units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-keep-upright\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{type:\"array\",value:\"number\",length:2,default:[0,0],requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},\"viewport-glyph\":{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{type:\"formatted\",default:\"\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{type:\"array\",value:\"string\",default:[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{type:\"number\",default:16,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{type:\"number\",default:10,minimum:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{type:\"number\",default:1.2,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-letter-spacing\":{type:\"number\",default:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{type:\"enum\",values:{auto:{},left:{},center:{},right:{}},default:\"center\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{type:\"number\",units:\"ems\",default:0,requires:[\"text-field\"],\"property-type\":\"data-driven\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{type:\"array\",value:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-variable-anchor-offset\":{type:\"variableAnchorOffsetCollection\",requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"text-field\",{\"!\":\"text-variable-anchor\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{type:\"number\",default:45,units:\"degrees\",requires:[\"text-field\",{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{type:\"array\",value:\"enum\",values:{horizontal:{},vertical:{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{type:\"number\",default:2,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{type:\"boolean\",default:!0,requires:[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{type:\"enum\",values:{none:{},uppercase:{},lowercase:{}},default:\"none\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{type:\"array\",value:\"number\",units:\"ems\",length:2,default:[0,0],requires:[\"text-field\",{\"!\":\"text-radial-offset\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"text-field\",{\"!\":\"text-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{type:\"boolean\",default:!1,requires:[\"text-field\",\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},filter:{type:\"array\",value:\"*\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{},within:{}}},geometry_type:{type:\"enum\",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:\"expression\"},stops:{type:\"array\",value:\"function_stop\"},base:{type:\"number\",default:1,minimum:0},property:{type:\"string\",default:\"$zoom\"},type:{type:\"enum\",values:{identity:{},exponential:{},interval:{},categorical:{}},default:\"exponential\"},colorSpace:{type:\"enum\",values:{rgb:{},lab:{},hcl:{}},default:\"rgb\"},default:{type:\"*\",required:!1}},function_stop:{type:\"array\",minimum:0,maximum:24,value:[\"number\",\"color\"],length:2},expression:{type:\"array\",value:\"*\",minimum:1},light:{anchor:{type:\"enum\",default:\"viewport\",values:{map:{},viewport:{}},\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]}},position:{type:\"array\",default:[1.15,210,30],length:3,value:\"number\",\"property-type\":\"data-constant\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]}},color:{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},intensity:{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},sky:{\"sky-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#88C6FC\",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-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-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}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_background\"],paint_fill:{\"fill-antialias\":{type:\"boolean\",default:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{type:\"color\",transition:!0,requires:[{\"!\":\"fill-pattern\"},{\"fill-antialias\":!0}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-extrusion-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-extrusion-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"fill-extrusion-height\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{type:\"number\",default:300,minimum:0,transition:!1,units:\"milliseconds\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_hillshade:{\"hillshade-illumination-direction\":{type:\"number\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{type:\"number\",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"color\",default:\"#FFFFFF\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_background:{\"background-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"background-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"background-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},transition:{duration:{type:\"number\",default:300,minimum:0,units:\"milliseconds\"},delay:{type:\"number\",default:0,minimum:0,units:\"milliseconds\"}},\"property-type\":{\"data-driven\":{type:\"property-type\"},\"cross-faded\":{type:\"property-type\"},\"cross-faded-data-driven\":{type:\"property-type\"},\"color-ramp\":{type:\"property-type\"},\"data-constant\":{type:\"property-type\"},constant:{type:\"property-type\"}},promoteId:{\"*\":{type:\"string\"}}};let xo=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"];function fu(u,a){let h={};for(let A in u)A!==\"ref\"&&(h[A]=u[A]);return xo.forEach(A=>{A in a&&(h[A]=a[A])}),h}function ei(u,a){if(Array.isArray(u)){if(!Array.isArray(a)||u.length!==a.length)return!1;for(let h=0;h`:u.itemType.kind===\"value\"?\"array\":`array<${a}>`}return u.kind}let Rt=[es,we,kr,Sr,Ln,Gn,Ra,ct(gr),vt,tt,nt];function Dt(u,a){if(a.kind===\"error\")return null;if(u.kind===\"array\"){if(a.kind===\"array\"&&(a.N===0&&a.itemType.kind===\"value\"||!Dt(u.itemType,a.itemType))&&(typeof u.N!=\"number\"||u.N===a.N))return null}else{if(u.kind===a.kind)return null;if(u.kind===\"value\"){for(let h of Rt)if(!Dt(h,a))return null}}return`Expected ${mt(u)} but found ${mt(a)} instead.`}function Ut(u,a){return a.some(h=>h.kind===u.kind)}function ft(u,a){return a.some(h=>h===\"null\"?u===null:h===\"array\"?Array.isArray(u):h===\"object\"?u&&!Array.isArray(u)&&typeof u==\"object\":h===typeof u)}function jt(u,a){return u.kind===\"array\"&&a.kind===\"array\"?u.itemType.kind===a.itemType.kind&&typeof u.N==\"number\":u.kind===a.kind}let le=.96422,ee=.82521,re=4/29,tr=6/29,nr=3*tr*tr,Rr=tr*tr*tr,yr=Math.PI/180,ni=180/Math.PI;function Ti(u){return(u%=360)<0&&(u+=360),u}function Hi([u,a,h,A]){let x,E,P=Dr((.2225045*(u=wn(u))+.7168786*(a=wn(a))+.0606169*(h=wn(h)))/1);u===a&&a===h?x=E=P:(x=Dr((.4360747*u+.3850649*a+.1430804*h)/le),E=Dr((.0139322*u+.0971045*a+.7141733*h)/ee));let D=116*P-16;return[D<0?0:D,500*(x-P),200*(P-E),A]}function wn(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function Dr(u){return u>Rr?Math.pow(u,1/3):u/nr+re}function tn([u,a,h,A]){let x=(u+16)/116,E=isNaN(a)?x:x+a/500,P=isNaN(h)?x:x-h/200;return x=1*rs(x),E=le*rs(E),P=ee*rs(P),[en(3.1338561*E-1.6168667*x-.4906146*P),en(-.9787684*E+1.9161415*x+.033454*P),en(.0719453*E-.2289914*x+1.4052427*P),A]}function en(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function rs(u){return u>tr?u*u*u:nr*(u-re)}function us(u){return parseInt(u.padEnd(2,u),16)/255}function kn(u,a){return ca(a?u/100:u,0,1)}function ca(u,a,h){return Math.min(Math.max(a,u),h)}function zm(u){return!u.some(Number.isNaN)}let Qg={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class gi{constructor(a,h,A,x=1,E=!0){this.r=a,this.g=h,this.b=A,this.a=x,E||(this.r*=x,this.g*=x,this.b*=x,x||this.overwriteGetter(\"rgb\",[a,h,A,x]))}static parse(a){if(a instanceof gi)return a;if(typeof a!=\"string\")return;let h=function(A){if((A=A.toLowerCase().trim())===\"transparent\")return[0,0,0,0];let x=Qg[A];if(x){let[P,D,B]=x;return[P/255,D/255,B/255,1]}if(A.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(A)){let P=A.length<6?1:2,D=1;return[us(A.slice(D,D+=P)),us(A.slice(D,D+=P)),us(A.slice(D,D+=P)),us(A.slice(D,D+P)||\"ff\")]}if(A.startsWith(\"rgb\")){let P=A.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(P){let[D,B,V,q,Q,rt,ot,lt,pt,xt,Mt,Vt]=P,It=[q||\" \",ot||\" \",xt].join(\"\");if(It===\" \"||It===\" /\"||It===\",,\"||It===\",,,\"){let zt=[V,rt,pt].join(\"\"),ie=zt===\"%%%\"?100:zt===\"\"?255:0;if(ie){let ue=[ca(+B/ie,0,1),ca(+Q/ie,0,1),ca(+lt/ie,0,1),Mt?kn(+Mt,Vt):1];if(zm(ue))return ue}}return}}let E=A.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(E){let[P,D,B,V,q,Q,rt,ot,lt]=E,pt=[B||\" \",q||\" \",rt].join(\"\");if(pt===\" \"||pt===\" /\"||pt===\",,\"||pt===\",,,\"){let xt=[+D,ca(+V,0,100),ca(+Q,0,100),ot?kn(+ot,lt):1];if(zm(xt))return function([Mt,Vt,It,zt]){function ie(ue){let Fe=(ue+Mt/30)%12,Je=Vt*Math.min(It,1-It);return It-Je*Math.max(-1,Math.min(Fe-3,9-Fe,1))}return Mt=Ti(Mt),Vt/=100,It/=100,[ie(0),ie(8),ie(4),zt]}(xt)}}}(a);return h?new gi(...h,!1):void 0}get rgb(){let{r:a,g:h,b:A,a:x}=this,E=x||1/0;return this.overwriteGetter(\"rgb\",[a/E,h/E,A/E,x])}get hcl(){return this.overwriteGetter(\"hcl\",function(a){let[h,A,x,E]=Hi(a),P=Math.sqrt(A*A+x*x);return[Math.round(1e4*P)?Ti(Math.atan2(x,A)*ni):NaN,P,h,E]}(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",Hi(this.rgb))}overwriteGetter(a,h){return Object.defineProperty(this,a,{value:h}),h}toString(){let[a,h,A,x]=this.rgb;return`rgba(${[a,h,A].map(E=>Math.round(255*E)).join(\",\")},${x})`}}gi.black=new gi(0,0,0,1),gi.white=new gi(1,1,1,1),gi.transparent=new gi(0,0,0,0),gi.red=new gi(1,0,0,1);class bo{constructor(a,h,A){this.sensitivity=a?h?\"variant\":\"case\":h?\"accent\":\"base\",this.locale=A,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(a,h){return this.collator.compare(a,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Pc{constructor(a,h,A,x,E){this.text=a,this.image=h,this.scale=A,this.fontStack=x,this.textColor=E}}class Wn{constructor(a){this.sections=a}static fromString(a){return new Wn([new Pc(a,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(a=>a.text.length!==0||a.image&&a.image.name.length!==0)}static factory(a){return a instanceof Wn?a:Wn.fromString(a)}toString(){return this.sections.length===0?\"\":this.sections.map(a=>a.text).join(\"\")}}class Sn{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Sn)return a;if(typeof a==\"number\")return new Sn([a,a,a,a]);if(Array.isArray(a)&&!(a.length<1||a.length>4)){for(let h of a)if(typeof h!=\"number\")return;switch(a.length){case 1:a=[a[0],a[0],a[0],a[0]];break;case 2:a=[a[0],a[1],a[0],a[1]];break;case 3:a=[a[0],a[1],a[2],a[1]]}return new Sn(a)}}toString(){return JSON.stringify(this.values)}}let Bl=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]);class Rn{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Rn)return a;if(Array.isArray(a)&&!(a.length<1)&&a.length%2==0){for(let h=0;h=0&&u<=255&&typeof a==\"number\"&&a>=0&&a<=255&&typeof h==\"number\"&&h>=0&&h<=255?A===void 0||typeof A==\"number\"&&A>=0&&A<=1?null:`Invalid rgba value [${[u,a,h,A].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof A==\"number\"?[u,a,h,A]:[u,a,h]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function df(u){if(u===null||typeof u==\"string\"||typeof u==\"boolean\"||typeof u==\"number\"||u instanceof gi||u instanceof bo||u instanceof Wn||u instanceof Sn||u instanceof Rn||u instanceof Hn)return!0;if(Array.isArray(u)){for(let a of u)if(!df(a))return!1;return!0}if(typeof u==\"object\"){for(let a in u)if(!df(u[a]))return!1;return!0}return!1}function fn(u){if(u===null)return es;if(typeof u==\"string\")return kr;if(typeof u==\"boolean\")return Sr;if(typeof u==\"number\")return we;if(u instanceof gi)return Ln;if(u instanceof bo)return Ec;if(u instanceof Wn)return Gn;if(u instanceof Sn)return vt;if(u instanceof Rn)return nt;if(u instanceof Hn)return tt;if(Array.isArray(u)){let a=u.length,h;for(let A of u){let x=fn(A);if(h){if(h===x)continue;h=gr;break}h=x}return ct(h||gr,a)}return Ra}function so(u){let a=typeof u;return u===null?\"\":a===\"string\"||a===\"number\"||a===\"boolean\"?String(u):u instanceof gi||u instanceof Wn||u instanceof Sn||u instanceof Rn||u instanceof Hn?u.toString():JSON.stringify(u)}class Da{constructor(a,h){this.type=a,this.value=h}static parse(a,h){if(a.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!df(a[1]))return h.error(\"invalid value\");let A=a[1],x=fn(A),E=h.expectedType;return x.kind!==\"array\"||x.N!==0||!E||E.kind!==\"array\"||typeof E.N==\"number\"&&E.N!==0||(x=E),new Da(x,A)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class qi{constructor(a){this.name=\"ExpressionEvaluationError\",this.message=a}toJSON(){return this.message}}let ch={string:kr,number:we,boolean:Sr,object:Ra};class oo{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A,x=1,E=a[0];if(E===\"array\"){let D,B;if(a.length>2){let V=a[1];if(typeof V!=\"string\"||!(V in ch)||V===\"object\")return h.error('The item type argument of \"array\" must be one of string, number, boolean',1);D=ch[V],x++}else D=gr;if(a.length>3){if(a[2]!==null&&(typeof a[2]!=\"number\"||a[2]<0||a[2]!==Math.floor(a[2])))return h.error('The length argument to \"array\" must be a positive integer literal',2);B=a[2],x++}A=ct(D,B)}else{if(!ch[E])throw new Error(`Types doesn't contain name = ${E}`);A=ch[E]}let P=[];for(;xa.outputDefined())}}let uh={\"to-boolean\":Sr,\"to-color\":Ln,\"to-number\":we,\"to-string\":kr};class Zo{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[0];if(!uh[A])throw new Error(`Can't parse ${A} as it is not part of the known types`);if((A===\"to-boolean\"||A===\"to-string\")&&a.length!==2)return h.error(\"Expected one argument.\");let x=uh[A],E=[];for(let P=1;P4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:du(h[0],h[1],h[2],h[3]),!A))return new gi(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new qi(A||`Could not parse color from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"padding\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Sn.parse(h);if(x)return x}throw new qi(`Could not parse padding from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"variableAnchorOffsetCollection\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Rn.parse(h);if(x)return x}throw new qi(`Could not parse variableAnchorOffsetCollection from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"number\":{let h=null;for(let A of this.args){if(h=A.evaluate(a),h===null)return 0;let x=Number(h);if(!isNaN(x))return x}throw new qi(`Could not convert ${JSON.stringify(h)} to number.`)}case\"formatted\":return Wn.fromString(so(this.args[0].evaluate(a)));case\"resolvedImage\":return Hn.fromString(so(this.args[0].evaluate(a)));default:return so(this.args[0].evaluate(a))}}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}let ua=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class Mi{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&\"id\"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type==\"number\"?ua[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(a){let h=this._parseColorCache[a];return h||(h=this._parseColorCache[a]=gi.parse(a)),h}}class pf{constructor(a,h,A=[],x,E=new ka,P=[]){this.registry=a,this.path=A,this.key=A.map(D=>`[${D}]`).join(\"\"),this.scope=E,this.errors=P,this.expectedType=x,this._isConstant=h}parse(a,h,A,x,E={}){return h?this.concat(h,A,x)._parse(a,E):this._parse(a,E)}_parse(a,h){function A(x,E,P){return P===\"assert\"?new oo(E,[x]):P===\"coerce\"?new Zo(E,[x]):x}if(a!==null&&typeof a!=\"string\"&&typeof a!=\"boolean\"&&typeof a!=\"number\"||(a=[\"literal\",a]),Array.isArray(a)){if(a.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let x=a[0];if(typeof x!=\"string\")return this.error(`Expression name must be a string, but found ${typeof x} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let E=this.registry[x];if(E){let P=E.parse(a,this);if(!P)return null;if(this.expectedType){let D=this.expectedType,B=P.type;if(D.kind!==\"string\"&&D.kind!==\"number\"&&D.kind!==\"boolean\"&&D.kind!==\"object\"&&D.kind!==\"array\"||B.kind!==\"value\")if(D.kind!==\"color\"&&D.kind!==\"formatted\"&&D.kind!==\"resolvedImage\"||B.kind!==\"value\"&&B.kind!==\"string\")if(D.kind!==\"padding\"||B.kind!==\"value\"&&B.kind!==\"number\"&&B.kind!==\"array\")if(D.kind!==\"variableAnchorOffsetCollection\"||B.kind!==\"value\"&&B.kind!==\"array\"){if(this.checkSubtype(D,B))return null}else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"assert\")}if(!(P instanceof Da)&&P.type.kind!==\"resolvedImage\"&&this._isConstant(P)){let D=new Mi;try{P=new Da(P.type,P.evaluate(D))}catch(B){return this.error(B.message),null}}return P}return this.error(`Unknown expression \"${x}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return this.error(a===void 0?\"'undefined' value invalid. Use null instead.\":typeof a==\"object\"?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,h,A){let x=typeof a==\"number\"?this.path.concat(a):this.path,E=A?this.scope.concat(A):this.scope;return new pf(this.registry,this._isConstant,x,h||null,E,this.errors)}error(a,...h){let A=`${this.key}${h.map(x=>`[${x}]`).join(\"\")}`;this.errors.push(new jn(A,a))}checkSubtype(a,h){let A=Dt(a,h);return A&&this.error(A),A}}class Ic{constructor(a,h,A){this.type=Ec,this.locale=A,this.caseSensitive=a,this.diacriticSensitive=h}static parse(a,h){if(a.length!==2)return h.error(\"Expected one argument.\");let A=a[1];if(typeof A!=\"object\"||Array.isArray(A))return h.error(\"Collator options argument must be an object.\");let x=h.parse(A[\"case-sensitive\"]!==void 0&&A[\"case-sensitive\"],1,Sr);if(!x)return null;let E=h.parse(A[\"diacritic-sensitive\"]!==void 0&&A[\"diacritic-sensitive\"],1,Sr);if(!E)return null;let P=null;return A.locale&&(P=h.parse(A.locale,1,kr),!P)?null:new Ic(x,E,P)}evaluate(a){return new bo(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)}eachChild(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)}outputDefined(){return!1}}let Fl=8192;function Td(u,a){u[0]=Math.min(u[0],a[0]),u[1]=Math.min(u[1],a[1]),u[2]=Math.max(u[2],a[0]),u[3]=Math.max(u[3],a[1])}function Af(u,a){return!(u[0]<=a[0]||u[2]>=a[2]||u[1]<=a[1]||u[3]>=a[3])}function ut(u,a){let h=(180+u[0])/360,A=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,x=Math.pow(2,a.z);return[Math.round(h*x*Fl),Math.round(A*x*Fl)]}function dt(u,a,h){let A=u[0]-a[0],x=u[1]-a[1],E=u[0]-h[0],P=u[1]-h[1];return A*P-E*x==0&&A*E<=0&&x*P<=0}function Ct(u,a){let h=!1;for(let P=0,D=a.length;P(A=u)[1]!=(E=B[V+1])[1]>A[1]&&A[0]<(E[0]-x[0])*(A[1]-x[1])/(E[1]-x[1])+x[0]&&(h=!h)}}var A,x,E;return h}function $t(u,a){for(let h=0;h0&&D<0||P<0&&D>0}function Ye(u,a,h){for(let V of h)for(let q=0;qh[2]){let x=.5*A,E=u[0]-h[0]>x?-A:h[0]-u[0]>x?A:0;E===0&&(E=u[0]-h[2]>x?-A:h[2]-u[0]>x?A:0),u[0]+=E}Td(a,u)}function Nm(u,a,h,A){let x=Math.pow(2,A.z)*Fl,E=[A.x*Fl,A.y*Fl],P=[];for(let D of u)for(let B of D){let V=[B.x+E[0],B.y+E[1]];Oa(V,a,h,x),P.push(V)}return P}function wx(u,a,h,A){let x=Math.pow(2,A.z)*Fl,E=[A.x*Fl,A.y*Fl],P=[];for(let B of u){let V=[];for(let q of B){let Q=[q.x+E[0],q.y+E[1]];Td(a,Q),V.push(Q)}P.push(V)}if(a[2]-a[0]<=x/2){(D=a)[0]=D[1]=1/0,D[2]=D[3]=-1/0;for(let B of P)for(let V of B)Oa(V,a,h,x)}var D;return P}class mf{constructor(a,h){this.type=Sr,this.geojson=a,this.geometries=h}static parse(a,h){if(a.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(df(a[1])){let A=a[1];if(A.type===\"FeatureCollection\"){let x=[];for(let E of A.features){let{type:P,coordinates:D}=E.geometry;P===\"Polygon\"&&x.push(D),P===\"MultiPolygon\"&&x.push(...D)}if(x.length)return new mf(A,{type:\"MultiPolygon\",coordinates:x})}else if(A.type===\"Feature\"){let x=A.geometry.type;if(x===\"Polygon\"||x===\"MultiPolygon\")return new mf(A,A.geometry)}else if(A.type===\"Polygon\"||A.type===\"MultiPolygon\")return new mf(A,A)}return h.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(a){if(a.geometry()!=null&&a.canonicalID()!=null){if(a.geometryType()===\"Point\")return function(h,A){let x=[1/0,1/0,-1/0,-1/0],E=[1/0,1/0,-1/0,-1/0],P=h.canonicalID();if(A.type===\"Polygon\"){let D=qn(A.coordinates,E,P),B=Nm(h.geometry(),x,E,P);if(!Af(x,E))return!1;for(let V of B)if(!Ct(V,D))return!1}if(A.type===\"MultiPolygon\"){let D=Ns(A.coordinates,E,P),B=Nm(h.geometry(),x,E,P);if(!Af(x,E))return!1;for(let V of B)if(!$t(V,D))return!1}return!0}(a,this.geometries);if(a.geometryType()===\"LineString\")return function(h,A){let x=[1/0,1/0,-1/0,-1/0],E=[1/0,1/0,-1/0,-1/0],P=h.canonicalID();if(A.type===\"Polygon\"){let D=qn(A.coordinates,E,P),B=wx(h.geometry(),x,E,P);if(!Af(x,E))return!1;for(let V of B)if(!si(V,D))return!1}if(A.type===\"MultiPolygon\"){let D=Ns(A.coordinates,E,P),B=wx(h.geometry(),x,E,P);if(!Af(x,E))return!1;for(let V of B)if(!is(V,D))return!1}return!0}(a,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Um{constructor(a,h){this.type=h.type,this.name=a,this.boundExpression=h}static parse(a,h){if(a.length!==2||typeof a[1]!=\"string\")return h.error(\"'var' expression requires exactly one string literal argument.\");let A=a[1];return h.scope.has(A)?new Um(A,h.scope.get(A)):h.error(`Unknown variable \"${A}\". Make sure \"${A}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}}class Ba{constructor(a,h,A,x){this.name=a,this.type=h,this._evaluate=A,this.args=x}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}static parse(a,h){let A=a[0],x=Ba.definitions[A];if(!x)return h.error(`Unknown expression \"${A}\". If you wanted a literal array, use [\"literal\", [...]].`,0);let E=Array.isArray(x)?x[0]:x.type,P=Array.isArray(x)?[[x[1],x[2]]]:x.overloads,D=P.filter(([V])=>!Array.isArray(V)||V.length===a.length-1),B=null;for(let[V,q]of D){B=new pf(h.registry,Up,h.path,null,h.scope);let Q=[],rt=!1;for(let ot=1;ot{return rt=Q,Array.isArray(rt)?`(${rt.map(mt).join(\", \")})`:`(${mt(rt.type)}...)`;var rt}).join(\" | \"),q=[];for(let Q=1;Q{h=a?h&&Up(A):h&&A instanceof Da}),!!h&&Vm(u)&&jp(u,[\"zoom\",\"heatmap-density\",\"line-progress\",\"accumulated\",\"is-supported-script\"])}function Vm(u){if(u instanceof Ba&&(u.name===\"get\"&&u.args.length===1||u.name===\"feature-state\"||u.name===\"has\"&&u.args.length===1||u.name===\"properties\"||u.name===\"geometry-type\"||u.name===\"id\"||/^filter-/.test(u.name))||u instanceof mf)return!1;let a=!0;return u.eachChild(h=>{a&&!Vm(h)&&(a=!1)}),a}function Vp(u){if(u instanceof Ba&&u.name===\"feature-state\")return!1;let a=!0;return u.eachChild(h=>{a&&!Vp(h)&&(a=!1)}),a}function jp(u,a){if(u instanceof Ba&&a.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(A=>{h&&!jp(A,a)&&(h=!1)}),h}function Gp(u,a){let h=u.length-1,A,x,E=0,P=h,D=0;for(;E<=P;)if(D=Math.floor((E+P)/2),A=u[D],x=u[D+1],A<=a){if(D===h||aa))throw new qi(\"Input is not a number.\");P=D-1}return 0}class Wp{constructor(a,h,A){this.type=a,this.input=h,this.labels=[],this.outputs=[];for(let[x,E]of A)this.labels.push(x),this.outputs.push(E)}static parse(a,h){if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");let A=h.parse(a[1],1,we);if(!A)return null;let x=[],E=null;h.expectedType&&h.expectedType.kind!==\"value\"&&(E=h.expectedType);for(let P=1;P=D)return h.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',V);let Q=h.parse(B,q,E);if(!Q)return null;E=E||Q.type,x.push([D,Q])}return new Wp(E,A,x)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;return x>=h[E-1]?A[E-1].evaluate(a):A[Gp(h,x)].evaluate(a)}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function kS(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,\"default\")?u.default:u}var RS=Sx;function Sx(u,a,h,A){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*a,this.by=3*(A-a)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=a,this.p2x=h,this.p2y=A}Sx.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,a){if(a===void 0&&(a=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,A=0;A<8;A++){var x=this.sampleCurveX(h)-u;if(Math.abs(x)x?P=h:D=h,h=.5*(D-P)+P;return h},solve:function(u,a){return this.sampleCurveY(this.solveCurveX(u,a))}};var DS=kS(RS);function gf(u,a,h){return u+h*(a-u)}function jm(u,a,h){return u.map((A,x)=>gf(A,a[x],h))}let Yo={number:gf,color:function(u,a,h,A=\"rgb\"){switch(A){case\"rgb\":{let[x,E,P,D]=jm(u.rgb,a.rgb,h);return new gi(x,E,P,D,!1)}case\"hcl\":{let[x,E,P,D]=u.hcl,[B,V,q,Q]=a.hcl,rt,ot;if(isNaN(x)||isNaN(B))isNaN(x)?isNaN(B)?rt=NaN:(rt=B,P!==1&&P!==0||(ot=V)):(rt=x,q!==1&&q!==0||(ot=E));else{let Vt=B-x;B>x&&Vt>180?Vt-=360:B180&&(Vt+=360),rt=x+h*Vt}let[lt,pt,xt,Mt]=function([Vt,It,zt,ie]){return Vt=isNaN(Vt)?0:Vt*yr,tn([zt,Math.cos(Vt)*It,Math.sin(Vt)*It,ie])}([rt,ot??gf(E,V,h),gf(P,q,h),gf(D,Q,h)]);return new gi(lt,pt,xt,Mt,!1)}case\"lab\":{let[x,E,P,D]=tn(jm(u.lab,a.lab,h));return new gi(x,E,P,D,!1)}}},array:jm,padding:function(u,a,h){return new Sn(jm(u.values,a.values,h))},variableAnchorOffsetCollection:function(u,a,h){let A=u.values,x=a.values;if(A.length!==x.length)throw new qi(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${a.toString()}`);let E=[];for(let P=0;Ptypeof q!=\"number\"||q<0||q>1))return h.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);x={name:\"cubic-bezier\",controlPoints:V}}}if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");if(E=h.parse(E,2,we),!E)return null;let D=[],B=null;A===\"interpolate-hcl\"||A===\"interpolate-lab\"?B=Ln:h.expectedType&&h.expectedType.kind!==\"value\"&&(B=h.expectedType);for(let V=0;V=q)return h.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',rt);let lt=h.parse(Q,ot,B);if(!lt)return null;B=B||lt.type,D.push([q,lt])}return jt(B,we)||jt(B,Ln)||jt(B,vt)||jt(B,nt)||jt(B,ct(we))?new wo(B,A,x,E,D):h.error(`Type ${mt(B)} is not interpolatable.`)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;if(x>=h[E-1])return A[E-1].evaluate(a);let P=Gp(h,x),D=wo.interpolationFactor(this.interpolation,x,h[P],h[P+1]),B=A[P].evaluate(a),V=A[P+1].evaluate(a);switch(this.operator){case\"interpolate\":return Yo[this.type.kind](B,V,D);case\"interpolate-hcl\":return Yo.color(B,V,D,\"hcl\");case\"interpolate-lab\":return Yo.color(B,V,D,\"lab\")}}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function yi(u,a,h,A){let x=A-h,E=u-h;return x===0?0:a===1?E/x:(Math.pow(a,E)-1)/(Math.pow(a,x)-1)}class Gm{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expectected at least one argument.\");let A=null,x=h.expectedType;x&&x.kind!==\"value\"&&(A=x);let E=[];for(let D of a.slice(1)){let B=h.parse(D,1+E.length,A,void 0,{typeAnnotation:\"omit\"});if(!B)return null;A=A||B.type,E.push(B)}if(!A)throw new Error(\"No output type\");let P=x&&E.some(D=>Dt(x,D.type));return new Gm(P?gr:A,E)}evaluate(a){let h,A=null,x=0;for(let E of this.args)if(x++,A=E.evaluate(a),A&&A instanceof Hn&&!A.available&&(h||(h=A.name),A=null,x===this.args.length&&(A=h)),A!==null)break;return A}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}class Md{constructor(a,h){this.type=h.type,this.bindings=[].concat(a),this.result=h}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(let h of this.bindings)a(h[1]);a(this.result)}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);let A=[];for(let E=1;E=A.length)throw new qi(`Array index out of bounds: ${h} > ${A.length-1}.`);if(h!==Math.floor(h))throw new qi(`Array index must be an integer, but found ${h} instead.`);return A[h]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}}class Hm{constructor(a,h){this.type=Sr,this.needle=a,this.haystack=h}static parse(a,h){if(a.length!==3)return h.error(`Expected 2 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,gr),x=h.parse(a[2],2,gr);return A&&x?Ut(A.type,[Sr,kr,we,es,gr])?new Hm(A,x):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${mt(A.type)} instead`):null}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!A)return!1;if(!ft(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new qi(`Expected first argument to be of type boolean, string, number or null, but found ${mt(fn(h))} instead.`);if(!ft(A,[\"string\",\"array\"]))throw new qi(`Expected second argument to be of type array or string, but found ${mt(fn(A))} instead.`);return A.indexOf(h)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}}class _f{constructor(a,h,A){this.type=we,this.needle=a,this.haystack=h,this.fromIndex=A}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,gr),x=h.parse(a[2],2,gr);if(!A||!x)return null;if(!Ut(A.type,[Sr,kr,we,es,gr]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${mt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,we);return E?new _f(A,x,E):null}return new _f(A,x)}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!ft(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new qi(`Expected first argument to be of type boolean, string, number or null, but found ${mt(fn(h))} instead.`);if(!ft(A,[\"string\",\"array\"]))throw new qi(`Expected second argument to be of type array or string, but found ${mt(fn(A))} instead.`);if(this.fromIndex){let x=this.fromIndex.evaluate(a);return A.indexOf(h,x)}return A.indexOf(h)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}}class Hp{constructor(a,h,A,x,E,P){this.inputType=a,this.type=h,this.input=A,this.cases=x,this.outputs=E,this.otherwise=P}static parse(a,h){if(a.length<5)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!=1)return h.error(\"Expected an even number of arguments.\");let A,x;h.expectedType&&h.expectedType.kind!==\"value\"&&(x=h.expectedType);let E={},P=[];for(let V=2;VNumber.MAX_SAFE_INTEGER)return rt.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof lt==\"number\"&&Math.floor(lt)!==lt)return rt.error(\"Numeric branch labels must be integer values.\");if(A){if(rt.checkSubtype(A,fn(lt)))return null}else A=fn(lt);if(E[String(lt)]!==void 0)return rt.error(\"Branch labels must be unique.\");E[String(lt)]=P.length}let ot=h.parse(Q,V,x);if(!ot)return null;x=x||ot.type,P.push(ot)}let D=h.parse(a[1],1,gr);if(!D)return null;let B=h.parse(a[a.length-1],a.length-1,x);return B?D.type.kind!==\"value\"&&h.concat(1).checkSubtype(A,D.type)?null:new Hp(A,x,D,E,P,B):null}evaluate(a){let h=this.input.evaluate(a);return(fn(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}}class qp{constructor(a,h,A){this.type=a,this.branches=h,this.otherwise=A}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return h.error(\"Expected an odd number of arguments.\");let A;h.expectedType&&h.expectedType.kind!==\"value\"&&(A=h.expectedType);let x=[];for(let P=1;Ph.outputDefined())&&this.otherwise.outputDefined()}}class Ed{constructor(a,h,A,x){this.type=a,this.input=h,this.beginIndex=A,this.endIndex=x}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,gr),x=h.parse(a[2],2,we);if(!A||!x)return null;if(!Ut(A.type,[ct(gr),kr,gr]))return h.error(`Expected first argument to be of type array or string, but found ${mt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,we);return E?new Ed(A.type,A,x,E):null}return new Ed(A.type,A,x)}evaluate(a){let h=this.input.evaluate(a),A=this.beginIndex.evaluate(a);if(!ft(h,[\"string\",\"array\"]))throw new qi(`Expected first argument to be of type array or string, but found ${mt(fn(h))} instead.`);if(this.endIndex){let x=this.endIndex.evaluate(a);return h.slice(A,x)}return h.slice(A)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}}function Pd(u,a){return u===\"==\"||u===\"!=\"?a.kind===\"boolean\"||a.kind===\"string\"||a.kind===\"number\"||a.kind===\"null\"||a.kind===\"value\":a.kind===\"string\"||a.kind===\"number\"||a.kind===\"value\"}function Zp(u,a,h,A){return A.compare(a,h)===0}function Fa(u,a,h){let A=u!==\"==\"&&u!==\"!=\";return class L8{constructor(E,P,D){this.type=Sr,this.lhs=E,this.rhs=P,this.collator=D,this.hasUntypedArgument=E.type.kind===\"value\"||P.type.kind===\"value\"}static parse(E,P){if(E.length!==3&&E.length!==4)return P.error(\"Expected two or three arguments.\");let D=E[0],B=P.parse(E[1],1,gr);if(!B)return null;if(!Pd(D,B.type))return P.concat(1).error(`\"${D}\" comparisons are not supported for type '${mt(B.type)}'.`);let V=P.parse(E[2],2,gr);if(!V)return null;if(!Pd(D,V.type))return P.concat(2).error(`\"${D}\" comparisons are not supported for type '${mt(V.type)}'.`);if(B.type.kind!==V.type.kind&&B.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(`Cannot compare types '${mt(B.type)}' and '${mt(V.type)}'.`);A&&(B.type.kind===\"value\"&&V.type.kind!==\"value\"?B=new oo(V.type,[B]):B.type.kind!==\"value\"&&V.type.kind===\"value\"&&(V=new oo(B.type,[V])));let q=null;if(E.length===4){if(B.type.kind!==\"string\"&&V.type.kind!==\"string\"&&B.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(\"Cannot use collator to compare non-string types.\");if(q=P.parse(E[3],3,Ec),!q)return null}return new L8(B,V,q)}evaluate(E){let P=this.lhs.evaluate(E),D=this.rhs.evaluate(E);if(A&&this.hasUntypedArgument){let B=fn(P),V=fn(D);if(B.kind!==V.kind||B.kind!==\"string\"&&B.kind!==\"number\")throw new qi(`Expected arguments for \"${u}\" to be (string, string) or (number, number), but found (${B.kind}, ${V.kind}) instead.`)}if(this.collator&&!A&&this.hasUntypedArgument){let B=fn(P),V=fn(D);if(B.kind!==\"string\"||V.kind!==\"string\")return a(E,P,D)}return this.collator?h(E,P,D,this.collator.evaluate(E)):a(E,P,D)}eachChild(E){E(this.lhs),E(this.rhs),this.collator&&E(this.collator)}outputDefined(){return!0}}}let qt=Fa(\"==\",function(u,a,h){return a===h},Zp),de=Fa(\"!=\",function(u,a,h){return a!==h},function(u,a,h,A){return!Zp(0,a,h,A)}),Re=Fa(\"<\",function(u,a,h){return a\",function(u,a,h){return a>h},function(u,a,h,A){return A.compare(a,h)>0}),g=Fa(\"<=\",function(u,a,h){return a<=h},function(u,a,h,A){return A.compare(a,h)<=0}),Ni=Fa(\">=\",function(u,a,h){return a>=h},function(u,a,h,A){return A.compare(a,h)>=0});class vi{constructor(a,h,A,x,E){this.type=kr,this.number=a,this.locale=h,this.currency=A,this.minFractionDigits=x,this.maxFractionDigits=E}static parse(a,h){if(a.length!==3)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,we);if(!A)return null;let x=a[2];if(typeof x!=\"object\"||Array.isArray(x))return h.error(\"NumberFormat options argument must be an object.\");let E=null;if(x.locale&&(E=h.parse(x.locale,1,kr),!E))return null;let P=null;if(x.currency&&(P=h.parse(x.currency,1,kr),!P))return null;let D=null;if(x[\"min-fraction-digits\"]&&(D=h.parse(x[\"min-fraction-digits\"],1,we),!D))return null;let B=null;return x[\"max-fraction-digits\"]&&(B=h.parse(x[\"max-fraction-digits\"],1,we),!B)?null:new vi(A,E,P,D,B)}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?\"currency\":\"decimal\",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}}class bt{constructor(a){this.type=Gn,this.sections=a}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[1];if(!Array.isArray(A)&&typeof A==\"object\")return h.error(\"First argument must be an image or text section.\");let x=[],E=!1;for(let P=1;P<=a.length-1;++P){let D=a[P];if(E&&typeof D==\"object\"&&!Array.isArray(D)){E=!1;let B=null;if(D[\"font-scale\"]&&(B=h.parse(D[\"font-scale\"],1,we),!B))return null;let V=null;if(D[\"text-font\"]&&(V=h.parse(D[\"text-font\"],1,ct(kr)),!V))return null;let q=null;if(D[\"text-color\"]&&(q=h.parse(D[\"text-color\"],1,Ln),!q))return null;let Q=x[x.length-1];Q.scale=B,Q.font=V,Q.textColor=q}else{let B=h.parse(a[P],1,gr);if(!B)return null;let V=B.type.kind;if(V!==\"string\"&&V!==\"value\"&&V!==\"null\"&&V!==\"resolvedImage\")return h.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");E=!0,x.push({content:B,scale:null,font:null,textColor:null})}}return new bt(x)}evaluate(a){return new Wn(this.sections.map(h=>{let A=h.content.evaluate(a);return fn(A)===tt?new Pc(\"\",A,null,null,null):new Pc(so(A),null,h.scale?h.scale.evaluate(a):null,h.font?h.font.evaluate(a).join(\",\"):null,h.textColor?h.textColor.evaluate(a):null)}))}eachChild(a){for(let h of this.sections)a(h.content),h.scale&&a(h.scale),h.font&&a(h.font),h.textColor&&a(h.textColor)}outputDefined(){return!1}}class Es{constructor(a){this.type=tt,this.input=a}static parse(a,h){if(a.length!==2)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,kr);return A?new Es(A):h.error(\"No image name provided.\")}evaluate(a){let h=this.input.evaluate(a),A=Hn.fromString(h);return A&&a.availableImages&&(A.available=a.availableImages.indexOf(h)>-1),A}eachChild(a){a(this.input)}outputDefined(){return!1}}class ao{constructor(a){this.type=we,this.input=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);let A=h.parse(a[1],1);return A?A.type.kind!==\"array\"&&A.type.kind!==\"string\"&&A.type.kind!==\"value\"?h.error(`Expected argument of type string or array, but found ${mt(A.type)} instead.`):new ao(A):null}evaluate(a){let h=this.input.evaluate(a);if(typeof h==\"string\"||Array.isArray(h))return h.length;throw new qi(`Expected value to be of type string or array, but found ${mt(fn(h))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}}let Yr={\"==\":qt,\"!=\":de,\">\":vr,\"<\":Re,\">=\":Ni,\"<=\":g,array:oo,at:Wm,boolean:oo,case:qp,coalesce:Gm,collator:Ic,format:bt,image:Es,in:Hm,\"index-of\":_f,interpolate:wo,\"interpolate-hcl\":wo,\"interpolate-lab\":wo,length:ao,let:Md,literal:Da,match:Hp,number:oo,\"number-format\":vi,object:oo,slice:Ed,step:Wp,string:oo,\"to-boolean\":Zo,\"to-color\":Zo,\"to-number\":Zo,\"to-string\":Zo,var:Um,within:mf};function dn(u,[a,h,A,x]){a=a.evaluate(u),h=h.evaluate(u),A=A.evaluate(u);let E=x?x.evaluate(u):1,P=du(a,h,A,E);if(P)throw new qi(P);return new gi(a/255,h/255,A/255,E,!1)}function zl(u,a){return u in a}function Jr(u,a){let h=a[u];return h===void 0?null:h}function $r(u){return{type:u}}function Cc(u){return{result:\"success\",value:u}}function yf(u){return{result:\"error\",value:u}}function vf(u){return u[\"property-type\"]===\"data-driven\"||u[\"property-type\"]===\"cross-faded-data-driven\"}function Yp(u){return!!u.expression&&u.expression.parameters.indexOf(\"zoom\")>-1}function $o(u){return!!u.expression&&u.expression.interpolated}function oi(u){return u instanceof Number?\"number\":u instanceof String?\"string\":u instanceof Boolean?\"boolean\":Array.isArray(u)?\"array\":u===null?\"null\":typeof u}function za(u){return typeof u==\"object\"&&u!==null&&!Array.isArray(u)}function Tx(u){return u}function pu(u,a){let h=a.type===\"color\",A=u.stops&&typeof u.stops[0][0]==\"object\",x=A||!(A||u.property!==void 0),E=u.type||($o(a)?\"exponential\":\"interval\");if(h||a.type===\"padding\"){let q=h?gi.parse:Sn.parse;(u=qo({},u)).stops&&(u.stops=u.stops.map(Q=>[Q[0],q(Q[1])])),u.default=q(u.default?u.default:a.default)}if(u.colorSpace&&(P=u.colorSpace)!==\"rgb\"&&P!==\"hcl\"&&P!==\"lab\")throw new Error(`Unknown color space: \"${u.colorSpace}\"`);var P;let D,B,V;if(E===\"exponential\")D=ai;else if(E===\"interval\")D=ki;else if(E===\"categorical\"){D=Pt,B=Object.create(null);for(let q of u.stops)B[q[0]]=q[1];V=typeof u.stops[0][0]}else{if(E!==\"identity\")throw new Error(`Unknown function type \"${E}\"`);D=qm}if(A){let q={},Q=[];for(let lt=0;ltlt[0]),evaluate:({zoom:lt},pt)=>ai({stops:rt,base:u.base},a,lt).evaluate(lt,pt)}}if(x){let q=E===\"exponential\"?{name:\"exponential\",base:u.base!==void 0?u.base:1}:null;return{kind:\"camera\",interpolationType:q,interpolationFactor:wo.interpolationFactor.bind(void 0,q),zoomStops:u.stops.map(Q=>Q[0]),evaluate:({zoom:Q})=>D(u,a,Q,B,V)}}return{kind:\"source\",evaluate(q,Q){let rt=Q&&Q.properties?Q.properties[u.property]:void 0;return rt===void 0?Tr(u.default,a.default):D(u,a,rt,B,V)}}}function Tr(u,a,h){return u!==void 0?u:a!==void 0?a:h!==void 0?h:void 0}function Pt(u,a,h,A,x){return Tr(typeof h===x?A[h]:void 0,u.default,a.default)}function ki(u,a,h){if(oi(h)!==\"number\")return Tr(u.default,a.default);let A=u.stops.length;if(A===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[A-1][0])return u.stops[A-1][1];let x=Gp(u.stops.map(E=>E[0]),h);return u.stops[x][1]}function ai(u,a,h){let A=u.base!==void 0?u.base:1;if(oi(h)!==\"number\")return Tr(u.default,a.default);let x=u.stops.length;if(x===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[x-1][0])return u.stops[x-1][1];let E=Gp(u.stops.map(q=>q[0]),h),P=function(q,Q,rt,ot){let lt=ot-rt,pt=q-rt;return lt===0?0:Q===1?pt/lt:(Math.pow(Q,pt)-1)/(Math.pow(Q,lt)-1)}(h,A,u.stops[E][0],u.stops[E+1][0]),D=u.stops[E][1],B=u.stops[E+1][1],V=Yo[a.type]||Tx;return typeof D.evaluate==\"function\"?{evaluate(...q){let Q=D.evaluate.apply(void 0,q),rt=B.evaluate.apply(void 0,q);if(Q!==void 0&&rt!==void 0)return V(Q,rt,P,u.colorSpace)}}:V(D,B,P,u.colorSpace)}function qm(u,a,h){switch(a.type){case\"color\":h=gi.parse(h);break;case\"formatted\":h=Wn.fromString(h.toString());break;case\"resolvedImage\":h=Hn.fromString(h.toString());break;case\"padding\":h=Sn.parse(h);break;default:oi(h)===a.type||a.type===\"enum\"&&a.values[h]||(h=void 0)}return Tr(h,u.default,a.default)}Ba.register(Yr,{error:[{kind:\"error\"},[kr],(u,[a])=>{throw new qi(a.evaluate(u))}],typeof:[kr,[gr],(u,[a])=>mt(fn(a.evaluate(u)))],\"to-rgba\":[ct(we,4),[Ln],(u,[a])=>{let[h,A,x,E]=a.evaluate(u).rgb;return[255*h,255*A,255*x,E]}],rgb:[Ln,[we,we,we],dn],rgba:[Ln,[we,we,we,we],dn],has:{type:Sr,overloads:[[[kr],(u,[a])=>zl(a.evaluate(u),u.properties())],[[kr,Ra],(u,[a,h])=>zl(a.evaluate(u),h.evaluate(u))]]},get:{type:gr,overloads:[[[kr],(u,[a])=>Jr(a.evaluate(u),u.properties())],[[kr,Ra],(u,[a,h])=>Jr(a.evaluate(u),h.evaluate(u))]]},\"feature-state\":[gr,[kr],(u,[a])=>Jr(a.evaluate(u),u.featureState||{})],properties:[Ra,[],u=>u.properties()],\"geometry-type\":[kr,[],u=>u.geometryType()],id:[gr,[],u=>u.id()],zoom:[we,[],u=>u.globals.zoom],\"heatmap-density\":[we,[],u=>u.globals.heatmapDensity||0],\"line-progress\":[we,[],u=>u.globals.lineProgress||0],accumulated:[gr,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],\"+\":[we,$r(we),(u,a)=>{let h=0;for(let A of a)h+=A.evaluate(u);return h}],\"*\":[we,$r(we),(u,a)=>{let h=1;for(let A of a)h*=A.evaluate(u);return h}],\"-\":{type:we,overloads:[[[we,we],(u,[a,h])=>a.evaluate(u)-h.evaluate(u)],[[we],(u,[a])=>-a.evaluate(u)]]},\"/\":[we,[we,we],(u,[a,h])=>a.evaluate(u)/h.evaluate(u)],\"%\":[we,[we,we],(u,[a,h])=>a.evaluate(u)%h.evaluate(u)],ln2:[we,[],()=>Math.LN2],pi:[we,[],()=>Math.PI],e:[we,[],()=>Math.E],\"^\":[we,[we,we],(u,[a,h])=>Math.pow(a.evaluate(u),h.evaluate(u))],sqrt:[we,[we],(u,[a])=>Math.sqrt(a.evaluate(u))],log10:[we,[we],(u,[a])=>Math.log(a.evaluate(u))/Math.LN10],ln:[we,[we],(u,[a])=>Math.log(a.evaluate(u))],log2:[we,[we],(u,[a])=>Math.log(a.evaluate(u))/Math.LN2],sin:[we,[we],(u,[a])=>Math.sin(a.evaluate(u))],cos:[we,[we],(u,[a])=>Math.cos(a.evaluate(u))],tan:[we,[we],(u,[a])=>Math.tan(a.evaluate(u))],asin:[we,[we],(u,[a])=>Math.asin(a.evaluate(u))],acos:[we,[we],(u,[a])=>Math.acos(a.evaluate(u))],atan:[we,[we],(u,[a])=>Math.atan(a.evaluate(u))],min:[we,$r(we),(u,a)=>Math.min(...a.map(h=>h.evaluate(u)))],max:[we,$r(we),(u,a)=>Math.max(...a.map(h=>h.evaluate(u)))],abs:[we,[we],(u,[a])=>Math.abs(a.evaluate(u))],round:[we,[we],(u,[a])=>{let h=a.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[we,[we],(u,[a])=>Math.floor(a.evaluate(u))],ceil:[we,[we],(u,[a])=>Math.ceil(a.evaluate(u))],\"filter-==\":[Sr,[kr,gr],(u,[a,h])=>u.properties()[a.value]===h.value],\"filter-id-==\":[Sr,[gr],(u,[a])=>u.id()===a.value],\"filter-type-==\":[Sr,[kr],(u,[a])=>u.geometryType()===a.value],\"filter-<\":[Sr,[kr,gr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A{let h=u.id(),A=a.value;return typeof h==typeof A&&h\":[Sr,[kr,gr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>x}],\"filter-id->\":[Sr,[gr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>A}],\"filter-<=\":[Sr,[kr,gr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A<=x}],\"filter-id-<=\":[Sr,[gr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h<=A}],\"filter->=\":[Sr,[kr,gr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>=x}],\"filter-id->=\":[Sr,[gr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>=A}],\"filter-has\":[Sr,[gr],(u,[a])=>a.value in u.properties()],\"filter-has-id\":[Sr,[],u=>u.id()!==null&&u.id()!==void 0],\"filter-type-in\":[Sr,[ct(kr)],(u,[a])=>a.value.indexOf(u.geometryType())>=0],\"filter-id-in\":[Sr,[ct(gr)],(u,[a])=>a.value.indexOf(u.id())>=0],\"filter-in-small\":[Sr,[kr,ct(gr)],(u,[a,h])=>h.value.indexOf(u.properties()[a.value])>=0],\"filter-in-large\":[Sr,[kr,ct(gr)],(u,[a,h])=>function(A,x,E,P){for(;E<=P;){let D=E+P>>1;if(x[D]===A)return!0;x[D]>A?P=D-1:E=D+1}return!1}(u.properties()[a.value],h.value,0,h.value.length-1)],all:{type:Sr,overloads:[[[Sr,Sr],(u,[a,h])=>a.evaluate(u)&&h.evaluate(u)],[$r(Sr),(u,a)=>{for(let h of a)if(!h.evaluate(u))return!1;return!0}]]},any:{type:Sr,overloads:[[[Sr,Sr],(u,[a,h])=>a.evaluate(u)||h.evaluate(u)],[$r(Sr),(u,a)=>{for(let h of a)if(h.evaluate(u))return!0;return!1}]]},\"!\":[Sr,[Sr],(u,[a])=>!a.evaluate(u)],\"is-supported-script\":[Sr,[kr],(u,[a])=>{let h=u.globals&&u.globals.isSupportedScript;return!h||h(a.evaluate(u))}],upcase:[kr,[kr],(u,[a])=>a.evaluate(u).toUpperCase()],downcase:[kr,[kr],(u,[a])=>a.evaluate(u).toLowerCase()],concat:[kr,$r(gr),(u,a)=>a.map(h=>so(h.evaluate(u))).join(\"\")],\"resolved-locale\":[kr,[Ec],(u,[a])=>a.evaluate(u).resolvedLocale()]});class rn{constructor(a,h){var A;this.expression=a,this._warningHistory={},this._evaluator=new Mi,this._defaultValue=h?(A=h).type===\"color\"&&za(A.default)?new gi(0,0,0,0):A.type===\"color\"?gi.parse(A.default)||null:A.type===\"padding\"?Sn.parse(A.default)||null:A.type===\"variableAnchorOffsetCollection\"?Rn.parse(A.default)||null:A.default===void 0?null:A.default:null,this._enumValues=h&&h.type===\"enum\"?h.values:null}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._evaluator.globals=a,this._evaluator.feature=h,this._evaluator.featureState=A,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P,this.expression.evaluate(this._evaluator)}evaluate(a,h,A,x,E,P){this._evaluator.globals=a,this._evaluator.feature=h||null,this._evaluator.featureState=A||null,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P||null;try{let D=this.expression.evaluate(this._evaluator);if(D==null||typeof D==\"number\"&&D!=D)return this._defaultValue;if(this._enumValues&&!(D in this._enumValues))throw new qi(`Expected value to be one of ${Object.keys(this._enumValues).map(B=>JSON.stringify(B)).join(\", \")}, but found ${JSON.stringify(D)} instead.`);return D}catch(D){return this._warningHistory[D.message]||(this._warningHistory[D.message]=!0,typeof console<\"u\"&&console.warn(D.message)),this._defaultValue}}}function Ui(u){return Array.isArray(u)&&u.length>0&&typeof u[0]==\"string\"&&u[0]in Yr}function hh(u,a){let h=new pf(Yr,Up,[],a?function(x){let E={color:Ln,string:kr,number:we,enum:kr,boolean:Sr,formatted:Gn,padding:vt,resolvedImage:tt,variableAnchorOffsetCollection:nt};return x.type===\"array\"?ct(E[x.value]||gr,x.length):E[x.type]}(a):void 0),A=h.parse(u,void 0,void 0,void 0,a&&a.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return A?Cc(new rn(A,a)):yf(h.errors)}class wt{constructor(a,h){this.kind=a,this._styleExpression=h,this.isStateDependent=a!==\"constant\"&&!Vp(h.expression)}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}}class Zm{constructor(a,h,A,x){this.kind=a,this.zoomStops=A,this._styleExpression=h,this.isStateDependent=a!==\"camera\"&&!Vp(h.expression),this.interpolationType=x}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}interpolationFactor(a,h,A){return this.interpolationType?wo.interpolationFactor(this.interpolationType,a,h,A):0}}function Xg(u,a){let h=hh(u,a);if(h.result===\"error\")return h;let A=h.value.expression,x=Vm(A);if(!x&&!vf(a))return yf([new jn(\"\",\"data expressions not supported\")]);let E=jp(A,[\"zoom\"]);if(!E&&!Yp(a))return yf([new jn(\"\",\"zoom expressions not supported\")]);let P=Qp(A);return P||E?P instanceof jn?yf([P]):P instanceof wo&&!$o(a)?yf([new jn(\"\",'\"interpolate\" expressions cannot be used with this property')]):Cc(P?new Zm(x?\"camera\":\"composite\",h.value,P.labels,P instanceof wo?P.interpolation:void 0):new wt(x?\"constant\":\"source\",h.value)):yf([new jn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')])}class $p{constructor(a,h){this._parameters=a,this._specification=h,qo(this,pu(this._parameters,this._specification))}static deserialize(a){return new $p(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function Qp(u){let a=null;if(u instanceof Md)a=Qp(u.result);else if(u instanceof Gm){for(let h of u.args)if(a=Qp(h),a)break}else(u instanceof Wp||u instanceof wo)&&u.input instanceof Ba&&u.input.name===\"zoom\"&&(a=u);return a instanceof jn||u.eachChild(h=>{let A=Qp(h);A instanceof jn?a=A:!a&&A?a=new jn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):a&&A&&a!==A&&(a=new jn(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),a}function Xp(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case\"has\":return u.length>=2&&u[1]!==\"$id\"&&u[1]!==\"$type\";case\"in\":return u.length>=3&&(typeof u[1]!=\"string\"||Array.isArray(u[2]));case\"!in\":case\"!has\":case\"none\":return!1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case\"any\":case\"all\":for(let a of u.slice(1))if(!Xp(a)&&typeof a!=\"boolean\")return!1;return!0;default:return!0}}let Kg={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function Id(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Xp(u)||(u=ha(u));let a=hh(u,Kg);if(a.result===\"error\")throw new Error(a.value.map(h=>`${h.key}: ${h.message}`).join(\", \"));return{filter:(h,A,x)=>a.value.evaluate(h,A,{},x),needGeometry:xf(u)}}function Jg(u,a){return ua?1:0}function xf(u){if(!Array.isArray(u))return!1;if(u[0]===\"within\")return!0;for(let a=1;a\"||a===\"<=\"||a===\">=\"?Dn(u[1],u[2],a):a===\"any\"?(h=u.slice(1),[\"any\"].concat(h.map(ha))):a===\"all\"?[\"all\"].concat(u.slice(1).map(ha)):a===\"none\"?[\"all\"].concat(u.slice(1).map(ha).map(Kp)):a===\"in\"?t_(u[1],u.slice(2)):a===\"!in\"?Kp(t_(u[1],u.slice(2))):a===\"has\"?e_(u[1]):a===\"!has\"?Kp(e_(u[1])):a!==\"within\"||u;var h}function Dn(u,a,h){switch(u){case\"$type\":return[`filter-type-${h}`,a];case\"$id\":return[`filter-id-${h}`,a];default:return[`filter-${h}`,u,a]}}function t_(u,a){if(a.length===0)return!1;switch(u){case\"$type\":return[\"filter-type-in\",[\"literal\",a]];case\"$id\":return[\"filter-id-in\",[\"literal\",a]];default:return a.length>200&&!a.some(h=>typeof h!=typeof a[0])?[\"filter-in-large\",u,[\"literal\",a.sort(Jg)]]:[\"filter-in-small\",u,[\"literal\",a]]}}function e_(u){switch(u){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",u]}}function Kp(u){return[\"!\",u]}function Ym(u){let a=typeof u;if(a===\"number\"||a===\"boolean\"||a===\"string\"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let x=\"[\";for(let E of u)x+=`${Ym(E)},`;return`${x}]`}let h=Object.keys(u).sort(),A=\"{\";for(let x=0;xA.maximum?[new me(a,h,`${h} is greater than the maximum value ${A.maximum}`)]:[]}function n_(u){let a=u.valueSpec,h=Tn(u.value.type),A,x,E,P={},D=h!==\"categorical\"&&u.value.property===void 0,B=!D,V=oi(u.value.stops)===\"array\"&&oi(u.value.stops[0])===\"array\"&&oi(u.value.stops[0][0])===\"object\",q=Us({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(ot){if(h===\"identity\")return[new me(ot.key,ot.value,'identity function may not have a \"stops\" property')];let lt=[],pt=ot.value;return lt=lt.concat(Jp({key:ot.key,value:pt,valueSpec:ot.valueSpec,validateSpec:ot.validateSpec,style:ot.style,styleSpec:ot.styleSpec,arrayElementValidator:Q})),oi(pt)===\"array\"&&pt.length===0&<.push(new me(ot.key,pt,\"array must have at least one stop\")),lt},default:function(ot){return ot.validateSpec({key:ot.key,value:ot.value,valueSpec:a,validateSpec:ot.validateSpec,style:ot.style,styleSpec:ot.styleSpec})}}});return h===\"identity\"&&D&&q.push(new me(u.key,u.value,'missing required property \"property\"')),h===\"identity\"||u.value.stops||q.push(new me(u.key,u.value,'missing required property \"stops\"')),h===\"exponential\"&&u.valueSpec.expression&&!$o(u.valueSpec)&&q.push(new me(u.key,u.value,\"exponential functions not supported\")),u.styleSpec.$version>=8&&(B&&!vf(u.valueSpec)?q.push(new me(u.key,u.value,\"property functions not supported\")):D&&!Yp(u.valueSpec)&&q.push(new me(u.key,u.value,\"zoom functions not supported\"))),h!==\"categorical\"&&!V||u.value.property!==void 0||q.push(new me(u.key,u.value,'\"property\" property is required')),q;function Q(ot){let lt=[],pt=ot.value,xt=ot.key;if(oi(pt)!==\"array\")return[new me(xt,pt,`array expected, ${oi(pt)} found`)];if(pt.length!==2)return[new me(xt,pt,`array length 2 expected, length ${pt.length} found`)];if(V){if(oi(pt[0])!==\"object\")return[new me(xt,pt,`object expected, ${oi(pt[0])} found`)];if(pt[0].zoom===void 0)return[new me(xt,pt,\"object stop key must have zoom\")];if(pt[0].value===void 0)return[new me(xt,pt,\"object stop key must have value\")];if(E&&E>Tn(pt[0].zoom))return[new me(xt,pt[0].zoom,\"stop zoom values must appear in ascending order\")];Tn(pt[0].zoom)!==E&&(E=Tn(pt[0].zoom),x=void 0,P={}),lt=lt.concat(Us({key:`${xt}[0]`,value:pt[0],valueSpec:{zoom:{}},validateSpec:ot.validateSpec,style:ot.style,styleSpec:ot.styleSpec,objectElementValidators:{zoom:tA,value:rt}}))}else lt=lt.concat(rt({key:`${xt}[0]`,value:pt[0],valueSpec:{},validateSpec:ot.validateSpec,style:ot.style,styleSpec:ot.styleSpec},pt));return Ui(Ei(pt[1]))?lt.concat([new me(`${xt}[1]`,pt[1],\"expressions are not allowed in function stops.\")]):lt.concat(ot.validateSpec({key:`${xt}[1]`,value:pt[1],valueSpec:a,validateSpec:ot.validateSpec,style:ot.style,styleSpec:ot.styleSpec}))}function rt(ot,lt){let pt=oi(ot.value),xt=Tn(ot.value),Mt=ot.value!==null?ot.value:lt;if(A){if(pt!==A)return[new me(ot.key,Mt,`${pt} stop domain type must match previous stop domain type ${A}`)]}else A=pt;if(pt!==\"number\"&&pt!==\"string\"&&pt!==\"boolean\")return[new me(ot.key,Mt,\"stop domain value must be a number, string, or boolean\")];if(pt!==\"number\"&&h!==\"categorical\"){let Vt=`number expected, ${pt} found`;return vf(a)&&h===void 0&&(Vt+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new me(ot.key,Mt,Vt)]}return h!==\"categorical\"||pt!==\"number\"||isFinite(xt)&&Math.floor(xt)===xt?h!==\"categorical\"&&pt===\"number\"&&x!==void 0&&xtnew me(`${u.key}${A.key}`,u.value,A.message));let h=a.value.expression||a.value._styleExpression.expression;if(u.expressionContext===\"property\"&&u.propertyKey===\"text-font\"&&!h.outputDefined())return[new me(u.key,u.value,`Invalid data expression for \"${u.propertyKey}\". Output values must be contained as literals within the expression.`)];if(u.expressionContext===\"property\"&&u.propertyType===\"layout\"&&!Vp(h))return[new me(u.key,u.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(u.expressionContext===\"filter\"&&!Vp(h))return[new me(u.key,u.value,'\"feature-state\" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf(\"cluster\")===0){if(!jp(h,[\"zoom\",\"feature-state\"]))return[new me(u.key,u.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(u.expressionContext===\"cluster-initial\"&&!Vm(h))return[new me(u.key,u.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function Lc(u){let a=u.key,h=u.value,A=u.valueSpec,x=[];return Array.isArray(A.values)?A.values.indexOf(Tn(h))===-1&&x.push(new me(a,h,`expected one of [${A.values.join(\", \")}], ${JSON.stringify(h)} found`)):Object.keys(A.values).indexOf(Tn(h))===-1&&x.push(new me(a,h,`expected one of [${Object.keys(A.values).join(\", \")}], ${JSON.stringify(h)} found`)),x}function mu(u){return Xp(Ei(u.value))?Au(qo({},u,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}})):bf(u)}function bf(u){let a=u.value,h=u.key;if(oi(a)!==\"array\")return[new me(h,a,`array expected, ${oi(a)} found`)];let A=u.styleSpec,x,E=[];if(a.length<1)return[new me(h,a,\"filter array must have at least 1 element\")];switch(E=E.concat(Lc({key:`${h}[0]`,value:a[0],valueSpec:A.filter_operator,style:u.style,styleSpec:u.styleSpec})),Tn(a[0])){case\"<\":case\"<=\":case\">\":case\">=\":a.length>=2&&Tn(a[1])===\"$type\"&&E.push(new me(h,a,`\"$type\" cannot be use with operator \"${a[0]}\"`));case\"==\":case\"!=\":a.length!==3&&E.push(new me(h,a,`filter array for operator \"${a[0]}\" must have 3 elements`));case\"in\":case\"!in\":a.length>=2&&(x=oi(a[1]),x!==\"string\"&&E.push(new me(`${h}[1]`,a[1],`string expected, ${x} found`)));for(let P=2;P{V in h&&a.push(new me(A,h[V],`\"${V}\" is prohibited for ref layers`))}),x.layers.forEach(V=>{Tn(V.id)===D&&(B=V)}),B?B.ref?a.push(new me(A,h.ref,\"ref cannot reference another ref layer\")):P=Tn(B.type):a.push(new me(A,h.ref,`ref layer \"${D}\" not found`))}else if(P!==\"background\")if(h.source){let B=x.sources&&x.sources[h.source],V=B&&Tn(B.type);B?V===\"vector\"&&P===\"raster\"?a.push(new me(A,h.source,`layer \"${h.id}\" requires a raster source`)):V!==\"raster-dem\"&&P===\"hillshade\"?a.push(new me(A,h.source,`layer \"${h.id}\" requires a raster-dem source`)):V===\"raster\"&&P!==\"raster\"?a.push(new me(A,h.source,`layer \"${h.id}\" requires a vector source`)):V!==\"vector\"||h[\"source-layer\"]?V===\"raster-dem\"&&P!==\"hillshade\"?a.push(new me(A,h.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):P!==\"line\"||!h.paint||!h.paint[\"line-gradient\"]||V===\"geojson\"&&B.lineMetrics||a.push(new me(A,h,`layer \"${h.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):a.push(new me(A,h,`layer \"${h.id}\" must specify a \"source-layer\"`)):a.push(new me(A,h.source,`source \"${h.source}\" not found`))}else a.push(new me(A,h,'missing required property \"source\"'));return a=a.concat(Us({key:A,value:h,valueSpec:E.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{\"*\":()=>[],type:()=>u.validateSpec({key:`${A}.type`,value:h.type,valueSpec:E.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:\"type\"}),filter:mu,layout:B=>Us({layer:h,key:B.key,value:B.value,style:B.style,styleSpec:B.styleSpec,validateSpec:B.validateSpec,objectElementValidators:{\"*\":V=>wf(qo({layerType:P},V))}}),paint:B=>Us({layer:h,key:B.key,value:B.value,style:B.style,styleSpec:B.styleSpec,validateSpec:B.validateSpec,objectElementValidators:{\"*\":V=>Qm(qo({layerType:P},V))}})}})),a}function kc(u){let a=u.value,h=u.key,A=oi(a);return A!==\"string\"?[new me(h,a,`string expected, ${A} found`)]:[]}let s_={promoteId:function({key:u,value:a}){if(oi(a)===\"string\")return kc({key:u,value:a});{let h=[];for(let A in a)h.push(...kc({key:`${u}.${A}`,value:a[A]}));return h}}};function o_(u){let a=u.value,h=u.key,A=u.styleSpec,x=u.style,E=u.validateSpec;if(!a.type)return[new me(h,a,'\"type\" is required')];let P=Tn(a.type),D;switch(P){case\"vector\":case\"raster\":return D=Us({key:h,value:a,valueSpec:A[`source_${P.replace(\"-\",\"_\")}`],style:u.style,styleSpec:A,objectElementValidators:s_,validateSpec:E}),D;case\"raster-dem\":return D=function(B){var V;let q=(V=B.sourceName)!==null&&V!==void 0?V:\"\",Q=B.value,rt=B.styleSpec,ot=rt.source_raster_dem,lt=B.style,pt=[],xt=oi(Q);if(Q===void 0)return pt;if(xt!==\"object\")return pt.push(new me(\"source_raster_dem\",Q,`object expected, ${xt} found`)),pt;let Mt=Tn(Q.encoding)===\"custom\",Vt=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],It=B.value.encoding?`\"${B.value.encoding}\"`:\"Default\";for(let zt in Q)!Mt&&Vt.includes(zt)?pt.push(new me(zt,Q[zt],`In \"${q}\": \"${zt}\" is only valid when \"encoding\" is set to \"custom\". ${It} encoding found`)):ot[zt]?pt=pt.concat(B.validateSpec({key:zt,value:Q[zt],valueSpec:ot[zt],validateSpec:B.validateSpec,style:lt,styleSpec:rt})):pt.push(new me(zt,Q[zt],`unknown property \"${zt}\"`));return pt}({sourceName:h,value:a,style:u.style,styleSpec:A,validateSpec:E}),D;case\"geojson\":if(D=Us({key:h,value:a,valueSpec:A.source_geojson,style:x,styleSpec:A,validateSpec:E,objectElementValidators:s_}),a.cluster)for(let B in a.clusterProperties){let[V,q]=a.clusterProperties[B],Q=typeof V==\"string\"?[V,[\"accumulated\"],[\"get\",B]]:V;D.push(...Au({key:`${h}.${B}.map`,value:q,validateSpec:E,expressionContext:\"cluster-map\"})),D.push(...Au({key:`${h}.${B}.reduce`,value:Q,validateSpec:E,expressionContext:\"cluster-reduce\"}))}return D;case\"video\":return Us({key:h,value:a,valueSpec:A.source_video,style:x,validateSpec:E,styleSpec:A});case\"image\":return Us({key:h,value:a,valueSpec:A.source_image,style:x,validateSpec:E,styleSpec:A});case\"canvas\":return[new me(h,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return Lc({key:`${h}.type`,value:a.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:x,validateSpec:E,styleSpec:A})}}function a_(u){let a=u.value,h=u.styleSpec,A=h.light,x=u.style,E=[],P=oi(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new me(\"light\",a,`object expected, ${P} found`)]),E;for(let D in a){let B=D.match(/^(.*)-transition$/);E=E.concat(B&&A[B[1]]&&A[B[1]].transition?u.validateSpec({key:D,value:a[D],valueSpec:h.transition,validateSpec:u.validateSpec,style:x,styleSpec:h}):A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new me(D,a[D],`unknown property \"${D}\"`)])}return E}function ns(u){let a=u.value,h=u.styleSpec,A=h.sky,x=u.style,E=oi(a);if(a===void 0)return[];if(E!==\"object\")return[new me(\"sky\",a,`object expected, ${E} found`)];let P=[];for(let D in a)P=P.concat(A[D]?_u({key:D,value:a[D],valueSpec:A[D],style:x,styleSpec:h}):[new me(D,a[D],`unknown property \"${D}\"`)]);return P}function al(u){let a=u.value,h=u.styleSpec,A=h.terrain,x=u.style,E=[],P=oi(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new me(\"terrain\",a,`object expected, ${P} found`)]),E;for(let D in a)E=E.concat(A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new me(D,a[D],`unknown property \"${D}\"`)]);return E}function Vi(u){let a=[],h=u.value,A=u.key;if(Array.isArray(h)){let x=[],E=[];for(let P in h)h[P].id&&x.includes(h[P].id)&&a.push(new me(A,h,`all the sprites' ids must be unique, but ${h[P].id} is duplicated`)),x.push(h[P].id),h[P].url&&E.includes(h[P].url)&&a.push(new me(A,h,`all the sprites' URLs must be unique, but ${h[P].url} is duplicated`)),E.push(h[P].url),a=a.concat(Us({key:`${A}[${P}]`,value:h[P],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:u.validateSpec}));return a}return kc({key:A,value:h})}let gu={\"*\":()=>[],array:Jp,boolean:function(u){let a=u.value,h=u.key,A=oi(a);return A!==\"boolean\"?[new me(h,a,`boolean expected, ${A} found`)]:[]},number:tA,color:function(u){let a=u.key,h=u.value,A=oi(h);return A!==\"string\"?[new me(a,h,`color expected, ${A} found`)]:gi.parse(String(h))?[]:[new me(a,h,`color expected, \"${h}\" found`)]},constants:i_,enum:Lc,filter:mu,function:n_,layer:Xm,object:Us,source:o_,light:a_,sky:ns,terrain:al,string:kc,formatted:function(u){return kc(u).length===0?[]:Au(u)},resolvedImage:function(u){return kc(u).length===0?[]:Au(u)},padding:function(u){let a=u.key,h=u.value;if(oi(h)===\"array\"){if(h.length<1||h.length>4)return[new me(a,h,`padding requires 1 to 4 values; ${h.length} values found`)];let A={type:\"number\"},x=[];for(let E=0;E[]}})),u.constants&&(h=h.concat(i_({key:\"constants\",value:u.constants,style:u,styleSpec:a,validateSpec:_u}))),Sf(h)}function lo(u){return function(a){return u({...a,validateSpec:_u})}}function Sf(u){return[].concat(u).sort((a,h)=>a.line-h.line)}function Ps(u){return function(...a){return Sf(u.apply(this,a))}}Na.source=Ps(lo(o_)),Na.sprite=Ps(lo(Vi)),Na.glyphs=Ps(lo(Cd)),Na.light=Ps(lo(a_)),Na.sky=Ps(lo(ns)),Na.terrain=Ps(lo(al)),Na.layer=Ps(lo(Xm)),Na.filter=Ps(lo(mu)),Na.paintProperty=Ps(lo(Qm)),Na.layoutProperty=Ps(lo(wf));let Tf=Na,eA=Tf.light,rA=Tf.paintProperty,ll=Tf.layoutProperty;function Rc(u,a){let h=!1;if(a&&a.length)for(let A of a)u.fire(new ln(new Error(A.message))),h=!0;return h}class yu{constructor(a,h,A){let x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;let P=new Int32Array(this.arrayBuffer);a=P[0],this.d=(h=P[1])+2*(A=P[2]);for(let B=0;B=Q[lt+0]&&x>=Q[lt+1])?(D[ot]=!0,P.push(q[ot])):D[ot]=!1}}}}_forEachCell(a,h,A,x,E,P,D,B){let V=this._convertToCellCoord(a),q=this._convertToCellCoord(h),Q=this._convertToCellCoord(A),rt=this._convertToCellCoord(x);for(let ot=V;ot<=Q;ot++)for(let lt=q;lt<=rt;lt++){let pt=this.d*lt+ot;if((!B||B(this._convertFromCellCoord(ot),this._convertFromCellCoord(lt),this._convertFromCellCoord(ot+1),this._convertFromCellCoord(lt+1)))&&E.call(this,a,h,A,x,pt,P,D,B))return}}_convertFromCellCoord(a){return(a-this.padding)/this.scale}_convertToCellCoord(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let a=this.cells,h=3+this.cells.length+1+1,A=0;for(let P=0;P=0)continue;let P=u[E];x[E]=Nl[A].shallow.indexOf(E)>=0?P:Mf(P,a)}u instanceof Error&&(x.message=u.message)}if(x.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return A!==\"Object\"&&(x.$name=A),x}throw new Error(\"can't serialize object of type \"+typeof u)}function Ef(u){if(u==null||typeof u==\"boolean\"||typeof u==\"number\"||typeof u==\"string\"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Km(u)||zs(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(Ef);if(typeof u==\"object\"){let a=u.$name||\"Object\";if(!Nl[a])throw new Error(`can't deserialize unregistered class ${a}`);let{klass:h}=Nl[a];if(!h)throw new Error(`can't deserialize unregistered class ${a}`);if(h.deserialize)return h.deserialize(u);let A=Object.create(h.prototype);for(let x of Object.keys(u)){if(x===\"$name\")continue;let E=u[x];A[x]=Nl[a].shallow.indexOf(x)>=0?E:Ef(E)}return A}throw new Error(\"can't deserialize object of type \"+typeof u)}class iA{constructor(){this.first=!0}update(a,h){let A=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=A,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=A,!0):(this.lastFloorZoom>A?(this.lastIntegerZoom=A+1,this.lastIntegerZoomTime=h):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,\"Arabic Supplement\":u=>u>=1872&&u<=1919,\"Arabic Extended-A\":u=>u>=2208&&u<=2303,\"Hangul Jamo\":u=>u>=4352&&u<=4607,\"Unified Canadian Aboriginal Syllabics\":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,\"Unified Canadian Aboriginal Syllabics Extended\":u=>u>=6320&&u<=6399,\"General Punctuation\":u=>u>=8192&&u<=8303,\"Letterlike Symbols\":u=>u>=8448&&u<=8527,\"Number Forms\":u=>u>=8528&&u<=8591,\"Miscellaneous Technical\":u=>u>=8960&&u<=9215,\"Control Pictures\":u=>u>=9216&&u<=9279,\"Optical Character Recognition\":u=>u>=9280&&u<=9311,\"Enclosed Alphanumerics\":u=>u>=9312&&u<=9471,\"Geometric Shapes\":u=>u>=9632&&u<=9727,\"Miscellaneous Symbols\":u=>u>=9728&&u<=9983,\"Miscellaneous Symbols and Arrows\":u=>u>=11008&&u<=11263,\"CJK Radicals Supplement\":u=>u>=11904&&u<=12031,\"Kangxi Radicals\":u=>u>=12032&&u<=12255,\"Ideographic Description Characters\":u=>u>=12272&&u<=12287,\"CJK Symbols and Punctuation\":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,\"Hangul Compatibility Jamo\":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,\"Bopomofo Extended\":u=>u>=12704&&u<=12735,\"CJK Strokes\":u=>u>=12736&&u<=12783,\"Katakana Phonetic Extensions\":u=>u>=12784&&u<=12799,\"Enclosed CJK Letters and Months\":u=>u>=12800&&u<=13055,\"CJK Compatibility\":u=>u>=13056&&u<=13311,\"CJK Unified Ideographs Extension A\":u=>u>=13312&&u<=19903,\"Yijing Hexagram Symbols\":u=>u>=19904&&u<=19967,\"CJK Unified Ideographs\":u=>u>=19968&&u<=40959,\"Yi Syllables\":u=>u>=40960&&u<=42127,\"Yi Radicals\":u=>u>=42128&&u<=42191,\"Hangul Jamo Extended-A\":u=>u>=43360&&u<=43391,\"Hangul Syllables\":u=>u>=44032&&u<=55215,\"Hangul Jamo Extended-B\":u=>u>=55216&&u<=55295,\"Private Use Area\":u=>u>=57344&&u<=63743,\"CJK Compatibility Ideographs\":u=>u>=63744&&u<=64255,\"Arabic Presentation Forms-A\":u=>u>=64336&&u<=65023,\"Vertical Forms\":u=>u>=65040&&u<=65055,\"CJK Compatibility Forms\":u=>u>=65072&&u<=65103,\"Small Form Variants\":u=>u>=65104&&u<=65135,\"Arabic Presentation Forms-B\":u=>u>=65136&&u<=65279,\"Halfwidth and Fullwidth Forms\":u=>u>=65280&&u<=65519};function nA(u){for(let a of u)if(Ld(a.charCodeAt(0)))return!0;return!1}function Pf(u){for(let a of u)if(!l_(a.charCodeAt(0)))return!1;return!0}function l_(u){return!(Le.Arabic(u)||Le[\"Arabic Supplement\"](u)||Le[\"Arabic Extended-A\"](u)||Le[\"Arabic Presentation Forms-A\"](u)||Le[\"Arabic Presentation Forms-B\"](u))}function Ld(u){return!(u!==746&&u!==747&&(u<4352||!(Le[\"Bopomofo Extended\"](u)||Le.Bopomofo(u)||Le[\"CJK Compatibility Forms\"](u)&&!(u>=65097&&u<=65103)||Le[\"CJK Compatibility Ideographs\"](u)||Le[\"CJK Compatibility\"](u)||Le[\"CJK Radicals Supplement\"](u)||Le[\"CJK Strokes\"](u)||!(!Le[\"CJK Symbols and Punctuation\"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||Le[\"CJK Unified Ideographs Extension A\"](u)||Le[\"CJK Unified Ideographs\"](u)||Le[\"Enclosed CJK Letters and Months\"](u)||Le[\"Hangul Compatibility Jamo\"](u)||Le[\"Hangul Jamo Extended-A\"](u)||Le[\"Hangul Jamo Extended-B\"](u)||Le[\"Hangul Jamo\"](u)||Le[\"Hangul Syllables\"](u)||Le.Hiragana(u)||Le[\"Ideographic Description Characters\"](u)||Le.Kanbun(u)||Le[\"Kangxi Radicals\"](u)||Le[\"Katakana Phonetic Extensions\"](u)||Le.Katakana(u)&&u!==12540||!(!Le[\"Halfwidth and Fullwidth Forms\"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!Le[\"Small Form Variants\"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||Le[\"Unified Canadian Aboriginal Syllabics\"](u)||Le[\"Unified Canadian Aboriginal Syllabics Extended\"](u)||Le[\"Vertical Forms\"](u)||Le[\"Yijing Hexagram Symbols\"](u)||Le[\"Yi Syllables\"](u)||Le[\"Yi Radicals\"](u))))}function kd(u){return!(Ld(u)||function(a){return!!(Le[\"Latin-1 Supplement\"](a)&&(a===167||a===169||a===174||a===177||a===188||a===189||a===190||a===215||a===247)||Le[\"General Punctuation\"](a)&&(a===8214||a===8224||a===8225||a===8240||a===8241||a===8251||a===8252||a===8258||a===8263||a===8264||a===8265||a===8273)||Le[\"Letterlike Symbols\"](a)||Le[\"Number Forms\"](a)||Le[\"Miscellaneous Technical\"](a)&&(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||a===9003||a>=9085&&a<=9114||a>=9150&&a<=9165||a===9167||a>=9169&&a<=9179||a>=9186&&a<=9215)||Le[\"Control Pictures\"](a)&&a!==9251||Le[\"Optical Character Recognition\"](a)||Le[\"Enclosed Alphanumerics\"](a)||Le[\"Geometric Shapes\"](a)||Le[\"Miscellaneous Symbols\"](a)&&!(a>=9754&&a<=9759)||Le[\"Miscellaneous Symbols and Arrows\"](a)&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||Le[\"CJK Symbols and Punctuation\"](a)||Le.Katakana(a)||Le[\"Private Use Area\"](a)||Le[\"CJK Compatibility Forms\"](a)||Le[\"Small Form Variants\"](a)||Le[\"Halfwidth and Fullwidth Forms\"](a)||a===8734||a===8756||a===8757||a>=9984&&a<=10087||a>=10102&&a<=10131||a===65532||a===65533)}(u))}function vu(u){return u>=1424&&u<=2303||Le[\"Arabic Presentation Forms-A\"](u)||Le[\"Arabic Presentation Forms-B\"](u)}function Mx(u,a){return!(!a&&vu(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||Le.Khmer(u))}function Jm(u){for(let a of u)if(vu(a.charCodeAt(0)))return!0;return!1}let xu=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=\"unavailable\",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Ri{constructor(a,h){this.zoom=a,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new iA,this.transition={})}isSupportedScript(a){return function(h,A){for(let x of h)if(!Mx(x.charCodeAt(0),A))return!1;return!0}(a,xu.getRTLTextPluginStatus()===\"loaded\")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let a=this.zoom,h=a-Math.floor(a),A=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*A}:{fromScale:.5,toScale:1,t:1-(1-A)*h}}}class Ul{constructor(a,h){this.property=a,this.value=h,this.expression=function(A,x){if(za(A))return new $p(A,x);if(Ui(A)){let E=Xg(A,x);if(E.result===\"error\")throw new Error(E.value.map(P=>`${P.key}: ${P.message}`).join(\", \"));return E.value}{let E=A;return x.type===\"color\"&&typeof A==\"string\"?E=gi.parse(A):x.type!==\"padding\"||typeof A!=\"number\"&&!Array.isArray(A)?x.type===\"variableAnchorOffsetCollection\"&&Array.isArray(A)&&(E=Rn.parse(A)):E=Sn.parse(A),{kind:\"constant\",evaluate:()=>E}}}(h===void 0?a.specification.default:h,a.specification)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}possiblyEvaluate(a,h,A){return this.property.possiblyEvaluate(this,a,h,A)}}class sA{constructor(a){this.property=a,this.value=new Ul(a,void 0)}transitioned(a,h){return new c_(this.property,this.value,h,Tt({},a.transition,this.transition),a.now)}untransitioned(){return new c_(this.property,this.value,null,{},0)}}class If{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return oe(this._values[a].value.value)}setValue(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new sA(this._values[a].property)),this._values[a].value=new Ul(this._values[a].property,h===null?void 0:oe(h))}getTransition(a){return oe(this._values[a].transition)}setTransition(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new sA(this._values[a].property)),this._values[a].transition=oe(h)||void 0}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A);let x=this.getTransition(h);x!==void 0&&(a[`${h}-transition`]=x)}return a}transitioned(a,h){let A=new t0(this._properties);for(let x of Object.keys(this._values))A._values[x]=this._values[x].transitioned(a,h._values[x]);return A}untransitioned(){let a=new t0(this._properties);for(let h of Object.keys(this._values))a._values[h]=this._values[h].untransitioned();return a}}class c_{constructor(a,h,A,x,E){this.property=a,this.value=h,this.begin=E+x.delay||0,this.end=this.begin+x.duration||0,a.specification.transition&&(x.delay||x.duration)&&(this.prior=A)}possiblyEvaluate(a,h,A){let x=a.now||0,E=this.value.possiblyEvaluate(a,h,A),P=this.prior;if(P){if(x>this.end)return this.prior=null,E;if(this.value.isDataDriven())return this.prior=null,E;if(x=1)return 1;let V=B*B,q=V*B;return 4*(B<.5?q:3*(B-V)+q-.75)}(D))}}return E}}class t0{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)}possiblyEvaluate(a,h,A){let x=new Rd(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}hasTransition(){for(let a of Object.keys(this._values))if(this._values[a].prior)return!0;return!1}}class u_{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}hasValue(a){return this._values[a].value!==void 0}getValue(a){return oe(this._values[a].value)}setValue(a,h){this._values[a]=new Ul(this._values[a].property,h===null?void 0:oe(h))}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A)}return a}possiblyEvaluate(a,h,A){let x=new Rd(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}}class cl{constructor(a,h,A){this.property=a,this.value=h,this.parameters=A}isConstant(){return this.value.kind===\"constant\"}constantOr(a){return this.value.kind===\"constant\"?this.value.value:a}evaluate(a,h,A,x){return this.property.evaluate(this.value,this.parameters,a,h,A,x)}}class Rd{constructor(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)}get(a){return this._values[a]}}class Xe{constructor(a){this.specification=a}possiblyEvaluate(a,h){if(a.isDataDriven())throw new Error(\"Value should not be data driven\");return a.expression.evaluate(h)}interpolate(a,h,A){let x=Yo[this.specification.type];return x?x(a,h,A):a}}class dr{constructor(a,h){this.specification=a,this.overrides=h}possiblyEvaluate(a,h,A,x){return new cl(this,a.expression.kind===\"constant\"||a.expression.kind===\"camera\"?{kind:\"constant\",value:a.expression.evaluate(h,null,{},A,x)}:a.expression,h)}interpolate(a,h,A){if(a.value.kind!==\"constant\"||h.value.kind!==\"constant\")return a;if(a.value.value===void 0||h.value.value===void 0)return new cl(this,{kind:\"constant\",value:void 0},a.parameters);let x=Yo[this.specification.type];if(x){let E=x(a.value.value,h.value.value,A);return new cl(this,{kind:\"constant\",value:E},a.parameters)}return a}evaluate(a,h,A,x,E,P){return a.kind===\"constant\"?a.value:a.evaluate(h,A,x,E,P)}}class Cf extends dr{possiblyEvaluate(a,h,A,x){if(a.value===void 0)return new cl(this,{kind:\"constant\",value:void 0},h);if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x),P=a.property.specification.type===\"resolvedImage\"&&typeof E!=\"string\"?E.name:E,D=this._calculate(P,P,P,h);return new cl(this,{kind:\"constant\",value:D},h)}if(a.expression.kind===\"camera\"){let E=this._calculate(a.expression.evaluate({zoom:h.zoom-1}),a.expression.evaluate({zoom:h.zoom}),a.expression.evaluate({zoom:h.zoom+1}),h);return new cl(this,{kind:\"constant\",value:E},h)}return new cl(this,a.expression,h)}evaluate(a,h,A,x,E,P){if(a.kind===\"source\"){let D=a.evaluate(h,A,x,E,P);return this._calculate(D,D,D,h)}return a.kind===\"composite\"?this._calculate(a.evaluate({zoom:Math.floor(h.zoom)-1},A,x),a.evaluate({zoom:Math.floor(h.zoom)},A,x),a.evaluate({zoom:Math.floor(h.zoom)+1},A,x),h):a.value}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class bu{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){if(a.value!==void 0){if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x);return this._calculate(E,E,E,h)}return this._calculate(a.expression.evaluate(new Ri(Math.floor(h.zoom-1),h)),a.expression.evaluate(new Ri(Math.floor(h.zoom),h)),a.expression.evaluate(new Ri(Math.floor(h.zoom+1),h)),h)}}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class e0{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){return!!a.expression.evaluate(h,null,{},A,x)}interpolate(){return!1}}class So{constructor(a){this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let h in a){let A=a[h];A.specification.overridable&&this.overridableProperties.push(h);let x=this.defaultPropertyValues[h]=new Ul(A,void 0),E=this.defaultTransitionablePropertyValues[h]=new sA(A);this.defaultTransitioningPropertyValues[h]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=x.possiblyEvaluate({})}}}ze(\"DataDrivenProperty\",dr),ze(\"DataConstantProperty\",Xe),ze(\"CrossFadedDataDrivenProperty\",Cf),ze(\"CrossFadedProperty\",bu),ze(\"ColorRampProperty\",e0);let r0=\"-transition\";class ul extends la{constructor(a,h){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1},a.type!==\"custom\"&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,a.type!==\"background\"&&(this.source=a.source,this.sourceLayer=a[\"source-layer\"],this.filter=a.filter),h.layout&&(this._unevaluatedLayout=new u_(h.layout)),h.paint)){this._transitionablePaint=new If(h.paint);for(let A in a.paint)this.setPaintProperty(A,a.paint[A],{validate:!1});for(let A in a.layout)this.setLayoutProperty(A,a.layout[A],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Rd(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return a===\"visibility\"?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,h,A={}){h!=null&&this._validate(ll,`layers.${this.id}.layout.${a}`,a,h,A)||(a!==\"visibility\"?this._unevaluatedLayout.setValue(a,h):this.visibility=h)}getPaintProperty(a){return a.endsWith(r0)?this._transitionablePaint.getTransition(a.slice(0,-11)):this._transitionablePaint.getValue(a)}setPaintProperty(a,h,A={}){if(h!=null&&this._validate(rA,`layers.${this.id}.paint.${a}`,a,h,A))return!1;if(a.endsWith(r0))return this._transitionablePaint.setTransition(a.slice(0,-11),h||void 0),!1;{let x=this._transitionablePaint._values[a],E=x.property.specification[\"property-type\"]===\"cross-faded-data-driven\",P=x.value.isDataDriven(),D=x.value;this._transitionablePaint.setValue(a,h),this._handleSpecialPaintPropertyUpdate(a);let B=this._transitionablePaint._values[a].value;return B.isDataDriven()||P||E||this._handleOverridablePaintPropertyUpdate(a,D,B)}}_handleSpecialPaintPropertyUpdate(a){}_handleOverridablePaintPropertyUpdate(a,h,A){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||this.visibility===\"none\"}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,h){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,h)}serialize(){let a={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&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),te(a,(h,A)=>!(h===void 0||A===\"layout\"&&!Object.keys(h).length||A===\"paint\"&&!Object.keys(h).length))}_validate(a,h,A,x,E={}){return(!E||E.validate!==!1)&&Rc(this,a.call(Tf,{key:h,layerType:this.type,objectKey:A,value:x,styleSpec:Jt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let a in this.paint._values){let h=this.paint.get(a);if(h instanceof cl&&vf(h.property.specification)&&(h.value.kind===\"source\"||h.value.kind===\"composite\")&&h.value.isStateDependent)return!0}return!1}}let Ex={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Dd{constructor(a,h){this._structArray=a,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Mn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,h){return a._trim(),h&&(a.isTransferred=!0,h.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(a){let h=Object.create(this.prototype);return h.arrayBuffer=a.arrayBuffer,h.length=a.length,h.capacity=a.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}}function On(u,a=1){let h=0,A=0;return{members:u.map(x=>{let E=Ex[x.type].BYTES_PER_ELEMENT,P=h=i0(h,Math.max(a,E)),D=x.components||1;return A=Math.max(A,E),h+=E*D,{name:x.name,type:x.type,components:D,offset:P}}),size:i0(h,Math.max(A,a)),alignment:a}}function i0(u,a){return Math.ceil(u/a)*a}class Ua extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.int16[x+0]=h,this.int16[x+1]=A,a}}Ua.prototype.bytesPerElement=4,ze(\"StructArrayLayout2i4\",Ua);class oA extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.int16[E+0]=h,this.int16[E+1]=A,this.int16[E+2]=x,a}}oA.prototype.bytesPerElement=6,ze(\"StructArrayLayout3i6\",oA);class co extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.int16[P+0]=h,this.int16[P+1]=A,this.int16[P+2]=x,this.int16[P+3]=E,a}}co.prototype.bytesPerElement=8,ze(\"StructArrayLayout4i8\",co);class Zn extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let B=6*a;return this.int16[B+0]=h,this.int16[B+1]=A,this.int16[B+2]=x,this.int16[B+3]=E,this.int16[B+4]=P,this.int16[B+5]=D,a}}Zn.prototype.bytesPerElement=12,ze(\"StructArrayLayout2i4i12\",Zn);class n0 extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let B=4*a,V=8*a;return this.int16[B+0]=h,this.int16[B+1]=A,this.uint8[V+4]=x,this.uint8[V+5]=E,this.uint8[V+6]=P,this.uint8[V+7]=D,a}}n0.prototype.bytesPerElement=8,ze(\"StructArrayLayout2i4ub8\",n0);class Lf extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.float32[x+0]=h,this.float32[x+1]=A,a}}Lf.prototype.bytesPerElement=8,ze(\"StructArrayLayout2f8\",Lf);class s0 extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,B,V,q){let Q=this.length;return this.resize(Q+1),this.emplace(Q,a,h,A,x,E,P,D,B,V,q)}emplace(a,h,A,x,E,P,D,B,V,q,Q){let rt=10*a;return this.uint16[rt+0]=h,this.uint16[rt+1]=A,this.uint16[rt+2]=x,this.uint16[rt+3]=E,this.uint16[rt+4]=P,this.uint16[rt+5]=D,this.uint16[rt+6]=B,this.uint16[rt+7]=V,this.uint16[rt+8]=q,this.uint16[rt+9]=Q,a}}s0.prototype.bytesPerElement=20,ze(\"StructArrayLayout10ui20\",s0);class o0 extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,B,V,q,Q,rt){let ot=this.length;return this.resize(ot+1),this.emplace(ot,a,h,A,x,E,P,D,B,V,q,Q,rt)}emplace(a,h,A,x,E,P,D,B,V,q,Q,rt,ot){let lt=12*a;return this.int16[lt+0]=h,this.int16[lt+1]=A,this.int16[lt+2]=x,this.int16[lt+3]=E,this.uint16[lt+4]=P,this.uint16[lt+5]=D,this.uint16[lt+6]=B,this.uint16[lt+7]=V,this.int16[lt+8]=q,this.int16[lt+9]=Q,this.int16[lt+10]=rt,this.int16[lt+11]=ot,a}}o0.prototype.bytesPerElement=24,ze(\"StructArrayLayout4i4ui4i24\",o0);class Dc extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.float32[E+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}Dc.prototype.bytesPerElement=12,ze(\"StructArrayLayout3f12\",Dc);class Vs extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint32[1*a+0]=h,a}}Vs.prototype.bytesPerElement=4,ze(\"StructArrayLayout1ul4\",Vs);class fh extends Mn{_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(a,h,A,x,E,P,D,B,V){let q=this.length;return this.resize(q+1),this.emplace(q,a,h,A,x,E,P,D,B,V)}emplace(a,h,A,x,E,P,D,B,V,q){let Q=10*a,rt=5*a;return this.int16[Q+0]=h,this.int16[Q+1]=A,this.int16[Q+2]=x,this.int16[Q+3]=E,this.int16[Q+4]=P,this.int16[Q+5]=D,this.uint32[rt+3]=B,this.uint16[Q+8]=V,this.uint16[Q+9]=q,a}}fh.prototype.bytesPerElement=20,ze(\"StructArrayLayout6i1ul2ui20\",fh);class hl extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let B=6*a;return this.int16[B+0]=h,this.int16[B+1]=A,this.int16[B+2]=x,this.int16[B+3]=E,this.int16[B+4]=P,this.int16[B+5]=D,a}}hl.prototype.bytesPerElement=12,ze(\"StructArrayLayout2i2i2i12\",hl);class Od extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E){let P=this.length;return this.resize(P+1),this.emplace(P,a,h,A,x,E)}emplace(a,h,A,x,E,P){let D=4*a,B=8*a;return this.float32[D+0]=h,this.float32[D+1]=A,this.float32[D+2]=x,this.int16[B+6]=E,this.int16[B+7]=P,a}}Od.prototype.bytesPerElement=16,ze(\"StructArrayLayout2f1f2i16\",Od);class Bd extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=12*a,D=3*a;return this.uint8[P+0]=h,this.uint8[P+1]=A,this.float32[D+1]=x,this.float32[D+2]=E,a}}Bd.prototype.bytesPerElement=12,ze(\"StructArrayLayout2ub2f12\",Bd);class dh extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[E+0]=h,this.uint16[E+1]=A,this.uint16[E+2]=x,a}}dh.prototype.bytesPerElement=6,ze(\"StructArrayLayout3ui6\",dh);class Is extends Mn{_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(a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt){let Vt=this.length;return this.resize(Vt+1),this.emplace(Vt,a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt)}emplace(a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt,Vt){let It=24*a,zt=12*a,ie=48*a;return this.int16[It+0]=h,this.int16[It+1]=A,this.uint16[It+2]=x,this.uint16[It+3]=E,this.uint32[zt+2]=P,this.uint32[zt+3]=D,this.uint32[zt+4]=B,this.uint16[It+10]=V,this.uint16[It+11]=q,this.uint16[It+12]=Q,this.float32[zt+7]=rt,this.float32[zt+8]=ot,this.uint8[ie+36]=lt,this.uint8[ie+37]=pt,this.uint8[ie+38]=xt,this.uint32[zt+10]=Mt,this.int16[It+22]=Vt,a}}Is.prototype.bytesPerElement=48,ze(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\",Is);class aA extends Mn{_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(a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt,Vt,It,zt,ie,ue,Fe,Je,De,Ce,Se,He){let Pe=this.length;return this.resize(Pe+1),this.emplace(Pe,a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt,Vt,It,zt,ie,ue,Fe,Je,De,Ce,Se,He)}emplace(a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt,xt,Mt,Vt,It,zt,ie,ue,Fe,Je,De,Ce,Se,He,Pe){let Ae=32*a,ur=16*a;return this.int16[Ae+0]=h,this.int16[Ae+1]=A,this.int16[Ae+2]=x,this.int16[Ae+3]=E,this.int16[Ae+4]=P,this.int16[Ae+5]=D,this.int16[Ae+6]=B,this.int16[Ae+7]=V,this.uint16[Ae+8]=q,this.uint16[Ae+9]=Q,this.uint16[Ae+10]=rt,this.uint16[Ae+11]=ot,this.uint16[Ae+12]=lt,this.uint16[Ae+13]=pt,this.uint16[Ae+14]=xt,this.uint16[Ae+15]=Mt,this.uint16[Ae+16]=Vt,this.uint16[Ae+17]=It,this.uint16[Ae+18]=zt,this.uint16[Ae+19]=ie,this.uint16[Ae+20]=ue,this.uint16[Ae+21]=Fe,this.uint16[Ae+22]=Je,this.uint32[ur+12]=De,this.float32[ur+13]=Ce,this.float32[ur+14]=Se,this.uint16[Ae+30]=He,this.uint16[Ae+31]=Pe,a}}aA.prototype.bytesPerElement=64,ze(\"StructArrayLayout8i15ui1ul2f2ui64\",aA);class ph extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.float32[1*a+0]=h,a}}ph.prototype.bytesPerElement=4,ze(\"StructArrayLayout1f4\",ph);class fl extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[6*a+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}fl.prototype.bytesPerElement=12,ze(\"StructArrayLayout1ui2f12\",fl);class Oc extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=4*a;return this.uint32[2*a+0]=h,this.uint16[E+2]=A,this.uint16[E+3]=x,a}}Oc.prototype.bytesPerElement=8,ze(\"StructArrayLayout1ul2ui8\",Oc);class Bc extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.uint16[x+0]=h,this.uint16[x+1]=A,a}}Bc.prototype.bytesPerElement=4,ze(\"StructArrayLayout2ui4\",Bc);class lA extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint16[1*a+0]=h,a}}lA.prototype.bytesPerElement=2,ze(\"StructArrayLayout1ui2\",lA);class cA extends Mn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.float32[P+0]=h,this.float32[P+1]=A,this.float32[P+2]=x,this.float32[P+3]=E,a}}cA.prototype.bytesPerElement=16,ze(\"StructArrayLayout4f16\",cA);class T extends Dd{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 _(this.anchorPointX,this.anchorPointY)}}T.prototype.size=20;class l extends fh{get(a){return new T(this,a)}}ze(\"CollisionBoxArray\",l);class f extends Dd{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(a){this._structArray.uint8[this._pos1+37]=a}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(a){this._structArray.uint8[this._pos1+38]=a}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(a){this._structArray.uint32[this._pos4+10]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}f.prototype.size=48;class v extends Is{get(a){return new f(this,a)}}ze(\"PlacedSymbolArray\",v);class b extends Dd{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(a){this._structArray.uint32[this._pos4+12]=a}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]}}b.prototype.size=64;class M extends aA{get(a){return new b(this,a)}}ze(\"SymbolInstanceArray\",M);class O extends ph{getoffsetX(a){return this.float32[1*a+0]}}ze(\"GlyphOffsetArray\",O);class F extends oA{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}ze(\"SymbolLineVertexArray\",F);class U extends Dd{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]}}U.prototype.size=12;class W extends fl{get(a){return new U(this,a)}}ze(\"TextAnchorOffsetArray\",W);class $ extends Dd{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]}}$.prototype.size=8;class X extends Oc{get(a){return new $(this,a)}}ze(\"FeatureIndexArray\",X);class at extends Ua{}class gt extends Ua{}class _t extends Ua{}class yt extends Zn{}class At extends n0{}class kt extends Lf{}class Wt extends s0{}class St extends o0{}class Nt extends Dc{}class Zt extends Vs{}class Ht extends hl{}class ne extends Bd{}class he extends dh{}class ce extends Bc{}let _e=On([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:Ve}=_e;class hr{constructor(a=[]){this.segments=a}prepareSegment(a,h,A,x){let E=this.segments[this.segments.length-1];return a>hr.MAX_VERTEX_ARRAY_LENGTH&&ke(`Max vertices per segment is ${hr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!E||E.vertexLength+a>hr.MAX_VERTEX_ARRAY_LENGTH||E.sortKey!==x)&&(E={vertexOffset:h.length,primitiveOffset:A.length,vertexLength:0,primitiveLength:0},x!==void 0&&(E.sortKey=x),this.segments.push(E)),E}get(){return this.segments}destroy(){for(let a of this.segments)for(let h in a.vaos)a.vaos[h].destroy()}static simpleSegment(a,h,A,x){return new hr([{vertexOffset:a,primitiveOffset:h,vertexLength:A,primitiveLength:x,vaos:{},sortKey:0}])}}function Ee(u,a){return 256*(u=J(Math.floor(u),0,255))+J(Math.floor(a),0,255)}hr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ze(\"SegmentVector\",hr);let lr=On([{name:\"a_pattern_from\",components:4,type:\"Uint16\"},{name:\"a_pattern_to\",components:4,type:\"Uint16\"},{name:\"a_pixel_ratio_from\",components:1,type:\"Uint16\"},{name:\"a_pixel_ratio_to\",components:1,type:\"Uint16\"}]);var qe={exports:{}},nn={exports:{}};nn.exports=function(u,a){var h,A,x,E,P,D,B,V;for(A=u.length-(h=3&u.length),x=a,P=3432918353,D=461845907,V=0;V>>16)*P&65535)<<16)&4294967295)<<15|B>>>17))*D+(((B>>>16)*D&65535)<<16)&4294967295)<<13|x>>>19))+((5*(x>>>16)&65535)<<16)&4294967295))+((58964+(E>>>16)&65535)<<16);switch(B=0,h){case 3:B^=(255&u.charCodeAt(V+2))<<16;case 2:B^=(255&u.charCodeAt(V+1))<<8;case 1:x^=B=(65535&(B=(B=(65535&(B^=255&u.charCodeAt(V)))*P+(((B>>>16)*P&65535)<<16)&4294967295)<<15|B>>>17))*D+(((B>>>16)*D&65535)<<16)&4294967295}return x^=u.length,x=2246822507*(65535&(x^=x>>>16))+((2246822507*(x>>>16)&65535)<<16)&4294967295,x=3266489909*(65535&(x^=x>>>13))+((3266489909*(x>>>16)&65535)<<16)&4294967295,(x^=x>>>16)>>>0};var ti=nn.exports,zr={exports:{}};zr.exports=function(u,a){for(var h,A=u.length,x=a^A,E=0;A>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(E)|(255&u.charCodeAt(++E))<<8|(255&u.charCodeAt(++E))<<16|(255&u.charCodeAt(++E))<<24))+((1540483477*(h>>>16)&65535)<<16),x=1540483477*(65535&x)+((1540483477*(x>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),A-=4,++E;switch(A){case 3:x^=(255&u.charCodeAt(E+2))<<16;case 2:x^=(255&u.charCodeAt(E+1))<<8;case 1:x=1540483477*(65535&(x^=255&u.charCodeAt(E)))+((1540483477*(x>>>16)&65535)<<16)}return x=1540483477*(65535&(x^=x>>>13))+((1540483477*(x>>>16)&65535)<<16),(x^=x>>>15)>>>0};var Qr=ti,Bn=zr.exports;qe.exports=Qr,qe.exports.murmur3=Qr,qe.exports.murmur2=Bn;var Or=o(qe.exports);class To{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,h,A,x){this.ids.push(Cs(a)),this.positions.push(h,A,x)}getPositions(a){if(!this.indexed)throw new Error(\"Trying to get index, but feature positions are not indexed\");let h=Cs(a),A=0,x=this.ids.length-1;for(;A>1;this.ids[P]>=h?x=P:A=P+1}let E=[];for(;this.ids[A]===h;)E.push({index:this.positions[3*A],start:this.positions[3*A+1],end:this.positions[3*A+2]}),A++;return E}static serialize(a,h){let A=new Float64Array(a.ids),x=new Uint32Array(a.positions);return En(A,x,0,A.length-1),h&&h.push(A.buffer,x.buffer),{ids:A,positions:x}}static deserialize(a){let h=new To;return h.ids=a.ids,h.positions=a.positions,h.indexed=!0,h}}function Cs(u){let a=+u;return!isNaN(a)&&a<=Number.MAX_SAFE_INTEGER?a:Or(String(u))}function En(u,a,h,A){for(;h>1],E=h-1,P=A+1;for(;;){do E++;while(u[E]x);if(E>=P)break;js(u,E,P),js(a,3*E,3*P),js(a,3*E+1,3*P+1),js(a,3*E+2,3*P+2)}P-h`u_${x}`),this.type=A}setUniform(a,h,A){a.set(A.constantOr(this.value))}getBinding(a,h,A){return this.type===\"color\"?new kf(a,h):new fa(a,h)}}class Yn{constructor(a,h){this.uniformNames=h.map(A=>`u_${A}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=a.tlbr}setUniform(a,h,A,x){let E=x===\"u_pattern_to\"?this.patternTo:x===\"u_pattern_from\"?this.patternFrom:x===\"u_pixel_ratio_to\"?this.pixelRatioTo:x===\"u_pixel_ratio_from\"?this.pixelRatioFrom:null;E&&a.set(E)}getBinding(a,h,A){return A.substr(0,9)===\"u_pattern\"?new Fc(a,h):new fa(a,h)}}class sn{constructor(a,h,A,x){this.expression=a,this.type=A,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:\"Float32\",components:A===\"color\"?2:1,offset:0})),this.paintVertexArray=new x}populatePaintArray(a,h,A,x,E){let P=this.paintVertexArray.length,D=this.expression.evaluate(new Ri(0),h,{},x,[],E);this.paintVertexArray.resize(a),this._setPaintValue(P,a,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:0},A,x);this._setPaintValue(a,h,E)}_setPaintValue(a,h,A){if(this.type===\"color\"){let x=wu(A);for(let E=a;E`u_${D}_t`),this.type=A,this.useIntegerZoom=x,this.zoom=E,this.maxValue=0,this.paintVertexAttributes=h.map(D=>({name:`a_${D}`,type:\"Float32\",components:A===\"color\"?4:2,offset:0})),this.paintVertexArray=new P}populatePaintArray(a,h,A,x,E){let P=this.expression.evaluate(new Ri(this.zoom),h,{},x,[],E),D=this.expression.evaluate(new Ri(this.zoom+1),h,{},x,[],E),B=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(B,a,P,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:this.zoom},A,x),P=this.expression.evaluate({zoom:this.zoom+1},A,x);this._setPaintValue(a,h,E,P)}_setPaintValue(a,h,A,x){if(this.type===\"color\"){let E=wu(A),P=wu(x);for(let D=a;D`#define HAS_UNIFORM_${x}`))}return a}getBinderAttributes(){let a=[];for(let h in this.binders){let A=this.binders[h];if(A instanceof sn||A instanceof pn)for(let x=0;x!0){this.programConfigurations={};for(let x of a)this.programConfigurations[x.id]=new Fi(x,h,A);this.needsUpload=!1,this._featureMap=new To,this._bufferOffset=0}populatePaintArrays(a,h,A,x,E,P){for(let D in this.programConfigurations)this.programConfigurations[D].populatePaintArrays(a,h,x,E,P);h.id!==void 0&&this._featureMap.add(h.id,A,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,h,A,x){for(let E of A)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(a,this._featureMap,h,E,x)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(let h in this.programConfigurations)this.programConfigurations[h].upload(a);this.needsUpload=!1}}destroy(){for(let a in this.programConfigurations)this.programConfigurations[a].destroy()}}function Pn(u,a){return{\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"text-halo-color\":[\"halo_color\"],\"icon-halo-color\":[\"halo_color\"],\"text-halo-blur\":[\"halo_blur\"],\"icon-halo-blur\":[\"halo_blur\"],\"text-halo-width\":[\"halo_width\"],\"icon-halo-width\":[\"halo_width\"],\"line-gap-width\":[\"gapwidth\"],\"line-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-extrusion-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"]}[u]||[u.replace(`${a}-`,\"\").replace(/-/g,\"_\")]}function a0(u,a,h){let A={color:{source:Lf,composite:cA},number:{source:ph,composite:Lf}},x=function(E){return{\"line-pattern\":{source:Wt,composite:Wt},\"fill-pattern\":{source:Wt,composite:Wt},\"fill-extrusion-pattern\":{source:Wt,composite:Wt}}[E]}(u);return x&&x[h]||A[a][h]}ze(\"ConstantBinder\",hs),ze(\"CrossFadedConstantBinder\",Yn),ze(\"SourceExpressionBinder\",sn),ze(\"CrossFadedCompositeBinder\",Ke),ze(\"CompositeExpressionBinder\",pn),ze(\"ProgramConfiguration\",Fi,{omit:[\"_buffers\"]}),ze(\"ProgramConfigurationSet\",Ls);let Fn=8192,Vl=Math.pow(2,14)-1,xe=-Vl-1;function Oe(u){let a=Fn/u.extent,h=u.loadGeometry();for(let A=0;AP.x+1||BP.y+1)&&ke(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}}return h}function Su(u,a){return{type:u.type,id:u.id,properties:u.properties,geometry:a?Oe(u):[]}}function Va(u,a,h,A,x){u.emplaceBack(2*a+(A+1)/2,2*h+(x+1)/2)}class Ah{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new gt,this.indexArray=new he,this.segments=new hr,this.programConfigurations=new Ls(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){let x=this.layers[0],E=[],P=null,D=!1;x.type===\"circle\"&&(P=x.layout.get(\"circle-sort-key\"),D=!P.isConstant());for(let{feature:B,id:V,index:q,sourceLayerIndex:Q}of a){let rt=this.layers[0]._featureFilter.needGeometry,ot=Su(B,rt);if(!this.layers[0]._featureFilter.filter(new Ri(this.zoom),ot,A))continue;let lt=D?P.evaluate(ot,{},A):void 0,pt={id:V,properties:B.properties,type:B.type,sourceLayerIndex:Q,index:q,geometry:rt?ot.geometry:Oe(B),patterns:{},sortKey:lt};E.push(pt)}D&&E.sort((B,V)=>B.sortKey-V.sortKey);for(let B of E){let{geometry:V,index:q,sourceLayerIndex:Q}=B,rt=a[q].feature;this.addFeature(B,V,q,A),h.featureIndex.insert(rt,V,q,Q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Ve),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(a,h,A,x){for(let E of h)for(let P of E){let D=P.x,B=P.y;if(D<0||D>=Fn||B<0||B>=Fn)continue;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),q=V.vertexLength;Va(this.layoutVertexArray,D,B,-1,-1),Va(this.layoutVertexArray,D,B,1,-1),Va(this.layoutVertexArray,D,B,1,1),Va(this.layoutVertexArray,D,B,-1,1),this.indexArray.emplaceBack(q,q+1,q+2),this.indexArray.emplaceBack(q,q+3,q+2),V.vertexLength+=4,V.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,{},x)}}function da(u,a){for(let h=0;h1){if(m(u,a))return!0;for(let A=0;A1?h:h.sub(a)._mult(x)._add(a))}function k(u,a){let h,A,x,E=!1;for(let P=0;Pa.y!=x.y>a.y&&a.x<(x.x-A.x)*(a.y-A.y)/(x.y-A.y)+A.x&&(E=!E)}return E}function L(u,a){let h=!1;for(let A=0,x=u.length-1;Aa.y!=P.y>a.y&&a.x<(P.x-E.x)*(a.y-E.y)/(P.y-E.y)+E.x&&(h=!h)}return h}function z(u,a,h){let A=h[0],x=h[2];if(u.xx.x&&a.x>x.x||u.yx.y&&a.y>x.y)return!1;let E=or(u,a,h[0]);return E!==or(u,a,h[1])||E!==or(u,a,h[2])||E!==or(u,a,h[3])}function H(u,a,h){let A=a.paint.get(u).value;return A.kind===\"constant\"?A.value:h.programConfigurations.get(a.id).getMaxValue(u)}function et(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function st(u,a,h,A,x){if(!a[0]&&!a[1])return u;let E=_.convert(a)._mult(x);h===\"viewport\"&&E._rotate(-A);let P=[];for(let D=0;D$e(xt,pt))}(V,B),ot=Q?q*D:q;for(let lt of x)for(let pt of lt){let xt=Q?pt:$e(pt,B),Mt=ot,Vt=Ft([],[pt.x,pt.y,0,1],B);if(this.paint.get(\"circle-pitch-scale\")===\"viewport\"&&this.paint.get(\"circle-pitch-alignment\")===\"map\"?Mt*=Vt[3]/P.cameraToCenterDistance:this.paint.get(\"circle-pitch-scale\")===\"map\"&&this.paint.get(\"circle-pitch-alignment\")===\"viewport\"&&(Mt*=P.cameraToCenterDistance/Vt[3]),l0(rt,xt,Mt))return!0}return!1}}function $e(u,a){let h=Ft([],[u.x,u.y,0,1],a);return new _(h[0]/h[3],h[1]/h[3])}class Be extends Ah{}let je;ze(\"HeatmapBucket\",Be,{omit:[\"layers\"]});var Xr={get paint(){return je=je||new So({\"heatmap-radius\":new dr(Jt.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new dr(Jt.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new Xe(Jt.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new e0(Jt.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new Xe(Jt.paint_heatmap[\"heatmap-opacity\"])})}};function Di(u,{width:a,height:h},A,x){if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==a*h*A)throw new RangeError(`mismatched image size. expected: ${x.length} but got: ${a*h*A}`)}else x=new Uint8Array(a*h*A);return u.width=a,u.height=h,u.data=x,u}function Pi(u,{width:a,height:h},A){if(a===u.width&&h===u.height)return;let x=Di({},{width:a,height:h},A);ji(u,x,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,a),height:Math.min(u.height,h)},A),u.width=a,u.height=h,u.data=x.data}function ji(u,a,h,A,x,E){if(x.width===0||x.height===0)return a;if(x.width>u.width||x.height>u.height||h.x>u.width-x.width||h.y>u.height-x.height)throw new RangeError(\"out of range source coordinates for image copy\");if(x.width>a.width||x.height>a.height||A.x>a.width-x.width||A.y>a.height-x.height)throw new RangeError(\"out of range destination coordinates for image copy\");let P=u.data,D=a.data;if(P===D)throw new Error(\"srcData equals dstData, so image is already copied\");for(let B=0;B{a[u.evaluationKey]=B;let V=u.expression.evaluate(a);x.data[P+D+0]=Math.floor(255*V.r/V.a),x.data[P+D+1]=Math.floor(255*V.g/V.a),x.data[P+D+2]=Math.floor(255*V.b/V.a),x.data[P+D+3]=Math.floor(255*V.a)};if(u.clips)for(let P=0,D=0;P80*h){A=E=u[0],x=P=u[1];for(var lt=h;ltE&&(E=D),B>P&&(P=B);V=(V=Math.max(E-A,P-x))!==0?32767/V:0}return Px(rt,ot,h,A,x,V,0),ot}function y6(u,a,h,A,x){var E,P;if(x===ZI(u,a,h,A)>0)for(E=a;E=a;E-=A)P=b6(E,u[E],u[E+1],P);return P&&BS(P,P.next)&&(Cx(P),P=P.next),P}function c0(u,a){if(!u)return u;a||(a=u);var h,A=u;do if(h=!1,A.steiner||!BS(A,A.next)&&fs(A.prev,A,A.next)!==0)A=A.next;else{if(Cx(A),(A=a=A.prev)===A.next)break;h=!0}while(h||A!==a);return a}function Px(u,a,h,A,x,E,P){if(u){!P&&E&&function(q,Q,rt,ot){var lt=q;do lt.z===0&&(lt.z=HI(lt.x,lt.y,Q,rt,ot)),lt.prevZ=lt.prev,lt.nextZ=lt.next,lt=lt.next;while(lt!==q);lt.prevZ.nextZ=null,lt.prevZ=null,function(pt){var xt,Mt,Vt,It,zt,ie,ue,Fe,Je=1;do{for(Mt=pt,pt=null,zt=null,ie=0;Mt;){for(ie++,Vt=Mt,ue=0,xt=0;xt0||Fe>0&&Vt;)ue!==0&&(Fe===0||!Vt||Mt.z<=Vt.z)?(It=Mt,Mt=Mt.nextZ,ue--):(It=Vt,Vt=Vt.nextZ,Fe--),zt?zt.nextZ=It:pt=It,It.prevZ=zt,zt=It;Mt=Vt}zt.nextZ=null,Je*=2}while(ie>1)}(lt)}(u,A,x,E);for(var D,B,V=u;u.prev!==u.next;)if(D=u.prev,B=u.next,E?HQ(u,A,x,E):WQ(u))a.push(D.i/h|0),a.push(u.i/h|0),a.push(B.i/h|0),Cx(u),u=B.next,V=B.next;else if((u=B)===V){P?P===1?Px(u=qQ(c0(u),a,h),a,h,A,x,E,2):P===2&&ZQ(u,a,h,A,x,E):Px(c0(u),a,h,A,x,E,1);break}}}function WQ(u){var a=u.prev,h=u,A=u.next;if(fs(a,h,A)>=0)return!1;for(var x=a.x,E=h.x,P=A.x,D=a.y,B=h.y,V=A.y,q=xE?x>P?x:P:E>P?E:P,ot=D>B?D>V?D:V:B>V?B:V,lt=A.next;lt!==a;){if(lt.x>=q&<.x<=rt&<.y>=Q&<.y<=ot&&h_(x,D,E,B,P,V,lt.x,lt.y)&&fs(lt.prev,lt,lt.next)>=0)return!1;lt=lt.next}return!0}function HQ(u,a,h,A){var x=u.prev,E=u,P=u.next;if(fs(x,E,P)>=0)return!1;for(var D=x.x,B=E.x,V=P.x,q=x.y,Q=E.y,rt=P.y,ot=DB?D>V?D:V:B>V?B:V,xt=q>Q?q>rt?q:rt:Q>rt?Q:rt,Mt=HI(ot,lt,a,h,A),Vt=HI(pt,xt,a,h,A),It=u.prevZ,zt=u.nextZ;It&&It.z>=Mt&&zt&&zt.z<=Vt;){if(It.x>=ot&&It.x<=pt&&It.y>=lt&&It.y<=xt&&It!==x&&It!==P&&h_(D,q,B,Q,V,rt,It.x,It.y)&&fs(It.prev,It,It.next)>=0||(It=It.prevZ,zt.x>=ot&&zt.x<=pt&&zt.y>=lt&&zt.y<=xt&&zt!==x&&zt!==P&&h_(D,q,B,Q,V,rt,zt.x,zt.y)&&fs(zt.prev,zt,zt.next)>=0))return!1;zt=zt.nextZ}for(;It&&It.z>=Mt;){if(It.x>=ot&&It.x<=pt&&It.y>=lt&&It.y<=xt&&It!==x&&It!==P&&h_(D,q,B,Q,V,rt,It.x,It.y)&&fs(It.prev,It,It.next)>=0)return!1;It=It.prevZ}for(;zt&&zt.z<=Vt;){if(zt.x>=ot&&zt.x<=pt&&zt.y>=lt&&zt.y<=xt&&zt!==x&&zt!==P&&h_(D,q,B,Q,V,rt,zt.x,zt.y)&&fs(zt.prev,zt,zt.next)>=0)return!1;zt=zt.nextZ}return!0}function qQ(u,a,h){var A=u;do{var x=A.prev,E=A.next.next;!BS(x,E)&&v6(x,A,A.next,E)&&Ix(x,E)&&Ix(E,x)&&(a.push(x.i/h|0),a.push(A.i/h|0),a.push(E.i/h|0),Cx(A),Cx(A.next),A=u=E),A=A.next}while(A!==u);return c0(A)}function ZQ(u,a,h,A,x,E){var P=u;do{for(var D=P.next.next;D!==P.prev;){if(P.i!==D.i&&KQ(P,D)){var B=x6(P,D);return P=c0(P,P.next),B=c0(B,B.next),Px(P,a,h,A,x,E,0),void Px(B,a,h,A,x,E,0)}D=D.next}P=P.next}while(P!==u)}function YQ(u,a){return u.x-a.x}function $Q(u,a){var h=function(x,E){var P,D=E,B=x.x,V=x.y,q=-1/0;do{if(V<=D.y&&V>=D.next.y&&D.next.y!==D.y){var Q=D.x+(V-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(Q<=B&&Q>q&&(q=Q,P=D.x=D.x&&D.x>=lt&&B!==D.x&&h_(VP.x||D.x===P.x&&QQ(P,D)))&&(P=D,xt=rt)),D=D.next;while(D!==ot);return P}(u,a);if(!h)return a;var A=x6(h,u);return c0(A,A.next),c0(h,h.next)}function QQ(u,a){return fs(u.prev,u,a.prev)<0&&fs(a.next,u,u.next)<0}function HI(u,a,h,A,x){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*x|0)|u<<8))|u<<4))|u<<2))|u<<1))|(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-A)*x|0)|a<<8))|a<<4))|a<<2))|a<<1))<<1}function XQ(u){var a=u,h=u;do(a.x=(u-P)*(E-D)&&(u-P)*(A-D)>=(h-P)*(a-D)&&(h-P)*(E-D)>=(x-P)*(A-D)}function KQ(u,a){return u.next.i!==a.i&&u.prev.i!==a.i&&!function(h,A){var x=h;do{if(x.i!==h.i&&x.next.i!==h.i&&x.i!==A.i&&x.next.i!==A.i&&v6(x,x.next,h,A))return!0;x=x.next}while(x!==h);return!1}(u,a)&&(Ix(u,a)&&Ix(a,u)&&function(h,A){var x=h,E=!1,P=(h.x+A.x)/2,D=(h.y+A.y)/2;do x.y>D!=x.next.y>D&&x.next.y!==x.y&&P<(x.next.x-x.x)*(D-x.y)/(x.next.y-x.y)+x.x&&(E=!E),x=x.next;while(x!==h);return E}(u,a)&&(fs(u.prev,u,a.prev)||fs(u,a.prev,a))||BS(u,a)&&fs(u.prev,u,u.next)>0&&fs(a.prev,a,a.next)>0)}function fs(u,a,h){return(a.y-u.y)*(h.x-a.x)-(a.x-u.x)*(h.y-a.y)}function BS(u,a){return u.x===a.x&&u.y===a.y}function v6(u,a,h,A){var x=zS(fs(u,a,h)),E=zS(fs(u,a,A)),P=zS(fs(h,A,u)),D=zS(fs(h,A,a));return x!==E&&P!==D||!(x!==0||!FS(u,h,a))||!(E!==0||!FS(u,A,a))||!(P!==0||!FS(h,u,A))||!(D!==0||!FS(h,a,A))}function FS(u,a,h){return a.x<=Math.max(u.x,h.x)&&a.x>=Math.min(u.x,h.x)&&a.y<=Math.max(u.y,h.y)&&a.y>=Math.min(u.y,h.y)}function zS(u){return u>0?1:u<0?-1:0}function Ix(u,a){return fs(u.prev,u,u.next)<0?fs(u,a,u.next)>=0&&fs(u,u.prev,a)>=0:fs(u,a,u.prev)<0||fs(u,u.next,a)<0}function x6(u,a){var h=new qI(u.i,u.x,u.y),A=new qI(a.i,a.x,a.y),x=u.next,E=a.prev;return u.next=a,a.prev=u,h.next=x,x.prev=h,A.next=h,h.prev=A,E.next=A,A.prev=E,A}function b6(u,a,h,A){var x=new qI(u,a,h);return A?(x.next=A.next,x.prev=A,A.next.prev=x,A.next=x):(x.prev=x,x.next=x),x}function Cx(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function qI(u,a,h){this.i=u,this.x=a,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ZI(u,a,h,A){for(var x=0,E=a,P=h-A;E0&&h.holes.push(A+=u[x-1].length)}return h};var w6=o(WI.exports);function JQ(u,a,h,A,x){S6(u,a,h||0,A||u.length-1,x||tX)}function S6(u,a,h,A,x){for(;A>h;){if(A-h>600){var E=A-h+1,P=a-h+1,D=Math.log(E),B=.5*Math.exp(2*D/3),V=.5*Math.sqrt(D*B*(E-B)/E)*(P-E/2<0?-1:1);S6(u,a,Math.max(h,Math.floor(a-P*B/E+V)),Math.min(A,Math.floor(a+(E-P)*B/E+V)),x)}var q=u[a],Q=h,rt=A;for(Lx(u,h,a),x(u[A],q)>0&&Lx(u,h,A);Q0;)rt--}x(u[h],q)===0?Lx(u,h,rt):Lx(u,++rt,A),rt<=a&&(h=rt+1),a<=rt&&(A=rt-1)}}function Lx(u,a,h){var A=u[a];u[a]=u[h],u[h]=A}function tX(u,a){return ua?1:0}function YI(u,a){let h=u.length;if(h<=1)return[u];let A=[],x,E;for(let P=0;P1)for(let P=0;Ph.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new _t,this.indexArray=new he,this.indexArray2=new ce,this.programConfigurations=new Ls(a.layers,a.zoom),this.segments=new hr,this.segments2=new hr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=$I(\"fill\",this.layers,h);let x=this.layers[0].layout.get(\"fill-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:B,index:V,sourceLayerIndex:q}of a){let Q=this.layers[0]._featureFilter.needGeometry,rt=Su(D,Q);if(!this.layers[0]._featureFilter.filter(new Ri(this.zoom),rt,A))continue;let ot=E?x.evaluate(rt,{},A,h.availableImages):void 0,lt={id:B,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:Q?rt.geometry:Oe(D),patterns:{},sortKey:ot};P.push(lt)}E&&P.sort((D,B)=>D.sortKey-B.sortKey);for(let D of P){let{geometry:B,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let Q=QI(\"fill\",this.layers,D,this.zoom,h);this.patternFeatures.push(Q)}else this.addFeature(D,B,V,A,{});h.featureIndex.insert(a[V].feature,B,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,GQ),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),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(a,h,A,x,E){for(let P of YI(h,500)){let D=0;for(let ot of P)D+=ot.length;let B=this.segments.prepareSegment(D,this.layoutVertexArray,this.indexArray),V=B.vertexLength,q=[],Q=[];for(let ot of P){if(ot.length===0)continue;ot!==P[0]&&Q.push(q.length/2);let lt=this.segments2.prepareSegment(ot.length,this.layoutVertexArray,this.indexArray2),pt=lt.vertexLength;this.layoutVertexArray.emplaceBack(ot[0].x,ot[0].y),this.indexArray2.emplaceBack(pt+ot.length-1,pt),q.push(ot[0].x),q.push(ot[0].y);for(let xt=1;xt>3}if(x--,A===1||A===2)E+=u.readSVarint(),P+=u.readSVarint(),A===1&&(a&&D.push(a),a=[]),a.push(new aX(E,P));else{if(A!==7)throw new Error(\"unknown command \"+A);a&&a.push(a[0].clone())}}return a&&D.push(a),D},f_.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var a=u.readVarint()+u.pos,h=1,A=0,x=0,E=0,P=1/0,D=-1/0,B=1/0,V=-1/0;u.pos>3}if(A--,h===1||h===2)(x+=u.readSVarint())D&&(D=x),(E+=u.readSVarint())V&&(V=E);else if(h!==7)throw new Error(\"unknown command \"+h)}return[P,B,D,V]},f_.prototype.toGeoJSON=function(u,a,h){var A,x,E=this.extent*Math.pow(2,h),P=this.extent*u,D=this.extent*a,B=this.loadGeometry(),V=f_.types[this.type];function q(ot){for(var lt=0;lt>3;x=P===1?A.readString():P===2?A.readFloat():P===3?A.readDouble():P===4?A.readVarint64():P===5?A.readVarint():P===6?A.readSVarint():P===7?A.readBoolean():null}return x}(h))}I6.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[u];var a=this._pbf.readVarint()+this._pbf.pos;return new uX(this._pbf,a,this.extent,this._keys,this._values)};var fX=P6;function dX(u,a,h){if(u===3){var A=new fX(h,h.readVarint()+h.pos);A.length&&(a[A.name]=A)}}uA.VectorTile=function(u,a){this.layers=u.readFields(dX,{},a)},uA.VectorTileFeature=E6,uA.VectorTileLayer=P6;let pX=uA.VectorTileFeature.types,KI=Math.pow(2,13);function kx(u,a,h,A,x,E,P,D){u.emplaceBack(a,h,2*Math.floor(A*KI)+P,x*KI*2,E*KI*2,Math.round(D))}class JI{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new yt,this.centroidVertexArray=new at,this.indexArray=new he,this.programConfigurations=new Ls(a.layers,a.zoom),this.segments=new hr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.features=[],this.hasPattern=$I(\"fill-extrusion\",this.layers,h);for(let{feature:x,id:E,index:P,sourceLayerIndex:D}of a){let B=this.layers[0]._featureFilter.needGeometry,V=Su(x,B);if(!this.layers[0]._featureFilter.filter(new Ri(this.zoom),V,A))continue;let q={id:E,sourceLayerIndex:D,index:P,geometry:B?V.geometry:Oe(x),properties:x.properties,type:x.type,patterns:{}};this.hasPattern?this.features.push(QI(\"fill-extrusion\",this.layers,q,this.zoom,h)):this.addFeature(q,q.geometry,P,A,{}),h.featureIndex.insert(x,q.geometry,P,D,this.index,!0)}}addFeatures(a,h,A){for(let x of this.features){let{geometry:E}=x;this.addFeature(x,E,x.index,h,A)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,oX),this.centroidVertexBuffer=a.createVertexBuffer(this.centroidVertexArray,sX.members,!0),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(a,h,A,x,E){let P={x:0,y:0,vertexCount:0};for(let D of YI(h,500)){let B=0;for(let lt of D)B+=lt.length;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let lt of D){if(lt.length===0||mX(lt))continue;let pt=0;for(let xt=0;xt=1){let Vt=lt[xt-1];if(!AX(Mt,Vt)){V.vertexLength+4>hr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let It=Mt.sub(Vt)._perp()._unit(),zt=Vt.dist(Mt);pt+zt>32768&&(pt=0),kx(this.layoutVertexArray,Mt.x,Mt.y,It.x,It.y,0,0,pt),kx(this.layoutVertexArray,Mt.x,Mt.y,It.x,It.y,0,1,pt),P.x+=2*Mt.x,P.y+=2*Mt.y,P.vertexCount+=2,pt+=zt,kx(this.layoutVertexArray,Vt.x,Vt.y,It.x,It.y,0,0,pt),kx(this.layoutVertexArray,Vt.x,Vt.y,It.x,It.y,0,1,pt),P.x+=2*Vt.x,P.y+=2*Vt.y,P.vertexCount+=2;let ie=V.vertexLength;this.indexArray.emplaceBack(ie,ie+2,ie+1),this.indexArray.emplaceBack(ie+1,ie+2,ie+3),V.vertexLength+=4,V.primitiveLength+=2}}}}if(V.vertexLength+B>hr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(B,this.layoutVertexArray,this.indexArray)),pX[a.type]!==\"Polygon\")continue;let q=[],Q=[],rt=V.vertexLength;for(let lt of D)if(lt.length!==0){lt!==D[0]&&Q.push(q.length/2);for(let pt=0;ptFn)||u.y===a.y&&(u.y<0||u.y>Fn)}function mX(u){return u.every(a=>a.x<0)||u.every(a=>a.x>Fn)||u.every(a=>a.y<0)||u.every(a=>a.y>Fn)}let C6;ze(\"FillExtrusionBucket\",JI,{omit:[\"layers\",\"features\"]});var gX={get paint(){return C6=C6||new So({\"fill-extrusion-opacity\":new Xe(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new dr(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new Xe(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new Xe(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new Cf(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new dr(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new dr(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new Xe(Jt[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])})}};class _X extends ul{constructor(a){super(a,gX)}createBucket(a){return new JI(a)}queryRadius(){return et(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature(a,h,A,x,E,P,D,B){let V=st(a,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),P.angle,D),q=this.paint.get(\"fill-extrusion-height\").evaluate(h,A),Q=this.paint.get(\"fill-extrusion-base\").evaluate(h,A),rt=function(lt,pt,xt,Mt){let Vt=[];for(let It of lt){let zt=[It.x,It.y,0,1];Ft(zt,zt,pt),Vt.push(new _(zt[0]/zt[3],zt[1]/zt[3]))}return Vt}(V,B),ot=function(lt,pt,xt,Mt){let Vt=[],It=[],zt=Mt[8]*pt,ie=Mt[9]*pt,ue=Mt[10]*pt,Fe=Mt[11]*pt,Je=Mt[8]*xt,De=Mt[9]*xt,Ce=Mt[10]*xt,Se=Mt[11]*xt;for(let He of lt){let Pe=[],Ae=[];for(let ur of He){let er=ur.x,ri=ur.y,An=Mt[0]*er+Mt[4]*ri+Mt[12],In=Mt[1]*er+Mt[5]*ri+Mt[13],Hs=Mt[2]*er+Mt[6]*ri+Mt[14],jl=Mt[3]*er+Mt[7]*ri+Mt[15],ja=Hs+ue,ks=jl+Fe,Mo=An+Je,Xo=In+De,Ga=Hs+Ce,Wa=jl+Se,qs=new _((An+zt)/ks,(In+ie)/ks);qs.z=ja/ks,Pe.push(qs);let Zs=new _(Mo/Wa,Xo/Wa);Zs.z=Ga/Wa,Ae.push(Zs)}Vt.push(Pe),It.push(Ae)}return[Vt,It]}(x,Q,q,B);return function(lt,pt,xt){let Mt=1/0;dl(xt,pt)&&(Mt=L6(xt,pt[0]));for(let Vt=0;Vth.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new At,this.layoutVertexArray2=new kt,this.indexArray=new he,this.programConfigurations=new Ls(a.layers,a.zoom),this.segments=new hr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=$I(\"line\",this.layers,h);let x=this.layers[0].layout.get(\"line-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:B,index:V,sourceLayerIndex:q}of a){let Q=this.layers[0]._featureFilter.needGeometry,rt=Su(D,Q);if(!this.layers[0]._featureFilter.filter(new Ri(this.zoom),rt,A))continue;let ot=E?x.evaluate(rt,{},A):void 0,lt={id:B,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:Q?rt.geometry:Oe(D),patterns:{},sortKey:ot};P.push(lt)}E&&P.sort((D,B)=>D.sortKey-B.sortKey);for(let D of P){let{geometry:B,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let Q=QI(\"line\",this.layers,D,this.zoom,h);this.patternFeatures.push(Q)}else this.addFeature(D,B,V,A,{});h.featureIndex.insert(a[V].feature,B,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,bX)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,vX),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_start\")&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_end\"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,h,A,x,E){let P=this.layers[0].layout,D=P.get(\"line-join\").evaluate(a,{}),B=P.get(\"line-cap\"),V=P.get(\"line-miter-limit\"),q=P.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(a);for(let Q of h)this.addLine(Q,a,D,B,V,q);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,E,x)}addLine(a,h,A,x,E,P){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Mt=0;Mt=2&&a[B-1].equals(a[B-2]);)B--;let V=0;for(;V0;if(Fe&&Mt>V){let Se=rt.dist(ot);if(Se>2*q){let He=rt.sub(rt.sub(ot)._mult(q/Se)._round());this.updateDistance(ot,He),this.addCurrentVertex(He,pt,0,0,Q),ot=He}}let De=ot&<,Ce=De?A:D?\"butt\":x;if(De&&Ce===\"round\"&&(ieE&&(Ce=\"bevel\"),Ce===\"bevel\"&&(ie>2&&(Ce=\"flipbevel\"),ie100)Vt=xt.mult(-1);else{let Se=ie*pt.add(xt).mag()/pt.sub(xt).mag();Vt._perp()._mult(Se*(Je?-1:1))}this.addCurrentVertex(rt,Vt,0,0,Q),this.addCurrentVertex(rt,Vt.mult(-1),0,0,Q)}else if(Ce===\"bevel\"||Ce===\"fakeround\"){let Se=-Math.sqrt(ie*ie-1),He=Je?Se:0,Pe=Je?0:Se;if(ot&&this.addCurrentVertex(rt,pt,He,Pe,Q),Ce===\"fakeround\"){let Ae=Math.round(180*ue/Math.PI/20);for(let ur=1;ur2*q){let He=rt.add(lt.sub(rt)._mult(q/Se)._round());this.updateDistance(rt,He),this.addCurrentVertex(He,xt,0,0,Q),rt=He}}}}addCurrentVertex(a,h,A,x,E,P=!1){let D=h.y*x-h.x,B=-h.y-h.x*x;this.addHalfVertex(a,h.x+h.y*A,h.y-h.x*A,P,!1,A,E),this.addHalfVertex(a,D,B,P,!0,-x,E),this.distance>k6/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(a,h,A,x,E,P))}addHalfVertex({x:a,y:h},A,x,E,P,D,B){let V=.5*(this.lineClips?this.scaledDistance*(k6-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a<<1)+(E?1:0),(h<<1)+(P?1:0),Math.round(63*A)+128,Math.round(63*x)+128,1+(D===0?0:D<0?-1:1)|(63&V)<<2,V>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let q=B.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,q),B.primitiveLength++),P?this.e2=q:this.e1=q}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(a,h){this.distance+=a.dist(h),this.updateScaledDistance()}}let R6,D6;ze(\"LineBucket\",tC,{omit:[\"layers\",\"patternFeatures\"]});var O6={get paint(){return D6=D6||new So({\"line-opacity\":new dr(Jt.paint_line[\"line-opacity\"]),\"line-color\":new dr(Jt.paint_line[\"line-color\"]),\"line-translate\":new Xe(Jt.paint_line[\"line-translate\"]),\"line-translate-anchor\":new Xe(Jt.paint_line[\"line-translate-anchor\"]),\"line-width\":new dr(Jt.paint_line[\"line-width\"]),\"line-gap-width\":new dr(Jt.paint_line[\"line-gap-width\"]),\"line-offset\":new dr(Jt.paint_line[\"line-offset\"]),\"line-blur\":new dr(Jt.paint_line[\"line-blur\"]),\"line-dasharray\":new bu(Jt.paint_line[\"line-dasharray\"]),\"line-pattern\":new Cf(Jt.paint_line[\"line-pattern\"]),\"line-gradient\":new e0(Jt.paint_line[\"line-gradient\"])})},get layout(){return R6=R6||new So({\"line-cap\":new Xe(Jt.layout_line[\"line-cap\"]),\"line-join\":new dr(Jt.layout_line[\"line-join\"]),\"line-miter-limit\":new Xe(Jt.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new Xe(Jt.layout_line[\"line-round-limit\"]),\"line-sort-key\":new dr(Jt.layout_line[\"line-sort-key\"])})}};class TX extends dr{possiblyEvaluate(a,h){return h=new Ri(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(a,h)}evaluate(a,h,A,x){return h=Tt({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(a,h,A,x)}}let NS;class MX extends ul{constructor(a){super(a,O6),this.gradientVersion=0,NS||(NS=new TX(O6.paint.properties[\"line-width\"].specification),NS.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(a){if(a===\"line-gradient\"){let h=this.gradientExpression();this.stepInterpolant=!!function(A){return A._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Wp,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(a,h){super.recalculate(a,h),this.paint._values[\"line-floorwidth\"]=NS.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,a)}createBucket(a){return new tC(a)}queryRadius(a){let h=a,A=B6(H(\"line-width\",this,h),H(\"line-gap-width\",this,h)),x=H(\"line-offset\",this,h);return A/2+Math.abs(x)+et(this.paint.get(\"line-translate\"))}queryIntersectsFeature(a,h,A,x,E,P,D){let B=st(a,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),P.angle,D),V=D/2*B6(this.paint.get(\"line-width\").evaluate(h,A),this.paint.get(\"line-gap-width\").evaluate(h,A)),q=this.paint.get(\"line-offset\").evaluate(h,A);return q&&(x=function(Q,rt){let ot=[];for(let lt=0;lt=3){for(let xt=0;xt0?a+2*u:u}let EX=On([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),PX=On([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);On([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);let IX=On([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"}]);On([{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\"}]);let F6=On([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),CX=On([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);function LX(u,a,h){return u.sections.forEach(A=>{A.text=function(x,E,P){let D=E.layout.get(\"text-transform\").evaluate(P,{});return D===\"uppercase\"?x=x.toLocaleUpperCase():D===\"lowercase\"&&(x=x.toLocaleLowerCase()),xu.applyArabicShaping&&(x=xu.applyArabicShaping(x)),x}(A.text,a,h)}),u}On([{name:\"triangle\",components:3,type:\"Uint16\"}]),On([{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\"}]),On([{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\"}]),On([{type:\"Float32\",name:\"offsetX\"}]),On([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),On([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);let Dx={\"!\":\"\\uFE15\",\"#\":\"\\uFF03\",$:\"\\uFF04\",\"%\":\"\\uFF05\",\"&\":\"\\uFF06\",\"(\":\"\\uFE35\",\")\":\"\\uFE36\",\"*\":\"\\uFF0A\",\"+\":\"\\uFF0B\",\",\":\"\\uFE10\",\"-\":\"\\uFE32\",\".\":\"\\u30FB\",\"/\":\"\\uFF0F\",\":\":\"\\uFE13\",\";\":\"\\uFE14\",\"<\":\"\\uFE3F\",\"=\":\"\\uFF1D\",\">\":\"\\uFE40\",\"?\":\"\\uFE16\",\"@\":\"\\uFF20\",\"[\":\"\\uFE47\",\"\\\\\":\"\\uFF3C\",\"]\":\"\\uFE48\",\"^\":\"\\uFF3E\",_:\"\\uFE33\",\"`\":\"\\uFF40\",\"{\":\"\\uFE37\",\"|\":\"\\u2015\",\"}\":\"\\uFE38\",\"~\":\"\\uFF5E\",\"\\xA2\":\"\\uFFE0\",\"\\xA3\":\"\\uFFE1\",\"\\xA5\":\"\\uFFE5\",\"\\xA6\":\"\\uFFE4\",\"\\xAC\":\"\\uFFE2\",\"\\xAF\":\"\\uFFE3\",\"\\u2013\":\"\\uFE32\",\"\\u2014\":\"\\uFE31\",\"\\u2018\":\"\\uFE43\",\"\\u2019\":\"\\uFE44\",\"\\u201C\":\"\\uFE41\",\"\\u201D\":\"\\uFE42\",\"\\u2026\":\"\\uFE19\",\"\\u2027\":\"\\u30FB\",\"\\u20A9\":\"\\uFFE6\",\"\\u3001\":\"\\uFE11\",\"\\u3002\":\"\\uFE12\",\"\\u3008\":\"\\uFE3F\",\"\\u3009\":\"\\uFE40\",\"\\u300A\":\"\\uFE3D\",\"\\u300B\":\"\\uFE3E\",\"\\u300C\":\"\\uFE41\",\"\\u300D\":\"\\uFE42\",\"\\u300E\":\"\\uFE43\",\"\\u300F\":\"\\uFE44\",\"\\u3010\":\"\\uFE3B\",\"\\u3011\":\"\\uFE3C\",\"\\u3014\":\"\\uFE39\",\"\\u3015\":\"\\uFE3A\",\"\\u3016\":\"\\uFE17\",\"\\u3017\":\"\\uFE18\",\"\\uFF01\":\"\\uFE15\",\"\\uFF08\":\"\\uFE35\",\"\\uFF09\":\"\\uFE36\",\"\\uFF0C\":\"\\uFE10\",\"\\uFF0D\":\"\\uFE32\",\"\\uFF0E\":\"\\u30FB\",\"\\uFF1A\":\"\\uFE13\",\"\\uFF1B\":\"\\uFE14\",\"\\uFF1C\":\"\\uFE3F\",\"\\uFF1E\":\"\\uFE40\",\"\\uFF1F\":\"\\uFE16\",\"\\uFF3B\":\"\\uFE47\",\"\\uFF3D\":\"\\uFE48\",\"\\uFF3F\":\"\\uFE33\",\"\\uFF5B\":\"\\uFE37\",\"\\uFF5C\":\"\\u2015\",\"\\uFF5D\":\"\\uFE38\",\"\\uFF5F\":\"\\uFE35\",\"\\uFF60\":\"\\uFE36\",\"\\uFF61\":\"\\uFE12\",\"\\uFF62\":\"\\uFE41\",\"\\uFF63\":\"\\uFE42\"};var Ws=24,z6=Zi,N6=function(u,a,h,A,x){var E,P,D=8*x-A-1,B=(1<>1,q=-7,Q=h?x-1:0,rt=h?-1:1,ot=u[a+Q];for(Q+=rt,E=ot&(1<<-q)-1,ot>>=-q,q+=D;q>0;E=256*E+u[a+Q],Q+=rt,q-=8);for(P=E&(1<<-q)-1,E>>=-q,q+=A;q>0;P=256*P+u[a+Q],Q+=rt,q-=8);if(E===0)E=1-V;else{if(E===B)return P?NaN:1/0*(ot?-1:1);P+=Math.pow(2,A),E-=V}return(ot?-1:1)*P*Math.pow(2,E-A)},U6=function(u,a,h,A,x,E){var P,D,B,V=8*E-x-1,q=(1<>1,rt=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,ot=A?0:E-1,lt=A?1:-1,pt=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(D=isNaN(a)?1:0,P=q):(P=Math.floor(Math.log(a)/Math.LN2),a*(B=Math.pow(2,-P))<1&&(P--,B*=2),(a+=P+Q>=1?rt/B:rt*Math.pow(2,1-Q))*B>=2&&(P++,B/=2),P+Q>=q?(D=0,P=q):P+Q>=1?(D=(a*B-1)*Math.pow(2,x),P+=Q):(D=a*Math.pow(2,Q-1)*Math.pow(2,x),P=0));x>=8;u[h+ot]=255&D,ot+=lt,D/=256,x-=8);for(P=P<0;u[h+ot]=255&P,ot+=lt,P/=256,V-=8);u[h+ot-lt]|=128*pt};function Zi(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Zi.Varint=0,Zi.Fixed64=1,Zi.Bytes=2,Zi.Fixed32=5;var eC=4294967296,V6=1/eC,j6=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf8\");function Fd(u){return u.type===Zi.Bytes?u.readVarint()+u.pos:u.pos+1}function d_(u,a,h){return h?4294967296*a+(u>>>0):4294967296*(a>>>0)+(u>>>0)}function G6(u,a,h){var A=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));h.realloc(A);for(var x=h.pos-1;x>=u;x--)h.buf[x+A]=h.buf[x]}function kX(u,a){for(var h=0;h>>8,u[h+2]=a>>>16,u[h+3]=a>>>24}function W6(u,a){return(u[a]|u[a+1]<<8|u[a+2]<<16)+(u[a+3]<<24)}Zi.prototype={destroy:function(){this.buf=null},readFields:function(u,a,h){for(h=h||this.length;this.pos>3,E=this.pos;this.type=7&A,u(x,a,this),this.pos===E&&this.skip(A)}return a},readMessage:function(u,a){return this.readFields(u,a,this.readVarint()+this.pos)},readFixed32:function(){var u=US(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=W6(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=US(this.buf,this.pos)+US(this.buf,this.pos+4)*eC;return this.pos+=8,u},readSFixed64:function(){var u=US(this.buf,this.pos)+W6(this.buf,this.pos+4)*eC;return this.pos+=8,u},readFloat:function(){var u=N6(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=N6(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var a,h,A=this.buf;return a=127&(h=A[this.pos++]),h<128?a:(a|=(127&(h=A[this.pos++]))<<7,h<128?a:(a|=(127&(h=A[this.pos++]))<<14,h<128?a:(a|=(127&(h=A[this.pos++]))<<21,h<128?a:function(x,E,P){var D,B,V=P.buf;if(D=(112&(B=V[P.pos++]))>>4,B<128||(D|=(127&(B=V[P.pos++]))<<3,B<128)||(D|=(127&(B=V[P.pos++]))<<10,B<128)||(D|=(127&(B=V[P.pos++]))<<17,B<128)||(D|=(127&(B=V[P.pos++]))<<24,B<128)||(D|=(1&(B=V[P.pos++]))<<31,B<128))return d_(x,D,E);throw new Error(\"Expected varint not more than 10 bytes\")}(a|=(15&(h=A[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,a=this.pos;return this.pos=u,u-a>=12&&j6?function(h,A,x){return j6.decode(h.subarray(A,x))}(this.buf,a,u):function(h,A,x){for(var E=\"\",P=A;P239?4:q>223?3:q>191?2:1;if(P+rt>x)break;rt===1?q<128&&(Q=q):rt===2?(192&(D=h[P+1]))==128&&(Q=(31&q)<<6|63&D)<=127&&(Q=null):rt===3?(B=h[P+2],(192&(D=h[P+1]))==128&&(192&B)==128&&((Q=(15&q)<<12|(63&D)<<6|63&B)<=2047||Q>=55296&&Q<=57343)&&(Q=null)):rt===4&&(B=h[P+2],V=h[P+3],(192&(D=h[P+1]))==128&&(192&B)==128&&(192&V)==128&&((Q=(15&q)<<18|(63&D)<<12|(63&B)<<6|63&V)<=65535||Q>=1114112)&&(Q=null)),Q===null?(Q=65533,rt=1):Q>65535&&(Q-=65536,E+=String.fromCharCode(Q>>>10&1023|55296),Q=56320|1023&Q),E+=String.fromCharCode(Q),P+=rt}return E}(this.buf,a,u)},readBytes:function(){var u=this.readVarint()+this.pos,a=this.buf.subarray(this.pos,u);return this.pos=u,a},readPackedVarint:function(u,a){if(this.type!==Zi.Bytes)return u.push(this.readVarint(a));var h=Fd(this);for(u=u||[];this.pos127;);else if(a===Zi.Bytes)this.pos=this.readVarint()+this.pos;else if(a===Zi.Fixed32)this.pos+=4;else{if(a!==Zi.Fixed64)throw new Error(\"Unimplemented type: \"+a);this.pos+=8}},writeTag:function(u,a){this.writeVarint(u<<3|a)},realloc:function(u){for(var a=this.length||16;a268435455||u<0?function(a,h){var A,x;if(a>=0?(A=a%4294967296|0,x=a/4294967296|0):(x=~(-a/4294967296),4294967295^(A=~(-a%4294967296))?A=A+1|0:(A=0,x=x+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error(\"Given varint doesn't fit into 10 bytes\");h.realloc(10),function(E,P,D){D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,D.buf[D.pos]=127&(E>>>=7)}(A,0,h),function(E,P){var D=(7&E)<<4;P.buf[P.pos++]|=D|((E>>>=3)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E)))))}(x,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var a=this.pos;this.pos=function(A,x,E){for(var P,D,B=0;B55295&&P<57344){if(!D){P>56319||B+1===x.length?(A[E++]=239,A[E++]=191,A[E++]=189):D=P;continue}if(P<56320){A[E++]=239,A[E++]=191,A[E++]=189,D=P;continue}P=D-55296<<10|P-56320|65536,D=null}else D&&(A[E++]=239,A[E++]=191,A[E++]=189,D=null);P<128?A[E++]=P:(P<2048?A[E++]=P>>6|192:(P<65536?A[E++]=P>>12|224:(A[E++]=P>>18|240,A[E++]=P>>12&63|128),A[E++]=P>>6&63|128),A[E++]=63&P|128)}return E}(this.buf,u,this.pos);var h=this.pos-a;h>=128&&G6(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),U6(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),U6(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var a=u.length;this.writeVarint(a),this.realloc(a);for(var h=0;h=128&&G6(h,A,this),this.pos=h-1,this.writeVarint(A),this.pos+=A},writeMessage:function(u,a,h){this.writeTag(u,Zi.Bytes),this.writeRawMessage(a,h)},writePackedVarint:function(u,a){a.length&&this.writeMessage(u,kX,a)},writePackedSVarint:function(u,a){a.length&&this.writeMessage(u,RX,a)},writePackedBoolean:function(u,a){a.length&&this.writeMessage(u,BX,a)},writePackedFloat:function(u,a){a.length&&this.writeMessage(u,DX,a)},writePackedDouble:function(u,a){a.length&&this.writeMessage(u,OX,a)},writePackedFixed32:function(u,a){a.length&&this.writeMessage(u,FX,a)},writePackedSFixed32:function(u,a){a.length&&this.writeMessage(u,zX,a)},writePackedFixed64:function(u,a){a.length&&this.writeMessage(u,NX,a)},writePackedSFixed64:function(u,a){a.length&&this.writeMessage(u,UX,a)},writeBytesField:function(u,a){this.writeTag(u,Zi.Bytes),this.writeBytes(a)},writeFixed32Field:function(u,a){this.writeTag(u,Zi.Fixed32),this.writeFixed32(a)},writeSFixed32Field:function(u,a){this.writeTag(u,Zi.Fixed32),this.writeSFixed32(a)},writeFixed64Field:function(u,a){this.writeTag(u,Zi.Fixed64),this.writeFixed64(a)},writeSFixed64Field:function(u,a){this.writeTag(u,Zi.Fixed64),this.writeSFixed64(a)},writeVarintField:function(u,a){this.writeTag(u,Zi.Varint),this.writeVarint(a)},writeSVarintField:function(u,a){this.writeTag(u,Zi.Varint),this.writeSVarint(a)},writeStringField:function(u,a){this.writeTag(u,Zi.Bytes),this.writeString(a)},writeFloatField:function(u,a){this.writeTag(u,Zi.Fixed32),this.writeFloat(a)},writeDoubleField:function(u,a){this.writeTag(u,Zi.Fixed64),this.writeDouble(a)},writeBooleanField:function(u,a){this.writeVarintField(u,!!a)}};var rC=o(z6);let iC=3;function VX(u,a,h){u===1&&h.readMessage(jX,a)}function jX(u,a,h){if(u===3){let{id:A,bitmap:x,width:E,height:P,left:D,top:B,advance:V}=h.readMessage(GX,{});a.push({id:A,bitmap:new Ai({width:E+2*iC,height:P+2*iC},x),metrics:{width:E,height:P,left:D,top:B,advance:V}})}}function GX(u,a,h){u===1?a.id=h.readVarint():u===2?a.bitmap=h.readBytes():u===3?a.width=h.readVarint():u===4?a.height=h.readVarint():u===5?a.left=h.readSVarint():u===6?a.top=h.readSVarint():u===7&&(a.advance=h.readVarint())}let H6=iC;function q6(u){let a=0,h=0;for(let P of u)a+=P.w*P.h,h=Math.max(h,P.w);u.sort((P,D)=>D.h-P.h);let A=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(a/.95)),h),h:1/0}],x=0,E=0;for(let P of u)for(let D=A.length-1;D>=0;D--){let B=A[D];if(!(P.w>B.w||P.h>B.h)){if(P.x=B.x,P.y=B.y,E=Math.max(E,P.y+P.h),x=Math.max(x,P.x+P.w),P.w===B.w&&P.h===B.h){let V=A.pop();D=0&&A>=a&&jS[this.text.charCodeAt(A)];A--)h--;this.text=this.text.substring(a,h),this.sectionIndex=this.sectionIndex.slice(a,h)}substring(a,h){let A=new A_;return A.text=this.text.substring(a,h),A.sectionIndex=this.sectionIndex.slice(a,h),A.sections=this.sections,A}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,h)=>Math.max(a,this.sections[h].scale),0)}addTextSection(a,h){this.text+=a.text,this.sections.push(Bx.forText(a.scale,a.fontStack||h));let A=this.sections.length-1;for(let x=0;x=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function VS(u,a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt){let xt=A_.fromFeature(u,x),Mt;Q===n.ah.vertical&&xt.verticalizePunctuation();let{processBidirectionalText:Vt,processStyledBidirectionalText:It}=xu;if(Vt&&xt.sections.length===1){Mt=[];let ue=Vt(xt.toString(),sC(xt,V,E,a,A,ot,lt));for(let Fe of ue){let Je=new A_;Je.text=Fe,Je.sections=xt.sections;for(let De=0;De0&&Nd>Al&&(Al=Nd)}else{let Nc=Je[ci.fontStack],gl=Nc&&Nc[Ko];if(gl&&gl.rect)mh=gl.rect,Tu=gl.metrics;else{let Nd=Fe[ci.fontStack],Vx=Nd&&Nd[Ko];if(!Vx)continue;Tu=Vx.metrics}$s=(Zs-ci.scale)*Ws}Mu?(ue.verticalizable=!0,Aa.push({glyph:Ko,imageName:gh,x:An,y:In+$s,vertical:Mu,scale:ci.scale,fontStack:ci.fontStack,sectionIndex:ma,metrics:Tu,rect:mh}),An+=zd*ci.scale+ur):(Aa.push({glyph:Ko,imageName:gh,x:An,y:In+$s,vertical:Mu,scale:ci.scale,fontStack:ci.fontStack,sectionIndex:ma,metrics:Tu,rect:mh}),An+=Tu.advance*ci.scale+ur)}Aa.length!==0&&(Hs=Math.max(An-ur,Hs),qX(Aa,0,Aa.length-1,ja,Al)),An=0;let ml=Se*Zs+Al;Ha.lineOffset=Math.max(Al,pa),In+=ml,jl=Math.max(ml,jl),++ks}var Mo;let Xo=In-Ox,{horizontalAlign:Ga,verticalAlign:Wa}=oC(He);(function(qs,Zs,pa,Ha,Aa,Al,ml,Ys,ci){let ma=(Zs-pa)*Aa,Ko=0;Ko=Al!==ml?-Ys*Ha-Ox:(-Ha*ci+.5)*ml;for(let $s of qs)for(let Tu of $s.positionedGlyphs)Tu.x+=ma,Tu.y+=Ko})(ue.positionedLines,ja,Ga,Wa,Hs,jl,Se,Xo,Ce.length),ue.top+=-Wa*Xo,ue.bottom=ue.top+Xo,ue.left+=-Ga*Hs,ue.right=ue.left+Hs}(ie,a,h,A,Mt,P,D,B,Q,V,rt,pt),!function(ue){for(let Fe of ue)if(Fe.positionedGlyphs.length!==0)return!1;return!0}(zt)&&ie}let jS={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},WX={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Y6(u,a,h,A,x,E){if(a.imageName){let P=A[a.imageName];return P?P.displaySize[0]*a.scale*Ws/E+x:0}{let P=h[a.fontStack],D=P&&P[u];return D?D.metrics.advance*a.scale+x:0}}function $6(u,a,h,A){let x=Math.pow(u-a,2);return A?u=0,q=0;for(let rt=0;rtP.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Te([]),this.placementViewportMatrix=Te([]);let h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=J6(this.zoom,h[\"text-size\"]),this.iconSizeData=J6(this.zoom,h[\"icon-size\"]);let A=this.layers[0].layout,x=A.get(\"symbol-sort-key\"),E=A.get(\"symbol-z-order\");this.canOverlap=aC(A,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||aC(A,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||A.get(\"text-ignore-placement\")||A.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=E!==\"viewport-y\"&&!x.isConstant(),this.sortFeaturesByY=(E===\"viewport-y\"||E===\"auto\"&&!this.sortFeaturesByKey)&&this.canOverlap,A.get(\"symbol-placement\")===\"point\"&&(this.writingModes=A.get(\"text-writing-mode\").map(P=>n.ah[P])),this.stateDependentLayerIds=this.layers.filter(P=>P.isStateDependent()).map(P=>P.id),this.sourceID=a.sourceID}createArrays(){this.text=new cC(new Ls(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new cC(new Ls(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new O,this.lineVertexArray=new F,this.symbolInstances=new M,this.textAnchorOffsets=new W}calculateGlyphDependencies(a,h,A,x,E){for(let P=0;P0)&&(P.value.kind!==\"constant\"||P.value.value.length>0),q=B.value.kind!==\"constant\"||!!B.value.value||Object.keys(B.parameters).length>0,Q=E.get(\"symbol-sort-key\");if(this.features=[],!V&&!q)return;let rt=h.iconDependencies,ot=h.glyphDependencies,lt=h.availableImages,pt=new Ri(this.zoom);for(let{feature:xt,id:Mt,index:Vt,sourceLayerIndex:It}of a){let zt=x._featureFilter.needGeometry,ie=Su(xt,zt);if(!x._featureFilter.filter(pt,ie,A))continue;let ue,Fe;if(zt||(ie.geometry=Oe(xt)),V){let De=x.getValueAndResolveTokens(\"text-field\",ie,A,lt),Ce=Wn.factory(De);QX(Ce)&&(this.hasRTLText=!0),(!this.hasRTLText||xu.getRTLTextPluginStatus()===\"unavailable\"||this.hasRTLText&&xu.isParsed())&&(ue=LX(Ce,x,ie))}if(q){let De=x.getValueAndResolveTokens(\"icon-image\",ie,A,lt);Fe=De instanceof Hn?De:Hn.fromString(De)}if(!ue&&!Fe)continue;let Je=this.sortFeaturesByKey?Q.evaluate(ie,{},A):void 0;if(this.features.push({id:Mt,text:ue,icon:Fe,index:Vt,sourceLayerIndex:It,geometry:ie.geometry,properties:xt.properties,type:YX[xt.type],sortKey:Je}),Fe&&(rt[Fe.name]=!0),ue){let De=P.evaluate(ie,{},A).join(\",\"),Ce=E.get(\"text-rotation-alignment\")!==\"viewport\"&&E.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.ah.vertical)>=0;for(let Se of ue.sections)if(Se.image)rt[Se.image.name]=!0;else{let He=nA(ue.toString()),Pe=Se.fontStack||De,Ae=ot[Pe]=ot[Pe]||{};this.calculateGlyphDependencies(Se.text,Ae,Ce,this.allowVerticalPlacement,He)}}}E.get(\"symbol-placement\")===\"line\"&&(this.features=function(xt){let Mt={},Vt={},It=[],zt=0;function ie(De){It.push(xt[De]),zt++}function ue(De,Ce,Se){let He=Vt[De];return delete Vt[De],Vt[Ce]=He,It[He].geometry[0].pop(),It[He].geometry[0]=It[He].geometry[0].concat(Se[0]),He}function Fe(De,Ce,Se){let He=Mt[Ce];return delete Mt[Ce],Mt[De]=He,It[He].geometry[0].shift(),It[He].geometry[0]=Se[0].concat(It[He].geometry[0]),He}function Je(De,Ce,Se){let He=Se?Ce[0][Ce[0].length-1]:Ce[0][0];return`${De}:${He.x}:${He.y}`}for(let De=0;DeDe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((xt,Mt)=>xt.sortKey-Mt.sortKey)}update(a,h,A){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,h,this.layers,A),this.icon.programConfigurations.updatePaintArrays(a,h,this.layers,A))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,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(a,h){let A=this.lineVertexArray.length;if(a.segment!==void 0){let x=a.dist(h[a.segment+1]),E=a.dist(h[a.segment]),P={};for(let D=a.segment+1;D=0;D--)P[D]={x:h[D].x,y:h[D].y,tileUnitDistanceFromAnchor:E},D>0&&(E+=h[D-1].dist(h[D]));for(let D=0;D0}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(a,h){let A=a.placedSymbolArray.get(h),x=A.vertexStartIndex+4*A.numGlyphs;for(let E=A.vertexStartIndex;Ex[D]-x[B]||E[B]-E[D]),P}addToSortKeyRanges(a,h){let A=this.sortKeyRanges[this.sortKeyRanges.length-1];A&&A.sortKey===h?A.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(a){if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let h of this.symbolInstanceIndexes){let A=this.symbolInstances.get(h);this.featureSortOrder.push(A.featureIndex),[A.rightJustifiedTextSymbolIndex,A.centerJustifiedTextSymbolIndex,A.leftJustifiedTextSymbolIndex].forEach((x,E,P)=>{x>=0&&P.indexOf(x)===E&&this.addIndicesForPlacedSymbol(this.text,x)}),A.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,A.verticalPlacedTextSymbolIndex),A.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.placedIconSymbolIndex),A.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let tF,eF;ze(\"SymbolBucket\",m_,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),m_.MAX_GLYPHS=65535,m_.addDynamicAttributes=lC;var hC={get paint(){return eF=eF||new So({\"icon-opacity\":new dr(Jt.paint_symbol[\"icon-opacity\"]),\"icon-color\":new dr(Jt.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new dr(Jt.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new dr(Jt.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new dr(Jt.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new Xe(Jt.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new Xe(Jt.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new dr(Jt.paint_symbol[\"text-opacity\"]),\"text-color\":new dr(Jt.paint_symbol[\"text-color\"],{runtimeType:Ln,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),\"text-halo-color\":new dr(Jt.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new dr(Jt.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new dr(Jt.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new Xe(Jt.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new Xe(Jt.paint_symbol[\"text-translate-anchor\"])})},get layout(){return tF=tF||new So({\"symbol-placement\":new Xe(Jt.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new Xe(Jt.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new Xe(Jt.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new dr(Jt.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new Xe(Jt.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new Xe(Jt.layout_symbol[\"icon-allow-overlap\"]),\"icon-overlap\":new Xe(Jt.layout_symbol[\"icon-overlap\"]),\"icon-ignore-placement\":new Xe(Jt.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new Xe(Jt.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new Xe(Jt.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new dr(Jt.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new Xe(Jt.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new Xe(Jt.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new dr(Jt.layout_symbol[\"icon-image\"]),\"icon-rotate\":new dr(Jt.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new dr(Jt.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new Xe(Jt.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new dr(Jt.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new dr(Jt.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new Xe(Jt.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new Xe(Jt.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new Xe(Jt.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new dr(Jt.layout_symbol[\"text-field\"]),\"text-font\":new dr(Jt.layout_symbol[\"text-font\"]),\"text-size\":new dr(Jt.layout_symbol[\"text-size\"]),\"text-max-width\":new dr(Jt.layout_symbol[\"text-max-width\"]),\"text-line-height\":new Xe(Jt.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new dr(Jt.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new dr(Jt.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new dr(Jt.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new Xe(Jt.layout_symbol[\"text-variable-anchor\"]),\"text-variable-anchor-offset\":new dr(Jt.layout_symbol[\"text-variable-anchor-offset\"]),\"text-anchor\":new dr(Jt.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new Xe(Jt.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new Xe(Jt.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new dr(Jt.layout_symbol[\"text-rotate\"]),\"text-padding\":new Xe(Jt.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new Xe(Jt.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new dr(Jt.layout_symbol[\"text-transform\"]),\"text-offset\":new dr(Jt.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new Xe(Jt.layout_symbol[\"text-allow-overlap\"]),\"text-overlap\":new Xe(Jt.layout_symbol[\"text-overlap\"]),\"text-ignore-placement\":new Xe(Jt.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new Xe(Jt.layout_symbol[\"text-optional\"])})}};class rF{constructor(a){if(a.property.overrides===void 0)throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=a.property.overrides?a.property.overrides.runtimeType:es,this.defaultValue=a}evaluate(a){if(a.formattedSection){let h=this.defaultValue.property.overrides;if(h&&h.hasOverride(a.formattedSection))return h.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ze(\"FormatSectionOverride\",rF,{omit:[\"defaultValue\"]});class WS extends ul{constructor(a){super(a,hC)}recalculate(a,h){if(super.recalculate(a,h),this.layout.get(\"icon-rotation-alignment\")===\"auto\"&&(this.layout._values[\"icon-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout._values[\"text-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),this.layout.get(\"text-pitch-alignment\")===\"auto\"&&(this.layout._values[\"text-pitch-alignment\"]=this.layout.get(\"text-rotation-alignment\")===\"map\"?\"map\":\"viewport\"),this.layout.get(\"icon-pitch-alignment\")===\"auto\"&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\")),this.layout.get(\"symbol-placement\")===\"point\"){let A=this.layout.get(\"text-writing-mode\");if(A){let x=[];for(let E of A)x.indexOf(E)<0&&x.push(E);this.layout._values[\"text-writing-mode\"]=x}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(a,h,A,x){let E=this.layout.get(a).evaluate(h,{},A,x),P=this._unevaluatedLayout._values[a];return P.isDataDriven()||Ui(P.value)||!E?E:function(D,B){return B.replace(/{([^{}]+)}/g,(V,q)=>D&&q in D?String(D[q]):\"\")}(h.properties,E)}createBucket(a){return new m_(a)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let a of hC.paint.overridableProperties){if(!WS.hasPaintOverride(this.layout,a))continue;let h=this.paint.get(a),A=new rF(h),x=new rn(A,h.property.specification),E=null;E=h.value.kind===\"constant\"||h.value.kind===\"source\"?new wt(\"source\",x):new Zm(\"composite\",x,h.value.zoomStops),this.paint._values[a]=new cl(h.property,E,h.parameters)}}_handleOverridablePaintPropertyUpdate(a,h,A){return!(!this.layout||h.isDataDriven()||A.isDataDriven())&&WS.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,h){let A=a.get(\"text-field\"),x=hC.paint.properties[h],E=!1,P=D=>{for(let B of D)if(x.overrides&&x.overrides.hasOverride(B))return void(E=!0)};if(A.value.kind===\"constant\"&&A.value.value instanceof Wn)P(A.value.value.sections);else if(A.value.kind===\"source\"){let D=V=>{E||(V instanceof Da&&fn(V.value)===Gn?P(V.value.sections):V instanceof bt?P(V.sections):V.eachChild(D))},B=A.value;B._styleExpression&&D(B._styleExpression.expression)}return E}}let iF;var XX={get paint(){return iF=iF||new So({\"background-color\":new Xe(Jt.paint_background[\"background-color\"]),\"background-pattern\":new bu(Jt.paint_background[\"background-pattern\"]),\"background-opacity\":new Xe(Jt.paint_background[\"background-opacity\"])})}};class KX extends ul{constructor(a){super(a,XX)}}let nF;var JX={get paint(){return nF=nF||new So({\"raster-opacity\":new Xe(Jt.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new Xe(Jt.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new Xe(Jt.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new Xe(Jt.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new Xe(Jt.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new Xe(Jt.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new Xe(Jt.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new Xe(Jt.paint_raster[\"raster-fade-duration\"])})}};class tK extends ul{constructor(a){super(a,JX)}}class eK extends ul{constructor(a){super(a,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=a}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error(\"Custom layers cannot be serialized\")}}class rK{constructor(a){this._methodToThrottle=a,this._triggered=!1,typeof MessageChannel<\"u\"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let fC=63710088e-1;class dA{constructor(a,h){if(isNaN(a)||isNaN(h))throw new Error(`Invalid LngLat object: (${a}, ${h})`);if(this.lng=+a,this.lat=+h,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new dA(ht(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(a){let h=Math.PI/180,A=this.lat*h,x=a.lat*h,E=Math.sin(A)*Math.sin(x)+Math.cos(A)*Math.cos(x)*Math.cos((a.lng-this.lng)*h);return fC*Math.acos(Math.min(E,1))}static convert(a){if(a instanceof dA)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new dA(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a==\"object\"&&a!==null)return new dA(Number(\"lng\"in a?a.lng:a.lon),Number(a.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 [, ]\")}}let sF=2*Math.PI*fC;function oF(u){return sF*Math.cos(u*Math.PI/180)}function aF(u){return(180+u)/360}function lF(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function cF(u,a){return u/oF(a)}function dC(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class HS{constructor(a,h,A=0){this.x=+a,this.y=+h,this.z=+A}static fromLngLat(a,h=0){let A=dA.convert(a);return new HS(aF(A.lng),lF(A.lat),cF(h,A.lat))}toLngLat(){return new dA(360*this.x-180,dC(this.y))}toAltitude(){return this.z*oF(dC(this.y))}meterInMercatorCoordinateUnits(){return 1/sF*(a=dC(this.y),1/Math.cos(a*Math.PI/180));var a}}function uF(u,a,h){var A=2*Math.PI*6378137/256/Math.pow(2,h);return[u*A-2*Math.PI*6378137/2,a*A-2*Math.PI*6378137/2]}class pC{constructor(a,h,A){if(a<0||a>25||A<0||A>=Math.pow(2,a)||h<0||h>=Math.pow(2,a))throw new Error(`x=${h}, y=${A}, z=${a} outside of bounds. 0<=x<${Math.pow(2,a)}, 0<=y<${Math.pow(2,a)} 0<=z<=25 `);this.z=a,this.x=h,this.y=A,this.key=zx(0,a,a,h,A)}equals(a){return this.z===a.z&&this.x===a.x&&this.y===a.y}url(a,h,A){let x=(P=this.y,D=this.z,B=uF(256*(E=this.x),256*(P=Math.pow(2,D)-P-1),D),V=uF(256*(E+1),256*(P+1),D),B[0]+\",\"+B[1]+\",\"+V[0]+\",\"+V[1]);var E,P,D,B,V;let q=function(Q,rt,ot){let lt,pt=\"\";for(let xt=Q;xt>0;xt--)lt=1<1?\"@2x\":\"\").replace(/{quadkey}/g,q).replace(/{bbox-epsg-3857}/g,x)}isChildOf(a){let h=this.z-a.z;return h>0&&a.x===this.x>>h&&a.y===this.y>>h}getTilePoint(a){let h=Math.pow(2,this.z);return new _((a.x*h-this.x)*Fn,(a.y*h-this.y)*Fn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class hF{constructor(a,h){this.wrap=a,this.canonical=h,this.key=zx(a,h.z,h.z,h.x,h.y)}}class zc{constructor(a,h,A,x,E){if(a= z; overscaledZ = ${a}; z = ${A}`);this.overscaledZ=a,this.wrap=h,this.canonical=new pC(A,+x,+E),this.key=zx(h,a,A,x,E)}clone(){return new zc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)}scaledTo(a){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let h=this.canonical.z-a;return a>this.canonical.z?new zc(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zc(a,this.wrap,a,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(a,h){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let A=this.canonical.z-a;return a>this.canonical.z?zx(this.wrap*+h,a,this.canonical.z,this.canonical.x,this.canonical.y):zx(this.wrap*+h,a,a,this.canonical.x>>A,this.canonical.y>>A)}isChildOf(a){if(a.wrap!==this.wrap)return!1;let h=this.canonical.z-a.canonical.z;return a.overscaledZ===0||a.overscaledZ>h&&a.canonical.y===this.canonical.y>>h}children(a){if(this.overscaledZ>=a)return[new zc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let h=this.canonical.z+1,A=2*this.canonical.x,x=2*this.canonical.y;return[new zc(h,this.wrap,h,A,x),new zc(h,this.wrap,h,A+1,x),new zc(h,this.wrap,h,A,x+1),new zc(h,this.wrap,h,A+1,x+1)]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.ythis.max&&(this.max=Q),Q=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return(h+1)*this.stride+(a+1)}unpack(a,h,A){return a*this.redFactor+h*this.greenFactor+A*this.blueFactor-this.baseShift}getPixels(){return new di({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,h,A){if(this.dim!==a.dim)throw new Error(\"dem dimension mismatch\");let x=h*this.dim,E=h*this.dim+this.dim,P=A*this.dim,D=A*this.dim+this.dim;switch(h){case-1:x=E-1;break;case 1:E=x+1}switch(A){case-1:P=D-1;break;case 1:D=P+1}let B=-h*this.dim,V=-A*this.dim;for(let q=P;q=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${a} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[a]}}class pF{constructor(a,h,A,x,E){this.type=\"Feature\",this._vectorTileFeature=a,a._z=h,a._x=A,a._y=x,this.properties=a.properties,this.id=E}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(a){this._geometry=a}toJSON(){let a={geometry:this.geometry};for(let h in this)h!==\"_geometry\"&&h!==\"_vectorTileFeature\"&&(a[h]=this[h]);return a}}class AF{constructor(a,h){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new yu(Fn,16,0),this.grid3D=new yu(Fn,16,0),this.featureIndexArray=new X,this.promoteId=h}insert(a,h,A,x,E,P){let D=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(A,x,E);let B=P?this.grid3D:this.grid;for(let V=0;V=0&&Q[3]>=0&&B.insert(D,Q[0],Q[1],Q[2],Q[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new uA.VectorTile(new rC(this.rawTileData)).layers,this.sourceLayerCoder=new dF(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"])),this.vtLayers}query(a,h,A,x){this.loadVTLayers();let E=a.params||{},P=Fn/a.tileSize/a.scale,D=Id(E.filter),B=a.queryGeometry,V=a.queryPadding*P,q=gF(B),Q=this.grid.query(q.minX-V,q.minY-V,q.maxX+V,q.maxY+V),rt=gF(a.cameraQueryGeometry),ot=this.grid3D.query(rt.minX-V,rt.minY-V,rt.maxX+V,rt.maxY+V,(xt,Mt,Vt,It)=>function(zt,ie,ue,Fe,Je){for(let Ce of zt)if(ie<=Ce.x&&ue<=Ce.y&&Fe>=Ce.x&&Je>=Ce.y)return!0;let De=[new _(ie,ue),new _(ie,Je),new _(Fe,Je),new _(Fe,ue)];if(zt.length>2){for(let Ce of De)if(L(zt,Ce))return!0}for(let Ce=0;Ce(It||(It=Oe(zt)),ie.queryIntersectsFeature(B,zt,ue,It,this.z,a.transform,P,a.pixelPosMatrix)))}return lt}loadMatchingFeature(a,h,A,x,E,P,D,B,V,q,Q){let rt=this.bucketLayerIDs[h];if(P&&!function(xt,Mt){for(let Vt=0;Vt=0)return!0;return!1}(P,rt))return;let ot=this.sourceLayerCoder.decode(A),lt=this.vtLayers[ot].feature(x);if(E.needGeometry){let xt=Su(lt,!0);if(!E.filter(new Ri(this.tileID.overscaledZ),xt,this.tileID.canonical))return}else if(!E.filter(new Ri(this.tileID.overscaledZ),lt))return;let pt=this.getId(lt,ot);for(let xt=0;xt{let D=a instanceof Rd?a.get(P):null;return D&&D.evaluate?D.evaluate(h,A,x):D})}function gF(u){let a=1/0,h=1/0,A=-1/0,x=-1/0;for(let E of u)a=Math.min(a,E.x),h=Math.min(h,E.y),A=Math.max(A,E.x),x=Math.max(x,E.y);return{minX:a,minY:h,maxX:A,maxY:x}}function iK(u,a){return a-u}function _F(u,a,h,A,x){let E=[];for(let P=0;P=A&&Q.x>=A||(q.x>=A?q=new _(A,q.y+(A-q.x)/(Q.x-q.x)*(Q.y-q.y))._round():Q.x>=A&&(Q=new _(A,q.y+(A-q.x)/(Q.x-q.x)*(Q.y-q.y))._round()),q.y>=x&&Q.y>=x||(q.y>=x?q=new _(q.x+(x-q.y)/(Q.y-q.y)*(Q.x-q.x),x)._round():Q.y>=x&&(Q=new _(q.x+(x-q.y)/(Q.y-q.y)*(Q.x-q.x),x)._round()),B&&q.equals(B[B.length-1])||(B=[q],E.push(B)),B.push(Q)))))}}return E}ze(\"FeatureIndex\",AF,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class pA extends _{constructor(a,h,A,x){super(a,h),this.angle=A,x!==void 0&&(this.segment=x)}clone(){return new pA(this.x,this.y,this.angle,this.segment)}}function yF(u,a,h,A,x){if(a.segment===void 0||h===0)return!0;let E=a,P=a.segment+1,D=0;for(;D>-h/2;){if(P--,P<0)return!1;D-=u[P].dist(E),E=u[P]}D+=u[P].dist(u[P+1]),P++;let B=[],V=0;for(;DA;)V-=B.shift().angleDelta;if(V>x)return!1;P++,D+=q.dist(Q)}return!0}function vF(u){let a=0;for(let h=0;hV){let lt=(V-B)/ot,pt=Yo.number(Q.x,rt.x,lt),xt=Yo.number(Q.y,rt.y,lt),Mt=new pA(pt,xt,rt.angleTo(Q),q);return Mt._round(),!P||yF(u,Mt,D,P,a)?Mt:void 0}B+=ot}}function sK(u,a,h,A,x,E,P,D,B){let V=xF(A,E,P),q=bF(A,x),Q=q*P,rt=u[0].x===0||u[0].x===B||u[0].y===0||u[0].y===B;return a-Q=0&&zt=0&&ie=0&&rt+V<=q){let ue=new pA(zt,ie,Vt,lt);ue._round(),A&&!yF(u,ue,E,A,x)||ot.push(ue)}}Q+=Mt}return D||ot.length||P||(ot=wF(u,Q/2,h,A,x,E,P,!0,B)),ot}ze(\"Anchor\",pA);let g_=pl;function SF(u,a,h,A){let x=[],E=u.image,P=E.pixelRatio,D=E.paddedRect.w-2*g_,B=E.paddedRect.h-2*g_,V=u.right-u.left,q=u.bottom-u.top,Q=E.stretchX||[[0,D]],rt=E.stretchY||[[0,B]],ot=(Se,He)=>Se+He[1]-He[0],lt=Q.reduce(ot,0),pt=rt.reduce(ot,0),xt=D-lt,Mt=B-pt,Vt=0,It=lt,zt=0,ie=pt,ue=0,Fe=xt,Je=0,De=Mt;if(E.content&&A){let Se=E.content;Vt=qS(Q,0,Se[0]),zt=qS(rt,0,Se[1]),It=qS(Q,Se[0],Se[2]),ie=qS(rt,Se[1],Se[3]),ue=Se[0]-Vt,Je=Se[1]-zt,Fe=Se[2]-Se[0]-It,De=Se[3]-Se[1]-ie}let Ce=(Se,He,Pe,Ae)=>{let ur=ZS(Se.stretch-Vt,It,V,u.left),er=YS(Se.fixed-ue,Fe,Se.stretch,lt),ri=ZS(He.stretch-zt,ie,q,u.top),An=YS(He.fixed-Je,De,He.stretch,pt),In=ZS(Pe.stretch-Vt,It,V,u.left),Hs=YS(Pe.fixed-ue,Fe,Pe.stretch,lt),jl=ZS(Ae.stretch-zt,ie,q,u.top),ja=YS(Ae.fixed-Je,De,Ae.stretch,pt),ks=new _(ur,ri),Mo=new _(In,ri),Xo=new _(In,jl),Ga=new _(ur,jl),Wa=new _(er/P,An/P),qs=new _(Hs/P,ja/P),Zs=a*Math.PI/180;if(Zs){let Aa=Math.sin(Zs),Al=Math.cos(Zs),ml=[Al,-Aa,Aa,Al];ks._matMult(ml),Mo._matMult(ml),Ga._matMult(ml),Xo._matMult(ml)}let pa=Se.stretch+Se.fixed,Ha=He.stretch+He.fixed;return{tl:ks,tr:Mo,bl:Ga,br:Xo,tex:{x:E.paddedRect.x+g_+pa,y:E.paddedRect.y+g_+Ha,w:Pe.stretch+Pe.fixed-pa,h:Ae.stretch+Ae.fixed-Ha},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Wa,pixelOffsetBR:qs,minFontScaleX:Fe/P/V,minFontScaleY:De/P/q,isSDF:h}};if(A&&(E.stretchX||E.stretchY)){let Se=TF(Q,xt,lt),He=TF(rt,Mt,pt);for(let Pe=0;Pe0&&(lt=Math.max(10,lt),this.circleDiameter=lt)}else{let Q=P.top*D-B[0],rt=P.bottom*D+B[2],ot=P.left*D-B[3],lt=P.right*D+B[1],pt=P.collisionPadding;if(pt&&(ot-=pt[0]*D,Q-=pt[1]*D,lt+=pt[2]*D,rt+=pt[3]*D),q){let xt=new _(ot,Q),Mt=new _(lt,Q),Vt=new _(ot,rt),It=new _(lt,rt),zt=q*Math.PI/180;xt._rotate(zt),Mt._rotate(zt),Vt._rotate(zt),It._rotate(zt),ot=Math.min(xt.x,Mt.x,Vt.x,It.x),lt=Math.max(xt.x,Mt.x,Vt.x,It.x),Q=Math.min(xt.y,Mt.y,Vt.y,It.y),rt=Math.max(xt.y,Mt.y,Vt.y,It.y)}a.emplaceBack(h.x,h.y,ot,Q,lt,rt,A,x,E)}this.boxEndIndex=a.length}}class oK{constructor(a=[],h=aK){if(this.data=a,this.length=this.data.length,this.compare=h,this.length>0)for(let A=(this.length>>1)-1;A>=0;A--)this._down(A)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let a=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),a}peek(){return this.data[0]}_up(a){let{data:h,compare:A}=this,x=h[a];for(;a>0;){let E=a-1>>1,P=h[E];if(A(x,P)>=0)break;h[a]=P,a=E}h[a]=x}_down(a){let{data:h,compare:A}=this,x=this.length>>1,E=h[a];for(;a=0)break;h[a]=D,a=P}h[a]=E}}function aK(u,a){return ua?1:0}function lK(u,a=1,h=!1){let A=1/0,x=1/0,E=-1/0,P=-1/0,D=u[0];for(let ot=0;otE)&&(E=lt.x),(!ot||lt.y>P)&&(P=lt.y)}let B=Math.min(E-A,P-x),V=B/2,q=new oK([],cK);if(B===0)return new _(A,x);for(let ot=A;otQ.d||!Q.d)&&(Q=ot,h&&console.log(\"found best %d after %d probes\",Math.round(1e4*ot.d)/1e4,rt)),ot.max-Q.d<=a||(V=ot.h/2,q.push(new __(ot.p.x-V,ot.p.y-V,V,u)),q.push(new __(ot.p.x+V,ot.p.y-V,V,u)),q.push(new __(ot.p.x-V,ot.p.y+V,V,u)),q.push(new __(ot.p.x+V,ot.p.y+V,V,u)),rt+=4)}return h&&(console.log(`num probes: ${rt}`),console.log(`best distance: ${Q.d}`)),Q.p}function cK(u,a){return a.max-u.max}function __(u,a,h,A){this.p=new _(u,a),this.h=h,this.d=function(x,E){let P=!1,D=1/0;for(let B=0;Bx.y!=lt.y>x.y&&x.x<(lt.x-ot.x)*(x.y-ot.y)/(lt.y-ot.y)+ot.x&&(P=!P),D=Math.min(D,C(x,ot,lt))}}return(P?1:-1)*Math.sqrt(D)}(this.p,A),this.max=this.d+this.h*Math.SQRT2}var Qo;n.ap=void 0,(Qo=n.ap||(n.ap={}))[Qo.center=1]=\"center\",Qo[Qo.left=2]=\"left\",Qo[Qo.right=3]=\"right\",Qo[Qo.top=4]=\"top\",Qo[Qo.bottom=5]=\"bottom\",Qo[Qo[\"top-left\"]=6]=\"top-left\",Qo[Qo[\"top-right\"]=7]=\"top-right\",Qo[Qo[\"bottom-left\"]=8]=\"bottom-left\",Qo[Qo[\"bottom-right\"]=9]=\"bottom-right\";let AA=7,AC=Number.POSITIVE_INFINITY;function MF(u,a){return a[1]!==AC?function(h,A,x){let E=0,P=0;switch(A=Math.abs(A),x=Math.abs(x),h){case\"top-right\":case\"top-left\":case\"top\":P=x-AA;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":P=-x+AA}switch(h){case\"top-right\":case\"bottom-right\":case\"right\":E=-A;break;case\"top-left\":case\"bottom-left\":case\"left\":E=A}return[E,P]}(u,a[0],a[1]):function(h,A){let x=0,E=0;A<0&&(A=0);let P=A/Math.SQRT2;switch(h){case\"top-right\":case\"top-left\":E=P-AA;break;case\"bottom-right\":case\"bottom-left\":E=-P+AA;break;case\"bottom\":E=-A+AA;break;case\"top\":E=A-AA}switch(h){case\"top-right\":case\"bottom-right\":x=-P;break;case\"top-left\":case\"bottom-left\":x=P;break;case\"left\":x=A;break;case\"right\":x=-A}return[x,E]}(u,a[0])}function EF(u,a,h){var A;let x=u.layout,E=(A=x.get(\"text-variable-anchor-offset\"))===null||A===void 0?void 0:A.evaluate(a,{},h);if(E){let D=E.values,B=[];for(let V=0;Vrt*Ws);q.startsWith(\"top\")?Q[1]-=AA:q.startsWith(\"bottom\")&&(Q[1]+=AA),B[V+1]=Q}return new Rn(B)}let P=x.get(\"text-variable-anchor\");if(P){let D;D=u._unevaluatedLayout.getValue(\"text-radial-offset\")!==void 0?[x.get(\"text-radial-offset\").evaluate(a,{},h)*Ws,AC]:x.get(\"text-offset\").evaluate(a,{},h).map(V=>V*Ws);let B=[];for(let V of P)B.push(V,MF(V,D));return new Rn(B)}return null}function mC(u){switch(u){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}function uK(u,a,h,A,x,E,P,D,B,V,q){let Q=E.textMaxSize.evaluate(a,{});Q===void 0&&(Q=P);let rt=u.layers[0].layout,ot=rt.get(\"icon-offset\").evaluate(a,{},q),lt=IF(h.horizontal),pt=P/24,xt=u.tilePixelRatio*pt,Mt=u.tilePixelRatio*Q/24,Vt=u.tilePixelRatio*D,It=u.tilePixelRatio*rt.get(\"symbol-spacing\"),zt=rt.get(\"text-padding\")*u.tilePixelRatio,ie=function(Ae,ur,er,ri=1){let An=Ae.get(\"icon-padding\").evaluate(ur,{},er),In=An&&An.values;return[In[0]*ri,In[1]*ri,In[2]*ri,In[3]*ri]}(rt,a,q,u.tilePixelRatio),ue=rt.get(\"text-max-angle\")/180*Math.PI,Fe=rt.get(\"text-rotation-alignment\")!==\"viewport\"&&rt.get(\"symbol-placement\")!==\"point\",Je=rt.get(\"icon-rotation-alignment\")===\"map\"&&rt.get(\"symbol-placement\")!==\"point\",De=rt.get(\"symbol-placement\"),Ce=It/2,Se=rt.get(\"icon-text-fit\"),He;A&&Se!==\"none\"&&(u.allowVerticalPlacement&&h.vertical&&(He=K6(A,h.vertical,Se,rt.get(\"icon-text-fit-padding\"),ot,pt)),lt&&(A=K6(A,lt,Se,rt.get(\"icon-text-fit-padding\"),ot,pt)));let Pe=(Ae,ur)=>{ur.x<0||ur.x>=Fn||ur.y<0||ur.y>=Fn||function(er,ri,An,In,Hs,jl,ja,ks,Mo,Xo,Ga,Wa,qs,Zs,pa,Ha,Aa,Al,ml,Ys,ci,ma,Ko,$s,Tu){let mh=er.addToLineVertexArray(ri,An),gh,zd,Mu,Nc,gl=0,Nd=0,Vx=0,RF=0,SC=-1,TC=-1,Ud={},DF=Or(\"\");if(er.allowVerticalPlacement&&In.vertical){let ga=ks.layout.get(\"text-rotate\").evaluate(ci,{},$s)+90;Mu=new $S(Mo,ri,Xo,Ga,Wa,In.vertical,qs,Zs,pa,ga),ja&&(Nc=new $S(Mo,ri,Xo,Ga,Wa,ja,Aa,Al,pa,ga))}if(Hs){let ga=ks.layout.get(\"icon-rotate\").evaluate(ci,{}),Uc=ks.layout.get(\"icon-text-fit\")!==\"none\",u0=SF(Hs,ga,Ko,Uc),yh=ja?SF(ja,ga,Ko,Uc):void 0;zd=new $S(Mo,ri,Xo,Ga,Wa,Hs,Aa,Al,!1,ga),gl=4*u0.length;let h0=er.iconSizeData,Of=null;h0.kind===\"source\"?(Of=[Df*ks.layout.get(\"icon-size\").evaluate(ci,{})],Of[0]>fA&&ke(`${er.layerIds[0]}: Value for \"icon-size\" is >= ${Fx}. Reduce your \"icon-size\".`)):h0.kind===\"composite\"&&(Of=[Df*ma.compositeIconSizes[0].evaluate(ci,{},$s),Df*ma.compositeIconSizes[1].evaluate(ci,{},$s)],(Of[0]>fA||Of[1]>fA)&&ke(`${er.layerIds[0]}: Value for \"icon-size\" is >= ${Fx}. Reduce your \"icon-size\".`)),er.addSymbols(er.icon,u0,Of,Ys,ml,ci,n.ah.none,ri,mh.lineStartIndex,mh.lineLength,-1,$s),SC=er.icon.placedSymbolArray.length-1,yh&&(Nd=4*yh.length,er.addSymbols(er.icon,yh,Of,Ys,ml,ci,n.ah.vertical,ri,mh.lineStartIndex,mh.lineLength,-1,$s),TC=er.icon.placedSymbolArray.length-1)}let OF=Object.keys(In.horizontal);for(let ga of OF){let Uc=In.horizontal[ga];if(!gh){DF=Or(Uc.text);let yh=ks.layout.get(\"text-rotate\").evaluate(ci,{},$s);gh=new $S(Mo,ri,Xo,Ga,Wa,Uc,qs,Zs,pa,yh)}let u0=Uc.positionedLines.length===1;if(Vx+=PF(er,ri,Uc,jl,ks,pa,ci,Ha,mh,In.vertical?n.ah.horizontal:n.ah.horizontalOnly,u0?OF:[ga],Ud,SC,ma,$s),u0)break}In.vertical&&(RF+=PF(er,ri,In.vertical,jl,ks,pa,ci,Ha,mh,n.ah.vertical,[\"vertical\"],Ud,TC,ma,$s));let dK=gh?gh.boxStartIndex:er.collisionBoxArray.length,pK=gh?gh.boxEndIndex:er.collisionBoxArray.length,AK=Mu?Mu.boxStartIndex:er.collisionBoxArray.length,mK=Mu?Mu.boxEndIndex:er.collisionBoxArray.length,gK=zd?zd.boxStartIndex:er.collisionBoxArray.length,_K=zd?zd.boxEndIndex:er.collisionBoxArray.length,yK=Nc?Nc.boxStartIndex:er.collisionBoxArray.length,vK=Nc?Nc.boxEndIndex:er.collisionBoxArray.length,_h=-1,XS=(ga,Uc)=>ga&&ga.circleDiameter?Math.max(ga.circleDiameter,Uc):Uc;_h=XS(gh,_h),_h=XS(Mu,_h),_h=XS(zd,_h),_h=XS(Nc,_h);let BF=_h>-1?1:0;BF&&(_h*=Tu/Ws),er.glyphOffsetArray.length>=m_.MAX_GLYPHS&&ke(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),ci.sortKey!==void 0&&er.addToSortKeyRanges(er.symbolInstances.length,ci.sortKey);let xK=EF(ks,ci,$s),[bK,wK]=function(ga,Uc){let u0=ga.length,yh=Uc?.values;if(yh?.length>0)for(let h0=0;h0=0?Ud.right:-1,Ud.center>=0?Ud.center:-1,Ud.left>=0?Ud.left:-1,Ud.vertical||-1,SC,TC,DF,dK,pK,AK,mK,gK,_K,yK,vK,Xo,Vx,RF,gl,Nd,BF,0,qs,_h,bK,wK)}(u,ur,Ae,h,A,x,He,u.layers[0],u.collisionBoxArray,a.index,a.sourceLayerIndex,u.index,xt,[zt,zt,zt,zt],Fe,B,Vt,ie,Je,ot,a,E,V,q,P)};if(De===\"line\")for(let Ae of _F(a.geometry,0,0,Fn,Fn)){let ur=sK(Ae,It,ue,h.vertical||lt,A,24,Mt,u.overscaling,Fn);for(let er of ur)lt&&hK(u,lt.text,Ce,er)||Pe(Ae,er)}else if(De===\"line-center\"){for(let Ae of a.geometry)if(Ae.length>1){let ur=nK(Ae,ue,h.vertical||lt,A,24,Mt);ur&&Pe(Ae,ur)}}else if(a.type===\"Polygon\")for(let Ae of YI(a.geometry,0)){let ur=lK(Ae,16);Pe(Ae[0],new pA(ur.x,ur.y,0))}else if(a.type===\"LineString\")for(let Ae of a.geometry)Pe(Ae,new pA(Ae[0].x,Ae[0].y,0));else if(a.type===\"Point\")for(let Ae of a.geometry)for(let ur of Ae)Pe([ur],new pA(ur.x,ur.y,0))}function PF(u,a,h,A,x,E,P,D,B,V,q,Q,rt,ot,lt){let pt=function(Vt,It,zt,ie,ue,Fe,Je,De){let Ce=ie.layout.get(\"text-rotate\").evaluate(Fe,{})*Math.PI/180,Se=[];for(let He of It.positionedLines)for(let Pe of He.positionedGlyphs){if(!Pe.rect)continue;let Ae=Pe.rect||{},ur=H6+1,er=!0,ri=1,An=0,In=(ue||De)&&Pe.vertical,Hs=Pe.metrics.advance*Pe.scale/2;if(De&&It.verticalizable&&(An=He.lineOffset/2-(Pe.imageName?-(Ws-Pe.metrics.width*Pe.scale)/2:(Pe.scale-1)*Ws)),Pe.imageName){let Ys=Je[Pe.imageName];er=Ys.sdf,ri=Ys.pixelRatio,ur=pl/ri}let jl=ue?[Pe.x+Hs,Pe.y]:[0,0],ja=ue?[0,0]:[Pe.x+Hs+zt[0],Pe.y+zt[1]-An],ks=[0,0];In&&(ks=ja,ja=[0,0]);let Mo=Pe.metrics.isDoubleResolution?2:1,Xo=(Pe.metrics.left-ur)*Pe.scale-Hs+ja[0],Ga=(-Pe.metrics.top-ur)*Pe.scale+ja[1],Wa=Xo+Ae.w/Mo*Pe.scale/ri,qs=Ga+Ae.h/Mo*Pe.scale/ri,Zs=new _(Xo,Ga),pa=new _(Wa,Ga),Ha=new _(Xo,qs),Aa=new _(Wa,qs);if(In){let Ys=new _(-Hs,Hs-Ox),ci=-Math.PI/2,ma=Ws/2-Hs,Ko=new _(5-Ox-ma,-(Pe.imageName?ma:0)),$s=new _(...ks);Zs._rotateAround(ci,Ys)._add(Ko)._add($s),pa._rotateAround(ci,Ys)._add(Ko)._add($s),Ha._rotateAround(ci,Ys)._add(Ko)._add($s),Aa._rotateAround(ci,Ys)._add(Ko)._add($s)}if(Ce){let Ys=Math.sin(Ce),ci=Math.cos(Ce),ma=[ci,-Ys,Ys,ci];Zs._matMult(ma),pa._matMult(ma),Ha._matMult(ma),Aa._matMult(ma)}let Al=new _(0,0),ml=new _(0,0);Se.push({tl:Zs,tr:pa,bl:Ha,br:Aa,tex:Ae,writingMode:It.writingMode,glyphOffset:jl,sectionIndex:Pe.sectionIndex,isSDF:er,pixelOffsetTL:Al,pixelOffsetBR:ml,minFontScaleX:0,minFontScaleY:0})}return Se}(0,h,D,x,E,P,A,u.allowVerticalPlacement),xt=u.textSizeData,Mt=null;xt.kind===\"source\"?(Mt=[Df*x.layout.get(\"text-size\").evaluate(P,{})],Mt[0]>fA&&ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Fx}. Reduce your \"text-size\".`)):xt.kind===\"composite\"&&(Mt=[Df*ot.compositeTextSizes[0].evaluate(P,{},lt),Df*ot.compositeTextSizes[1].evaluate(P,{},lt)],(Mt[0]>fA||Mt[1]>fA)&&ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Fx}. Reduce your \"text-size\".`)),u.addSymbols(u.text,pt,Mt,D,E,P,V,a,B.lineStartIndex,B.lineLength,rt,lt);for(let Vt of q)Q[Vt]=u.text.placedSymbolArray.length-1;return 4*pt.length}function IF(u){for(let a in u)return u[a];return null}function hK(u,a,h,A){let x=u.compareText;if(a in x){let E=x[a];for(let P=E.length-1;P>=0;P--)if(A.dist(E[P])>4;if(x!==1)throw new Error(`Got v${x} data when expected v1.`);let E=CF[15&A];if(!E)throw new Error(\"Unrecognized array type.\");let[P]=new Uint16Array(a,2,1),[D]=new Uint32Array(a,4,1);return new gC(D,P,E,a)}constructor(a,h=64,A=Float64Array,x){if(isNaN(a)||a<0)throw new Error(`Unpexpected numItems value: ${a}.`);this.numItems=+a,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=A,this.IndexArrayType=a<65536?Uint16Array:Uint32Array;let E=CF.indexOf(this.ArrayType),P=2*a*this.ArrayType.BYTES_PER_ELEMENT,D=a*this.IndexArrayType.BYTES_PER_ELEMENT,B=(8-D%8)%8;if(E<0)throw new Error(`Unexpected typed array class: ${A}.`);x&&x instanceof ArrayBuffer?(this.data=x,this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+B,2*a),this._pos=2*a,this._finished=!0):(this.data=new ArrayBuffer(8+P+D+B),this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+B,2*a),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+E]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=a)}add(a,h){let A=this._pos>>1;return this.ids[A]=A,this.coords[this._pos++]=a,this.coords[this._pos++]=h,A}finish(){let a=this._pos>>1;if(a!==this.numItems)throw new Error(`Added ${a} items when expected ${this.numItems}.`);return _C(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(a,h,A,x){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:E,coords:P,nodeSize:D}=this,B=[0,E.length-1,0],V=[];for(;B.length;){let q=B.pop()||0,Q=B.pop()||0,rt=B.pop()||0;if(Q-rt<=D){for(let xt=rt;xt<=Q;xt++){let Mt=P[2*xt],Vt=P[2*xt+1];Mt>=a&&Mt<=A&&Vt>=h&&Vt<=x&&V.push(E[xt])}continue}let ot=rt+Q>>1,lt=P[2*ot],pt=P[2*ot+1];lt>=a&<<=A&&pt>=h&&pt<=x&&V.push(E[ot]),(q===0?a<=lt:h<=pt)&&(B.push(rt),B.push(ot-1),B.push(1-q)),(q===0?A>=lt:x>=pt)&&(B.push(ot+1),B.push(Q),B.push(1-q))}return V}within(a,h,A){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:x,coords:E,nodeSize:P}=this,D=[0,x.length-1,0],B=[],V=A*A;for(;D.length;){let q=D.pop()||0,Q=D.pop()||0,rt=D.pop()||0;if(Q-rt<=P){for(let xt=rt;xt<=Q;xt++)kF(E[2*xt],E[2*xt+1],a,h)<=V&&B.push(x[xt]);continue}let ot=rt+Q>>1,lt=E[2*ot],pt=E[2*ot+1];kF(lt,pt,a,h)<=V&&B.push(x[ot]),(q===0?a-A<=lt:h-A<=pt)&&(D.push(rt),D.push(ot-1),D.push(1-q)),(q===0?a+A>=lt:h+A>=pt)&&(D.push(ot+1),D.push(Q),D.push(1-q))}return B}}function _C(u,a,h,A,x,E){if(x-A<=h)return;let P=A+x>>1;LF(u,a,P,A,x,E),_C(u,a,h,A,P-1,1-E),_C(u,a,h,P+1,x,1-E)}function LF(u,a,h,A,x,E){for(;x>A;){if(x-A>600){let V=x-A+1,q=h-A+1,Q=Math.log(V),rt=.5*Math.exp(2*Q/3),ot=.5*Math.sqrt(Q*rt*(V-rt)/V)*(q-V/2<0?-1:1);LF(u,a,h,Math.max(A,Math.floor(h-q*rt/V+ot)),Math.min(x,Math.floor(h+(V-q)*rt/V+ot)),E)}let P=a[2*h+E],D=A,B=x;for(Nx(u,a,A,h),a[2*x+E]>P&&Nx(u,a,A,x);DP;)B--}a[2*A+E]===P?Nx(u,a,A,B):(B++,Nx(u,a,B,x)),B<=h&&(A=B+1),h<=B&&(x=B-1)}}function Nx(u,a,h,A){yC(u,h,A),yC(a,2*h,2*A),yC(a,2*h+1,2*A+1)}function yC(u,a,h){let A=u[a];u[a]=u[h],u[h]=A}function kF(u,a,h,A){let x=u-h,E=a-A;return x*x+E*E}var vC;n.bc=void 0,(vC=n.bc||(n.bc={})).create=\"create\",vC.load=\"load\",vC.fullLoad=\"fullLoad\";let QS=null,Ux=[],xC=1e3/60,bC=\"loadTime\",wC=\"fullLoadTime\",fK={mark(u){performance.mark(u)},frame(u){let a=u;QS!=null&&Ux.push(a-QS),QS=a},clearMetrics(){QS=null,Ux=[],performance.clearMeasures(bC),performance.clearMeasures(wC);for(let u in n.bc)performance.clearMarks(n.bc[u])},getPerformanceMetrics(){performance.measure(bC,n.bc.create,n.bc.load),performance.measure(wC,n.bc.create,n.bc.fullLoad);let u=performance.getEntriesByName(bC)[0].duration,a=performance.getEntriesByName(wC)[0].duration,h=Ux.length,A=1/(Ux.reduce((E,P)=>E+P,0)/h/1e3),x=Ux.filter(E=>E>xC).reduce((E,P)=>E+(P-xC)/xC,0);return{loadTime:u,fullLoadTime:a,fps:A,percentDroppedFrames:x/(h+x)*100,totalFrames:h}}};n.$=hr,n.A=se,n.B=function(u){if(hn==null){let a=u.navigator?u.navigator.userAgent:null;hn=!!u.safari||!(!a||!(/\\b(iPad|iPhone|iPod)\\b/.test(a)||a.match(\"Safari\")&&!a.match(\"Chrome\")))}return hn},n.C=class{constructor(u,a){this.target=u,this.mapId=a,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new rK(()=>this.process()),this.subscription=function(h,A,x,E){return h.addEventListener(A,x,!1),{unsubscribe:()=>{h.removeEventListener(A,x,!1)}}}(this.target,\"message\",h=>this.receive(h)),this.globalScope=Lr(self)?u:window}registerMessageHandler(u,a){this.messageHandlers[u]=a}sendAsync(u,a){return new Promise((h,A)=>{let x=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[x]={resolve:h,reject:A},a&&a.signal.addEventListener(\"abort\",()=>{delete this.resolveRejects[x];let D={id:x,type:\"\",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(D)},{once:!0});let E=[],P=Object.assign(Object.assign({},u),{id:x,sourceMapId:this.mapId,origin:location.origin,data:Mf(u.data,E)});this.target.postMessage(P,{transfer:E})})}receive(u){let a=u.data,h=a.id;if(a.origin===location.origin&&(!a.targetMapId||this.mapId===a.targetMapId)){if(a.type===\"\"){delete this.tasks[h];let A=this.abortControllers[h];return delete this.abortControllers[h],void(A&&A.abort())}if(Lr(self)||a.mustQueue)return this.tasks[h]=a,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,a)}}process(){if(this.taskQueue.length===0)return;let u=this.taskQueue.shift(),a=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),a&&this.processTask(u,a)}processTask(u,a){return s(this,void 0,void 0,function*(){if(a.type===\"\"){let x=this.resolveRejects[u];return delete this.resolveRejects[u],x?void(a.error?x.reject(Ef(a.error)):x.resolve(Ef(a.data))):void 0}if(!this.messageHandlers[a.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${a.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(\", \")}`));let h=Ef(a.data),A=new AbortController;this.abortControllers[u]=A;try{let x=yield this.messageHandlers[a.type](a.sourceMapId,h,A);this.completeTask(u,null,x)}catch(x){this.completeTask(u,x)}})}completeTask(u,a,h){let A=[];delete this.abortControllers[u];let x={id:u,type:\"\",sourceMapId:this.mapId,origin:location.origin,error:a?Mf(a):null,data:Mf(h,A)};this.target.postMessage(x,{transfer:A})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},n.D=Xe,n.E=la,n.F=function(){var u=new se(16);return se!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},n.G=Vo,n.H=function(u,a,h){var A,x,E,P,D,B,V,q,Q,rt,ot,lt,pt=h[0],xt=h[1],Mt=h[2];return a===u?(u[12]=a[0]*pt+a[4]*xt+a[8]*Mt+a[12],u[13]=a[1]*pt+a[5]*xt+a[9]*Mt+a[13],u[14]=a[2]*pt+a[6]*xt+a[10]*Mt+a[14],u[15]=a[3]*pt+a[7]*xt+a[11]*Mt+a[15]):(x=a[1],E=a[2],P=a[3],D=a[4],B=a[5],V=a[6],q=a[7],Q=a[8],rt=a[9],ot=a[10],lt=a[11],u[0]=A=a[0],u[1]=x,u[2]=E,u[3]=P,u[4]=D,u[5]=B,u[6]=V,u[7]=q,u[8]=Q,u[9]=rt,u[10]=ot,u[11]=lt,u[12]=A*pt+D*xt+Q*Mt+a[12],u[13]=x*pt+B*xt+rt*Mt+a[13],u[14]=E*pt+V*xt+ot*Mt+a[14],u[15]=P*pt+q*xt+lt*Mt+a[15]),u},n.I=nC,n.J=function(u,a,h){var A=h[0],x=h[1],E=h[2];return u[0]=a[0]*A,u[1]=a[1]*A,u[2]=a[2]*A,u[3]=a[3]*A,u[4]=a[4]*x,u[5]=a[5]*x,u[6]=a[6]*x,u[7]=a[7]*x,u[8]=a[8]*E,u[9]=a[9]*E,u[10]=a[10]*E,u[11]=a[11]*E,u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},n.K=We,n.L=function(u,a){let h={};for(let A=0;A{let a=window.document.createElement(\"video\");return a.muted=!0,new Promise(h=>{a.onloadstart=()=>{h(a)};for(let A of u){let x=window.document.createElement(\"source\");cs(A)||(a.crossOrigin=\"Anonymous\"),x.src=A,a.appendChild(x)}})},n.a3=function(){return Ot++},n.a4=l,n.a5=m_,n.a6=Id,n.a7=Su,n.a8=Ri,n.a9=pF,n.aA=oe,n.aB=function(u,a){if(!u)return[{command:\"setStyle\",args:[a]}];let h=[];try{if(!ei(u.version,a.version))return[{command:\"setStyle\",args:[a]}];ei(u.center,a.center)||h.push({command:\"setCenter\",args:[a.center]}),ei(u.zoom,a.zoom)||h.push({command:\"setZoom\",args:[a.zoom]}),ei(u.bearing,a.bearing)||h.push({command:\"setBearing\",args:[a.bearing]}),ei(u.pitch,a.pitch)||h.push({command:\"setPitch\",args:[a.pitch]}),ei(u.sprite,a.sprite)||h.push({command:\"setSprite\",args:[a.sprite]}),ei(u.glyphs,a.glyphs)||h.push({command:\"setGlyphs\",args:[a.glyphs]}),ei(u.transition,a.transition)||h.push({command:\"setTransition\",args:[a.transition]}),ei(u.light,a.light)||h.push({command:\"setLight\",args:[a.light]}),ei(u.terrain,a.terrain)||h.push({command:\"setTerrain\",args:[a.terrain]});let A={},x=[];(function(P,D,B,V){let q;for(q in D=D||{},P=P||{})Object.prototype.hasOwnProperty.call(P,q)&&(Object.prototype.hasOwnProperty.call(D,q)||Ho(q,B,V));for(q in D)Object.prototype.hasOwnProperty.call(D,q)&&(Object.prototype.hasOwnProperty.call(P,q)?ei(P[q],D[q])||(P[q].type===\"geojson\"&&D[q].type===\"geojson\"&&La(P,D,q)?Cn(B,{command:\"setGeoJSONSourceData\",args:[q,D[q].data]}):Ol(q,D,B,V)):bn(q,D,B))})(u.sources,a.sources,x,A);let E=[];u.layers&&u.layers.forEach(P=>{\"source\"in P&&A[P.source]?h.push({command:\"removeLayer\",args:[P.id]}):E.push(P)}),h=h.concat(x),function(P,D,B){D=D||[];let V=(P=P||[]).map(ff),q=D.map(ff),Q=P.reduce(Ms,{}),rt=D.reduce(Ms,{}),ot=V.slice(),lt=Object.create(null),pt,xt,Mt,Vt,It;for(let zt=0,ie=0;zt@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,(h,A,x,E)=>{let P=x||E;return a[A]=!P||P.toLowerCase(),\"\"}),a[\"max-age\"]){let h=parseInt(a[\"max-age\"],10);isNaN(h)?delete a[\"max-age\"]:a[\"max-age\"]=h}return a},n.ab=function(u,a){let h=[];for(let A in u)A in a||h.push(A);return h},n.ac=J,n.ad=function(u,a,h){var A=Math.sin(h),x=Math.cos(h),E=a[0],P=a[1],D=a[2],B=a[3],V=a[4],q=a[5],Q=a[6],rt=a[7];return a!==u&&(u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[0]=E*x+V*A,u[1]=P*x+q*A,u[2]=D*x+Q*A,u[3]=B*x+rt*A,u[4]=V*x-E*A,u[5]=q*x-P*A,u[6]=Q*x-D*A,u[7]=rt*x-B*A,u},n.ae=function(u){var a=new se(16);return a[0]=u[0],a[1]=u[1],a[2]=u[2],a[3]=u[3],a[4]=u[4],a[5]=u[5],a[6]=u[6],a[7]=u[7],a[8]=u[8],a[9]=u[9],a[10]=u[10],a[11]=u[11],a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15],a},n.af=Ft,n.ag=function(u,a){let h=0,A=0;if(u.kind===\"constant\")A=u.layoutSize;else if(u.kind!==\"source\"){let{interpolationType:x,minZoom:E,maxZoom:P}=u,D=x?J(wo.interpolationFactor(x,a,E,P),0,1):0;u.kind===\"camera\"?A=Yo.number(u.minSize,u.maxSize,D):h=D}return{uSizeT:h,uSize:A}},n.ai=function(u,{uSize:a,uSizeT:h},{lowerSize:A,upperSize:x}){return u.kind===\"source\"?A/Df:u.kind===\"composite\"?Yo.number(A/Df,x/Df,h):a},n.aj=lC,n.ak=function(u,a,h,A){let x=a.y-u.y,E=a.x-u.x,P=A.y-h.y,D=A.x-h.x,B=P*E-D*x;if(B===0)return null;let V=(D*(u.y-h.y)-P*(u.x-h.x))/B;return new _(u.x+V*E,u.y+V*x)},n.al=_F,n.am=da,n.an=Te,n.ao=Ws,n.aq=aC,n.ar=function(u,a){var h=a[0],A=a[1],x=a[2],E=a[3],P=a[4],D=a[5],B=a[6],V=a[7],q=a[8],Q=a[9],rt=a[10],ot=a[11],lt=a[12],pt=a[13],xt=a[14],Mt=a[15],Vt=h*D-A*P,It=h*B-x*P,zt=h*V-E*P,ie=A*B-x*D,ue=A*V-E*D,Fe=x*V-E*B,Je=q*pt-Q*lt,De=q*xt-rt*lt,Ce=q*Mt-ot*lt,Se=Q*xt-rt*pt,He=Q*Mt-ot*pt,Pe=rt*Mt-ot*xt,Ae=Vt*Pe-It*He+zt*Se+ie*Ce-ue*De+Fe*Je;return Ae?(u[0]=(D*Pe-B*He+V*Se)*(Ae=1/Ae),u[1]=(x*He-A*Pe-E*Se)*Ae,u[2]=(pt*Fe-xt*ue+Mt*ie)*Ae,u[3]=(rt*ue-Q*Fe-ot*ie)*Ae,u[4]=(B*Ce-P*Pe-V*De)*Ae,u[5]=(h*Pe-x*Ce+E*De)*Ae,u[6]=(xt*zt-lt*Fe-Mt*It)*Ae,u[7]=(q*Fe-rt*zt+ot*It)*Ae,u[8]=(P*He-D*Ce+V*Je)*Ae,u[9]=(A*Ce-h*He-E*Je)*Ae,u[10]=(lt*ue-pt*zt+Mt*Vt)*Ae,u[11]=(Q*zt-q*ue-ot*Vt)*Ae,u[12]=(D*De-P*Se-B*Je)*Ae,u[13]=(h*Se-A*De+x*Je)*Ae,u[14]=(pt*It-lt*ie-xt*Vt)*Ae,u[15]=(q*ie-Q*It+rt*Vt)*Ae,u):null},n.as=mC,n.at=oC,n.au=gC,n.av=function(){let u={},a=Jt.$version;for(let h in Jt.$root){let A=Jt.$root[h];if(A.required){let x=null;x=h===\"version\"?a:A.type===\"array\"?[]:{},x!=null&&(u[h]=x)}}return u},n.aw=iA,n.ax=vo,n.ay=function(u){u=u.slice();let a=Object.create(null);for(let h=0;hAe*Ws)}let De=P?\"center\":h.get(\"text-justify\").evaluate(V,{},u.canonical),Ce=h.get(\"symbol-placement\"),Se=Ce===\"point\"?h.get(\"text-max-width\").evaluate(V,{},u.canonical)*Ws:0,He=()=>{u.bucket.allowVerticalPlacement&&nA(zt)&&(lt.vertical=VS(pt,u.glyphMap,u.glyphPositions,u.imagePositions,q,Se,E,Fe,\"left\",ue,Mt,n.ah.vertical,!0,Ce,rt,Q))};if(!P&&Je){let Pe=new Set;if(De===\"auto\")for(let ur=0;urs(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));let a=new Blob([new Uint8Array(u)],{type:\"image/png\"});try{return createImageBitmap(a)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),n.e=Tt,n.f=u=>new Promise((a,h)=>{let A=new Image;A.onload=()=>{a(A),URL.revokeObjectURL(A.src),A.onload=null,window.requestAnimationFrame(()=>{A.src=Tc})},A.onerror=()=>h(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.\"));let x=new Blob([new Uint8Array(u)],{type:\"image/png\"});A.src=u.byteLength?URL.createObjectURL(x):Tc}),n.g=Ca,n.h=(u,a)=>Bi(Tt(u,{type:\"json\"}),a),n.i=Lr,n.j=ln,n.k=Wo,n.l=(u,a)=>Bi(Tt(u,{type:\"arrayBuffer\"}),a),n.m=Bi,n.n=function(u){return new rC(u).readFields(VX,[])},n.o=Ai,n.p=q6,n.q=So,n.r=eA,n.s=cs,n.t=Rc,n.u=Le,n.v=Jt,n.w=ke,n.x=Tf,n.y=function([u,a,h]){return a+=90,a*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(a)*Math.sin(h),y:u*Math.sin(a)*Math.sin(h),z:u*Math.cos(h)}},n.z=Yo}),r(\"worker\",[\"./shared\"],function(n){\"use strict\";class s{constructor(tt){this.keyCache={},tt&&this.replace(tt)}replace(tt){this._layerConfigs={},this._layers={},this.update(tt,[])}update(tt,nt){for(let mt of tt){this._layerConfigs[mt.id]=mt;let Rt=this._layers[mt.id]=n.az(mt);Rt._featureFilter=n.a6(Rt.filter),this.keyCache[mt.id]&&delete this.keyCache[mt.id]}for(let mt of nt)delete this.keyCache[mt],delete this._layerConfigs[mt],delete this._layers[mt];this.familiesBySource={};let ct=n.bg(Object.values(this._layerConfigs),this.keyCache);for(let mt of ct){let Rt=mt.map(ee=>this._layers[ee.id]),Dt=Rt[0];if(Dt.visibility===\"none\")continue;let Ut=Dt.source||\"\",ft=this.familiesBySource[Ut];ft||(ft=this.familiesBySource[Ut]={});let jt=Dt.sourceLayer||\"_geojsonTileLayer\",le=ft[jt];le||(le=ft[jt]=[]),le.push(Rt)}}}class o{constructor(tt){let nt={},ct=[];for(let Ut in tt){let ft=tt[Ut],jt=nt[Ut]={};for(let le in ft){let ee=ft[+le];if(!ee||ee.bitmap.width===0||ee.bitmap.height===0)continue;let re={x:0,y:0,w:ee.bitmap.width+2,h:ee.bitmap.height+2};ct.push(re),jt[le]={rect:re,metrics:ee.metrics}}}let{w:mt,h:Rt}=n.p(ct),Dt=new n.o({width:mt||1,height:Rt||1});for(let Ut in tt){let ft=tt[Ut];for(let jt in ft){let le=ft[+jt];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;let ee=nt[Ut][jt].rect;n.o.copy(le.bitmap,Dt,{x:0,y:0},{x:ee.x+1,y:ee.y+1},le.bitmap)}}this.image=Dt,this.positions=nt}}n.bh(\"GlyphAtlas\",o);class c{constructor(tt){this.tileID=new n.Q(tt.tileID.overscaledZ,tt.tileID.wrap,tt.tileID.canonical.z,tt.tileID.canonical.x,tt.tileID.canonical.y),this.uid=tt.uid,this.zoom=tt.zoom,this.pixelRatio=tt.pixelRatio,this.tileSize=tt.tileSize,this.source=tt.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=tt.showCollisionBoxes,this.collectResourceTiming=!!tt.collectResourceTiming,this.returnDependencies=!!tt.returnDependencies,this.promoteId=tt.promoteId,this.inFlightDependencies=[]}parse(tt,nt,ct,mt){return n._(this,void 0,void 0,function*(){this.status=\"parsing\",this.data=tt,this.collisionBoxArray=new n.a4;let Rt=new n.bi(Object.keys(tt.layers).sort()),Dt=new n.bj(this.tileID,this.promoteId);Dt.bucketLayerIDs=[];let Ut={},ft={featureIndex:Dt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ct},jt=nt.familiesBySource[this.source];for(let Dr in jt){let tn=tt.layers[Dr];if(!tn)continue;tn.version===1&&n.w(`Vector tile source \"${this.source}\" layer \"${Dr}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);let en=Rt.encode(Dr),rs=[];for(let us=0;us=kn.maxzoom||kn.visibility!==\"none\"&&(d(us,this.zoom,ct),(Ut[kn.id]=kn.createBucket({index:Dt.bucketLayerIDs.length,layers:us,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:en,sourceID:this.source})).populate(rs,ft,this.tileID.canonical),Dt.bucketLayerIDs.push(us.map(ca=>ca.id)))}}let le=n.aE(ft.glyphDependencies,Dr=>Object.keys(Dr).map(Number));this.inFlightDependencies.forEach(Dr=>Dr?.abort()),this.inFlightDependencies=[];let ee=Promise.resolve({});if(Object.keys(le).length){let Dr=new AbortController;this.inFlightDependencies.push(Dr),ee=mt.sendAsync({type:\"getGlyphs\",data:{stacks:le,source:this.source,tileID:this.tileID,type:\"glyphs\"}},Dr)}let re=Object.keys(ft.iconDependencies),tr=Promise.resolve({});if(re.length){let Dr=new AbortController;this.inFlightDependencies.push(Dr),tr=mt.sendAsync({type:\"getImages\",data:{icons:re,source:this.source,tileID:this.tileID,type:\"icons\"}},Dr)}let nr=Object.keys(ft.patternDependencies),Rr=Promise.resolve({});if(nr.length){let Dr=new AbortController;this.inFlightDependencies.push(Dr),Rr=mt.sendAsync({type:\"getImages\",data:{icons:nr,source:this.source,tileID:this.tileID,type:\"patterns\"}},Dr)}let[yr,ni,Ti]=yield Promise.all([ee,tr,Rr]),Hi=new o(yr),wn=new n.bk(ni,Ti);for(let Dr in Ut){let tn=Ut[Dr];tn instanceof n.a5?(d(tn.layers,this.zoom,ct),n.bl({bucket:tn,glyphMap:yr,glyphPositions:Hi.positions,imageMap:ni,imagePositions:wn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):tn.hasPattern&&(tn instanceof n.bm||tn instanceof n.bn||tn instanceof n.bo)&&(d(tn.layers,this.zoom,ct),tn.addFeatures(ft,this.tileID.canonical,wn.patternPositions))}return this.status=\"done\",{buckets:Object.values(Ut).filter(Dr=>!Dr.isEmpty()),featureIndex:Dt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Hi.image,imageAtlas:wn,glyphMap:this.returnDependencies?yr:null,iconMap:this.returnDependencies?ni:null,glyphPositions:this.returnDependencies?Hi.positions:null}})}}function d(vt,tt,nt){let ct=new n.a8(tt);for(let mt of vt)mt.recalculate(ct,nt)}class _{constructor(tt,nt,ct){this.actor=tt,this.layerIndex=nt,this.availableImages=ct,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(tt,nt){return n._(this,void 0,void 0,function*(){let ct=yield n.l(tt.request,nt);try{return{vectorTile:new n.bp.VectorTile(new n.bq(ct.data)),rawData:ct.data,cacheControl:ct.cacheControl,expires:ct.expires}}catch(mt){let Rt=new Uint8Array(ct.data),Dt=`Unable to parse the tile at ${tt.request.url}, `;throw Dt+=Rt[0]===31&&Rt[1]===139?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${mt.messge}`,new Error(Dt)}})}loadTile(tt){return n._(this,void 0,void 0,function*(){let nt=tt.uid,ct=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.br(tt.request),mt=new c(tt);this.loading[nt]=mt;let Rt=new AbortController;mt.abort=Rt;try{let Dt=yield this.loadVectorTile(tt,Rt);if(delete this.loading[nt],!Dt)return null;let Ut=Dt.rawData,ft={};Dt.expires&&(ft.expires=Dt.expires),Dt.cacheControl&&(ft.cacheControl=Dt.cacheControl);let jt={};if(ct){let ee=ct.finish();ee&&(jt.resourceTiming=JSON.parse(JSON.stringify(ee)))}mt.vectorTile=Dt.vectorTile;let le=mt.parse(Dt.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[nt]=mt,this.fetching[nt]={rawTileData:Ut,cacheControl:ft,resourceTiming:jt};try{let ee=yield le;return n.e({rawTileData:Ut.slice(0)},ee,ft,jt)}finally{delete this.fetching[nt]}}catch(Dt){throw delete this.loading[nt],mt.status=\"done\",this.loaded[nt]=mt,Dt}})}reloadTile(tt){return n._(this,void 0,void 0,function*(){let nt=tt.uid;if(!this.loaded||!this.loaded[nt])throw new Error(\"Should not be trying to reload a tile that was never loaded or has been removed\");let ct=this.loaded[nt];if(ct.showCollisionBoxes=tt.showCollisionBoxes,ct.status===\"parsing\"){let mt=yield ct.parse(ct.vectorTile,this.layerIndex,this.availableImages,this.actor),Rt;if(this.fetching[nt]){let{rawTileData:Dt,cacheControl:Ut,resourceTiming:ft}=this.fetching[nt];delete this.fetching[nt],Rt=n.e({rawTileData:Dt.slice(0)},mt,Ut,ft)}else Rt=mt;return Rt}if(ct.status===\"done\"&&ct.vectorTile)return ct.parse(ct.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(tt){return n._(this,void 0,void 0,function*(){let nt=this.loading,ct=tt.uid;nt&&nt[ct]&&nt[ct].abort&&(nt[ct].abort.abort(),delete nt[ct])})}removeTile(tt){return n._(this,void 0,void 0,function*(){this.loaded&&this.loaded[tt.uid]&&delete this.loaded[tt.uid]})}}class w{constructor(){this.loaded={}}loadTile(tt){return n._(this,void 0,void 0,function*(){let{uid:nt,encoding:ct,rawImageData:mt,redFactor:Rt,greenFactor:Dt,blueFactor:Ut,baseShift:ft}=tt,jt=mt.width+2,le=mt.height+2,ee=n.b(mt)?new n.R({width:jt,height:le},yield n.bs(mt,-1,-1,jt,le)):mt,re=new n.bt(nt,ee,ct,Rt,Dt,Ut,ft);return this.loaded=this.loaded||{},this.loaded[nt]=re,re})}removeTile(tt){let nt=this.loaded,ct=tt.uid;nt&&nt[ct]&&delete nt[ct]}}function I(vt,tt){if(vt.length!==0){R(vt[0],tt);for(var nt=1;nt=Math.abs(Ut)?nt-ft+Ut:Ut-ft+nt,nt=ft}nt+ct>=0!=!!tt&&vt.reverse()}var N=n.bu(function vt(tt,nt){var ct,mt=tt&&tt.type;if(mt===\"FeatureCollection\")for(ct=0;ct>31}function cr(vt,tt){for(var nt=vt.loadGeometry(),ct=vt.type,mt=0,Rt=0,Dt=nt.length,Ut=0;Utvt},Tc=Math.fround||(Ss=new Float32Array(1),vt=>(Ss[0]=+vt,Ss[0]));var Ss;let no=3,Ts=5,yo=6;class aa{constructor(tt){this.options=Object.assign(Object.create(zs),tt),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(tt){let{log:nt,minZoom:ct,maxZoom:mt}=this.options;nt&&console.time(\"total time\");let Rt=`prepare ${tt.length} points`;nt&&console.time(Rt),this.points=tt;let Dt=[];for(let ft=0;ft=ct;ft--){let jt=+Date.now();Ut=this.trees[ft]=this._createTree(this._cluster(Ut,ft)),nt&&console.log(\"z%d: %d clusters in %dms\",ft,Ut.numItems,+Date.now()-jt)}return nt&&console.timeEnd(\"total time\"),this}getClusters(tt,nt){let ct=((tt[0]+180)%360+360)%360-180,mt=Math.max(-90,Math.min(90,tt[1])),Rt=tt[2]===180?180:((tt[2]+180)%360+360)%360-180,Dt=Math.max(-90,Math.min(90,tt[3]));if(tt[2]-tt[0]>=360)ct=-180,Rt=180;else if(ct>Rt){let ee=this.getClusters([ct,mt,180,Dt],nt),re=this.getClusters([-180,mt,Rt,Dt],nt);return ee.concat(re)}let Ut=this.trees[this._limitZoom(nt)],ft=Ut.range(Vo(ct),Li(Dt),Vo(Rt),Li(mt)),jt=Ut.data,le=[];for(let ee of ft){let re=this.stride*ee;le.push(jt[re+Ts]>1?ol(jt,re,this.clusterProps):this.points[jt[re+no]])}return le}getChildren(tt){let nt=this._getOriginId(tt),ct=this._getOriginZoom(tt),mt=\"No cluster with the specified id.\",Rt=this.trees[ct];if(!Rt)throw new Error(mt);let Dt=Rt.data;if(nt*this.stride>=Dt.length)throw new Error(mt);let Ut=this.options.radius/(this.options.extent*Math.pow(2,ct-1)),ft=Rt.within(Dt[nt*this.stride],Dt[nt*this.stride+1],Ut),jt=[];for(let le of ft){let ee=le*this.stride;Dt[ee+4]===tt&&jt.push(Dt[ee+Ts]>1?ol(Dt,ee,this.clusterProps):this.points[Dt[ee+no]])}if(jt.length===0)throw new Error(mt);return jt}getLeaves(tt,nt,ct){let mt=[];return this._appendLeaves(mt,tt,nt=nt||10,ct=ct||0,0),mt}getTile(tt,nt,ct){let mt=this.trees[this._limitZoom(tt)],Rt=Math.pow(2,tt),{extent:Dt,radius:Ut}=this.options,ft=Ut/Dt,jt=(ct-ft)/Rt,le=(ct+1+ft)/Rt,ee={features:[]};return this._addTileFeatures(mt.range((nt-ft)/Rt,jt,(nt+1+ft)/Rt,le),mt.data,nt,ct,Rt,ee),nt===0&&this._addTileFeatures(mt.range(1-ft/Rt,jt,1,le),mt.data,Rt,ct,Rt,ee),nt===Rt-1&&this._addTileFeatures(mt.range(0,jt,ft/Rt,le),mt.data,-1,ct,Rt,ee),ee.features.length?ee:null}getClusterExpansionZoom(tt){let nt=this._getOriginZoom(tt)-1;for(;nt<=this.options.maxZoom;){let ct=this.getChildren(tt);if(nt++,ct.length!==1)break;tt=ct[0].properties.cluster_id}return nt}_appendLeaves(tt,nt,ct,mt,Rt){let Dt=this.getChildren(nt);for(let Ut of Dt){let ft=Ut.properties;if(ft&&ft.cluster?Rt+ft.point_count<=mt?Rt+=ft.point_count:Rt=this._appendLeaves(tt,ft.cluster_id,ct,mt,Rt):Rt1,le,ee,re;if(jt)le=Ca(nt,ft,this.clusterProps),ee=nt[ft],re=nt[ft+1];else{let Rr=this.points[nt[ft+no]];le=Rr.properties;let[yr,ni]=Rr.geometry.coordinates;ee=Vo(yr),re=Li(ni)}let tr={type:1,geometry:[[Math.round(this.options.extent*(ee*Rt-ct)),Math.round(this.options.extent*(re*Rt-mt))]],tags:le},nr;nr=jt||this.options.generateId?nt[ft+no]:this.points[nt[ft+no]].id,nr!==void 0&&(tr.id=nr),Dt.features.push(tr)}}_limitZoom(tt){return Math.max(this.options.minZoom,Math.min(Math.floor(+tt),this.options.maxZoom+1))}_cluster(tt,nt){let{radius:ct,extent:mt,reduce:Rt,minPoints:Dt}=this.options,Ut=ct/(mt*Math.pow(2,nt)),ft=tt.data,jt=[],le=this.stride;for(let ee=0;eent&&(yr+=ft[Ti+Ts])}if(yr>Rr&&yr>=Dt){let ni,Ti=re*Rr,Hi=tr*Rr,wn=-1,Dr=((ee/le|0)<<5)+(nt+1)+this.points.length;for(let tn of nr){let en=tn*le;if(ft[en+2]<=nt)continue;ft[en+2]=nt;let rs=ft[en+Ts];Ti+=ft[en]*rs,Hi+=ft[en+1]*rs,ft[en+4]=Dr,Rt&&(ni||(ni=this._map(ft,ee,!0),wn=this.clusterProps.length,this.clusterProps.push(ni)),Rt(ni,this._map(ft,en)))}ft[ee+4]=Dr,jt.push(Ti/yr,Hi/yr,1/0,Dr,-1,yr),Rt&&jt.push(wn)}else{for(let ni=0;ni1)for(let ni of nr){let Ti=ni*le;if(!(ft[Ti+2]<=nt)){ft[Ti+2]=nt;for(let Hi=0;Hi>5}_getOriginZoom(tt){return(tt-this.points.length)%32}_map(tt,nt,ct){if(tt[nt+Ts]>1){let Dt=this.clusterProps[tt[nt+yo]];return ct?Object.assign({},Dt):Dt}let mt=this.points[tt[nt+no]].properties,Rt=this.options.map(mt);return ct&&Rt===mt?Object.assign({},Rt):Rt}}function ol(vt,tt,nt){return{type:\"Feature\",id:vt[tt+no],properties:Ca(vt,tt,nt),geometry:{type:\"Point\",coordinates:[(ct=vt[tt],360*(ct-.5)),vo(vt[tt+1])]}};var ct}function Ca(vt,tt,nt){let ct=vt[tt+Ts],mt=ct>=1e4?`${Math.round(ct/1e3)}k`:ct>=1e3?Math.round(ct/100)/10+\"k\":ct,Rt=vt[tt+yo],Dt=Rt===-1?{}:Object.assign({},nt[Rt]);return Object.assign(Dt,{cluster:!0,cluster_id:vt[tt+no],point_count:ct,point_count_abbreviated:mt})}function Vo(vt){return vt/360+.5}function Li(vt){let tt=Math.sin(vt*Math.PI/180),nt=.5-.25*Math.log((1+tt)/(1-tt))/Math.PI;return nt<0?0:nt>1?1:nt}function vo(vt){let tt=(180-360*vt)*Math.PI/180;return 360*Math.atan(Math.exp(tt))/Math.PI-90}function Bi(vt,tt,nt,ct){for(var mt,Rt=ct,Dt=nt-tt>>1,Ut=nt-tt,ft=vt[tt],jt=vt[tt+1],le=vt[nt],ee=vt[nt+1],re=tt+3;reRt)mt=re,Rt=tr;else if(tr===Rt){var nr=Math.abs(re-Dt);nrct&&(mt-tt>3&&Bi(vt,tt,mt,ct),vt[mt+2]=Rt,nt-mt>3&&Bi(vt,mt,nt,ct))}function cs(vt,tt,nt,ct,mt,Rt){var Dt=mt-nt,Ut=Rt-ct;if(Dt!==0||Ut!==0){var ft=((vt-nt)*Dt+(tt-ct)*Ut)/(Dt*Dt+Ut*Ut);ft>1?(nt=mt,ct=Rt):ft>0&&(nt+=Dt*ft,ct+=Ut*ft)}return(Dt=vt-nt)*Dt+(Ut=tt-ct)*Ut}function jo(vt,tt,nt,ct){var mt={id:vt===void 0?null:vt,type:tt,geometry:nt,tags:ct,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Rt){var Dt=Rt.geometry,Ut=Rt.type;if(Ut===\"Point\"||Ut===\"MultiPoint\"||Ut===\"LineString\")Go(Rt,Dt);else if(Ut===\"Polygon\"||Ut===\"MultiLineString\")for(var ft=0;ft0&&(Dt+=ct?(mt*jt-ft*Rt)/2:Math.sqrt(Math.pow(ft-mt,2)+Math.pow(jt-Rt,2))),mt=ft,Rt=jt}var le=tt.length-3;tt[2]=1,Bi(tt,0,le,nt),tt[le+2]=1,tt.size=Math.abs(Dt),tt.start=0,tt.end=tt.size}function Jt(vt,tt,nt,ct){for(var mt=0;mt1?1:nt}function ei(vt,tt,nt,ct,mt,Rt,Dt,Ut){if(ct/=tt,Rt>=(nt/=tt)&&Dt=ct)return null;for(var ft=[],jt=0;jt=nt&&nr=ct)){var Rr=[];if(re===\"Point\"||re===\"MultiPoint\")Cn(ee,Rr,nt,ct,mt);else if(re===\"LineString\")bn(ee,Rr,nt,ct,mt,!1,Ut.lineMetrics);else if(re===\"MultiLineString\")Ol(ee,Rr,nt,ct,mt,!1);else if(re===\"Polygon\")Ol(ee,Rr,nt,ct,mt,!0);else if(re===\"MultiPolygon\")for(var yr=0;yr=nt&&Dt<=ct&&(tt.push(vt[Rt]),tt.push(vt[Rt+1]),tt.push(vt[Rt+2]))}}function bn(vt,tt,nt,ct,mt,Rt,Dt){for(var Ut,ft,jt=Ho(vt),le=mt===0?Mc:ff,ee=vt.start,re=0;rent&&(ft=le(jt,tr,nr,yr,ni,nt),Dt&&(jt.start=ee+Ut*ft)):Ti>ct?Hi=nt&&(ft=le(jt,tr,nr,yr,ni,nt),wn=!0),Hi>ct&&Ti<=ct&&(ft=le(jt,tr,nr,yr,ni,ct),wn=!0),!Rt&&wn&&(Dt&&(jt.end=ee+Ut*ft),tt.push(jt),jt=Ho(vt)),Dt&&(ee+=Ut)}var Dr=vt.length-3;tr=vt[Dr],nr=vt[Dr+1],Rr=vt[Dr+2],(Ti=mt===0?tr:nr)>=nt&&Ti<=ct&&La(jt,tr,nr,Rr),Dr=jt.length-3,Rt&&Dr>=3&&(jt[Dr]!==jt[0]||jt[Dr+1]!==jt[1])&&La(jt,jt[0],jt[1],jt[2]),jt.length&&tt.push(jt)}function Ho(vt){var tt=[];return tt.size=vt.size,tt.start=vt.start,tt.end=vt.end,tt}function Ol(vt,tt,nt,ct,mt,Rt){for(var Dt=0;DtDt.maxX&&(Dt.maxX=le),ee>Dt.maxY&&(Dt.maxY=ee)}return Dt}function es(vt,tt,nt,ct){var mt=tt.geometry,Rt=tt.type,Dt=[];if(Rt===\"Point\"||Rt===\"MultiPoint\")for(var Ut=0;Ut0&&tt.size<(mt?Dt:ct))nt.numPoints+=tt.length/3;else{for(var Ut=[],ft=0;ftDt)&&(nt.numSimplified++,Ut.push(tt[ft]),Ut.push(tt[ft+1])),nt.numPoints++;mt&&function(jt,le){for(var ee=0,re=0,tr=jt.length,nr=tr-2;re0===le)for(re=0,tr=jt.length;re24)throw new Error(\"maxZoom should be in the 0-24 range\");if(tt.promoteId&&tt.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var ct=function(mt,Rt){var Dt=[];if(mt.type===\"FeatureCollection\")for(var Ut=0;Ut1&&console.time(\"creation\"),re=this.tiles[ee]=ka(vt,tt,nt,ct,ft),this.tileCoords.push({z:tt,x:nt,y:ct}),jt)){jt>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",tt,nt,ct,re.numFeatures,re.numPoints,re.numSimplified),console.timeEnd(\"creation\"));var tr=\"z\"+tt;this.stats[tr]=(this.stats[tr]||0)+1,this.total++}if(re.source=vt,mt){if(tt===ft.maxZoom||tt===mt)continue;var nr=1<1&&console.time(\"clipping\");var Rr,yr,ni,Ti,Hi,wn,Dr=.5*ft.buffer/ft.extent,tn=.5-Dr,en=.5+Dr,rs=1+Dr;Rr=yr=ni=Ti=null,Hi=ei(vt,le,nt-Dr,nt+en,0,re.minX,re.maxX,ft),wn=ei(vt,le,nt+tn,nt+rs,0,re.minX,re.maxX,ft),vt=null,Hi&&(Rr=ei(Hi,le,ct-Dr,ct+en,1,re.minY,re.maxY,ft),yr=ei(Hi,le,ct+tn,ct+rs,1,re.minY,re.maxY,ft),Hi=null),wn&&(ni=ei(wn,le,ct-Dr,ct+en,1,re.minY,re.maxY,ft),Ti=ei(wn,le,ct+tn,ct+rs,1,re.minY,re.maxY,ft),wn=null),jt>1&&console.timeEnd(\"clipping\"),Ut.push(Rr||[],tt+1,2*nt,2*ct),Ut.push(yr||[],tt+1,2*nt,2*ct+1),Ut.push(ni||[],tt+1,2*nt+1,2*ct),Ut.push(Ti||[],tt+1,2*nt+1,2*ct+1)}}},kr.prototype.getTile=function(vt,tt,nt){var ct=this.options,mt=ct.extent,Rt=ct.debug;if(vt<0||vt>24)return null;var Dt=1<1&&console.log(\"drilling down to z%d-%d-%d\",vt,tt,nt);for(var ft,jt=vt,le=tt,ee=nt;!ft&&jt>0;)jt--,le=Math.floor(le/2),ee=Math.floor(ee/2),ft=this.tiles[Sr(jt,le,ee)];return ft&&ft.source?(Rt>1&&console.log(\"found parent tile z%d-%d-%d\",jt,le,ee),Rt>1&&console.time(\"drilling down\"),this.splitTile(ft.source,jt,le,ee,vt,tt,nt),Rt>1&&console.timeEnd(\"drilling down\"),this.tiles[Ut]?qo(this.tiles[Ut],mt):null):null};class Ec extends _{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(tt,nt){return n._(this,void 0,void 0,function*(){let ct=tt.tileID.canonical;if(!this._geoJSONIndex)throw new Error(\"Unable to parse the data into a cluster or geojson\");let mt=this._geoJSONIndex.getTile(ct.z,ct.x,ct.y);if(!mt)return null;let Rt=new class{constructor(Ut){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=n.W,this.length=Ut.length,this._features=Ut}feature(Ut){return new class{constructor(ft){this._feature=ft,this.extent=n.W,this.type=ft.type,this.properties=ft.tags,\"id\"in ft&&!isNaN(ft.id)&&(this.id=parseInt(ft.id,10))}loadGeometry(){if(this._feature.type===1){let ft=[];for(let jt of this._feature.geometry)ft.push([new n.P(jt[0],jt[1])]);return ft}{let ft=[];for(let jt of this._feature.geometry){let le=[];for(let ee of jt)le.push(new n.P(ee[0],ee[1]));ft.push(le)}return ft}}toGeoJSON(ft,jt,le){return j.call(this,ft,jt,le)}}(this._features[Ut])}}(mt.features),Dt=hn(Rt);return Dt.byteOffset===0&&Dt.byteLength===Dt.buffer.byteLength||(Dt=new Uint8Array(Dt)),{vectorTile:Rt,rawData:Dt.buffer}})}loadData(tt){var nt;return n._(this,void 0,void 0,function*(){(nt=this._pendingRequest)===null||nt===void 0||nt.abort();let ct=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.br(tt.request);this._pendingRequest=new AbortController;try{let mt=yield this.loadGeoJSON(tt,this._pendingRequest);if(delete this._pendingRequest,typeof mt!=\"object\")throw new Error(`Input data given to '${tt.source}' is not a valid GeoJSON object.`);if(N(mt,!0),tt.filter){let Dt=n.bx(tt.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(Dt.result===\"error\")throw new Error(Dt.value.map(ft=>`${ft.key}: ${ft.message}`).join(\", \"));mt={type:\"FeatureCollection\",features:mt.features.filter(ft=>Dt.value.evaluate({zoom:0},ft))}}this._geoJSONIndex=tt.cluster?new aa(function({superclusterOptions:Dt,clusterProperties:Ut}){if(!Ut||!Dt)return Dt;let ft={},jt={},le={accumulated:null,zoom:0},ee={properties:null},re=Object.keys(Ut);for(let tr of re){let[nr,Rr]=Ut[tr],yr=n.bx(Rr),ni=n.bx(typeof nr==\"string\"?[nr,[\"accumulated\"],[\"get\",tr]]:nr);ft[tr]=yr.value,jt[tr]=ni.value}return Dt.map=tr=>{ee.properties=tr;let nr={};for(let Rr of re)nr[Rr]=ft[Rr].evaluate(le,ee);return nr},Dt.reduce=(tr,nr)=>{ee.properties=nr;for(let Rr of re)le.accumulated=tr[Rr],tr[Rr]=jt[Rr].evaluate(le,ee)},Dt}(tt)).load(mt.features):function(Dt,Ut){return new kr(Dt,Ut)}(mt,tt.geojsonVtOptions),this.loaded={};let Rt={};if(ct){let Dt=ct.finish();Dt&&(Rt.resourceTiming={},Rt.resourceTiming[tt.source]=JSON.parse(JSON.stringify(Dt)))}return Rt}catch(mt){if(delete this._pendingRequest,n.by(mt))return{abandoned:!0};throw mt}})}reloadTile(tt){let nt=this.loaded;return nt&&nt[tt.uid]?super.reloadTile(tt):this.loadTile(tt)}loadGeoJSON(tt,nt){return n._(this,void 0,void 0,function*(){let{promoteId:ct}=tt;if(tt.request){let mt=yield n.h(tt.request,nt);return this._dataUpdateable=Ra(mt.data,ct)?gr(mt.data,ct):void 0,mt.data}if(typeof tt.data==\"string\")try{let mt=JSON.parse(tt.data);return this._dataUpdateable=Ra(mt,ct)?gr(mt,ct):void 0,mt}catch{throw new Error(`Input data given to '${tt.source}' is not a valid GeoJSON object.`)}if(!tt.dataDiff)throw new Error(`Input data given to '${tt.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${tt.source}`);return function(mt,Rt,Dt){var Ut,ft,jt,le;if(Rt.removeAll&&mt.clear(),Rt.remove)for(let ee of Rt.remove)mt.delete(ee);if(Rt.add)for(let ee of Rt.add){let re=Ln(ee,Dt);re!=null&&mt.set(re,ee)}if(Rt.update)for(let ee of Rt.update){let re=mt.get(ee.id);if(re==null)continue;let tr=!ee.removeAllProperties&&(((Ut=ee.removeProperties)===null||Ut===void 0?void 0:Ut.length)>0||((ft=ee.addOrUpdateProperties)===null||ft===void 0?void 0:ft.length)>0);if((ee.newGeometry||ee.removeAllProperties||tr)&&(re=Object.assign({},re),mt.set(ee.id,re),tr&&(re.properties=Object.assign({},re.properties))),ee.newGeometry&&(re.geometry=ee.newGeometry),ee.removeAllProperties)re.properties={};else if(((jt=ee.removeProperties)===null||jt===void 0?void 0:jt.length)>0)for(let nr of ee.removeProperties)Object.prototype.hasOwnProperty.call(re.properties,nr)&&delete re.properties[nr];if(((le=ee.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0)for(let{key:nr,value:Rr}of ee.addOrUpdateProperties)re.properties[nr]=Rr}}(this._dataUpdateable,tt.dataDiff,ct),{type:\"FeatureCollection\",features:Array.from(this._dataUpdateable.values())}})}removeSource(tt){return n._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(tt){return this._geoJSONIndex.getClusterExpansionZoom(tt.clusterId)}getClusterChildren(tt){return this._geoJSONIndex.getChildren(tt.clusterId)}getClusterLeaves(tt){return this._geoJSONIndex.getLeaves(tt.clusterId,tt.limit,tt.offset)}}class Gn{constructor(tt){this.self=tt,this.actor=new n.C(tt),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(nt,ct)=>{if(this.externalWorkerSourceTypes[nt])throw new Error(`Worker source with name \"${nt}\" already registered.`);this.externalWorkerSourceTypes[nt]=ct},this.self.addProtocol=n.be,this.self.removeProtocol=n.bf,this.self.registerRTLTextPlugin=nt=>{if(n.bz.isParsed())throw new Error(\"RTL text plugin already registered.\");n.bz.setMethods(nt)},this.actor.registerMessageHandler(\"loadDEMTile\",(nt,ct)=>this._getDEMWorkerSource(nt,ct.source).loadTile(ct)),this.actor.registerMessageHandler(\"removeDEMTile\",(nt,ct)=>n._(this,void 0,void 0,function*(){this._getDEMWorkerSource(nt,ct.source).removeTile(ct)})),this.actor.registerMessageHandler(\"getClusterExpansionZoom\",(nt,ct)=>n._(this,void 0,void 0,function*(){return this._getWorkerSource(nt,ct.type,ct.source).getClusterExpansionZoom(ct)})),this.actor.registerMessageHandler(\"getClusterChildren\",(nt,ct)=>n._(this,void 0,void 0,function*(){return this._getWorkerSource(nt,ct.type,ct.source).getClusterChildren(ct)})),this.actor.registerMessageHandler(\"getClusterLeaves\",(nt,ct)=>n._(this,void 0,void 0,function*(){return this._getWorkerSource(nt,ct.type,ct.source).getClusterLeaves(ct)})),this.actor.registerMessageHandler(\"loadData\",(nt,ct)=>this._getWorkerSource(nt,ct.type,ct.source).loadData(ct)),this.actor.registerMessageHandler(\"loadTile\",(nt,ct)=>this._getWorkerSource(nt,ct.type,ct.source).loadTile(ct)),this.actor.registerMessageHandler(\"reloadTile\",(nt,ct)=>this._getWorkerSource(nt,ct.type,ct.source).reloadTile(ct)),this.actor.registerMessageHandler(\"abortTile\",(nt,ct)=>this._getWorkerSource(nt,ct.type,ct.source).abortTile(ct)),this.actor.registerMessageHandler(\"removeTile\",(nt,ct)=>this._getWorkerSource(nt,ct.type,ct.source).removeTile(ct)),this.actor.registerMessageHandler(\"removeSource\",(nt,ct)=>n._(this,void 0,void 0,function*(){if(!this.workerSources[nt]||!this.workerSources[nt][ct.type]||!this.workerSources[nt][ct.type][ct.source])return;let mt=this.workerSources[nt][ct.type][ct.source];delete this.workerSources[nt][ct.type][ct.source],mt.removeSource!==void 0&&mt.removeSource(ct)})),this.actor.registerMessageHandler(\"setReferrer\",(nt,ct)=>n._(this,void 0,void 0,function*(){this.referrer=ct})),this.actor.registerMessageHandler(\"syncRTLPluginState\",(nt,ct)=>this._syncRTLPluginState(nt,ct)),this.actor.registerMessageHandler(\"importScript\",(nt,ct)=>n._(this,void 0,void 0,function*(){this.self.importScripts(ct)})),this.actor.registerMessageHandler(\"setImages\",(nt,ct)=>this._setImages(nt,ct)),this.actor.registerMessageHandler(\"updateLayers\",(nt,ct)=>n._(this,void 0,void 0,function*(){this._getLayerIndex(nt).update(ct.layers,ct.removedIds)})),this.actor.registerMessageHandler(\"setLayers\",(nt,ct)=>n._(this,void 0,void 0,function*(){this._getLayerIndex(nt).replace(ct)}))}_setImages(tt,nt){return n._(this,void 0,void 0,function*(){this.availableImages[tt]=nt;for(let ct in this.workerSources[tt]){let mt=this.workerSources[tt][ct];for(let Rt in mt)mt[Rt].availableImages=nt}})}_syncRTLPluginState(tt,nt){return n._(this,void 0,void 0,function*(){n.bz.setState(nt);let ct=n.bz.getPluginURL();if(nt.pluginStatus===\"loaded\"&&!n.bz.isParsed()&&ct!=null){this.self.importScripts(ct);let mt=n.bz.isParsed();if(mt)return mt;throw new Error(`RTL Text Plugin failed to import scripts from ${ct}`)}return!1})}_getAvailableImages(tt){let nt=this.availableImages[tt];return nt||(nt=[]),nt}_getLayerIndex(tt){let nt=this.layerIndexes[tt];return nt||(nt=this.layerIndexes[tt]=new s),nt}_getWorkerSource(tt,nt,ct){if(this.workerSources[tt]||(this.workerSources[tt]={}),this.workerSources[tt][nt]||(this.workerSources[tt][nt]={}),!this.workerSources[tt][nt][ct]){let mt={sendAsync:(Rt,Dt)=>(Rt.targetMapId=tt,this.actor.sendAsync(Rt,Dt))};switch(nt){case\"vector\":this.workerSources[tt][nt][ct]=new _(mt,this._getLayerIndex(tt),this._getAvailableImages(tt));break;case\"geojson\":this.workerSources[tt][nt][ct]=new Ec(mt,this._getLayerIndex(tt),this._getAvailableImages(tt));break;default:this.workerSources[tt][nt][ct]=new this.externalWorkerSourceTypes[nt](mt,this._getLayerIndex(tt),this._getAvailableImages(tt))}}return this.workerSources[tt][nt][ct]}_getDEMWorkerSource(tt,nt){return this.demWorkerSources[tt]||(this.demWorkerSources[tt]={}),this.demWorkerSources[tt][nt]||(this.demWorkerSources[tt][nt]=new w),this.demWorkerSources[tt][nt]}}return n.i(self)&&(self.worker=new Gn(self)),Gn}),r(\"index\",[\"exports\",\"./shared\"],function(n,s){\"use strict\";var o=\"4.0.0\";let c,d,_={now:typeof performance<\"u\"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:T=>new Promise((l,f)=>{let v=requestAnimationFrame(l);T.signal.addEventListener(\"abort\",()=>{cancelAnimationFrame(v),f(s.c())})}),getImageData(T,l=0){return this.getImageCanvasContext(T).getImageData(-l,-l,T.width+2*l,T.height+2*l)},getImageCanvasContext(T){let l=window.document.createElement(\"canvas\"),f=l.getContext(\"2d\",{willReadFrequently:!0});if(!f)throw new Error(\"failed to create canvas 2d context\");return l.width=T.width,l.height=T.height,f.drawImage(T,0,0,T.width,T.height),f},resolveURL:T=>(c||(c=document.createElement(\"a\")),c.href=T,c.href),hardwareConcurrency:typeof navigator<\"u\"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(d==null&&(d=matchMedia(\"(prefers-reduced-motion: reduce)\")),d.matches)}};class w{static testProp(l){if(!w.docStyle)return l[0];for(let f=0;f{window.removeEventListener(\"click\",w.suppressClickInternal,!0)},0)}static getScale(l){let f=l.getBoundingClientRect();return{x:f.width/l.offsetWidth||1,y:f.height/l.offsetHeight||1,boundingClientRect:f}}static getPoint(l,f,v){let b=f.boundingClientRect;return new s.P((v.clientX-b.left)/f.x-l.clientLeft,(v.clientY-b.top)/f.y-l.clientTop)}static mousePos(l,f){let v=w.getScale(l);return w.getPoint(l,v,f)}static touchPos(l,f){let v=[],b=w.getScale(l);for(let M=0;M{l=[],f=0,v=0,b={}},T.addThrottleControl=U=>{let W=v++;return b[W]=U,W},T.removeThrottleControl=U=>{delete b[U],O()},T.getImage=(U,W,$=!0)=>new Promise((X,at)=>{I.supported&&(U.headers||(U.headers={}),U.headers.accept=\"image/webp,*/*\"),s.e(U,{type:\"image\"}),l.push({abortController:W,requestParameters:U,supportImageRefresh:$,state:\"queued\",onError:gt=>{at(gt)},onSuccess:gt=>{X(gt)}}),O()});let M=U=>s._(this,void 0,void 0,function*(){U.state=\"running\";let{requestParameters:W,supportImageRefresh:$,onError:X,onSuccess:at,abortController:gt}=U,_t=$===!1&&!s.i(self)&&!s.g(W.url)&&(!W.headers||Object.keys(W.headers).reduce((kt,Wt)=>kt&&Wt===\"accept\",!0));f++;let yt=_t?F(W,gt):s.m(W,gt);try{let kt=yield yt;delete U.abortController,U.state=\"completed\",kt.data instanceof HTMLImageElement||s.b(kt.data)?at(kt):kt.data&&at({data:yield(At=kt.data,typeof createImageBitmap==\"function\"?s.d(At):s.f(At)),cacheControl:kt.cacheControl,expires:kt.expires})}catch(kt){delete U.abortController,X(kt)}finally{f--,O()}var At}),O=()=>{let U=(()=>{for(let W of Object.keys(b))if(b[W]())return!0;return!1})()?s.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:s.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let W=f;W0;W++){let $=l.shift();$.abortController.signal.aborted?W--:M($)}},F=(U,W)=>new Promise(($,X)=>{let at=new Image,gt=U.url,_t=U.credentials;_t&&_t===\"include\"?at.crossOrigin=\"use-credentials\":(_t&&_t===\"same-origin\"||!s.s(gt))&&(at.crossOrigin=\"anonymous\"),W.signal.addEventListener(\"abort\",()=>{at.src=\"\",X(s.c())}),at.fetchPriority=\"high\",at.onload=()=>{at.onerror=at.onload=null,$({data:at})},at.onerror=()=>{at.onerror=at.onload=null,W.signal.aborted||X(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.\"))},at.src=gt})}(Z||(Z={})),Z.resetRequestQueue(),function(T){T.Glyphs=\"Glyphs\",T.Image=\"Image\",T.Source=\"Source\",T.SpriteImage=\"SpriteImage\",T.SpriteJSON=\"SpriteJSON\",T.Style=\"Style\",T.Tile=\"Tile\",T.Unknown=\"Unknown\"}(K||(K={}));class J{constructor(l){this._transformRequestFn=l}transformRequest(l,f){return this._transformRequestFn&&this._transformRequestFn(l,f)||{url:l}}normalizeSpriteURL(l,f,v){let b=function(M){let O=M.match(ht);if(!O)throw new Error(`Unable to parse URL \"${M}\"`);return{protocol:O[1],authority:O[2],path:O[3]||\"/\",params:O[4]?O[4].split(\"&\"):[]}}(l);return b.path+=`${f}${v}`,function(M){let O=M.params.length?`?${M.params.join(\"&\")}`:\"\";return`${M.protocol}://${M.authority}${M.path}${O}`}(b)}setTransformRequest(l){this._transformRequestFn=l}}let ht=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;function Tt(T){var l=new s.A(3);return l[0]=T[0],l[1]=T[1],l[2]=T[2],l}var Ot,Yt=function(T,l,f){return T[0]=l[0]-f[0],T[1]=l[1]-f[1],T[2]=l[2]-f[2],T};Ot=new s.A(3),s.A!=Float32Array&&(Ot[0]=0,Ot[1]=0,Ot[2]=0);var te=function(T){var l=T[0],f=T[1];return l*l+f*f};function oe(T){let l=[];if(typeof T==\"string\")l.push({id:\"default\",url:T});else if(T&&T.length>0){let f=[];for(let{id:v,url:b}of T){let M=`${v}${b}`;f.indexOf(M)===-1&&(f.push(M),l.push({id:v,url:b}))}}return l}(function(){var T=new s.A(2);s.A!=Float32Array&&(T[0]=0,T[1]=0)})();class ae{constructor(l,f,v,b){this.context=l,this.format=v,this.texture=l.gl.createTexture(),this.update(f,b)}update(l,f,v){let{width:b,height:M}=l,O=!(this.size&&this.size[0]===b&&this.size[1]===M||v),{context:F}=this,{gl:U}=F;if(this.useMipmap=!!(f&&f.useMipmap),U.bindTexture(U.TEXTURE_2D,this.texture),F.pixelStoreUnpackFlipY.set(!1),F.pixelStoreUnpack.set(1),F.pixelStoreUnpackPremultiplyAlpha.set(this.format===U.RGBA&&(!f||f.premultiply!==!1)),O)this.size=[b,M],l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||s.b(l)?U.texImage2D(U.TEXTURE_2D,0,this.format,this.format,U.UNSIGNED_BYTE,l):U.texImage2D(U.TEXTURE_2D,0,this.format,b,M,0,this.format,U.UNSIGNED_BYTE,l.data);else{let{x:W,y:$}=v||{x:0,y:0};l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||s.b(l)?U.texSubImage2D(U.TEXTURE_2D,0,W,$,U.RGBA,U.UNSIGNED_BYTE,l):U.texSubImage2D(U.TEXTURE_2D,0,W,$,b,M,U.RGBA,U.UNSIGNED_BYTE,l.data)}this.useMipmap&&this.isSizePowerOfTwo()&&U.generateMipmap(U.TEXTURE_2D)}bind(l,f,v){let{context:b}=this,{gl:M}=b;M.bindTexture(M.TEXTURE_2D,this.texture),v!==M.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(v=M.LINEAR),l!==this.filter&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,l),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,v||l),this.filter=l),f!==this.wrap&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,f),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}function ke(T){let{userImage:l}=T;return!!(l&&l.render&&l.render())&&(T.data.replace(new Uint8Array(l.data.buffer)),!0)}class or extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new s.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(l){if(this.loaded!==l&&(this.loaded=l,l)){for(let{ids:f,promiseResolve:v}of this.requestors)v(this._getImagesForIds(f));this.requestors=[]}}getImage(l){let f=this.images[l];if(f&&!f.data&&f.spriteData){let v=f.spriteData;f.data=new s.R({width:v.width,height:v.height},v.context.getImageData(v.x,v.y,v.width,v.height).data),f.spriteData=null}return f}addImage(l,f){if(this.images[l])throw new Error(`Image id ${l} already exist, use updateImage instead`);this._validate(l,f)&&(this.images[l]=f)}_validate(l,f){let v=!0,b=f.data||f.spriteData;return this._validateStretch(f.stretchX,b&&b.width)||(this.fire(new s.j(new Error(`Image \"${l}\" has invalid \"stretchX\" value`))),v=!1),this._validateStretch(f.stretchY,b&&b.height)||(this.fire(new s.j(new Error(`Image \"${l}\" has invalid \"stretchY\" value`))),v=!1),this._validateContent(f.content,f)||(this.fire(new s.j(new Error(`Image \"${l}\" has invalid \"content\" value`))),v=!1),v}_validateStretch(l,f){if(!l)return!0;let v=0;for(let b of l){if(b[0]{let b=!0;if(!this.isLoaded())for(let M of l)this.images[M]||(b=!1);this.isLoaded()||b?f(this._getImagesForIds(l)):this.requestors.push({ids:l,promiseResolve:f})})}_getImagesForIds(l){let f={};for(let v of l){let b=this.getImage(v);b||(this.fire(new s.k(\"styleimagemissing\",{id:v})),b=this.getImage(v)),b?f[v]={data:b.data.clone(),pixelRatio:b.pixelRatio,sdf:b.sdf,version:b.version,stretchX:b.stretchX,stretchY:b.stretchY,content:b.content,hasRenderCallback:!!(b.userImage&&b.userImage.render)}:s.w(`Image \"${v}\" 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 f}getPixelSize(){let{width:l,height:f}=this.atlasImage;return{width:l,height:f}}getPattern(l){let f=this.patterns[l],v=this.getImage(l);if(!v)return null;if(f&&f.position.version===v.version)return f.position;if(f)f.position.version=v.version;else{let b={w:v.data.width+2,h:v.data.height+2,x:0,y:0},M=new s.I(b,v);this.patterns[l]={bin:b,position:M}}return this._updatePatternAtlas(),this.patterns[l].position}bind(l){let f=l.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new ae(l,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){let l=[];for(let M in this.patterns)l.push(this.patterns[M].bin);let{w:f,h:v}=s.p(l),b=this.atlasImage;b.resize({width:f||1,height:v||1});for(let M in this.patterns){let{bin:O}=this.patterns[M],F=O.x+1,U=O.y+1,W=this.getImage(M).data,$=W.width,X=W.height;s.R.copy(W,b,{x:0,y:0},{x:F,y:U},{width:$,height:X}),s.R.copy(W,b,{x:0,y:X-1},{x:F,y:U-1},{width:$,height:1}),s.R.copy(W,b,{x:0,y:0},{x:F,y:U+X},{width:$,height:1}),s.R.copy(W,b,{x:$-1,y:0},{x:F-1,y:U},{width:1,height:X}),s.R.copy(W,b,{x:0,y:0},{x:F+$,y:U},{width:1,height:X})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(l){for(let f of l){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;let v=this.getImage(f);v||s.w(`Image with ID: \"${f}\" was not found`),ke(v)&&this.updateImage(f,v)}}}let cr=1e20;function Lr(T,l,f,v,b,M,O,F,U){for(let W=l;W-1);U++,M[U]=F,O[U]=W,O[U+1]=cr}for(let F=0,U=0;F65535)throw new Error(\"glyphs > 65535 not supported\");if(v.ranges[M])return{stack:l,id:f,glyph:b};if(!this.url)throw new Error(\"glyphsUrl is not set\");if(!v.requests[M]){let F=zs.loadGlyphRange(l,M,this.url,this.requestManager);v.requests[M]=F}let O=yield v.requests[M];for(let F in O)this._doesCharSupportLocalGlyph(+F)||(v.glyphs[+F]=O[+F]);return v.ranges[M]=!0,{stack:l,id:f,glyph:O[f]||null}})}_doesCharSupportLocalGlyph(l){return!!this.localIdeographFontFamily&&(s.u[\"CJK Unified Ideographs\"](l)||s.u[\"Hangul Syllables\"](l)||s.u.Hiragana(l)||s.u.Katakana(l))}_tinySDF(l,f,v){let b=this.localIdeographFontFamily;if(!b||!this._doesCharSupportLocalGlyph(v))return;let M=l.tinySDF;if(!M){let F=\"400\";/bold/i.test(f)?F=\"900\":/medium/i.test(f)?F=\"500\":/light/i.test(f)&&(F=\"200\"),M=l.tinySDF=new zs.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:b,fontWeight:F})}let O=M.draw(String.fromCharCode(v));return{id:v,bitmap:new s.o({width:O.width||60,height:O.height||60},O.data),metrics:{width:O.glyphWidth/2||24,height:O.glyphHeight/2||24,left:O.glyphLeft/2+.5||0,top:O.glyphTop/2-27.5||-8,advance:O.glyphAdvance/2||24,isDoubleResolution:!0}}}}zs.loadGlyphRange=function(T,l,f,v){return s._(this,void 0,void 0,function*(){let b=256*l,M=b+255,O=v.transformRequest(f.replace(\"{fontstack}\",T).replace(\"{range}\",`${b}-${M}`),K.Glyphs),F=yield s.l(O,new AbortController);if(!F||!F.data)throw new Error(`Could not load glyph range. range: ${l}, ${b}-${M}`);let U={};for(let W of s.n(F.data))U[W.id]=W;return U})},zs.TinySDF=class{constructor({fontSize:T=24,buffer:l=3,radius:f=8,cutoff:v=.25,fontFamily:b=\"sans-serif\",fontWeight:M=\"normal\",fontStyle:O=\"normal\"}={}){this.buffer=l,this.cutoff=v,this.radius=f;let F=this.size=T+4*l,U=this._createCanvas(F),W=this.ctx=U.getContext(\"2d\",{willReadFrequently:!0});W.font=`${O} ${M} ${T}px ${b}`,W.textBaseline=\"alphabetic\",W.textAlign=\"left\",W.fillStyle=\"black\",this.gridOuter=new Float64Array(F*F),this.gridInner=new Float64Array(F*F),this.f=new Float64Array(F),this.z=new Float64Array(F+1),this.v=new Uint16Array(F)}_createCanvas(T){let l=document.createElement(\"canvas\");return l.width=l.height=T,l}draw(T){let{width:l,actualBoundingBoxAscent:f,actualBoundingBoxDescent:v,actualBoundingBoxLeft:b,actualBoundingBoxRight:M}=this.ctx.measureText(T),O=Math.ceil(f),F=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(M-b))),U=Math.min(this.size-this.buffer,O+Math.ceil(v)),W=F+2*this.buffer,$=U+2*this.buffer,X=Math.max(W*$,0),at=new Uint8ClampedArray(X),gt={data:at,width:W,height:$,glyphWidth:F,glyphHeight:U,glyphTop:O,glyphLeft:0,glyphAdvance:l};if(F===0||U===0)return gt;let{ctx:_t,buffer:yt,gridInner:At,gridOuter:kt}=this;_t.clearRect(yt,yt,F,U),_t.fillText(T,yt,yt+O);let Wt=_t.getImageData(yt,yt,F,U);kt.fill(cr,0,X),At.fill(0,0,X);for(let St=0;St0?ne*ne:0,At[Ht]=ne<0?ne*ne:0}}Lr(kt,0,0,W,$,W,this.f,this.v,this.z),Lr(At,yt,yt,F,U,W,this.f,this.v,this.z);for(let St=0;St1&&(U=l[++F]);let $=Math.abs(W-U.left),X=Math.abs(W-U.right),at=Math.min($,X),gt,_t=M/v*(b+1);if(U.isDash){let yt=b-Math.abs(_t);gt=Math.sqrt(at*at+yt*yt)}else gt=b-Math.sqrt(at*at+_t*_t);this.data[O+W]=Math.max(0,Math.min(255,gt+128))}}}addRegularDash(l){for(let F=l.length-1;F>=0;--F){let U=l[F],W=l[F+1];U.zeroLength?l.splice(F,1):W&&W.isDash===U.isDash&&(W.left=U.left,l.splice(F,1))}let f=l[0],v=l[l.length-1];f.isDash===v.isDash&&(f.left=v.left-this.width,v.right=f.right+this.width);let b=this.width*this.nextRow,M=0,O=l[M];for(let F=0;F1&&(O=l[++M]);let U=Math.abs(F-O.left),W=Math.abs(F-O.right),$=Math.min(U,W);this.data[b+F]=Math.max(0,Math.min(255,(O.isDash?$:-$)+128))}}addDash(l,f){let v=f?7:0,b=2*v+1;if(this.nextRow+b>this.height)return s.w(\"LineAtlas out of space\"),null;let M=0;for(let F=0;F{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[yo]}numActive(){return Object.keys(this.active).length}}let ol=Math.floor(_.hardwareConcurrency/2),Ca,Vo;function Li(){return Ca||(Ca=new aa),Ca}aa.workerCount=s.B(globalThis)?Math.max(Math.min(ol,3),1):1;class vo{constructor(l,f){this.workerPool=l,this.actors=[],this.currentActor=0,this.id=f;let v=this.workerPool.acquire(f);for(let b=0;b{f.remove()}),this.actors=[],l&&this.workerPool.release(this.id)}registerMessageHandler(l,f){for(let v of this.actors)v.registerMessageHandler(l,f)}}function Bi(){return Vo||(Vo=new vo(Li(),s.G),Vo.registerMessageHandler(\"getResource\",(T,l,f)=>s.m(l,f))),Vo}function cs(T,l){let f=s.F();return s.H(f,f,[1,1,0]),s.J(f,f,[.5*T.width,.5*T.height,1]),s.K(f,f,T.calculatePosMatrix(l.toUnwrapped()))}function jo(T,l,f,v,b,M){let O=function(X,at,gt){if(X)for(let _t of X){let yt=at[_t];if(yt&&yt.source===gt&&yt.type===\"fill-extrusion\")return!0}else for(let _t in at){let yt=at[_t];if(yt.source===gt&&yt.type===\"fill-extrusion\")return!0}return!1}(b&&b.layers,l,T.id),F=M.maxPitchScaleFactor(),U=T.tilesIn(v,F,O);U.sort(Go);let W=[];for(let X of U)W.push({wrappedTileID:X.tileID.wrapped().key,queryResults:X.tile.queryRenderedFeatures(l,f,T._state,X.queryGeometry,X.cameraQueryGeometry,X.scale,b,M,F,cs(T.transform,X.tileID))});let $=function(X){let at={},gt={};for(let _t of X){let yt=_t.queryResults,At=_t.wrappedTileID,kt=gt[At]=gt[At]||{};for(let Wt in yt){let St=yt[Wt],Nt=kt[Wt]=kt[Wt]||{},Zt=at[Wt]=at[Wt]||[];for(let Ht of St)Nt[Ht.featureIndex]||(Nt[Ht.featureIndex]=!0,Zt.push(Ht))}}return at}(W);for(let X in $)$[X].forEach(at=>{let gt=at.feature,_t=T.getFeatureState(gt.layer[\"source-layer\"],gt.id);gt.source=gt.layer.source,gt.layer[\"source-layer\"]&&(gt.sourceLayer=gt.layer[\"source-layer\"]),gt.state=_t});return $}function Go(T,l){let f=T.tileID,v=l.tileID;return f.overscaledZ-v.overscaledZ||f.canonical.y-v.canonical.y||f.wrap-v.wrap||f.canonical.x-v.canonical.x}function Wo(T,l,f){return s._(this,void 0,void 0,function*(){let v=T;if(T.url?v=(yield s.h(l.transformRequest(T.url,K.Source),f)).data:yield _.frameAsync(f),!v)return null;let b=s.L(s.e(v,T),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);return\"vector_layers\"in v&&v.vector_layers&&(b.vectorLayerIds=v.vector_layers.map(M=>M.id)),b})}class ln{constructor(l,f){l&&(f?this.setSouthWest(l).setNorthEast(f):Array.isArray(l)&&(l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1])))}setNorthEast(l){return this._ne=l instanceof s.M?new s.M(l.lng,l.lat):s.M.convert(l),this}setSouthWest(l){return this._sw=l instanceof s.M?new s.M(l.lng,l.lat):s.M.convert(l),this}extend(l){let f=this._sw,v=this._ne,b,M;if(l instanceof s.M)b=l,M=l;else{if(!(l instanceof ln))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(ln.convert(l)):this.extend(s.M.convert(l)):l&&(\"lng\"in l||\"lon\"in l)&&\"lat\"in l?this.extend(s.M.convert(l)):this;if(b=l._sw,M=l._ne,!b||!M)return this}return f||v?(f.lng=Math.min(b.lng,f.lng),f.lat=Math.min(b.lat,f.lat),v.lng=Math.max(M.lng,v.lng),v.lat=Math.max(M.lat,v.lat)):(this._sw=new s.M(b.lng,b.lat),this._ne=new s.M(M.lng,M.lat)),this}getCenter(){return new s.M((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 s.M(this.getWest(),this.getNorth())}getSouthEast(){return new s.M(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(l){let{lng:f,lat:v}=s.M.convert(l),b=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(b=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=v&&v<=this._ne.lat&&b}static convert(l){return l instanceof ln?l:l&&new ln(l)}static fromLngLat(l,f=0){let v=360*f/40075017,b=v/Math.cos(Math.PI/180*l.lat);return new ln(new s.M(l.lng-b,l.lat-v),new s.M(l.lng+b,l.lat+v))}}class la{constructor(l,f,v){this.bounds=ln.convert(this.validateBounds(l)),this.minzoom=f||0,this.maxzoom=v||24}validateBounds(l){return Array.isArray(l)&&l.length===4?[Math.max(-180,l[0]),Math.max(-90,l[1]),Math.min(180,l[2]),Math.min(90,l[3])]:[-180,-90,180,90]}contains(l){let f=Math.pow(2,l.z),v=Math.floor(s.N(this.bounds.getWest())*f),b=Math.floor(s.O(this.bounds.getNorth())*f),M=Math.ceil(s.N(this.bounds.getEast())*f),O=Math.ceil(s.O(this.bounds.getSouth())*f);return l.x>=v&&l.x=b&&l.y{this._options.tiles=l}),this}setUrl(l){return this.setSourceProperty(()=>{this.url=l,this._options.url=l}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return s.e({},this._options)}loadTile(l){return s._(this,void 0,void 0,function*(){let f=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),v={request:this.map._requestManager.transformRequest(f,K.Tile),uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};v.request.collectResourceTiming=this._collectResourceTiming;let b=\"reloadTile\";if(l.actor&&l.state!==\"expired\"){if(l.state===\"loading\")return new Promise((M,O)=>{l.reloadPromise={resolve:M,reject:O}})}else l.actor=this.dispatcher.getActor(),b=\"loadTile\";l.abortController=new AbortController;try{let M=yield l.actor.sendAsync({type:b,data:v},l.abortController);if(delete l.abortController,l.aborted)return;this._afterTileLoadWorkerResponse(l,M)}catch(M){if(delete l.abortController,l.aborted)return;if(M&&M.status!==404)throw M;this._afterTileLoadWorkerResponse(l,null)}})}_afterTileLoadWorkerResponse(l,f){if(f&&f.resourceTiming&&(l.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&l.setExpiryData(f),l.loadVectorData(f,this.map.painter),l.reloadPromise){let v=l.reloadPromise;l.reloadPromise=null,this.loadTile(l).then(v.resolve).catch(v.reject)}}abortTile(l){return s._(this,void 0,void 0,function*(){l.abortController&&(l.abortController.abort(),delete l.abortController),l.actor&&(yield l.actor.sendAsync({type:\"abortTile\",data:{uid:l.uid,type:this.type,source:this.id}}))})}unloadTile(l){return s._(this,void 0,void 0,function*(){l.unloadVectorData(),l.actor&&(yield l.actor.sendAsync({type:\"removeTile\",data:{uid:l.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class xo extends s.E{constructor(l,f,v,b){super(),this.id=l,this.dispatcher=v,this.setEventedParent(b),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=s.e({type:\"raster\"},f),s.e(this,s.L(f,[\"url\",\"scheme\",\"tileSize\"]))}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=new AbortController;try{let l=yield Wo(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,l&&(s.e(this,l),l.bounds&&(this.tileBounds=new la(l.bounds,this.minzoom,this.maxzoom)),this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})))}catch(l){this._tileJSONRequest=null,this.fire(new s.j(l))}})}loaded(){return this._loaded}onAdd(l){this.map=l,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(l){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}serialize(){return s.e({},this._options)}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l){return s._(this,void 0,void 0,function*(){let f=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);l.abortController=new AbortController;try{let v=yield Z.getImage(this.map._requestManager.transformRequest(f,K.Tile),l.abortController,this.map._refreshExpiredTiles);if(delete l.abortController,l.aborted)return void(l.state=\"unloaded\");if(v&&v.data){this.map._refreshExpiredTiles&&v.cacheControl&&v.expires&&l.setExpiryData({cacheControl:v.cacheControl,expires:v.expires});let b=this.map.painter.context,M=b.gl,O=v.data;l.texture=this.map.painter.getTileTexture(O.width),l.texture?l.texture.update(O,{useMipmap:!0}):(l.texture=new ae(b,O,M.RGBA,{useMipmap:!0}),l.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),b.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax)),l.state=\"loaded\"}}catch(v){if(delete l.abortController,l.aborted)l.state=\"unloaded\";else if(v)throw l.state=\"errored\",v}})}abortTile(l){return s._(this,void 0,void 0,function*(){l.abortController&&(l.abortController.abort(),delete l.abortController)})}unloadTile(l){return s._(this,void 0,void 0,function*(){l.texture&&this.map.painter.saveTileTexture(l.texture)})}hasTransition(){return!1}}class fu extends xo{constructor(l,f,v,b){super(l,f,v,b),this.type=\"raster-dem\",this.maxzoom=22,this._options=s.e({type:\"raster-dem\"},f),this.encoding=f.encoding||\"mapbox\",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(l){return s._(this,void 0,void 0,function*(){let f=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),v=this.map._requestManager.transformRequest(f,K.Tile);l.neighboringTiles=this._getNeighboringTiles(l.tileID),l.abortController=new AbortController;try{let b=yield Z.getImage(v,l.abortController,this.map._refreshExpiredTiles);if(delete l.abortController,l.aborted)return void(l.state=\"unloaded\");if(b&&b.data){let M=b.data;this.map._refreshExpiredTiles&&b.cacheControl&&b.expires&&l.setExpiryData({cacheControl:b.cacheControl,expires:b.expires});let O=s.b(M)&&s.S()?M:yield this.readImageNow(M),F={type:this.type,uid:l.uid,source:this.id,rawImageData:O,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!l.actor||l.state===\"expired\"){l.actor=this.dispatcher.getActor();let U=yield l.actor.sendAsync({type:\"loadDEMTile\",data:F});l.dem=U,l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0,l.state=\"loaded\"}}}catch(b){if(delete l.abortController,l.aborted)l.state=\"unloaded\";else if(b)throw l.state=\"errored\",b}})}readImageNow(l){return s._(this,void 0,void 0,function*(){if(typeof VideoFrame<\"u\"&&s.U()){let f=l.width+2,v=l.height+2;try{return new s.R({width:f,height:v},yield s.V(l,-1,-1,f,v))}catch{}}return _.getImageData(l,1)})}_getNeighboringTiles(l){let f=l.canonical,v=Math.pow(2,f.z),b=(f.x-1+v)%v,M=f.x===0?l.wrap-1:l.wrap,O=(f.x+1+v)%v,F=f.x+1===v?l.wrap+1:l.wrap,U={};return U[new s.Q(l.overscaledZ,M,f.z,b,f.y).key]={backfilled:!1},U[new s.Q(l.overscaledZ,F,f.z,O,f.y).key]={backfilled:!1},f.y>0&&(U[new s.Q(l.overscaledZ,M,f.z,b,f.y-1).key]={backfilled:!1},U[new s.Q(l.overscaledZ,l.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},U[new s.Q(l.overscaledZ,F,f.z,O,f.y-1).key]={backfilled:!1}),f.y+10&&s.e(M,{resourceTiming:b}),this.fire(new s.k(\"data\",Object.assign(Object.assign({},M),{sourceDataType:\"metadata\"}))),this.fire(new s.k(\"data\",Object.assign(Object.assign({},M),{sourceDataType:\"content\"})))}catch(v){if(this._pendingLoads--,this._removed)return void this.fire(new s.k(\"dataabort\",{dataType:\"source\"}));this.fire(new s.j(v))}})}loaded(){return this._pendingLoads===0}loadTile(l){return s._(this,void 0,void 0,function*(){let f=l.actor?\"reloadTile\":\"loadTile\";l.actor=this.actor;let v={type:this.type,uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};l.abortController=new AbortController;let b=yield this.actor.sendAsync({type:f,data:v},l.abortController);delete l.abortController,l.unloadVectorData(),l.aborted||l.loadVectorData(b,this.map.painter,f===\"reloadTile\")})}abortTile(l){return s._(this,void 0,void 0,function*(){l.abortController&&(l.abortController.abort(),delete l.abortController),l.aborted=!0})}unloadTile(l){return s._(this,void 0,void 0,function*(){l.unloadVectorData(),yield this.actor.sendAsync({type:\"removeTile\",data:{uid:l.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:\"removeSource\",data:{type:this.type,source:this.id}})}serialize(){return s.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Cn=s.X([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class bn extends s.E{constructor(l,f,v,b){super(),this.id=l,this.dispatcher=v,this.coordinates=f.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(b),this.options=f}load(l){return s._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new s.k(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,this._request=new AbortController;try{let f=yield Z.getImage(this.map._requestManager.transformRequest(this.url,K.Image),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,l&&(this.coordinates=l),this._finishLoading())}catch(f){this._request=null,this.fire(new s.j(f))}})}loaded(){return this._loaded}updateImage(l){return l.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=l.url,this.load(l.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})))}onAdd(l){this.map=l,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(l){this.coordinates=l;let f=l.map(s.Y.fromLngLat);this.tileID=function(b){let M=1/0,O=1/0,F=-1/0,U=-1/0;for(let at of b)M=Math.min(M,at.x),O=Math.min(O,at.y),F=Math.max(F,at.x),U=Math.max(U,at.y);let W=Math.max(F-M,U-O),$=Math.max(0,Math.floor(-Math.log(W)/Math.LN2)),X=Math.pow(2,$);return new s.a0($,Math.floor((M+F)/2*X),Math.floor((O+U)/2*X))}(f),this.minzoom=this.maxzoom=this.tileID.z;let v=f.map(b=>this.tileID.getTilePoint(b)._round());return this._boundsArray=new s.Z,this._boundsArray.emplaceBack(v[0].x,v[0].y,0,0),this._boundsArray.emplaceBack(v[1].x,v[1].y,s.W,0),this._boundsArray.emplaceBack(v[3].x,v[3].y,0,s.W),this._boundsArray.emplaceBack(v[2].x,v[2].y,s.W,s.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let l=this.map.painter.context,f=l.gl;this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,Cn.members)),this.boundsSegments||(this.boundsSegments=s.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ae(l,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let v=!1;for(let b in this.tiles){let M=this.tiles[b];M.state!==\"loaded\"&&(M.state=\"loaded\",M.texture=this.texture,v=!0)}v&&this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))}loadTile(l){return s._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(l.tileID.canonical)?(this.tiles[String(l.tileID.wrap)]=l,l.buckets={}):l.state=\"errored\"})}serialize(){return{type:\"image\",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Ho extends bn{constructor(l,f,v,b){super(l,f,v,b),this.roundZoom=!0,this.type=\"video\",this.options=f}load(){return s._(this,void 0,void 0,function*(){this._loaded=!1;let l=this.options;this.urls=[];for(let f of l.urls)this.urls.push(this.map._requestManager.transformRequest(f,K.Source).url);try{let f=yield s.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener(\"playing\",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new s.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){let f=this.video.seekable;lf.end(0)?this.fire(new s.j(new s.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let l=this.map.painter.context,f=l.gl;this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,Cn.members)),this.boundsSegments||(this.boundsSegments=s.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new ae(l,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let v=!1;for(let b in this.tiles){let M=this.tiles[b];M.state!==\"loaded\"&&(M.state=\"loaded\",M.texture=this.texture,v=!0)}v&&this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))}serialize(){return{type:\"video\",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ol extends bn{constructor(l,f,v,b){super(l,f,v,b),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!=\"number\"))||this.fire(new s.j(new s.a1(`sources.${l}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.j(new s.a1(`sources.${l}`,null,'missing required property \"coordinates\"'))),f.animate&&typeof f.animate!=\"boolean\"&&this.fire(new s.j(new s.a1(`sources.${l}`,null,'optional \"animate\" property must be a boolean value'))),f.canvas?typeof f.canvas==\"string\"||f.canvas instanceof HTMLCanvasElement||this.fire(new s.j(new s.a1(`sources.${l}`,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 s.j(new s.a1(`sources.${l}`,null,'missing required property \"canvas\"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return s._(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 s.j(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let f=this.map.painter.context,v=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,Cn.members)),this.boundsSegments||(this.boundsSegments=s.$.simpleSegment(0,0,4,2)),this.texture?(l||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ae(f,this.canvas,v.RGBA,{premultiply:!0});let b=!1;for(let M in this.tiles){let O=this.tiles[M];O.state!==\"loaded\"&&(O.state=\"loaded\",O.texture=this.texture,b=!0)}b&&this.fire(new s.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))}serialize(){return{type:\"canvas\",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}}let La={},Mc=T=>{switch(T){case\"geojson\":return ei;case\"image\":return bn;case\"raster\":return xo;case\"raster-dem\":return fu;case\"vector\":return Jt;case\"video\":return Ho;case\"canvas\":return Ol}return La[T]};class ff extends s.E{constructor(){super(...arguments),this.pluginStatus=\"unavailable\",this.pluginURL=null,this.dispatcher=Bi(),this.queue=[]}_sendPluginStateToWorker(){return s._(this,void 0,void 0,function*(){yield this.dispatcher.broadcast(\"syncRTLPluginState\",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}),this.fire(new s.k(\"pluginStateChange\",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}))})}getRTLTextPluginStatus(){return this.pluginStatus}clearRTLTextPlugin(){this.pluginStatus=\"unavailable\",this.pluginURL=null}setRTLTextPlugin(l,f=!1){return s._(this,void 0,void 0,function*(){if(this.pluginStatus===\"deferred\"||this.pluginStatus===\"loading\"||this.pluginStatus===\"loaded\")throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");this.pluginURL=_.resolveURL(l),this.pluginStatus=\"deferred\",yield this._sendPluginStateToWorker(),f||(yield this._downloadRTLTextPlugin())})}_downloadRTLTextPlugin(){return s._(this,void 0,void 0,function*(){if(this.pluginStatus!==\"deferred\"||!this.pluginURL)throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");try{this.pluginStatus=\"loading\",yield this._sendPluginStateToWorker(),yield s.l({url:this.pluginURL},new AbortController),this.pluginStatus=\"loaded\"}catch{this.pluginStatus=\"error\"}yield this._sendPluginStateToWorker()})}lazyLoadRTLTextPlugin(){return s._(this,void 0,void 0,function*(){this.pluginStatus===\"deferred\"&&(yield this._downloadRTLTextPlugin())})}}let Ms=null;function me(){return Ms||(Ms=new ff),Ms}class qo{constructor(l,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=l,this.uid=s.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=\"loading\"}registerFadeDuration(l){let f=l+this.timeAdded;fM.getLayer(W)).filter(Boolean);if(U.length!==0){F.layers=U,F.stateDependentLayerIds&&(F.stateDependentLayers=F.stateDependentLayerIds.map(W=>U.filter($=>$.id===W)[0]));for(let W of U)O[W.id]=F}}return O}(l.buckets,f.style),this.hasSymbolBuckets=!1;for(let b in this.buckets){let M=this.buckets[b];if(M instanceof s.a5){if(this.hasSymbolBuckets=!0,!v)break;M.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let b in this.buckets){let M=this.buckets[b];if(M instanceof s.a5&&M.hasRTLText){this.hasRTLText=!0,me().lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(let b in this.buckets){let M=this.buckets[b];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(b).queryRadius(M))}l.imageAtlas&&(this.imageAtlas=l.imageAtlas),l.glyphAtlasImage&&(this.glyphAtlasImage=l.glyphAtlasImage)}else this.collisionBoxArray=new s.a4}unloadVectorData(){for(let l in this.buckets)this.buckets[l].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=\"unloaded\"}getBucket(l){return this.buckets[l.id]}upload(l){for(let v in this.buckets){let b=this.buckets[v];b.uploadPending()&&b.upload(l)}let f=l.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ae(l,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ae(l,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(l){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(l,this.imageAtlasTexture)}queryRenderedFeatures(l,f,v,b,M,O,F,U,W,$){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:b,cameraQueryGeometry:M,scale:O,tileSize:this.tileSize,pixelPosMatrix:$,transform:U,params:F,queryPadding:this.queryPadding*W},l,f,v):{}}querySourceFeatures(l,f){let v=this.latestFeatureIndex;if(!v||!v.rawTileData)return;let b=v.loadVTLayers(),M=f&&f.sourceLayer?f.sourceLayer:\"\",O=b._geojsonTileLayer||b[M];if(!O)return;let F=s.a6(f&&f.filter),{z:U,x:W,y:$}=this.tileID.canonical,X={z:U,x:W,y:$};for(let at=0;atv)b=!1;else if(f)if(this.expirationTime{this.remove(l,M)},v)),this.data[b].push(M),this.order.push(b),this.order.length>this.max){let O=this._getAndRemoveByKey(this.order[0]);O&&this.onRemove(O)}return this}has(l){return l.wrapped().key in this.data}getAndRemove(l){return this.has(l)?this._getAndRemoveByKey(l.wrapped().key):null}_getAndRemoveByKey(l){let f=this.data[l].shift();return f.timeout&&clearTimeout(f.timeout),this.data[l].length===0&&delete this.data[l],this.order.splice(this.order.indexOf(l),1),f.value}getByKey(l){let f=this.data[l];return f?f[0].value:null}get(l){return this.has(l)?this.data[l.wrapped().key][0].value:null}remove(l,f){if(!this.has(l))return this;let v=l.wrapped().key,b=f===void 0?0:this.data[v].indexOf(f),M=this.data[v][b];return this.data[v].splice(b,1),M.timeout&&clearTimeout(M.timeout),this.data[v].length===0&&delete this.data[v],this.onRemove(M.value),this.order.splice(this.order.indexOf(v),1),this}setMaxSize(l){for(this.max=l;this.order.length>this.max;){let f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(l){let f=[];for(let v in this.data)for(let b of this.data[v])l(b.value)||f.push(b);for(let v of f)this.remove(v.value.tileID,v)}}class ka{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(l,f,v){let b=String(f);if(this.stateChanges[l]=this.stateChanges[l]||{},this.stateChanges[l][b]=this.stateChanges[l][b]||{},s.e(this.stateChanges[l][b],v),this.deletedStates[l]===null){this.deletedStates[l]={};for(let M in this.state[l])M!==b&&(this.deletedStates[l][M]=null)}else if(this.deletedStates[l]&&this.deletedStates[l][b]===null){this.deletedStates[l][b]={};for(let M in this.state[l][b])v[M]||(this.deletedStates[l][b][M]=null)}else for(let M in v)this.deletedStates[l]&&this.deletedStates[l][b]&&this.deletedStates[l][b][M]===null&&delete this.deletedStates[l][b][M]}removeFeatureState(l,f,v){if(this.deletedStates[l]===null)return;let b=String(f);if(this.deletedStates[l]=this.deletedStates[l]||{},v&&f!==void 0)this.deletedStates[l][b]!==null&&(this.deletedStates[l][b]=this.deletedStates[l][b]||{},this.deletedStates[l][b][v]=null);else if(f!==void 0)if(this.stateChanges[l]&&this.stateChanges[l][b])for(v in this.deletedStates[l][b]={},this.stateChanges[l][b])this.deletedStates[l][b][v]=null;else this.deletedStates[l][b]=null;else this.deletedStates[l]=null}getState(l,f){let v=String(f),b=s.e({},(this.state[l]||{})[v],(this.stateChanges[l]||{})[v]);if(this.deletedStates[l]===null)return{};if(this.deletedStates[l]){let M=this.deletedStates[l][f];if(M===null)return{};for(let O in M)delete b[O]}return b}initializeTileState(l,f){l.setFeatureState(this.state,f)}coalesceChanges(l,f){let v={};for(let b in this.stateChanges){this.state[b]=this.state[b]||{};let M={};for(let O in this.stateChanges[b])this.state[b][O]||(this.state[b][O]={}),s.e(this.state[b][O],this.stateChanges[b][O]),M[O]=this.state[b][O];v[b]=M}for(let b in this.deletedStates){this.state[b]=this.state[b]||{};let M={};if(this.deletedStates[b]===null)for(let O in this.state[b])M[O]={},this.state[b][O]={};else for(let O in this.deletedStates[b]){if(this.deletedStates[b][O]===null)this.state[b][O]={};else for(let F of Object.keys(this.deletedStates[b][O]))delete this.state[b][O][F];M[O]=this.state[b][O]}v[b]=v[b]||{},s.e(v[b],M)}if(this.stateChanges={},this.deletedStates={},Object.keys(v).length!==0)for(let b in l)l[b].setFeatureState(v,f)}}class es extends s.E{constructor(l,f,v){super(),this.id=l,this.dispatcher=v,this.on(\"data\",b=>{b.dataType===\"source\"&&b.sourceDataType===\"metadata\"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&b.dataType===\"source\"&&b.sourceDataType===\"content\"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on(\"dataloading\",()=>{this._sourceErrored=!1}),this.on(\"error\",()=>{this._sourceErrored=this._source.loaded()}),this._source=((b,M,O,F)=>{let U=new(Mc(M.type))(b,M,O,F);if(U.id!==b)throw new Error(`Expected Source id to be ${b} instead of ${U.id}`);return U})(l,f,v,this),this._tiles={},this._cache=new jn(0,b=>this._unloadTile(b)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ka,this._didEmitContent=!1,this._updated=!1}onAdd(l){this.map=l,this._maxTileCacheSize=l?l._maxTileCacheSize:null,this._maxTileCacheZoomLevels=l?l._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(l)}onRemove(l){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(l)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let l in this._tiles){let f=this._tiles[l];if(f.state!==\"loaded\"&&f.state!==\"errored\")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let l=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,l&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(l,f,v){return s._(this,void 0,void 0,function*(){try{yield this._source.loadTile(l),this._tileLoaded(l,f,v)}catch(b){l.state=\"errored\",b.status!==404?this._source.fire(new s.j(b,{tile:l})):this.update(this.transform,this.terrain)}})}_unloadTile(l){this._source.unloadTile&&this._source.unloadTile(l)}_abortTile(l){this._source.abortTile&&this._source.abortTile(l),this._source.fire(new s.k(\"dataabort\",{tile:l,coord:l.tileID,dataType:\"source\"}))}serialize(){return this._source.serialize()}prepare(l){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let f in this._tiles){let v=this._tiles[f];v.upload(l),v.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(l=>l.tileID).sort(we).map(l=>l.key)}getRenderableIds(l){let f=[];for(let v in this._tiles)this._isIdRenderable(v,l)&&f.push(this._tiles[v]);return l?f.sort((v,b)=>{let M=v.tileID,O=b.tileID,F=new s.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle),U=new s.P(O.canonical.x,O.canonical.y)._rotate(this.transform.angle);return M.overscaledZ-O.overscaledZ||U.y-F.y||U.x-F.x}).map(v=>v.tileID.key):f.map(v=>v.tileID).sort(we).map(v=>v.key)}hasRenderableParent(l){let f=this.findLoadedParent(l,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(l,f){return this._tiles[l]&&this._tiles[l].hasData()&&!this._coveredTiles[l]&&(f||!this._tiles[l].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let l in this._tiles)this._tiles[l].state!==\"errored\"&&this._reloadTile(l,\"reloading\")}}_reloadTile(l,f){return s._(this,void 0,void 0,function*(){let v=this._tiles[l];v&&(v.state!==\"loading\"&&(v.state=f),yield this._loadTile(v,l,f))})}_tileLoaded(l,f,v){l.timeAdded=_.now(),v===\"expired\"&&(l.refreshedUponExpiration=!0),this._setTileReloadTimer(f,l),this.getSource().type===\"raster-dem\"&&l.dem&&this._backfillDEM(l),this._state.initializeTileState(l,this.map?this.map.painter:null),l.aborted||this._source.fire(new s.k(\"data\",{dataType:\"source\",tile:l,coord:l.tileID}))}_backfillDEM(l){let f=this.getRenderableIds();for(let b=0;b1||(Math.abs(O)>1&&(Math.abs(O+U)===1?O+=U:Math.abs(O-U)===1&&(O-=U)),M.dem&&b.dem&&(b.dem.backfillBorder(M.dem,O,F),b.neighboringTiles&&b.neighboringTiles[W]&&(b.neighboringTiles[W].backfilled=!0)))}}getTile(l){return this.getTileByID(l.key)}getTileByID(l){return this._tiles[l]}_retainLoadedChildren(l,f,v,b){for(let M in this._tiles){let O=this._tiles[M];if(b[M]||!O.hasData()||O.tileID.overscaledZ<=f||O.tileID.overscaledZ>v)continue;let F=O.tileID;for(;O&&O.tileID.overscaledZ>f+1;){let W=O.tileID.scaledTo(O.tileID.overscaledZ-1);O=this._tiles[W.key],O&&O.hasData()&&(F=W)}let U=F;for(;U.overscaledZ>f;)if(U=U.scaledTo(U.overscaledZ-1),l[U.key]){b[F.key]=F;break}}}findLoadedParent(l,f){if(l.key in this._loadedParentTiles){let v=this._loadedParentTiles[l.key];return v&&v.tileID.overscaledZ>=f?v:null}for(let v=l.overscaledZ-1;v>=f;v--){let b=l.scaledTo(v),M=this._getLoadedTile(b);if(M)return M}}_getLoadedTile(l){let f=this._tiles[l.key];return f&&f.hasData()?f:this._cache.getByKey(l.wrapped().key)}updateCacheSize(l){let f=Math.ceil(l.width/this._source.tileSize)+1,v=Math.ceil(l.height/this._source.tileSize)+1,b=Math.floor(f*v*(this._maxTileCacheZoomLevels===null?s.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),M=typeof this._maxTileCacheSize==\"number\"?Math.min(this._maxTileCacheSize,b):b;this._cache.setMaxSize(M)}handleWrapJump(l){let f=Math.round((l-(this._prevLng===void 0?l:this._prevLng))/360);if(this._prevLng=l,f){let v={};for(let b in this._tiles){let M=this._tiles[b];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+f),v[M.tileID.key]=M}this._tiles=v;for(let b in this._timers)clearTimeout(this._timers[b]),delete this._timers[b];for(let b in this._tiles)this._setTileReloadTimer(b,this._tiles[b])}}update(l,f){if(this.transform=l,this.terrain=f,!this._sourceLoaded||this._paused)return;let v;this.updateCacheSize(l),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?v=l.getVisibleUnwrappedCoordinates(this._source.tileID).map($=>new s.Q($.canonical.z,$.wrap,$.canonical.z,$.canonical.x,$.canonical.y)):(v=l.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(v=v.filter($=>this._source.hasTile($)))):v=[];let b=l.coveringZoomLevel(this._source),M=Math.max(b-es.maxOverzooming,this._source.minzoom),O=Math.max(b+es.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let $={};for(let X of v)if(X.canonical.z>this._source.minzoom){let at=X.scaledTo(X.canonical.z-1);$[at.key]=at;let gt=X.scaledTo(Math.max(this._source.minzoom,Math.min(X.canonical.z,5)));$[gt.key]=gt}v=v.concat(Object.values($))}let F=v.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,F&&this.fire(new s.k(\"data\",{sourceDataType:\"idle\",dataType:\"source\",sourceId:this.id}));let U=this._updateRetainedTiles(v,b);if(kr(this._source.type)){let $={},X={},at=Object.keys(U),gt=_.now();for(let _t of at){let yt=U[_t],At=this._tiles[_t];if(!At||At.fadeEndTime!==0&&At.fadeEndTime<=gt)continue;let kt=this.findLoadedParent(yt,M);kt&&(this._addTile(kt.tileID),$[kt.tileID.key]=kt.tileID),X[_t]=yt}this._retainLoadedChildren(X,b,O,U);for(let _t in $)U[_t]||(this._coveredTiles[_t]=!0,U[_t]=$[_t]);if(f){let _t={},yt={};for(let At of v)this._tiles[At.key].hasData()?_t[At.key]=At:yt[At.key]=At;for(let At in yt){let kt=yt[At].children(this._source.maxzoom);this._tiles[kt[0].key]&&this._tiles[kt[1].key]&&this._tiles[kt[2].key]&&this._tiles[kt[3].key]&&(_t[kt[0].key]=U[kt[0].key]=kt[0],_t[kt[1].key]=U[kt[1].key]=kt[1],_t[kt[2].key]=U[kt[2].key]=kt[2],_t[kt[3].key]=U[kt[3].key]=kt[3],delete yt[At])}for(let At in yt){let kt=this.findLoadedParent(yt[At],this._source.minzoom);if(kt){_t[kt.tileID.key]=U[kt.tileID.key]=kt.tileID;for(let Wt in _t)_t[Wt].isChildOf(kt.tileID)&&delete _t[Wt]}}for(let At in this._tiles)_t[At]||(this._coveredTiles[At]=!0)}}for(let $ in U)this._tiles[$].clearFadeHold();let W=s.ab(this._tiles,U);for(let $ of W){let X=this._tiles[$];X.hasSymbolBuckets&&!X.holdingForFade()?X.setHoldDuration(this.map._fadeDuration):X.hasSymbolBuckets&&!X.symbolFadeFinished()||this._removeTile($)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let l in this._tiles)this._tiles[l].holdingForFade()&&this._removeTile(l)}_updateRetainedTiles(l,f){let v={},b={},M=Math.max(f-es.maxOverzooming,this._source.minzoom),O=Math.max(f+es.maxUnderzooming,this._source.minzoom),F={};for(let U of l){let W=this._addTile(U);v[U.key]=U,W.hasData()||fthis._source.maxzoom){let X=U.children(this._source.maxzoom)[0],at=this.getTile(X);if(at&&at.hasData()){v[X.key]=X;continue}}else{let X=U.children(this._source.maxzoom);if(v[X[0].key]&&v[X[1].key]&&v[X[2].key]&&v[X[3].key])continue}let $=W.wasRequested();for(let X=U.overscaledZ-1;X>=M;--X){let at=U.scaledTo(X);if(b[at.key])break;if(b[at.key]=!0,W=this.getTile(at),!W&&$&&(W=this._addTile(at)),W){let gt=W.hasData();if(($||gt)&&(v[at.key]=at),$=W.wasRequested(),gt)break}}}return v}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let l in this._tiles){let f=[],v,b=this._tiles[l].tileID;for(;b.overscaledZ>0;){if(b.key in this._loadedParentTiles){v=this._loadedParentTiles[b.key];break}f.push(b.key);let M=b.scaledTo(b.overscaledZ-1);if(v=this._getLoadedTile(M),v)break;b=M}for(let M of f)this._loadedParentTiles[M]=v}}_addTile(l){let f=this._tiles[l.key];if(f)return f;f=this._cache.getAndRemove(l),f&&(this._setTileReloadTimer(l.key,f),f.tileID=l,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[l.key]&&(clearTimeout(this._cacheTimers[l.key]),delete this._cacheTimers[l.key],this._setTileReloadTimer(l.key,f)));let v=f;return f||(f=new qo(l,this._source.tileSize*l.overscaleFactor()),this._loadTile(f,l.key,f.state)),f.uses++,this._tiles[l.key]=f,v||this._source.fire(new s.k(\"dataloading\",{tile:f,coord:f.tileID,dataType:\"source\"})),f}_setTileReloadTimer(l,f){l in this._timers&&(clearTimeout(this._timers[l]),delete this._timers[l]);let v=f.getExpiryTimeout();v&&(this._timers[l]=setTimeout(()=>{this._reloadTile(l,\"expired\"),delete this._timers[l]},v))}_removeTile(l){let f=this._tiles[l];f&&(f.uses--,delete this._tiles[l],this._timers[l]&&(clearTimeout(this._timers[l]),delete this._timers[l]),f.uses>0||(f.hasData()&&f.state!==\"reloading\"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let l in this._tiles)this._removeTile(l);this._cache.reset()}tilesIn(l,f,v){let b=[],M=this.transform;if(!M)return b;let O=v?M.getCameraQueryGeometry(l):l,F=l.map(_t=>M.pointCoordinate(_t,this.terrain)),U=O.map(_t=>M.pointCoordinate(_t,this.terrain)),W=this.getIds(),$=1/0,X=1/0,at=-1/0,gt=-1/0;for(let _t of U)$=Math.min($,_t.x),X=Math.min(X,_t.y),at=Math.max(at,_t.x),gt=Math.max(gt,_t.y);for(let _t=0;_t=0&&St[1].y+Wt>=0){let Nt=F.map(Ht=>At.getTilePoint(Ht)),Zt=U.map(Ht=>At.getTilePoint(Ht));b.push({tile:yt,tileID:At,queryGeometry:Nt,cameraQueryGeometry:Zt,scale:kt})}}return b}getVisibleCoordinates(l){let f=this.getRenderableIds(l).map(v=>this._tiles[v].tileID);for(let v of f)v.posMatrix=this.transform.calculatePosMatrix(v.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(kr(this._source.type)){let l=_.now();for(let f in this._tiles)if(this._tiles[f].fadeEndTime>=l)return!0}return!1}setFeatureState(l,f,v){this._state.updateState(l=l||\"_geojsonTileLayer\",f,v)}removeFeatureState(l,f,v){this._state.removeFeatureState(l=l||\"_geojsonTileLayer\",f,v)}getFeatureState(l,f){return this._state.getState(l=l||\"_geojsonTileLayer\",f)}setDependencies(l,f,v){let b=this._tiles[l];b&&b.setDependencies(f,v)}reloadTilesForDependencies(l,f){for(let v in this._tiles)this._tiles[v].hasDependency(l,f)&&this._reloadTile(v,\"reloading\");this._cache.filter(v=>!v.hasDependency(l,f))}}function we(T,l){let f=Math.abs(2*T.wrap)-+(T.wrap<0),v=Math.abs(2*l.wrap)-+(l.wrap<0);return T.overscaledZ-l.overscaledZ||v-f||l.canonical.y-T.canonical.y||l.canonical.x-T.canonical.x}function kr(T){return T===\"raster\"||T===\"image\"||T===\"video\"}es.maxOverzooming=10,es.maxUnderzooming=3;class Sr{constructor(l,f){this.reset(l,f)}reset(l,f){this.points=l||[],this._distances=[0];for(let v=1;v0?(b-O)/F:0;return this.points[M].mult(1-U).add(this.points[f].mult(U))}}function Ln(T,l){let f=!0;return T===\"always\"||T!==\"never\"&&l!==\"never\"||(f=!1),f}class Ra{constructor(l,f,v){let b=this.boxCells=[],M=this.circleCells=[];this.xCellCount=Math.ceil(l/v),this.yCellCount=Math.ceil(f/v);for(let O=0;Othis.width||b<0||f>this.height)return[];let U=[];if(l<=0&&f<=0&&this.width<=v&&this.height<=b){if(M)return[{key:null,x1:l,y1:f,x2:v,y2:b}];for(let W=0;W0}hitTestCircle(l,f,v,b,M){let O=l-v,F=l+v,U=f-v,W=f+v;if(F<0||O>this.width||W<0||U>this.height)return!1;let $=[];return this._forEachCell(O,U,F,W,this._queryCellCircle,$,{hitTest:!0,overlapMode:b,circle:{x:l,y:f,radius:v},seenUids:{box:{},circle:{}}},M),$.length>0}_queryCell(l,f,v,b,M,O,F,U){let{seenUids:W,hitTest:$,overlapMode:X}=F,at=this.boxCells[M];if(at!==null){let _t=this.bboxes;for(let yt of at)if(!W.box[yt]){W.box[yt]=!0;let At=4*yt,kt=this.boxKeys[yt];if(l<=_t[At+2]&&f<=_t[At+3]&&v>=_t[At+0]&&b>=_t[At+1]&&(!U||U(kt))&&(!$||!Ln(X,kt.overlapMode))&&(O.push({key:kt,x1:_t[At],y1:_t[At+1],x2:_t[At+2],y2:_t[At+3]}),$))return!0}}let gt=this.circleCells[M];if(gt!==null){let _t=this.circles;for(let yt of gt)if(!W.circle[yt]){W.circle[yt]=!0;let At=3*yt,kt=this.circleKeys[yt];if(this._circleAndRectCollide(_t[At],_t[At+1],_t[At+2],l,f,v,b)&&(!U||U(kt))&&(!$||!Ln(X,kt.overlapMode))){let Wt=_t[At],St=_t[At+1],Nt=_t[At+2];if(O.push({key:kt,x1:Wt-Nt,y1:St-Nt,x2:Wt+Nt,y2:St+Nt}),$)return!0}}}return!1}_queryCellCircle(l,f,v,b,M,O,F,U){let{circle:W,seenUids:$,overlapMode:X}=F,at=this.boxCells[M];if(at!==null){let _t=this.bboxes;for(let yt of at)if(!$.box[yt]){$.box[yt]=!0;let At=4*yt,kt=this.boxKeys[yt];if(this._circleAndRectCollide(W.x,W.y,W.radius,_t[At+0],_t[At+1],_t[At+2],_t[At+3])&&(!U||U(kt))&&!Ln(X,kt.overlapMode))return O.push(!0),!0}}let gt=this.circleCells[M];if(gt!==null){let _t=this.circles;for(let yt of gt)if(!$.circle[yt]){$.circle[yt]=!0;let At=3*yt,kt=this.circleKeys[yt];if(this._circlesCollide(_t[At],_t[At+1],_t[At+2],W.x,W.y,W.radius)&&(!U||U(kt))&&!Ln(X,kt.overlapMode))return O.push(!0),!0}}}_forEachCell(l,f,v,b,M,O,F,U){let W=this._convertToXCellCoord(l),$=this._convertToYCellCoord(f),X=this._convertToXCellCoord(v),at=this._convertToYCellCoord(b);for(let gt=W;gt<=X;gt++)for(let _t=$;_t<=at;_t++)if(M.call(this,l,f,v,b,this.xCellCount*_t+gt,O,F,U))return}_convertToXCellCoord(l){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(l*this.xScale)))}_convertToYCellCoord(l){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(l*this.yScale)))}_circlesCollide(l,f,v,b,M,O){let F=b-l,U=M-f,W=v+O;return W*W>F*F+U*U}_circleAndRectCollide(l,f,v,b,M,O,F){let U=(O-b)/2,W=Math.abs(l-(b+U));if(W>U+v)return!1;let $=(F-M)/2,X=Math.abs(f-(M+$));if(X>$+v)return!1;if(W<=U||X<=$)return!0;let at=W-U,gt=X-$;return at*at+gt*gt<=v*v}}function gr(T,l,f,v,b){let M=s.F();return l?(s.J(M,M,[1/b,1/b,1]),f||s.ad(M,M,v.angle)):s.K(M,v.labelPlaneMatrix,T),M}function Ec(T,l,f,v,b){if(l){let M=s.ae(T);return s.J(M,M,[b,b,1]),f||s.ad(M,M,-v.angle),M}return v.glCoordMatrix}function Gn(T,l,f){let v;f?(v=[T.x,T.y,f(T.x,T.y),1],s.af(v,v,l)):(v=[T.x,T.y,0,1],tr(v,v,l));let b=v[3];return{point:new s.P(v[0]/b,v[1]/b),signedDistanceFromCamera:b}}function vt(T,l){return .5+T/l*.5}function tt(T,l){let f=T[0]/T[3],v=T[1]/T[3];return f>=-l[0]&&f<=l[0]&&v>=-l[1]&&v<=l[1]}function nt(T,l,f,v,b,M,O,F,U,W){let $=v?T.textSizeData:T.iconSizeData,X=s.ag($,f.transform.zoom),at=[256/f.width*2+1,256/f.height*2+1],gt=v?T.text.dynamicLayoutVertexArray:T.icon.dynamicLayoutVertexArray;gt.clear();let _t=T.lineVertexArray,yt=v?T.text.placedSymbolArray:T.icon.placedSymbolArray,At=f.transform.width/f.transform.height,kt=!1;for(let Wt=0;WtMath.abs(f.x-l.x)*v?{useVertical:!0}:(T===s.ah.vertical?l.yf.x)?{needsFlipping:!0}:null}function Rt(T,l,f,v,b,M,O,F,U,W,$,X,at,gt,_t,yt){let At=l/24,kt=T.lineOffsetX*At,Wt=T.lineOffsetY*At,St;if(T.numGlyphs>1){let Nt=T.glyphStartIndex+T.numGlyphs,Zt=T.lineStartIndex,Ht=T.lineStartIndex+T.lineLength,ne=ct(At,F,kt,Wt,f,$,X,T,U,M,at,_t,yt);if(!ne)return{notEnoughRoom:!0};let he=Gn(ne.first.point,O,yt).point,ce=Gn(ne.last.point,O,yt).point;if(v&&!f){let _e=mt(T.writingMode,he,ce,gt);if(_e)return _e}St=[ne.first];for(let _e=T.glyphStartIndex+1;_e0?he.point:Dt(X,ne,Zt,1,b,yt),_e=mt(T.writingMode,Zt,ce,gt);if(_e)return _e}let Nt=le(At*F.getoffsetX(T.glyphStartIndex),kt,Wt,f,$,X,T.segment,T.lineStartIndex,T.lineStartIndex+T.lineLength,U,M,at,_t,yt);if(!Nt)return{notEnoughRoom:!0};St=[Nt]}for(let Nt of St)s.aj(W,Nt.point,Nt.angle);return{}}function Dt(T,l,f,v,b,M){let O=Gn(T.add(T.sub(l)._unit()),b,M).point,F=f.sub(O);return f.add(F._mult(v/F.mag()))}function Ut(T,l){let{projectionCache:f,lineVertexArray:v,labelPlaneMatrix:b,tileAnchorPoint:M,distanceFromAnchor:O,getElevation:F,previousVertex:U,direction:W,absOffsetX:$}=l;if(f.projections[T])return f.projections[T];let X=new s.P(v.getx(T),v.gety(T)),at=Gn(X,b,F);if(at.signedDistanceFromCamera>0)return f.projections[T]=at.point,at.point;let gt=T-W;return Dt(O===0?M:new s.P(v.getx(gt),v.gety(gt)),X,U,$-O+1,b,F)}function ft(T,l,f){return T._unit()._perp()._mult(l*f)}function jt(T,l,f,v,b,M,O,F){let{projectionCache:U,direction:W}=F;if(U.offsets[T])return U.offsets[T];let $=f.add(l);if(T+W=b)return U.offsets[T]=$,$;let X=Ut(T+W,F),at=ft(X.sub(f),O,W),gt=f.add(at),_t=X.add(at);return U.offsets[T]=s.ak(M,$,gt,_t)||$,U.offsets[T]}function le(T,l,f,v,b,M,O,F,U,W,$,X,at,gt){let _t=v?T-l:T+l,yt=_t>0?1:-1,At=0;v&&(yt*=-1,At=Math.PI),yt<0&&(At+=Math.PI);let kt,Wt,St=yt>0?F+O:F+O+1,Nt=b,Zt=b,Ht=0,ne=0,he=Math.abs(_t),ce=[],_e;for(;Ht+ne<=he;){if(St+=yt,St=U)return null;Ht+=ne,Zt=Nt,Wt=kt;let Ee={projectionCache:X,lineVertexArray:W,labelPlaneMatrix:$,tileAnchorPoint:M,distanceFromAnchor:Ht,getElevation:gt,previousVertex:Zt,direction:yt,absOffsetX:he};if(Nt=Ut(St,Ee),f===0)ce.push(Zt),_e=Nt.sub(Zt);else{let lr,qe=Nt.sub(Zt);lr=qe.mag()===0?ft(Ut(St+yt,Ee).sub(Nt),f,yt):ft(qe,f,yt),Wt||(Wt=Zt.add(lr)),kt=jt(St,lr,Nt,F,U,Wt,f,Ee),ce.push(Wt),_e=kt.sub(Wt)}ne=_e.mag()}let Ve=_e._mult((he-Ht)/ne)._add(Wt||Zt),hr=At+Math.atan2(Nt.y-Zt.y,Nt.x-Zt.x);return ce.push(Ve),{point:Ve,angle:at?hr:0,path:ce}}let ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function re(T,l){for(let f=0;f=1;zr--)qe.push(Ee.path[zr]);for(let zr=1;zrGn(Qr,U,_t));qe=zr.some(Qr=>Qr.signedDistanceFromCamera<=0)?[]:zr.map(Qr=>Qr.point)}let ti=[];if(qe.length>0){let zr=qe[0].clone(),Qr=qe[0].clone();for(let Bn=1;Bn=_e.x&&Qr.x<=Ve.x&&zr.y>=_e.y&&Qr.y<=Ve.y?[qe]:Qr.x<_e.x||zr.x>Ve.x||Qr.y<_e.y||zr.y>Ve.y?[]:s.al([qe],_e.x,_e.y,Ve.x,Ve.y)}for(let zr of ti){hr.reset(zr,.25*ce);let Qr=0;Qr=hr.length<=.5*ce?1:Math.ceil(hr.paddedLength/nn)+1;for(let Bn=0;Bn=this.screenRightBoundary||bthis.screenBottomBoundary}isInsideGrid(l,f,v,b){return v>=0&&l=0&&fv.collisionGroupID===f}}return this.collisionGroups[l]}}function en(T,l,f,v,b){let{horizontalAlign:M,verticalAlign:O}=s.at(T);return new s.P(-(M-.5)*l+v[0]*b,-(O-.5)*f+v[1]*b)}function rs(T,l,f,v,b,M){let{x1:O,x2:F,y1:U,y2:W,anchorPointX:$,anchorPointY:X}=T,at=new s.P(l,f);return v&&at._rotate(b?M:-M),{x1:O+at.x,y1:U+at.y,x2:F+at.x,y2:W+at.y,anchorPointX:$,anchorPointY:X}}class us{constructor(l,f,v,b,M){this.transform=l.clone(),this.terrain=f,this.collisionIndex=new Rr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=v,this.retainedQueryData={},this.collisionGroups=new tn(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(l,f,v,b){let M=v.getBucket(f),O=v.latestFeatureIndex;if(!M||!O||f.id!==M.layerIds[0])return;let F=v.collisionBoxArray,U=M.layers[0].layout,W=Math.pow(2,this.transform.zoom-v.tileID.overscaledZ),$=v.tileSize/s.W,X=this.transform.calculatePosMatrix(v.tileID.toUnwrapped()),at=U.get(\"text-pitch-alignment\")===\"map\",gt=U.get(\"text-rotation-alignment\")===\"map\",_t=yr(v,1,this.transform.zoom),yt=gr(X,at,gt,this.transform,_t),At=null;if(at){let Wt=Ec(X,at,gt,this.transform,_t);At=s.K([],this.transform.labelPlaneMatrix,Wt)}this.retainedQueryData[M.bucketInstanceId]=new Dr(M.bucketInstanceId,O,M.sourceLayerIndex,M.index,v.tileID);let kt={bucket:M,layout:U,posMatrix:X,textLabelPlaneMatrix:yt,labelToScreenMatrix:At,scale:W,textPixelRatio:$,holdingForFade:v.holdingForFade(),collisionBoxArray:F,partiallyEvaluatedTextSize:s.ag(M.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(M.sourceID)};if(b)for(let Wt of M.sortKeyRanges){let{sortKey:St,symbolInstanceStart:Nt,symbolInstanceEnd:Zt}=Wt;l.push({sortKey:St,symbolInstanceStart:Nt,symbolInstanceEnd:Zt,parameters:kt})}else l.push({symbolInstanceStart:0,symbolInstanceEnd:M.symbolInstances.length,parameters:kt})}attemptAnchorPlacement(l,f,v,b,M,O,F,U,W,$,X,at,gt,_t,yt,At){let kt=s.ap[l.textAnchor],Wt=[l.textOffset0,l.textOffset1],St=en(kt,v,b,Wt,M),Nt=this.collisionIndex.placeCollisionBox(rs(f,St.x,St.y,O,F,this.transform.angle),X,U,W,$.predicate,At);if((!yt||this.collisionIndex.placeCollisionBox(rs(yt,St.x,St.y,O,F,this.transform.angle),X,U,W,$.predicate,At).box.length!==0)&&Nt.box.length>0){let Zt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[at.crossTileID]&&this.prevPlacement.placements[at.crossTileID]&&this.prevPlacement.placements[at.crossTileID].text&&(Zt=this.prevPlacement.variableOffsets[at.crossTileID].anchor),at.crossTileID===0)throw new Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[at.crossTileID]={textOffset:Wt,width:v,height:b,anchor:kt,textBoxScale:M,prevAnchor:Zt},this.markUsedJustification(gt,kt,at,_t),gt.allowVerticalPlacement&&(this.markUsedOrientation(gt,_t,at),this.placedOrientations[at.crossTileID]=_t),{shift:St,placedGlyphBoxes:Nt}}}placeLayerBucketPart(l,f,v){let{bucket:b,layout:M,posMatrix:O,textLabelPlaneMatrix:F,labelToScreenMatrix:U,textPixelRatio:W,holdingForFade:$,collisionBoxArray:X,partiallyEvaluatedTextSize:at,collisionGroup:gt}=l.parameters,_t=M.get(\"text-optional\"),yt=M.get(\"icon-optional\"),At=s.aq(M,\"text-overlap\",\"text-allow-overlap\"),kt=At===\"always\",Wt=s.aq(M,\"icon-overlap\",\"icon-allow-overlap\"),St=Wt===\"always\",Nt=M.get(\"text-rotation-alignment\")===\"map\",Zt=M.get(\"text-pitch-alignment\")===\"map\",Ht=M.get(\"icon-text-fit\")!==\"none\",ne=M.get(\"symbol-z-order\")===\"viewport-y\",he=kt&&(St||!b.hasIconData()||yt),ce=St&&(kt||!b.hasTextData()||_t);!b.collisionArrays&&X&&b.deserializeCollisionBoxes(X);let _e=this.retainedQueryData[b.bucketInstanceId].tileID,Ve=this.terrain?(Ee,lr)=>this.terrain.getElevation(_e,Ee,lr):null,hr=(Ee,lr)=>{var qe,nn;if(f[Ee.crossTileID])return;if($)return void(this.placements[Ee.crossTileID]=new Hi(!1,!1,!1));let ti=!1,zr=!1,Qr=!0,Bn=null,Or={box:null,offscreen:null},To={box:null,offscreen:null},Cs=null,En=null,js=null,Gs=0,fa=0,Fc=0;lr.textFeatureIndex?Gs=lr.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Gs=Ee.featureIndex),lr.verticalTextFeatureIndex&&(fa=lr.verticalTextFeatureIndex);let kf=lr.textBox;if(kf){let hs=Ke=>{let Fi=s.ah.horizontal;if(b.allowVerticalPlacement&&!Ke&&this.prevPlacement){let Ls=this.prevPlacement.placedOrientations[Ee.crossTileID];Ls&&(this.placedOrientations[Ee.crossTileID]=Ls,Fi=Ls,this.markUsedOrientation(b,Fi,Ee))}return Fi},Yn=(Ke,Fi)=>{if(b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&lr.verticalTextBox){for(let Ls of b.writingModes)if(Ls===s.ah.vertical?(Or=Fi(),To=Or):Or=Ke(),Or&&Or.box&&Or.box.length)break}else Or=Ke()},sn=Ee.textAnchorOffsetStartIndex,pn=Ee.textAnchorOffsetEndIndex;if(pn===sn){let Ke=(Fi,Ls)=>{let Pn=this.collisionIndex.placeCollisionBox(Fi,At,W,O,gt.predicate,Ve);return Pn&&Pn.box&&Pn.box.length&&(this.markUsedOrientation(b,Ls,Ee),this.placedOrientations[Ee.crossTileID]=Ls),Pn};Yn(()=>Ke(kf,s.ah.horizontal),()=>{let Fi=lr.verticalTextBox;return b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Fi?Ke(Fi,s.ah.vertical):{box:null,offscreen:null}}),hs(Or&&Or.box&&Or.box.length)}else{let Ke=s.ap[(nn=(qe=this.prevPlacement)===null||qe===void 0?void 0:qe.variableOffsets[Ee.crossTileID])===null||nn===void 0?void 0:nn.anchor],Fi=(Pn,a0,Fn)=>{let Vl=Pn.x2-Pn.x1,xe=Pn.y2-Pn.y1,Oe=Ee.textBoxScale,Su=Ht&&Wt===\"never\"?a0:null,Va={box:[],offscreen:!1},Ah=At===\"never\"?1:2,da=\"never\";Ke&&Ah++;for(let l0=0;l0Fi(kf,lr.iconBox,s.ah.horizontal),()=>{let Pn=lr.verticalTextBox;return b.allowVerticalPlacement&&!(Or&&Or.box&&Or.box.length)&&Ee.numVerticalGlyphVertices>0&&Pn?Fi(Pn,lr.verticalIconBox,s.ah.vertical):{box:null,offscreen:null}}),Or&&(ti=Or.box,Qr=Or.offscreen);let Ls=hs(Or&&Or.box);if(!ti&&this.prevPlacement){let Pn=this.prevPlacement.variableOffsets[Ee.crossTileID];Pn&&(this.variableOffsets[Ee.crossTileID]=Pn,this.markUsedJustification(b,Pn.anchor,Ee,Ls))}}}if(Cs=Or,ti=Cs&&Cs.box&&Cs.box.length>0,Qr=Cs&&Cs.offscreen,Ee.useRuntimeCollisionCircles){let hs=b.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),Yn=s.ai(b.textSizeData,at,hs),sn=M.get(\"text-padding\");En=this.collisionIndex.placeCollisionCircles(At,hs,b.lineVertexArray,b.glyphOffsetArray,Yn,O,F,U,v,Zt,gt.predicate,Ee.collisionCircleDiameter,sn,Ve),En.circles.length&&En.collisionDetected&&!v&&s.w(\"Collisions detected, but collision boxes are not shown\"),ti=kt||En.circles.length>0&&!En.collisionDetected,Qr=Qr&&En.offscreen}if(lr.iconFeatureIndex&&(Fc=lr.iconFeatureIndex),lr.iconBox){let hs=Yn=>{let sn=Ht&&Bn?rs(Yn,Bn.x,Bn.y,Nt,Zt,this.transform.angle):Yn;return this.collisionIndex.placeCollisionBox(sn,Wt,W,O,gt.predicate,Ve)};To&&To.box&&To.box.length&&lr.verticalIconBox?(js=hs(lr.verticalIconBox),zr=js.box.length>0):(js=hs(lr.iconBox),zr=js.box.length>0),Qr=Qr&&js.offscreen}let Rf=_t||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,wu=yt||Ee.numIconVertices===0;if(Rf||wu?wu?Rf||(zr=zr&&ti):ti=zr&&ti:zr=ti=zr&&ti,ti&&Cs&&Cs.box&&this.collisionIndex.insertCollisionBox(Cs.box,At,M.get(\"text-ignore-placement\"),b.bucketInstanceId,To&&To.box&&fa?fa:Gs,gt.ID),zr&&js&&this.collisionIndex.insertCollisionBox(js.box,Wt,M.get(\"icon-ignore-placement\"),b.bucketInstanceId,Fc,gt.ID),En&&(ti&&this.collisionIndex.insertCollisionCircles(En.circles,At,M.get(\"text-ignore-placement\"),b.bucketInstanceId,Gs,gt.ID),v)){let hs=b.bucketInstanceId,Yn=this.collisionCircleArrays[hs];Yn===void 0&&(Yn=this.collisionCircleArrays[hs]=new wn);for(let sn=0;sn=0;--lr){let qe=Ee[lr];hr(b.symbolInstances.get(qe),b.collisionArrays[qe])}}else for(let Ee=l.symbolInstanceStart;Ee=0&&(l.text.placedSymbolArray.get(F).crossTileID=M>=0&&F!==M?0:v.crossTileID)}markUsedOrientation(l,f,v){let b=f===s.ah.horizontal||f===s.ah.horizontalOnly?f:0,M=f===s.ah.vertical?f:0,O=[v.leftJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.rightJustifiedTextSymbolIndex];for(let F of O)l.text.placedSymbolArray.get(F).placedOrientation=b;v.verticalPlacedTextSymbolIndex&&(l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation=M)}commit(l){this.commitTime=l,this.zoomAtLastRecencyCheck=this.transform.zoom;let f=this.prevPlacement,v=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;let b=f?f.symbolFadeChange(l):1,M=f?f.opacities:{},O=f?f.variableOffsets:{},F=f?f.placedOrientations:{};for(let U in this.placements){let W=this.placements[U],$=M[U];$?(this.opacities[U]=new Ti($,b,W.text,W.icon),v=v||W.text!==$.text.placed||W.icon!==$.icon.placed):(this.opacities[U]=new Ti(null,b,W.text,W.icon,W.skipFade),v=v||W.text||W.icon)}for(let U in M){let W=M[U];if(!this.opacities[U]){let $=new Ti(W,b,!1,!1);$.isHidden()||(this.opacities[U]=$,v=v||W.text.placed||W.icon.placed)}}for(let U in O)this.variableOffsets[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.variableOffsets[U]=O[U]);for(let U in F)this.placedOrientations[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.placedOrientations[U]=F[U]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error(\"Last placement time for previous placement is not defined\");v?this.lastPlacementChangeTime=l:typeof this.lastPlacementChangeTime!=\"number\"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:l)}updateLayerOpacities(l,f){let v={};for(let b of f){let M=b.getBucket(l);M&&b.latestFeatureIndex&&l.id===M.layerIds[0]&&this.updateBucketOpacities(M,v,b.collisionBoxArray)}}updateBucketOpacities(l,f,v){l.hasTextData()&&(l.text.opacityVertexArray.clear(),l.text.hasVisibleVertices=!1),l.hasIconData()&&(l.icon.opacityVertexArray.clear(),l.icon.hasVisibleVertices=!1),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexArray.clear(),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexArray.clear();let b=l.layers[0],M=b.layout,O=new Ti(null,0,!1,!1,!0),F=M.get(\"text-allow-overlap\"),U=M.get(\"icon-allow-overlap\"),W=b._unevaluatedLayout.hasValue(\"text-variable-anchor\")||b._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),$=M.get(\"text-rotation-alignment\")===\"map\",X=M.get(\"text-pitch-alignment\")===\"map\",at=M.get(\"icon-text-fit\")!==\"none\",gt=new Ti(null,0,F&&(U||!l.hasIconData()||M.get(\"icon-optional\")),U&&(F||!l.hasTextData()||M.get(\"text-optional\")),!0);!l.collisionArrays&&v&&(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData())&&l.deserializeCollisionBoxes(v);let _t=(yt,At,kt)=>{for(let Wt=0;Wt0,Ht=this.placedOrientations[At.crossTileID],ne=Ht===s.ah.vertical,he=Ht===s.ah.horizontal||Ht===s.ah.horizontalOnly;if(kt>0||Wt>0){let ce=Sn(Nt.text);_t(l.text,kt,ne?Bl:ce),_t(l.text,Wt,he?Bl:ce);let _e=Nt.text.isHidden();[At.rightJustifiedTextSymbolIndex,At.centerJustifiedTextSymbolIndex,At.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(l.text.placedSymbolArray.get(Ee).hidden=_e||ne?1:0)}),At.verticalPlacedTextSymbolIndex>=0&&(l.text.placedSymbolArray.get(At.verticalPlacedTextSymbolIndex).hidden=_e||he?1:0);let Ve=this.variableOffsets[At.crossTileID];Ve&&this.markUsedJustification(l,Ve.anchor,At,Ht);let hr=this.placedOrientations[At.crossTileID];hr&&(this.markUsedJustification(l,\"left\",At,hr),this.markUsedOrientation(l,hr,At))}if(Zt){let ce=Sn(Nt.icon),_e=!(at&&At.verticalPlacedIconSymbolIndex&&ne);At.placedIconSymbolIndex>=0&&(_t(l.icon,At.numIconVertices,_e?ce:Bl),l.icon.placedSymbolArray.get(At.placedIconSymbolIndex).hidden=Nt.icon.isHidden()),At.verticalPlacedIconSymbolIndex>=0&&(_t(l.icon,At.numVerticalIconVertices,_e?Bl:ce),l.icon.placedSymbolArray.get(At.verticalPlacedIconSymbolIndex).hidden=Nt.icon.isHidden())}if(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData()){let ce=l.collisionArrays[yt];if(ce){let _e=new s.P(0,0);if(ce.textBox||ce.verticalTextBox){let hr=!0;if(W){let Ee=this.variableOffsets[St];Ee?(_e=en(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),$&&_e._rotate(X?this.transform.angle:-this.transform.angle)):hr=!1}ce.textBox&&kn(l.textCollisionBox.collisionVertexArray,Nt.text.placed,!hr||ne,_e.x,_e.y),ce.verticalTextBox&&kn(l.textCollisionBox.collisionVertexArray,Nt.text.placed,!hr||he,_e.x,_e.y)}let Ve=!!(!he&&ce.verticalIconBox);ce.iconBox&&kn(l.iconCollisionBox.collisionVertexArray,Nt.icon.placed,Ve,at?_e.x:0,at?_e.y:0),ce.verticalIconBox&&kn(l.iconCollisionBox.collisionVertexArray,Nt.icon.placed,!Ve,at?_e.x:0,at?_e.y:0)}}}if(l.sortFeatures(this.transform.angle),this.retainedQueryData[l.bucketInstanceId]&&(this.retainedQueryData[l.bucketInstanceId].featureSortOrder=l.featureSortOrder),l.hasTextData()&&l.text.opacityVertexBuffer&&l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray),l.hasIconData()&&l.icon.opacityVertexBuffer&&l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexBuffer&&l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexBuffer&&l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray),l.text.opacityVertexArray.length!==l.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${l.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${l.text.layoutVertexArray.length}) / 4`);if(l.icon.opacityVertexArray.length!==l.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${l.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${l.icon.layoutVertexArray.length}) / 4`);if(l.bucketInstanceId in this.collisionCircleArrays){let yt=this.collisionCircleArrays[l.bucketInstanceId];l.placementInvProjMatrix=yt.invProjMatrix,l.placementViewportMatrix=yt.viewportMatrix,l.collisionCircleArray=yt.circles,delete this.collisionCircleArrays[l.bucketInstanceId]}}symbolFadeChange(l){return this.fadeDuration===0?1:(l-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(l){return Math.max(0,(this.transform.zoom-l)/1.5)}hasTransitions(l){return this.stale||l-this.lastPlacementChangeTimel}setStale(){this.stale=!0}}function kn(T,l,f,v,b){T.emplaceBack(l?1:0,f?1:0,v||0,b||0),T.emplaceBack(l?1:0,f?1:0,v||0,b||0),T.emplaceBack(l?1:0,f?1:0,v||0,b||0),T.emplaceBack(l?1:0,f?1:0,v||0,b||0)}let ca=Math.pow(2,25),zm=Math.pow(2,24),Qg=Math.pow(2,17),gi=Math.pow(2,16),bo=Math.pow(2,9),Pc=Math.pow(2,8),Wn=Math.pow(2,1);function Sn(T){if(T.opacity===0&&!T.placed)return 0;if(T.opacity===1&&T.placed)return 4294967295;let l=T.placed?1:0,f=Math.floor(127*T.opacity);return f*ca+l*zm+f*Qg+l*gi+f*bo+l*Pc+f*Wn+l}let Bl=0;class Rn{constructor(l){this._sortAcrossTiles=l.layout.get(\"symbol-z-order\")!==\"viewport-y\"&&!l.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(l,f,v,b,M){let O=this._bucketParts;for(;this._currentTileIndexF.sortKey-U.sortKey));this._currentPartIndex!this._forceFullPlacement&&_.now()-b>2;for(;this._currentPlacementIndex>=0;){let O=f[l[this._currentPlacementIndex]],F=this.placement.collisionIndex.transform.zoom;if(O.type===\"symbol\"&&(!O.minzoom||O.minzoom<=F)&&(!O.maxzoom||O.maxzoom>F)){if(this._inProgressLayer||(this._inProgressLayer=new Rn(O)),this._inProgressLayer.continuePlacement(v[O.source],this.placement,this._showCollisionBoxes,O,M))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(l){return this.placement.commit(l),this.placement}}let du=512/s.W/2;class df{constructor(l,f,v){this.tileID=l,this.bucketInstanceId=v,this._symbolsByKey={};let b=new Map;for(let M=0;M({x:Math.floor(U.anchorX*du),y:Math.floor(U.anchorY*du)})),crossTileIDs:O.map(U=>U.crossTileID)};if(F.positions.length>128){let U=new s.au(F.positions.length,16,Uint16Array);for(let{x:W,y:$}of F.positions)U.add(W,$);U.finish(),delete F.positions,F.index=U}this._symbolsByKey[M]=F}}getScaledCoordinates(l,f){let{x:v,y:b,z:M}=this.tileID.canonical,{x:O,y:F,z:U}=f.canonical,W=du/Math.pow(2,U-M),$=(F*s.W+l.anchorY)*W,X=b*s.W*du;return{x:Math.floor((O*s.W+l.anchorX)*W-v*s.W*du),y:Math.floor($-X)}}findMatches(l,f,v){let b=this.tileID.canonical.zl)}}class fn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class so{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(l){let f=Math.round((l-this.lng)/360);if(f!==0)for(let v in this.indexes){let b=this.indexes[v],M={};for(let O in b){let F=b[O];F.tileID=F.tileID.unwrapTo(F.tileID.wrap+f),M[F.tileID.key]=F}this.indexes[v]=M}this.lng=l}addBucket(l,f,v){if(this.indexes[l.overscaledZ]&&this.indexes[l.overscaledZ][l.key]){if(this.indexes[l.overscaledZ][l.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(l.overscaledZ,this.indexes[l.overscaledZ][l.key])}for(let M=0;Ml.overscaledZ)for(let F in O){let U=O[F];U.tileID.isChildOf(l)&&U.findMatches(f.symbolInstances,l,b)}else{let F=O[l.scaledTo(Number(M)).key];F&&F.findMatches(f.symbolInstances,l,b)}}for(let M=0;M{f[v]=!0});for(let v in this.layerIndexes)f[v]||delete this.layerIndexes[v]}}let qi=(T,l)=>s.t(T,l&&l.filter(f=>f.identifier!==\"source.canvas\")),ch=s.av();class oo extends s.E{constructor(l,f={}){super(),this._rtlTextPluginStateChange=()=>{for(let v in this.sourceCaches){let b=this.sourceCaches[v].getSource().type;b!==\"vector\"&&b!==\"geojson\"||this.sourceCaches[v].reload()}},this.map=l,this.dispatcher=new vo(Li(),l._getMapId()),this.dispatcher.registerMessageHandler(\"getGlyphs\",(v,b)=>this.getGlyphs(v,b)),this.dispatcher.registerMessageHandler(\"getImages\",(v,b)=>this.getImages(v,b)),this.imageManager=new or,this.imageManager.setEventedParent(this),this.glyphManager=new zs(l._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ts(256,512),this.crossTileSymbolIndex=new Da,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new s.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(\"setReferrer\",s.ax()),me().on(\"pluginStateChange\",this._rtlTextPluginStateChange),this.on(\"data\",v=>{if(v.dataType!==\"source\"||v.sourceDataType!==\"metadata\")return;let b=this.sourceCaches[v.sourceId];if(!b)return;let M=b.getSource();if(M&&M.vectorLayerIds)for(let O in this._layers){let F=this._layers[O];F.source===M.id&&this._validateLayer(F)}})}loadURL(l,f={},v){this.fire(new s.k(\"dataloading\",{dataType:\"style\"})),f.validate=typeof f.validate!=\"boolean\"||f.validate;let b=this.map._requestManager.transformRequest(l,K.Style);this._loadStyleRequest=new AbortController,s.h(b,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,f,v)}).catch(M=>{this._loadStyleRequest=null,M&&this.fire(new s.j(M))})}loadJSON(l,f={},v){this.fire(new s.k(\"dataloading\",{dataType:\"style\"})),this._frameRequest=new AbortController,_.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(l,f,v)}).catch(()=>{})}loadEmpty(){this.fire(new s.k(\"dataloading\",{dataType:\"style\"})),this._load(ch,{validate:!1})}_load(l,f,v){var b;let M=f.transformStyle?f.transformStyle(v,l):l;if(!f.validate||!qi(this,s.x(M))){this._loaded=!0,this.stylesheet=M;for(let O in M.sources)this.addSource(O,M.sources[O],{validate:!1});M.sprite?this._loadSprite(M.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(M.glyphs),this._createLayers(),this.light=new no(this.stylesheet.light),this.map.setTerrain((b=this.stylesheet.terrain)!==null&&b!==void 0?b:null),this.fire(new s.k(\"data\",{dataType:\"style\"})),this.fire(new s.k(\"style.load\"))}}_createLayers(){let l=s.ay(this.stylesheet.layers);this.dispatcher.broadcast(\"setLayers\",l),this._order=l.map(f=>f.id),this._layers={},this._serializedLayers=null;for(let f of l){let v=s.az(f);v.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=v}}_loadSprite(l,f=!1,v=void 0){let b;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(M,O,F,U){return s._(this,void 0,void 0,function*(){let W=oe(M),$=F>1?\"@2x\":\"\",X={},at={};for(let{id:gt,url:_t}of W){let yt=O.transformRequest(O.normalizeSpriteURL(_t,$,\".json\"),K.SpriteJSON);X[gt]=s.h(yt,U);let At=O.transformRequest(O.normalizeSpriteURL(_t,$,\".png\"),K.SpriteImage);at[gt]=Z.getImage(At,U)}return yield Promise.all([...Object.values(X),...Object.values(at)]),function(gt,_t){return s._(this,void 0,void 0,function*(){let yt={};for(let At in gt){yt[At]={};let kt=_.getImageCanvasContext((yield _t[At]).data),Wt=(yield gt[At]).data;for(let St in Wt){let{width:Nt,height:Zt,x:Ht,y:ne,sdf:he,pixelRatio:ce,stretchX:_e,stretchY:Ve,content:hr}=Wt[St];yt[At][St]={data:null,pixelRatio:ce,sdf:he,stretchX:_e,stretchY:Ve,content:hr,spriteData:{width:Nt,height:Zt,x:Ht,y:ne,context:kt}}}}return yt})}(X,at)})}(l,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(M=>{if(this._spriteRequest=null,M)for(let O in M){this._spritesImagesIds[O]=[];let F=this._spritesImagesIds[O]?this._spritesImagesIds[O].filter(U=>!(U in M)):[];for(let U of F)this.imageManager.removeImage(U),this._changedImages[U]=!0;for(let U in M[O]){let W=O===\"default\"?U:`${O}:${U}`;this._spritesImagesIds[O].push(W),W in this.imageManager.images?this.imageManager.updateImage(W,M[O][U],!1):this.imageManager.addImage(W,M[O][U]),f&&(this._changedImages[W]=!0)}}}).catch(M=>{this._spriteRequest=null,b=M,this.fire(new s.j(b))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new s.k(\"data\",{dataType:\"style\"})),v&&v(b)})}_unloadSprite(){for(let l of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(l),this._changedImages[l]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new s.k(\"data\",{dataType:\"style\"}))}_validateLayer(l){let f=this.sourceCaches[l.source];if(!f)return;let v=l.sourceLayer;if(!v)return;let b=f.getSource();(b.type===\"geojson\"||b.vectorLayerIds&&b.vectorLayerIds.indexOf(v)===-1)&&this.fire(new s.j(new Error(`Source layer \"${v}\" does not exist on source \"${b.id}\" as specified by style layer \"${l.id}\".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let l in this.sourceCaches)if(!this.sourceCaches[l].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(l){let f=this._serializedAllLayers();if(!l||l.length===0)return Object.values(f);let v=[];for(let b of l)f[b]&&v.push(f[b]);return v}_serializedAllLayers(){let l=this._serializedLayers;if(l)return l;l=this._serializedLayers={};let f=Object.keys(this._layers);for(let v of f){let b=this._layers[v];b.type!==\"custom\"&&(l[v]=b.serialize())}return l}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(let l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading.\")}update(l){if(!this._loaded)return;let f=this._changed;if(this._changed){let b=Object.keys(this._updatedLayers),M=Object.keys(this._removedLayers);(b.length||M.length)&&this._updateWorkerLayers(b,M);for(let O in this._updatedSources){let F=this._updatedSources[O];if(F===\"reload\")this._reloadSource(O);else{if(F!==\"clear\")throw new Error(`Invalid action ${F}`);this._clearSource(O)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let O in this._updatedPaintProps)this._layers[O].updateTransitions(l);this.light.updateTransitions(l),this._resetUpdates()}let v={};for(let b in this.sourceCaches){let M=this.sourceCaches[b];v[b]=M.used,M.used=!1}for(let b of this._order){let M=this._layers[b];M.recalculate(l,this._availableImages),!M.isHidden(l.zoom)&&M.source&&(this.sourceCaches[M.source].used=!0)}for(let b in v){let M=this.sourceCaches[b];v[b]!==M.used&&M.fire(new s.k(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:b}))}this.light.recalculate(l),this.z=l.zoom,f&&this.fire(new s.k(\"data\",{dataType:\"style\"}))}_updateTilesForChangedImages(){let l=Object.keys(this._changedImages);if(l.length){for(let f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies([\"icons\",\"patterns\"],l);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let l in this.sourceCaches)this.sourceCaches[l].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1}}_updateWorkerLayers(l,f){this.dispatcher.broadcast(\"updateLayers\",{layers:this._serializeByIds(l),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(l,f={}){this._checkLoaded();let v=this.serialize();if(l=f.transformStyle?f.transformStyle(v,l):l,qi(this,s.x(l)))return!1;(l=s.aA(l)).layers=s.ay(l.layers);let b=s.aB(v,l),M=this._getOperationsToPerform(b);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(\", \")}.`);if(M.operations.length===0)return!1;for(let O of M.operations)O();return this.stylesheet=l,this._serializedLayers=null,!0}_getOperationsToPerform(l){let f=[],v=[];for(let b of l)switch(b.command){case\"setCenter\":case\"setZoom\":case\"setBearing\":case\"setPitch\":continue;case\"addLayer\":f.push(()=>this.addLayer.apply(this,b.args));break;case\"removeLayer\":f.push(()=>this.removeLayer.apply(this,b.args));break;case\"setPaintProperty\":f.push(()=>this.setPaintProperty.apply(this,b.args));break;case\"setLayoutProperty\":f.push(()=>this.setLayoutProperty.apply(this,b.args));break;case\"setFilter\":f.push(()=>this.setFilter.apply(this,b.args));break;case\"addSource\":f.push(()=>this.addSource.apply(this,b.args));break;case\"removeSource\":f.push(()=>this.removeSource.apply(this,b.args));break;case\"setLayerZoomRange\":f.push(()=>this.setLayerZoomRange.apply(this,b.args));break;case\"setLight\":f.push(()=>this.setLight.apply(this,b.args));break;case\"setGeoJSONSourceData\":f.push(()=>this.setGeoJSONSourceData.apply(this,b.args));break;case\"setGlyphs\":f.push(()=>this.setGlyphs.apply(this,b.args));break;case\"setSprite\":f.push(()=>this.setSprite.apply(this,b.args));break;case\"setTerrain\":f.push(()=>this.map.setTerrain.apply(this,b.args));break;case\"setTransition\":f.push(()=>{});break;default:v.push(b.command)}return{operations:f,unimplemented:v}}addImage(l,f){if(this.getImage(l))return this.fire(new s.j(new Error(`An image named \"${l}\" already exists.`)));this.imageManager.addImage(l,f),this._afterImageUpdated(l)}updateImage(l,f){this.imageManager.updateImage(l,f)}getImage(l){return this.imageManager.getImage(l)}removeImage(l){if(!this.getImage(l))return this.fire(new s.j(new Error(`An image named \"${l}\" does not exist.`)));this.imageManager.removeImage(l),this._afterImageUpdated(l)}_afterImageUpdated(l){this._availableImages=this.imageManager.listImages(),this._changedImages[l]=!0,this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new s.k(\"data\",{dataType:\"style\"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(l,f,v={}){if(this._checkLoaded(),this.sourceCaches[l]!==void 0)throw new Error(`Source \"${l}\" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(f.type)>=0&&this._validate(s.x.source,`sources.${l}`,f,null,v))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);let b=this.sourceCaches[l]=new es(l,f,this.dispatcher);b.style=this,b.setEventedParent(this,()=>({isSourceLoaded:b.loaded(),source:b.serialize(),sourceId:l})),b.onAdd(this.map),this._changed=!0}removeSource(l){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(\"There is no source with this ID\");for(let v in this._layers)if(this._layers[v].source===l)return this.fire(new s.j(new Error(`Source \"${l}\" cannot be removed while layer \"${v}\" is using it.`)));let f=this.sourceCaches[l];delete this.sourceCaches[l],delete this._updatedSources[l],f.fire(new s.k(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:l})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(l,f){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(`There is no source with this ID=${l}`);let v=this.sourceCaches[l].getSource();if(v.type!==\"geojson\")throw new Error(`geojsonSource.type is ${v.type}, which is !== 'geojson`);v.setData(f),this._changed=!0}getSource(l){return this.sourceCaches[l]&&this.sourceCaches[l].getSource()}addLayer(l,f,v={}){this._checkLoaded();let b=l.id;if(this.getLayer(b))return void this.fire(new s.j(new Error(`Layer \"${b}\" already exists on this map.`)));let M;if(l.type===\"custom\"){if(qi(this,s.aC(l)))return;M=s.az(l)}else{if(\"source\"in l&&typeof l.source==\"object\"&&(this.addSource(b,l.source),l=s.aA(l),l=s.e(l,{source:b})),this._validate(s.x.layer,`layers.${b}`,l,{arrayIndex:-1},v))return;M=s.az(l),this._validateLayer(M),M.setEventedParent(this,{layer:{id:b}})}let O=f?this._order.indexOf(f):this._order.length;if(f&&O===-1)this.fire(new s.j(new Error(`Cannot add layer \"${b}\" before non-existing layer \"${f}\".`)));else{if(this._order.splice(O,0,b),this._layerOrderChanged=!0,this._layers[b]=M,this._removedLayers[b]&&M.source&&M.type!==\"custom\"){let F=this._removedLayers[b];delete this._removedLayers[b],F.type!==M.type?this._updatedSources[M.source]=\"clear\":(this._updatedSources[M.source]=\"reload\",this.sourceCaches[M.source].pause())}this._updateLayer(M),M.onAdd&&M.onAdd(this.map)}}moveLayer(l,f){if(this._checkLoaded(),this._changed=!0,!this._layers[l])return void this.fire(new s.j(new Error(`The layer '${l}' does not exist in the map's style and cannot be moved.`)));if(l===f)return;let v=this._order.indexOf(l);this._order.splice(v,1);let b=f?this._order.indexOf(f):this._order.length;f&&b===-1?this.fire(new s.j(new Error(`Cannot move layer \"${l}\" before non-existing layer \"${f}\".`))):(this._order.splice(b,0,l),this._layerOrderChanged=!0)}removeLayer(l){this._checkLoaded();let f=this._layers[l];if(!f)return void this.fire(new s.j(new Error(`Cannot remove non-existing layer \"${l}\".`)));f.setEventedParent(null);let v=this._order.indexOf(l);this._order.splice(v,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[l]=f,delete this._layers[l],this._serializedLayers&&delete this._serializedLayers[l],delete this._updatedLayers[l],delete this._updatedPaintProps[l],f.onRemove&&f.onRemove(this.map)}getLayer(l){return this._layers[l]}getLayersOrder(){return[...this._order]}hasLayer(l){return l in this._layers}setLayerZoomRange(l,f,v){this._checkLoaded();let b=this.getLayer(l);b?b.minzoom===f&&b.maxzoom===v||(f!=null&&(b.minzoom=f),v!=null&&(b.maxzoom=v),this._updateLayer(b)):this.fire(new s.j(new Error(`Cannot set the zoom range of non-existing layer \"${l}\".`)))}setFilter(l,f,v={}){this._checkLoaded();let b=this.getLayer(l);if(b){if(!s.aD(b.filter,f))return f==null?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(s.x.filter,`layers.${b.id}.filter`,f,null,v)||(b.filter=s.aA(f),this._updateLayer(b)))}else this.fire(new s.j(new Error(`Cannot filter non-existing layer \"${l}\".`)))}getFilter(l){return s.aA(this.getLayer(l).filter)}setLayoutProperty(l,f,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?s.aD(M.getLayoutProperty(f),v)||(M.setLayoutProperty(f,v,b),this._updateLayer(M)):this.fire(new s.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getLayoutProperty(l,f){let v=this.getLayer(l);if(v)return v.getLayoutProperty(f);this.fire(new s.j(new Error(`Cannot get style of non-existing layer \"${l}\".`)))}setPaintProperty(l,f,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?s.aD(M.getPaintProperty(f),v)||(M.setPaintProperty(f,v,b)&&this._updateLayer(M),this._changed=!0,this._updatedPaintProps[l]=!0):this.fire(new s.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getPaintProperty(l,f){return this.getLayer(l).getPaintProperty(f)}setFeatureState(l,f){this._checkLoaded();let v=l.source,b=l.sourceLayer,M=this.sourceCaches[v];if(M===void 0)return void this.fire(new s.j(new Error(`The source '${v}' does not exist in the map's style.`)));let O=M.getSource().type;O===\"geojson\"&&b?this.fire(new s.j(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))):O!==\"vector\"||b?(l.id===void 0&&this.fire(new s.j(new Error(\"The feature id parameter must be provided.\"))),M.setFeatureState(b,l.id,f)):this.fire(new s.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}removeFeatureState(l,f){this._checkLoaded();let v=l.source,b=this.sourceCaches[v];if(b===void 0)return void this.fire(new s.j(new Error(`The source '${v}' does not exist in the map's style.`)));let M=b.getSource().type,O=M===\"vector\"?l.sourceLayer:void 0;M!==\"vector\"||O?f&&typeof l.id!=\"string\"&&typeof l.id!=\"number\"?this.fire(new s.j(new Error(\"A feature id is required to remove its specific state property.\"))):b.removeFeatureState(O,l.id,f):this.fire(new s.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}getFeatureState(l){this._checkLoaded();let f=l.source,v=l.sourceLayer,b=this.sourceCaches[f];if(b!==void 0)return b.getSource().type!==\"vector\"||v?(l.id===void 0&&this.fire(new s.j(new Error(\"The feature id parameter must be provided.\"))),b.getFeatureState(v,l.id)):void this.fire(new s.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));this.fire(new s.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return s.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let l=s.aE(this.sourceCaches,M=>M.serialize()),f=this._serializeByIds(this._order),v=this.map.getTerrain()||void 0,b=this.stylesheet;return s.aF({version:b.version,name:b.name,metadata:b.metadata,light:b.light,center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch,sprite:b.sprite,glyphs:b.glyphs,transition:b.transition,sources:l,layers:f,terrain:v},M=>M!==void 0)}_updateLayer(l){this._updatedLayers[l.id]=!0,l.source&&!this._updatedSources[l.source]&&this.sourceCaches[l.source].getSource().type!==\"raster\"&&(this._updatedSources[l.source]=\"reload\",this.sourceCaches[l.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(l){let f=O=>this._layers[O].type===\"fill-extrusion\",v={},b=[];for(let O=this._order.length-1;O>=0;O--){let F=this._order[O];if(f(F)){v[F]=O;for(let U of l){let W=U[F];if(W)for(let $ of W)b.push($)}}}b.sort((O,F)=>F.intersectionZ-O.intersectionZ);let M=[];for(let O=this._order.length-1;O>=0;O--){let F=this._order[O];if(f(F))for(let U=b.length-1;U>=0;U--){let W=b[U].feature;if(v[W.layer.id]{let he=kt.featureSortOrder;if(he){let ce=he.indexOf(Ht.featureIndex);return he.indexOf(ne.featureIndex)-ce}return ne.featureIndex-Ht.featureIndex});for(let Ht of Zt)Nt.push(Ht)}}for(let kt in _t)_t[kt].forEach(Wt=>{let St=Wt.feature,Nt=W[F[kt].source].getFeatureState(St.layer[\"source-layer\"],St.id);St.source=St.layer.source,St.layer[\"source-layer\"]&&(St.sourceLayer=St.layer[\"source-layer\"]),St.state=Nt});return _t}(this._layers,O,this.sourceCaches,l,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(M)}querySourceFeatures(l,f){f&&f.filter&&this._validate(s.x.filter,\"querySourceFeatures.filter\",f.filter,null,f);let v=this.sourceCaches[l];return v?function(b,M){let O=b.getRenderableIds().map(W=>b.getTileByID(W)),F=[],U={};for(let W=0;Wat.getTileByID(gt)).sort((gt,_t)=>_t.tileID.overscaledZ-gt.tileID.overscaledZ||(gt.tileID.isLessThan(_t.tileID)?-1:1))}let X=this.crossTileSymbolIndex.addLayer($,U[$.source],l.center.lng);O=O||X}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((M=M||this._layerOrderChanged||v===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(_.now(),l.zoom))&&(this.pauseablePlacement=new Hn(l,this.map.terrain,this._order,M,f,v,b,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,U),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(_.now()),F=!0),O&&this.pauseablePlacement.placement.setStale()),F||O)for(let W of this._order){let $=this._layers[W];$.type===\"symbol\"&&this.placement.updateLayerOpacities($,U[$.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(_.now())}_releaseSymbolFadeTiles(){for(let l in this.sourceCaches)this.sourceCaches[l].releaseSymbolFadeTiles()}getImages(l,f){return s._(this,void 0,void 0,function*(){let v=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();let b=this.sourceCaches[f.source];return b&&b.setDependencies(f.tileID.key,f.type,f.icons),v})}getGlyphs(l,f){return s._(this,void 0,void 0,function*(){let v=yield this.glyphManager.getGlyphs(f.stacks),b=this.sourceCaches[f.source];return b&&b.setDependencies(f.tileID.key,f.type,[\"\"]),v})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(l,f={}){this._checkLoaded(),l&&this._validate(s.x.glyphs,\"glyphs\",l,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=l,this.glyphManager.entries={},this.glyphManager.setURL(l))}addSprite(l,f,v={},b){this._checkLoaded();let M=[{id:l,url:f}],O=[...oe(this.stylesheet.sprite),...M];this._validate(s.x.sprite,\"sprite\",O,null,v)||(this.stylesheet.sprite=O,this._loadSprite(M,!0,b))}removeSprite(l){this._checkLoaded();let f=oe(this.stylesheet.sprite);if(f.find(v=>v.id===l)){if(this._spritesImagesIds[l])for(let v of this._spritesImagesIds[l])this.imageManager.removeImage(v),this._changedImages[v]=!0;f.splice(f.findIndex(v=>v.id===l),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[l],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new s.k(\"data\",{dataType:\"style\"}))}else this.fire(new s.j(new Error(`Sprite \"${l}\" doesn't exists on this map.`)))}getSprite(){return oe(this.stylesheet.sprite)}setSprite(l,f={},v){this._checkLoaded(),l&&this._validate(s.x.sprite,\"sprite\",l,null,f)||(this.stylesheet.sprite=l,l?this._loadSprite(l,!0,v):(this._unloadSprite(),v&&v(null)))}}var uh=s.X([{name:\"a_pos\",type:\"Int16\",components:2}]),Zo=\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\";let ua={prelude:Mi(`#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\n`,`#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;}\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(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\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=(texture2D(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\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}`),background:Mi(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),backgroundPattern:Mi(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\"),circle:Mi(`varying vec3 v_data;varying 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);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying 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 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Mi(\"void main() {gl_FragColor=vec4(1.0);}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),heatmap:Mi(`uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Mi(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),collisionBox:Mi(\"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\",\"attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:Mi(\"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\",\"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),debug:Mi(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\",\"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}\"),fill:Mi(`#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Mi(`varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Mi(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Mi(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Mi(`varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying 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);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Mi(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\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 z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Mi(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:Mi(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\"),line:Mi(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),lineGradient:Mi(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),linePattern:Mi(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Mi(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Mi(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\"),symbolIcon:Mi(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Mi(`#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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:Mi(`#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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:Mi(\"uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}\",Zo),terrainDepth:Mi(\"varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}\",Zo),terrainCoords:Mi(\"precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}\",Zo)};function Mi(T,l){let f=/#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,v=l.match(/attribute ([\\w]+) ([\\w]+)/g),b=T.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),M=l.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),O=M?M.concat(b):b,F={};return{fragmentSource:T=T.replace(f,(U,W,$,X,at)=>(F[at]=!0,W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${at}\nvarying ${$} ${X} ${at};\n#else\nuniform ${$} ${X} u_${at};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${at}\n ${$} ${X} ${at} = u_${at};\n#endif\n`)),vertexSource:l=l.replace(f,(U,W,$,X,at)=>{let gt=X===\"float\"?\"vec2\":\"vec4\",_t=at.match(/color/)?\"color\":gt;return F[at]?W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${at}\nuniform lowp float u_${at}_t;\nattribute ${$} ${gt} a_${at};\nvarying ${$} ${X} ${at};\n#else\nuniform ${$} ${X} u_${at};\n#endif\n`:_t===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${at}\n ${at} = a_${at};\n#else\n ${$} ${X} ${at} = u_${at};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${at}\n ${at} = unpack_mix_${_t}(a_${at}, u_${at}_t);\n#else\n ${$} ${X} ${at} = u_${at};\n#endif\n`:W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${at}\nuniform lowp float u_${at}_t;\nattribute ${$} ${gt} a_${at};\n#else\nuniform ${$} ${X} u_${at};\n#endif\n`:_t===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${at}\n ${$} ${X} ${at} = a_${at};\n#else\n ${$} ${X} ${at} = u_${at};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${at}\n ${$} ${X} ${at} = unpack_mix_${_t}(a_${at}, u_${at}_t);\n#else\n ${$} ${X} ${at} = u_${at};\n#endif\n`}),staticAttributes:v,staticUniforms:O}}class pf{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(l,f,v,b,M,O,F,U,W){this.context=l;let $=this.boundPaintVertexBuffers.length!==b.length;for(let X=0;!$&&X({u_depth:new s.aG(Ht,ne.u_depth),u_terrain:new s.aG(Ht,ne.u_terrain),u_terrain_dim:new s.aH(Ht,ne.u_terrain_dim),u_terrain_matrix:new s.aI(Ht,ne.u_terrain_matrix),u_terrain_unpack:new s.aJ(Ht,ne.u_terrain_unpack),u_terrain_exaggeration:new s.aH(Ht,ne.u_terrain_exaggeration)}))(l,Zt),this.binderUniforms=v?v.getUniforms(l,Zt):[]}draw(l,f,v,b,M,O,F,U,W,$,X,at,gt,_t,yt,At,kt,Wt){let St=l.gl;if(this.failedToCreate)return;if(l.program.set(this.program),l.setDepthMode(v),l.setStencilMode(b),l.setColorMode(M),l.setCullFace(O),U){l.activeTexture.set(St.TEXTURE2),St.bindTexture(St.TEXTURE_2D,U.depthTexture),l.activeTexture.set(St.TEXTURE3),St.bindTexture(St.TEXTURE_2D,U.texture);for(let Zt in this.terrainUniforms)this.terrainUniforms[Zt].set(U[Zt])}for(let Zt in this.fixedUniforms)this.fixedUniforms[Zt].set(F[Zt]);yt&&yt.setUniforms(l,this.binderUniforms,gt,{zoom:_t});let Nt=0;switch(f){case St.LINES:Nt=2;break;case St.TRIANGLES:Nt=3;break;case St.LINE_STRIP:Nt=1}for(let Zt of at.get()){let Ht=Zt.vaos||(Zt.vaos={});(Ht[W]||(Ht[W]=new pf)).bind(l,this,$,yt?yt.getPaintVertexBuffers():[],X,Zt.vertexOffset,At,kt,Wt),St.drawElements(f,Zt.primitiveLength*Nt,St.UNSIGNED_SHORT,Zt.primitiveOffset*Nt*2)}}}function Td(T,l,f){let v=1/yr(f,1,l.transform.tileZoom),b=Math.pow(2,f.tileID.overscaledZ),M=f.tileSize*Math.pow(2,l.transform.tileZoom)/b,O=M*(f.tileID.canonical.x+f.tileID.wrap*b),F=M*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[v,T.fromScale,T.toScale],u_fade:T.t,u_pixel_coord_upper:[O>>16,F>>16],u_pixel_coord_lower:[65535&O,65535&F]}}let Af=(T,l,f,v)=>{let b=l.style.light,M=b.properties.get(\"position\"),O=[M.x,M.y,M.z],F=function(){var W=new s.A(9);return s.A!=Float32Array&&(W[1]=0,W[2]=0,W[3]=0,W[5]=0,W[6]=0,W[7]=0),W[0]=1,W[4]=1,W[8]=1,W}();b.properties.get(\"anchor\")===\"viewport\"&&function(W,$){var X=Math.sin($),at=Math.cos($);W[0]=at,W[1]=X,W[2]=0,W[3]=-X,W[4]=at,W[5]=0,W[6]=0,W[7]=0,W[8]=1}(F,-l.transform.angle),function(W,$,X){var at=$[0],gt=$[1],_t=$[2];W[0]=at*X[0]+gt*X[3]+_t*X[6],W[1]=at*X[1]+gt*X[4]+_t*X[7],W[2]=at*X[2]+gt*X[5]+_t*X[8]}(O,O,F);let U=b.properties.get(\"color\");return{u_matrix:T,u_lightpos:O,u_lightintensity:b.properties.get(\"intensity\"),u_lightcolor:[U.r,U.g,U.b],u_vertical_gradient:+f,u_opacity:v}},ut=(T,l,f,v,b,M,O)=>s.e(Af(T,l,f,v),Td(M,l,O),{u_height_factor:-Math.pow(2,b.overscaledZ)/O.tileSize/8}),dt=T=>({u_matrix:T}),Ct=(T,l,f,v)=>s.e(dt(T),Td(f,l,v)),$t=(T,l)=>({u_matrix:T,u_world:l}),ge=(T,l,f,v,b)=>s.e(Ct(T,l,f,v),{u_world:b}),Ye=(T,l,f,v)=>{let b=T.transform,M,O;if(v.paint.get(\"circle-pitch-alignment\")===\"map\"){let F=yr(f,1,b.zoom);M=!0,O=[F,F]}else M=!1,O=b.pixelsToGLUnits;return{u_camera_to_center_distance:b.cameraToCenterDistance,u_scale_with_map:+(v.paint.get(\"circle-pitch-scale\")===\"map\"),u_matrix:T.translatePosMatrix(l.posMatrix,f,v.paint.get(\"circle-translate\"),v.paint.get(\"circle-translate-anchor\")),u_pitch_with_map:+M,u_device_pixel_ratio:T.pixelRatio,u_extrude_scale:O}},si=(T,l,f)=>{let v=yr(f,1,l.zoom),b=Math.pow(2,l.zoom-f.tileID.overscaledZ),M=f.tileID.overscaleFactor();return{u_matrix:T,u_camera_to_center_distance:l.cameraToCenterDistance,u_pixels_to_tile_units:v,u_extrude_scale:[l.pixelsToGLUnits[0]/(v*b),l.pixelsToGLUnits[1]/(v*b)],u_overscale_factor:M}},is=(T,l,f=1)=>({u_matrix:T,u_color:l,u_overlay:0,u_overlay_scale:f}),qn=T=>({u_matrix:T}),Ns=(T,l,f,v)=>({u_matrix:T,u_extrude_scale:yr(l,1,f),u_intensity:v});function Oa(T,l){let f=Math.pow(2,l.canonical.z),v=l.canonical.y;return[new s.Y(0,v/f).toLngLat().lat,new s.Y(0,(v+1)/f).toLngLat().lat]}let Nm=(T,l,f,v)=>{let b=T.transform;return{u_matrix:Up(T,l,f,v),u_ratio:1/yr(l,1,b.zoom),u_device_pixel_ratio:T.pixelRatio,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},wx=(T,l,f,v,b)=>s.e(Nm(T,l,f,b),{u_image:0,u_image_height:v}),mf=(T,l,f,v,b)=>{let M=T.transform,O=Ba(l,M);return{u_matrix:Up(T,l,f,b),u_texsize:l.imageAtlasTexture.size,u_ratio:1/yr(l,1,M.zoom),u_device_pixel_ratio:T.pixelRatio,u_image:0,u_scale:[O,v.fromScale,v.toScale],u_fade:v.t,u_units_to_pixels:[1/M.pixelsToGLUnits[0],1/M.pixelsToGLUnits[1]]}},Um=(T,l,f,v,b,M)=>{let O=T.lineAtlas,F=Ba(l,T.transform),U=f.layout.get(\"line-cap\")===\"round\",W=O.getDash(v.from,U),$=O.getDash(v.to,U),X=W.width*b.fromScale,at=$.width*b.toScale;return s.e(Nm(T,l,f,M),{u_patternscale_a:[F/X,-W.height/2],u_patternscale_b:[F/at,-$.height/2],u_sdfgamma:O.width/(256*Math.min(X,at)*T.pixelRatio)/2,u_image:0,u_tex_y_a:W.y,u_tex_y_b:$.y,u_mix:b.t})};function Ba(T,l){return 1/yr(T,1,l.tileZoom)}function Up(T,l,f,v){return T.translatePosMatrix(v?v.posMatrix:l.tileID.posMatrix,l,f.paint.get(\"line-translate\"),f.paint.get(\"line-translate-anchor\"))}let Vm=(T,l,f,v,b)=>{return{u_matrix:T,u_tl_parent:l,u_scale_parent:f,u_buffer_scale:1,u_fade_t:v.mix,u_opacity:v.opacity*b.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:b.paint.get(\"raster-brightness-min\"),u_brightness_high:b.paint.get(\"raster-brightness-max\"),u_saturation_factor:(O=b.paint.get(\"raster-saturation\"),O>0?1-1/(1.001-O):-O),u_contrast_factor:(M=b.paint.get(\"raster-contrast\"),M>0?1/(1-M):1+M),u_spin_weights:Vp(b.paint.get(\"raster-hue-rotate\"))};var M,O};function Vp(T){T*=Math.PI/180;let l=Math.sin(T),f=Math.cos(T);return[(2*f+1)/3,(-Math.sqrt(3)*l-f+1)/3,(Math.sqrt(3)*l-f+1)/3]}let jp=(T,l,f,v,b,M,O,F,U,W)=>{let $=b.transform;return{u_is_size_zoom_constant:+(T===\"constant\"||T===\"source\"),u_is_size_feature_constant:+(T===\"constant\"||T===\"camera\"),u_size_t:l?l.uSizeT:0,u_size:l?l.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:$.width/$.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:O,u_coord_matrix:F,u_is_text:+U,u_pitch_with_map:+v,u_texsize:W,u_texture:0}},Gp=(T,l,f,v,b,M,O,F,U,W,$)=>{let X=b.transform;return s.e(jp(T,l,f,v,b,M,O,F,U,W),{u_gamma_scale:v?Math.cos(X._pitch)*X.cameraToCenterDistance:1,u_device_pixel_ratio:b.pixelRatio,u_is_halo:+$})},Wp=(T,l,f,v,b,M,O,F,U,W)=>s.e(Gp(T,l,f,v,b,M,O,F,!0,U,!0),{u_texsize_icon:W,u_texture_icon:1}),kS=(T,l,f)=>({u_matrix:T,u_opacity:l,u_color:f}),RS=(T,l,f,v,b,M)=>s.e(function(O,F,U,W){let $=U.imageManager.getPattern(O.from.toString()),X=U.imageManager.getPattern(O.to.toString()),{width:at,height:gt}=U.imageManager.getPixelSize(),_t=Math.pow(2,W.tileID.overscaledZ),yt=W.tileSize*Math.pow(2,U.transform.tileZoom)/_t,At=yt*(W.tileID.canonical.x+W.tileID.wrap*_t),kt=yt*W.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:$.tl,u_pattern_br_a:$.br,u_pattern_tl_b:X.tl,u_pattern_br_b:X.br,u_texsize:[at,gt],u_mix:F.t,u_pattern_size_a:$.displaySize,u_pattern_size_b:X.displaySize,u_scale_a:F.fromScale,u_scale_b:F.toScale,u_tile_units_to_pixels:1/yr(W,1,U.transform.tileZoom),u_pixel_coord_upper:[At>>16,kt>>16],u_pixel_coord_lower:[65535&At,65535&kt]}}(v,M,f,b),{u_matrix:T,u_opacity:l}),Sx={fillExtrusion:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_lightpos:new s.aK(T,l.u_lightpos),u_lightintensity:new s.aH(T,l.u_lightintensity),u_lightcolor:new s.aK(T,l.u_lightcolor),u_vertical_gradient:new s.aH(T,l.u_vertical_gradient),u_opacity:new s.aH(T,l.u_opacity)}),fillExtrusionPattern:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_lightpos:new s.aK(T,l.u_lightpos),u_lightintensity:new s.aH(T,l.u_lightintensity),u_lightcolor:new s.aK(T,l.u_lightcolor),u_vertical_gradient:new s.aH(T,l.u_vertical_gradient),u_height_factor:new s.aH(T,l.u_height_factor),u_image:new s.aG(T,l.u_image),u_texsize:new s.aL(T,l.u_texsize),u_pixel_coord_upper:new s.aL(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aL(T,l.u_pixel_coord_lower),u_scale:new s.aK(T,l.u_scale),u_fade:new s.aH(T,l.u_fade),u_opacity:new s.aH(T,l.u_opacity)}),fill:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix)}),fillPattern:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_image:new s.aG(T,l.u_image),u_texsize:new s.aL(T,l.u_texsize),u_pixel_coord_upper:new s.aL(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aL(T,l.u_pixel_coord_lower),u_scale:new s.aK(T,l.u_scale),u_fade:new s.aH(T,l.u_fade)}),fillOutline:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_world:new s.aL(T,l.u_world)}),fillOutlinePattern:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_world:new s.aL(T,l.u_world),u_image:new s.aG(T,l.u_image),u_texsize:new s.aL(T,l.u_texsize),u_pixel_coord_upper:new s.aL(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aL(T,l.u_pixel_coord_lower),u_scale:new s.aK(T,l.u_scale),u_fade:new s.aH(T,l.u_fade)}),circle:(T,l)=>({u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_scale_with_map:new s.aG(T,l.u_scale_with_map),u_pitch_with_map:new s.aG(T,l.u_pitch_with_map),u_extrude_scale:new s.aL(T,l.u_extrude_scale),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_matrix:new s.aI(T,l.u_matrix)}),collisionBox:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_pixels_to_tile_units:new s.aH(T,l.u_pixels_to_tile_units),u_extrude_scale:new s.aL(T,l.u_extrude_scale),u_overscale_factor:new s.aH(T,l.u_overscale_factor)}),collisionCircle:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_inv_matrix:new s.aI(T,l.u_inv_matrix),u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_viewport_size:new s.aL(T,l.u_viewport_size)}),debug:(T,l)=>({u_color:new s.aM(T,l.u_color),u_matrix:new s.aI(T,l.u_matrix),u_overlay:new s.aG(T,l.u_overlay),u_overlay_scale:new s.aH(T,l.u_overlay_scale)}),clippingMask:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix)}),heatmap:(T,l)=>({u_extrude_scale:new s.aH(T,l.u_extrude_scale),u_intensity:new s.aH(T,l.u_intensity),u_matrix:new s.aI(T,l.u_matrix)}),heatmapTexture:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_world:new s.aL(T,l.u_world),u_image:new s.aG(T,l.u_image),u_color_ramp:new s.aG(T,l.u_color_ramp),u_opacity:new s.aH(T,l.u_opacity)}),hillshade:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_image:new s.aG(T,l.u_image),u_latrange:new s.aL(T,l.u_latrange),u_light:new s.aL(T,l.u_light),u_shadow:new s.aM(T,l.u_shadow),u_highlight:new s.aM(T,l.u_highlight),u_accent:new s.aM(T,l.u_accent)}),hillshadePrepare:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_image:new s.aG(T,l.u_image),u_dimension:new s.aL(T,l.u_dimension),u_zoom:new s.aH(T,l.u_zoom),u_unpack:new s.aJ(T,l.u_unpack)}),line:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_ratio:new s.aH(T,l.u_ratio),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_units_to_pixels:new s.aL(T,l.u_units_to_pixels)}),lineGradient:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_ratio:new s.aH(T,l.u_ratio),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_units_to_pixels:new s.aL(T,l.u_units_to_pixels),u_image:new s.aG(T,l.u_image),u_image_height:new s.aH(T,l.u_image_height)}),linePattern:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_texsize:new s.aL(T,l.u_texsize),u_ratio:new s.aH(T,l.u_ratio),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_image:new s.aG(T,l.u_image),u_units_to_pixels:new s.aL(T,l.u_units_to_pixels),u_scale:new s.aK(T,l.u_scale),u_fade:new s.aH(T,l.u_fade)}),lineSDF:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_ratio:new s.aH(T,l.u_ratio),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_units_to_pixels:new s.aL(T,l.u_units_to_pixels),u_patternscale_a:new s.aL(T,l.u_patternscale_a),u_patternscale_b:new s.aL(T,l.u_patternscale_b),u_sdfgamma:new s.aH(T,l.u_sdfgamma),u_image:new s.aG(T,l.u_image),u_tex_y_a:new s.aH(T,l.u_tex_y_a),u_tex_y_b:new s.aH(T,l.u_tex_y_b),u_mix:new s.aH(T,l.u_mix)}),raster:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_tl_parent:new s.aL(T,l.u_tl_parent),u_scale_parent:new s.aH(T,l.u_scale_parent),u_buffer_scale:new s.aH(T,l.u_buffer_scale),u_fade_t:new s.aH(T,l.u_fade_t),u_opacity:new s.aH(T,l.u_opacity),u_image0:new s.aG(T,l.u_image0),u_image1:new s.aG(T,l.u_image1),u_brightness_low:new s.aH(T,l.u_brightness_low),u_brightness_high:new s.aH(T,l.u_brightness_high),u_saturation_factor:new s.aH(T,l.u_saturation_factor),u_contrast_factor:new s.aH(T,l.u_contrast_factor),u_spin_weights:new s.aK(T,l.u_spin_weights)}),symbolIcon:(T,l)=>({u_is_size_zoom_constant:new s.aG(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aG(T,l.u_is_size_feature_constant),u_size_t:new s.aH(T,l.u_size_t),u_size:new s.aH(T,l.u_size),u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_pitch:new s.aH(T,l.u_pitch),u_rotate_symbol:new s.aG(T,l.u_rotate_symbol),u_aspect_ratio:new s.aH(T,l.u_aspect_ratio),u_fade_change:new s.aH(T,l.u_fade_change),u_matrix:new s.aI(T,l.u_matrix),u_label_plane_matrix:new s.aI(T,l.u_label_plane_matrix),u_coord_matrix:new s.aI(T,l.u_coord_matrix),u_is_text:new s.aG(T,l.u_is_text),u_pitch_with_map:new s.aG(T,l.u_pitch_with_map),u_texsize:new s.aL(T,l.u_texsize),u_texture:new s.aG(T,l.u_texture)}),symbolSDF:(T,l)=>({u_is_size_zoom_constant:new s.aG(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aG(T,l.u_is_size_feature_constant),u_size_t:new s.aH(T,l.u_size_t),u_size:new s.aH(T,l.u_size),u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_pitch:new s.aH(T,l.u_pitch),u_rotate_symbol:new s.aG(T,l.u_rotate_symbol),u_aspect_ratio:new s.aH(T,l.u_aspect_ratio),u_fade_change:new s.aH(T,l.u_fade_change),u_matrix:new s.aI(T,l.u_matrix),u_label_plane_matrix:new s.aI(T,l.u_label_plane_matrix),u_coord_matrix:new s.aI(T,l.u_coord_matrix),u_is_text:new s.aG(T,l.u_is_text),u_pitch_with_map:new s.aG(T,l.u_pitch_with_map),u_texsize:new s.aL(T,l.u_texsize),u_texture:new s.aG(T,l.u_texture),u_gamma_scale:new s.aH(T,l.u_gamma_scale),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_is_halo:new s.aG(T,l.u_is_halo)}),symbolTextAndIcon:(T,l)=>({u_is_size_zoom_constant:new s.aG(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aG(T,l.u_is_size_feature_constant),u_size_t:new s.aH(T,l.u_size_t),u_size:new s.aH(T,l.u_size),u_camera_to_center_distance:new s.aH(T,l.u_camera_to_center_distance),u_pitch:new s.aH(T,l.u_pitch),u_rotate_symbol:new s.aG(T,l.u_rotate_symbol),u_aspect_ratio:new s.aH(T,l.u_aspect_ratio),u_fade_change:new s.aH(T,l.u_fade_change),u_matrix:new s.aI(T,l.u_matrix),u_label_plane_matrix:new s.aI(T,l.u_label_plane_matrix),u_coord_matrix:new s.aI(T,l.u_coord_matrix),u_is_text:new s.aG(T,l.u_is_text),u_pitch_with_map:new s.aG(T,l.u_pitch_with_map),u_texsize:new s.aL(T,l.u_texsize),u_texsize_icon:new s.aL(T,l.u_texsize_icon),u_texture:new s.aG(T,l.u_texture),u_texture_icon:new s.aG(T,l.u_texture_icon),u_gamma_scale:new s.aH(T,l.u_gamma_scale),u_device_pixel_ratio:new s.aH(T,l.u_device_pixel_ratio),u_is_halo:new s.aG(T,l.u_is_halo)}),background:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_opacity:new s.aH(T,l.u_opacity),u_color:new s.aM(T,l.u_color)}),backgroundPattern:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_opacity:new s.aH(T,l.u_opacity),u_image:new s.aG(T,l.u_image),u_pattern_tl_a:new s.aL(T,l.u_pattern_tl_a),u_pattern_br_a:new s.aL(T,l.u_pattern_br_a),u_pattern_tl_b:new s.aL(T,l.u_pattern_tl_b),u_pattern_br_b:new s.aL(T,l.u_pattern_br_b),u_texsize:new s.aL(T,l.u_texsize),u_mix:new s.aH(T,l.u_mix),u_pattern_size_a:new s.aL(T,l.u_pattern_size_a),u_pattern_size_b:new s.aL(T,l.u_pattern_size_b),u_scale_a:new s.aH(T,l.u_scale_a),u_scale_b:new s.aH(T,l.u_scale_b),u_pixel_coord_upper:new s.aL(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aL(T,l.u_pixel_coord_lower),u_tile_units_to_pixels:new s.aH(T,l.u_tile_units_to_pixels)}),terrain:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_texture:new s.aG(T,l.u_texture),u_ele_delta:new s.aH(T,l.u_ele_delta)}),terrainDepth:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_ele_delta:new s.aH(T,l.u_ele_delta)}),terrainCoords:(T,l)=>({u_matrix:new s.aI(T,l.u_matrix),u_texture:new s.aG(T,l.u_texture),u_terrain_coords_id:new s.aH(T,l.u_terrain_coords_id),u_ele_delta:new s.aH(T,l.u_ele_delta)})};class DS{constructor(l,f,v){this.context=l;let b=l.gl;this.buffer=b.createBuffer(),this.dynamicDraw=!!v,this.context.unbindVAO(),l.bindElementBuffer.set(this.buffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(l){let f=this.context.gl;if(!this.dynamicDraw)throw new Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,l.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let gf={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class jm{constructor(l,f,v,b){this.length=f.length,this.attributes=v,this.itemSize=f.bytesPerElement,this.dynamicDraw=b,this.context=l;let M=l.gl;this.buffer=M.createBuffer(),l.bindVertexBuffer.set(this.buffer),M.bufferData(M.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?M.DYNAMIC_DRAW:M.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(l){if(l.length!==this.length)throw new Error(`Length of new data is ${l.length}, which doesn't match current length of ${this.length}`);let f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,l.arrayBuffer)}enableAttributes(l,f){for(let v=0;v0){let _e=s.F(),Ve=ne;s.aP(_e,Ht.placementInvProjMatrix,T.transform.glCoordMatrix),s.aP(_e,_e,Ht.placementViewportMatrix),$.push({circleArray:ce,circleOffset:at,transform:Ve,invTransform:_e,coord:Nt}),X+=ce.length/4,at=X}he&&W.draw(F,U.LINES,ai.disabled,rn.disabled,T.colorModeForRenderPass(),Ui.disabled,si(ne,T.transform,Zt),T.style.map.terrain&&T.style.map.terrain.getTerrainData(Nt),f.id,he.layoutVertexBuffer,he.indexBuffer,he.segments,null,T.transform.zoom,null,null,he.collisionVertexBuffer)}if(!O||!$.length)return;let gt=T.useProgram(\"collisionCircle\"),_t=new s.aQ;_t.resize(4*X),_t._trim();let yt=0;for(let St of $)for(let Nt=0;Nt=0&&(_t[At.associatedIconIndex]={shiftedAnchor:hr,angle:Ee})}else re(At.numGlyphs,at)}if(W){gt.clear();let yt=T.icon.placedSymbolArray;for(let At=0;AtT.style.map.terrain.getElevation(he,Ls,Pn):null,Fi=f.layout.get(\"text-rotation-alignment\")===\"map\";nt(_e,he.posMatrix,T,b,Gs,fa,At,W,Fi,Ke)}let Rf=T.translatePosMatrix(he.posMatrix,ce,M,O),wu=kt||b&&Ht||kf?Zm:Gs,hs=T.translatePosMatrix(fa,ce,M,O,!0),Yn=Ee&&f.paint.get(b?\"text-halo-width\":\"icon-halo-width\").constantOr(1)!==0,sn;sn=Ee?_e.iconsInText?Wp(lr.kind,ti,Wt,At,T,Rf,wu,hs,Qr,Cs):Gp(lr.kind,ti,Wt,At,T,Rf,wu,hs,b,Qr,!0):jp(lr.kind,ti,Wt,At,T,Rf,wu,hs,b,Qr);let pn={program:nn,buffers:Ve,uniformValues:sn,atlasTexture:Bn,atlasTextureIcon:En,atlasInterpolation:Or,atlasInterpolationIcon:To,isSDF:Ee,hasHalo:Yn};if(St&&_e.canOverlap){Nt=!0;let Ke=Ve.segments.get();for(let Fi of Ke)ne.push({segments:new s.$([Fi]),sortKey:Fi.sortKey,state:pn,terrainData:zr})}else ne.push({segments:Ve.segments,sortKey:0,state:pn,terrainData:zr})}Nt&&ne.sort((he,ce)=>he.sortKey-ce.sortKey);for(let he of ne){let ce=he.state;if(at.activeTexture.set(gt.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,gt.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(at.activeTexture.set(gt.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,gt.CLAMP_TO_EDGE)),ce.isSDF){let _e=ce.uniformValues;ce.hasHalo&&(_e.u_is_halo=1,Kg(ce.buffers,he.segments,f,T,ce.program,Zt,$,X,_e,he.terrainData)),_e.u_is_halo=0}Kg(ce.buffers,he.segments,f,T,ce.program,Zt,$,X,ce.uniformValues,he.terrainData)}}function Kg(T,l,f,v,b,M,O,F,U,W){let $=v.context;b.draw($,$.gl.TRIANGLES,M,O,F,Ui.disabled,U,W,f.id,T.layoutVertexBuffer,T.indexBuffer,l,f.paint,v.transform.zoom,T.programConfigurations.get(f.id),T.dynamicLayoutVertexBuffer,T.opacityVertexBuffer)}function Id(T,l,f,v,b){if(!f||!v||!v.imageAtlas)return;let M=v.imageAtlas.patternPositions,O=M[f.to.toString()],F=M[f.from.toString()];if(!O&&F&&(O=F),!F&&O&&(F=O),!O||!F){let U=b.getPaintProperty(l);O=M[U],F=M[U]}O&&F&&T.setConstantPatternPositions(O,F)}function Jg(T,l,f,v,b,M,O){let F=T.context.gl,U=\"fill-pattern\",W=f.paint.get(U),$=W&&W.constantOr(1),X=f.getCrossfadeParameters(),at,gt,_t,yt,At;O?(gt=$&&!f.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",at=F.LINES):(gt=$?\"fillPattern\":\"fill\",at=F.TRIANGLES);let kt=W.constantOr(null);for(let Wt of v){let St=l.getTile(Wt);if($&&!St.patternsLoaded())continue;let Nt=St.getBucket(f);if(!Nt)continue;let Zt=Nt.programConfigurations.get(f.id),Ht=T.useProgram(gt,Zt),ne=T.style.map.terrain&&T.style.map.terrain.getTerrainData(Wt);$&&(T.context.activeTexture.set(F.TEXTURE0),St.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),Zt.updatePaintBuffers(X)),Id(Zt,U,kt,St,f);let he=ne?Wt:null,ce=T.translatePosMatrix(he?he.posMatrix:Wt.posMatrix,St,f.paint.get(\"fill-translate\"),f.paint.get(\"fill-translate-anchor\"));if(O){yt=Nt.indexBuffer2,At=Nt.segments2;let _e=[F.drawingBufferWidth,F.drawingBufferHeight];_t=gt===\"fillOutlinePattern\"&&$?ge(ce,T,X,St,_e):$t(ce,_e)}else yt=Nt.indexBuffer,At=Nt.segments,_t=$?Ct(ce,T,X,St):dt(ce);Ht.draw(T.context,at,b,T.stencilModeForClipping(Wt),M,Ui.disabled,_t,ne,f.id,Nt.layoutVertexBuffer,yt,At,f.paint,T.transform.zoom,Zt)}}function xf(T,l,f,v,b,M,O){let F=T.context,U=F.gl,W=\"fill-extrusion-pattern\",$=f.paint.get(W),X=$.constantOr(1),at=f.getCrossfadeParameters(),gt=f.paint.get(\"fill-extrusion-opacity\"),_t=$.constantOr(null);for(let yt of v){let At=l.getTile(yt),kt=At.getBucket(f);if(!kt)continue;let Wt=T.style.map.terrain&&T.style.map.terrain.getTerrainData(yt),St=kt.programConfigurations.get(f.id),Nt=T.useProgram(X?\"fillExtrusionPattern\":\"fillExtrusion\",St);X&&(T.context.activeTexture.set(U.TEXTURE0),At.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),St.updatePaintBuffers(at)),Id(St,W,_t,At,f);let Zt=T.translatePosMatrix(yt.posMatrix,At,f.paint.get(\"fill-extrusion-translate\"),f.paint.get(\"fill-extrusion-translate-anchor\")),Ht=f.paint.get(\"fill-extrusion-vertical-gradient\"),ne=X?ut(Zt,T,Ht,gt,yt,at,At):Af(Zt,T,Ht,gt);Nt.draw(F,F.gl.TRIANGLES,b,M,O,Ui.backCCW,ne,Wt,f.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,f.paint,T.transform.zoom,St,T.style.map.terrain&&kt.centroidVertexBuffer)}}function ha(T,l,f,v,b,M,O){let F=T.context,U=F.gl,W=f.fbo;if(!W)return;let $=T.useProgram(\"hillshade\"),X=T.style.map.terrain&&T.style.map.terrain.getTerrainData(l);F.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,W.colorAttachment.get()),$.draw(F,U.TRIANGLES,b,M,O,Ui.disabled,((at,gt,_t,yt)=>{let At=_t.paint.get(\"hillshade-shadow-color\"),kt=_t.paint.get(\"hillshade-highlight-color\"),Wt=_t.paint.get(\"hillshade-accent-color\"),St=_t.paint.get(\"hillshade-illumination-direction\")*(Math.PI/180);_t.paint.get(\"hillshade-illumination-anchor\")===\"viewport\"&&(St-=at.transform.angle);let Nt=!at.options.moving;return{u_matrix:yt?yt.posMatrix:at.transform.calculatePosMatrix(gt.tileID.toUnwrapped(),Nt),u_image:0,u_latrange:Oa(0,gt.tileID),u_light:[_t.paint.get(\"hillshade-exaggeration\"),St],u_shadow:At,u_highlight:kt,u_accent:Wt}})(T,f,v,X?l:null),X,v.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments)}function Dn(T,l,f,v,b,M){let O=T.context,F=O.gl,U=l.dem;if(U&&U.data){let W=U.dim,$=U.stride,X=U.getPixels();if(O.activeTexture.set(F.TEXTURE1),O.pixelStoreUnpackPremultiplyAlpha.set(!1),l.demTexture=l.demTexture||T.getTileTexture($),l.demTexture){let gt=l.demTexture;gt.update(X,{premultiply:!1}),gt.bind(F.NEAREST,F.CLAMP_TO_EDGE)}else l.demTexture=new ae(O,X,F.RGBA,{premultiply:!1}),l.demTexture.bind(F.NEAREST,F.CLAMP_TO_EDGE);O.activeTexture.set(F.TEXTURE0);let at=l.fbo;if(!at){let gt=new ae(O,{width:W,height:W,data:null},F.RGBA);gt.bind(F.LINEAR,F.CLAMP_TO_EDGE),at=l.fbo=O.createFramebuffer(W,W,!0,!1),at.colorAttachment.set(gt.texture)}O.bindFramebuffer.set(at.framebuffer),O.viewport.set([0,0,W,W]),T.useProgram(\"hillshadePrepare\").draw(O,F.TRIANGLES,v,b,M,Ui.disabled,((gt,_t)=>{let yt=_t.stride,At=s.F();return s.aN(At,0,s.W,-s.W,0,0,1),s.H(At,At,[0,-s.W,0]),{u_matrix:At,u_image:1,u_dimension:[yt,yt],u_zoom:gt.overscaledZ,u_unpack:_t.getUnpackVector()}})(l.tileID,U),null,f.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments),l.needsHillshadePrepare=!1}}function t_(T,l,f,v,b,M){let O=v.paint.get(\"raster-fade-duration\");if(!M&&O>0){let F=_.now(),U=(F-T.timeAdded)/O,W=l?(F-l.timeAdded)/O:-1,$=f.getSource(),X=b.coveringZoomLevel({tileSize:$.tileSize,roundZoom:$.roundZoom}),at=!l||Math.abs(l.tileID.overscaledZ-X)>Math.abs(T.tileID.overscaledZ-X),gt=at&&T.refreshedUponExpiration?1:s.ac(at?U:1-W,0,1);return T.refreshedUponExpiration&&U>=1&&(T.refreshedUponExpiration=!1),l?{opacity:1,mix:1-gt}:{opacity:gt,mix:0}}return{opacity:1,mix:0}}let e_=new s.aO(1,0,0,1),Kp=new s.aO(0,1,0,1),Ym=new s.aO(0,0,1,1),r_=new s.aO(1,0,1,1),i_=new s.aO(0,1,1,1);function Tn(T,l,f,v){Us(T,0,l+f/2,T.transform.width,f,v)}function Ei(T,l,f,v){Us(T,l-f/2,0,f,T.transform.height,v)}function Us(T,l,f,v,b,M){let O=T.context,F=O.gl;F.enable(F.SCISSOR_TEST),F.scissor(l*T.pixelRatio,f*T.pixelRatio,v*T.pixelRatio,b*T.pixelRatio),O.clear({color:M}),F.disable(F.SCISSOR_TEST)}function Jp(T,l,f){let v=T.context,b=v.gl,M=f.posMatrix,O=T.useProgram(\"debug\"),F=ai.disabled,U=rn.disabled,W=T.colorModeForRenderPass(),$=\"$debug\",X=T.style.map.terrain&&T.style.map.terrain.getTerrainData(f);v.activeTexture.set(b.TEXTURE0);let at=l.getTileByID(f.key).latestRawTileData,gt=Math.floor((at&&at.byteLength||0)/1024),_t=l.getTile(f).tileSize,yt=512/Math.min(_t,512)*(f.overscaledZ/T.transform.zoom)*.5,At=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(At+=` => ${f.overscaledZ}`),function(kt,Wt){kt.initDebugOverlayCanvas();let St=kt.debugOverlayCanvas,Nt=kt.context.gl,Zt=kt.debugOverlayCanvas.getContext(\"2d\");Zt.clearRect(0,0,St.width,St.height),Zt.shadowColor=\"white\",Zt.shadowBlur=2,Zt.lineWidth=1.5,Zt.strokeStyle=\"white\",Zt.textBaseline=\"top\",Zt.font=\"bold 36px Open Sans, sans-serif\",Zt.fillText(Wt,5,5),Zt.strokeText(Wt,5,5),kt.debugOverlayTexture.update(St),kt.debugOverlayTexture.bind(Nt.LINEAR,Nt.CLAMP_TO_EDGE)}(T,`${At} ${gt}kB`),O.draw(v,b.TRIANGLES,F,U,Pt.alphaBlended,Ui.disabled,is(M,s.aO.transparent,yt),null,$,T.debugBuffer,T.quadTriangleIndexBuffer,T.debugSegments),O.draw(v,b.LINE_STRIP,F,U,W,Ui.disabled,is(M,s.aO.red),X,$,T.debugBuffer,T.tileBorderIndexBuffer,T.debugSegments)}function tA(T,l,f){let v=T.context,b=v.gl,M=T.colorModeForRenderPass(),O=new ai(b.LEQUAL,ai.ReadWrite,T.depthRangeFor3D),F=T.useProgram(\"terrain\"),U=l.getTerrainMesh();v.bindFramebuffer.set(null),v.viewport.set([0,0,T.width,T.height]);for(let W of f){let $=T.renderToTexture.getTexture(W),X=l.getTerrainData(W.tileID);v.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,$.texture);let at={u_matrix:T.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_texture:0,u_ele_delta:l.getMeshFrameDelta(T.transform.zoom)};F.draw(v,b.TRIANGLES,O,rn.disabled,M,Ui.backCCW,at,X,\"terrain\",U.vertexBuffer,U.indexBuffer,U.segments)}}class n_{constructor(l,f){this.context=new ki(l),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.F(),renderTime:0},this.setup(),this.numSublayers=es.maxUnderzooming+es.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Da}resize(l,f,v){if(this.width=Math.floor(l*v),this.height=Math.floor(f*v),this.pixelRatio=v,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let b of this.style._order)this.style._layers[b].resize()}setup(){let l=this.context,f=new s.aV;f.emplaceBack(0,0),f.emplaceBack(s.W,0),f.emplaceBack(0,s.W),f.emplaceBack(s.W,s.W),this.tileExtentBuffer=l.createVertexBuffer(f,uh.members),this.tileExtentSegments=s.$.simpleSegment(0,0,4,2);let v=new s.aV;v.emplaceBack(0,0),v.emplaceBack(s.W,0),v.emplaceBack(0,s.W),v.emplaceBack(s.W,s.W),this.debugBuffer=l.createVertexBuffer(v,uh.members),this.debugSegments=s.$.simpleSegment(0,0,4,5);let b=new s.Z;b.emplaceBack(0,0,0,0),b.emplaceBack(s.W,0,s.W,0),b.emplaceBack(0,s.W,0,s.W),b.emplaceBack(s.W,s.W,s.W,s.W),this.rasterBoundsBuffer=l.createVertexBuffer(b,Cn.members),this.rasterBoundsSegments=s.$.simpleSegment(0,0,4,2);let M=new s.aV;M.emplaceBack(0,0),M.emplaceBack(1,0),M.emplaceBack(0,1),M.emplaceBack(1,1),this.viewportBuffer=l.createVertexBuffer(M,uh.members),this.viewportSegments=s.$.simpleSegment(0,0,4,2);let O=new s.aW;O.emplaceBack(0),O.emplaceBack(1),O.emplaceBack(3),O.emplaceBack(2),O.emplaceBack(0),this.tileBorderIndexBuffer=l.createIndexBuffer(O);let F=new s.aX;F.emplaceBack(0,1,2),F.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=l.createIndexBuffer(F);let U=this.context.gl;this.stencilClearMode=new rn({func:U.ALWAYS,mask:0},0,255,U.ZERO,U.ZERO,U.ZERO)}clearStencil(){let l=this.context,f=l.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let v=s.F();s.aN(v,0,this.width,this.height,0,0,1),s.J(v,v,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram(\"clippingMask\").draw(l,f.TRIANGLES,ai.disabled,this.stencilClearMode,Pt.disabled,Ui.disabled,qn(v),null,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(l,f){if(this.currentStencilSource===l.source||!l.isTileClipped()||!f||!f.length)return;this.currentStencilSource=l.source;let v=this.context,b=v.gl;this.nextStencilID+f.length>256&&this.clearStencil(),v.setColorMode(Pt.disabled),v.setDepthMode(ai.disabled);let M=this.useProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(let O of f){let F=this._tileClippingMaskIDs[O.key]=this.nextStencilID++,U=this.style.map.terrain&&this.style.map.terrain.getTerrainData(O);M.draw(v,b.TRIANGLES,ai.disabled,new rn({func:b.ALWAYS,mask:0},F,255,b.KEEP,b.KEEP,b.REPLACE),Pt.disabled,Ui.disabled,qn(O.posMatrix),U,\"$clipping\",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let l=this.nextStencilID++,f=this.context.gl;return new rn({func:f.NOTEQUAL,mask:255},l,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(l){let f=this.context.gl;return new rn({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[l.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(l){let f=this.context.gl,v=l.sort((O,F)=>F.overscaledZ-O.overscaledZ),b=v[v.length-1].overscaledZ,M=v[0].overscaledZ-b+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();let O={};for(let F=0;F=0;this.currentLayer--){let U=this.style._layers[v[this.currentLayer]],W=b[U.source],$=M[U.source];this._renderTileClippingMasks(U,$),this.renderLayer(this,W,U,$)}for(this.renderPass=\"translucent\",this.currentLayer=0;this.currentLayerAt.source&&!At.isHidden($)?[W.sourceCaches[At.source]]:[]),gt=at.filter(At=>At.getSource().type===\"vector\"),_t=at.filter(At=>At.getSource().type!==\"vector\"),yt=At=>{(!X||X.getSource().maxzoomyt(At)),X||_t.forEach(At=>yt(At)),X}(this.style,this.transform.zoom);U&&function(W,$,X){for(let at=0;atgt.style.map.terrain.getElevation(Ht,lr,qe):null)}}}(U,M,F,O,F.layout.get(\"text-rotation-alignment\"),F.layout.get(\"text-pitch-alignment\"),W),F.paint.get(\"icon-opacity\").constantOr(1)!==0&&Xp(M,O,F,U,!1,F.paint.get(\"icon-translate\"),F.paint.get(\"icon-translate-anchor\"),F.layout.get(\"icon-rotation-alignment\"),F.layout.get(\"icon-pitch-alignment\"),F.layout.get(\"icon-keep-upright\"),$,X),F.paint.get(\"text-opacity\").constantOr(1)!==0&&Xp(M,O,F,U,!0,F.paint.get(\"text-translate\"),F.paint.get(\"text-translate-anchor\"),F.layout.get(\"text-rotation-alignment\"),F.layout.get(\"text-pitch-alignment\"),F.layout.get(\"text-keep-upright\"),$,X),O.map.showCollisionBoxes&&(wt(M,O,F,U,F.paint.get(\"text-translate\"),F.paint.get(\"text-translate-anchor\"),!0),wt(M,O,F,U,F.paint.get(\"icon-translate\"),F.paint.get(\"icon-translate-anchor\"),!1))})(l,f,v,b,this.style.placement.variableOffsets);break;case\"circle\":(function(M,O,F,U){if(M.renderPass!==\"translucent\")return;let W=F.paint.get(\"circle-opacity\"),$=F.paint.get(\"circle-stroke-width\"),X=F.paint.get(\"circle-stroke-opacity\"),at=!F.layout.get(\"circle-sort-key\").isConstant();if(W.constantOr(1)===0&&($.constantOr(1)===0||X.constantOr(1)===0))return;let gt=M.context,_t=gt.gl,yt=M.depthModeForSublayer(0,ai.ReadOnly),At=rn.disabled,kt=M.colorModeForRenderPass(),Wt=[];for(let St=0;StSt.sortKey-Nt.sortKey);for(let St of Wt){let{programConfiguration:Nt,program:Zt,layoutVertexBuffer:Ht,indexBuffer:ne,uniformValues:he,terrainData:ce}=St.state;Zt.draw(gt,_t.TRIANGLES,yt,At,kt,Ui.disabled,he,ce,F.id,Ht,ne,St.segments,F.paint,M.transform.zoom,Nt)}})(l,f,v,b);break;case\"heatmap\":(function(M,O,F,U){if(F.paint.get(\"heatmap-opacity\")!==0)if(M.renderPass===\"offscreen\"){let W=M.context,$=W.gl,X=rn.disabled,at=new Pt([$.ONE,$.ONE],s.aO.transparent,[!0,!0,!0,!0]);(function(gt,_t,yt){let At=gt.gl;gt.activeTexture.set(At.TEXTURE1),gt.viewport.set([0,0,_t.width/4,_t.height/4]);let kt=yt.heatmapFbo;if(kt)At.bindTexture(At.TEXTURE_2D,kt.colorAttachment.get()),gt.bindFramebuffer.set(kt.framebuffer);else{let Wt=At.createTexture();At.bindTexture(At.TEXTURE_2D,Wt),At.texParameteri(At.TEXTURE_2D,At.TEXTURE_WRAP_S,At.CLAMP_TO_EDGE),At.texParameteri(At.TEXTURE_2D,At.TEXTURE_WRAP_T,At.CLAMP_TO_EDGE),At.texParameteri(At.TEXTURE_2D,At.TEXTURE_MIN_FILTER,At.LINEAR),At.texParameteri(At.TEXTURE_2D,At.TEXTURE_MAG_FILTER,At.LINEAR),kt=yt.heatmapFbo=gt.createFramebuffer(_t.width/4,_t.height/4,!1,!1),function(St,Nt,Zt,Ht){var ne,he;let ce=St.gl,_e=(ne=St.HALF_FLOAT)!==null&&ne!==void 0?ne:ce.UNSIGNED_BYTE,Ve=(he=St.RGBA16F)!==null&&he!==void 0?he:ce.RGBA;ce.texImage2D(ce.TEXTURE_2D,0,Ve,Nt.width/4,Nt.height/4,0,ce.RGBA,_e,null),Ht.colorAttachment.set(Zt)}(gt,_t,Wt,kt)}})(W,M,F),W.clear({color:s.aO.transparent});for(let gt=0;gt{let St=s.F();s.aN(St,0,yt.width,yt.height,0,0,1);let Nt=yt.context.gl;return{u_matrix:St,u_world:[Nt.drawingBufferWidth,Nt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:At.paint.get(\"heatmap-opacity\")}})(W,$),null,$.id,W.viewportBuffer,W.quadTriangleIndexBuffer,W.viewportSegments,$.paint,W.transform.zoom)}(M,F))})(l,f,v,b);break;case\"line\":(function(M,O,F,U){if(M.renderPass!==\"translucent\")return;let W=F.paint.get(\"line-opacity\"),$=F.paint.get(\"line-width\");if(W.constantOr(1)===0||$.constantOr(1)===0)return;let X=M.depthModeForSublayer(0,ai.ReadOnly),at=M.colorModeForRenderPass(),gt=F.paint.get(\"line-dasharray\"),_t=F.paint.get(\"line-pattern\"),yt=_t.constantOr(1),At=F.paint.get(\"line-gradient\"),kt=F.getCrossfadeParameters(),Wt=yt?\"linePattern\":gt?\"lineSDF\":At?\"lineGradient\":\"line\",St=M.context,Nt=St.gl,Zt=!0;for(let Ht of U){let ne=O.getTile(Ht);if(yt&&!ne.patternsLoaded())continue;let he=ne.getBucket(F);if(!he)continue;let ce=he.programConfigurations.get(F.id),_e=M.context.program.get(),Ve=M.useProgram(Wt,ce),hr=Zt||Ve.program!==_e,Ee=M.style.map.terrain&&M.style.map.terrain.getTerrainData(Ht),lr=_t.constantOr(null);if(lr&&ne.imageAtlas){let ti=ne.imageAtlas,zr=ti.patternPositions[lr.to.toString()],Qr=ti.patternPositions[lr.from.toString()];zr&&Qr&&ce.setConstantPatternPositions(zr,Qr)}let qe=Ee?Ht:null,nn=yt?mf(M,ne,F,kt,qe):gt?Um(M,ne,F,gt,kt,qe):At?wx(M,ne,F,he.lineClipsArray.length,qe):Nm(M,ne,F,qe);if(yt)St.activeTexture.set(Nt.TEXTURE0),ne.imageAtlasTexture.bind(Nt.LINEAR,Nt.CLAMP_TO_EDGE),ce.updatePaintBuffers(kt);else if(gt&&(hr||M.lineAtlas.dirty))St.activeTexture.set(Nt.TEXTURE0),M.lineAtlas.bind(St);else if(At){let ti=he.gradients[F.id],zr=ti.texture;if(F.gradientVersion!==ti.version){let Qr=256;if(F.stepInterpolant){let Bn=O.getSource().maxzoom,Or=Ht.canonical.z===Bn?Math.ceil(1<0?f.pop():null}isPatternMissing(l){if(!l)return!1;if(!l.from||!l.to)return!0;let f=this.imageManager.getPattern(l.from.toString()),v=this.imageManager.getPattern(l.to.toString());return!f||!v}useProgram(l,f){this.cache=this.cache||{};let v=l+(f?f.cacheKey:\"\")+(this._showOverdrawInspector?\"/overdraw\":\"\")+(this.style.map.terrain?\"/terrain\":\"\");return this.cache[v]||(this.cache[v]=new Fl(this.context,ua[l],f,Sx[l],this._showOverdrawInspector,this.style.map.terrain)),this.cache[v]}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(){let l=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(l.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new ae(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:l,drawingBufferHeight:f}=this.context.gl;return this.width!==l||this.height!==f}}class Au{constructor(l,f){this.points=l,this.planes=f}static fromInvProjectionMatrix(l,f,v){let b=Math.pow(2,v),M=[[-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(F=>{let U=1/(F=s.af([],F,l))[3]/f*b;return s.a_(F,F,[U,U,1/F[3],U])}),O=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(F=>{let U=function(at,gt){var _t=gt[0],yt=gt[1],At=gt[2],kt=_t*_t+yt*yt+At*At;return kt>0&&(kt=1/Math.sqrt(kt)),at[0]=gt[0]*kt,at[1]=gt[1]*kt,at[2]=gt[2]*kt,at}([],function(at,gt,_t){var yt=gt[0],At=gt[1],kt=gt[2],Wt=_t[0],St=_t[1],Nt=_t[2];return at[0]=At*Nt-kt*St,at[1]=kt*Wt-yt*Nt,at[2]=yt*St-At*Wt,at}([],Yt([],M[F[0]],M[F[1]]),Yt([],M[F[2]],M[F[1]]))),W=-(($=U)[0]*(X=M[F[1]])[0]+$[1]*X[1]+$[2]*X[2]);var $,X;return U.concat(W)});return new Au(M,O)}}class Lc{constructor(l,f){this.min=l,this.max=f,this.center=function(v,b,M){return v[0]=.5*b[0],v[1]=.5*b[1],v[2]=.5*b[2],v}([],function(v,b,M){return v[0]=b[0]+M[0],v[1]=b[1]+M[1],v[2]=b[2]+M[2],v}([],this.min,this.max))}quadrant(l){let f=[l%2==0,l<2],v=Tt(this.min),b=Tt(this.max);for(let M=0;M=0&&O++;if(O===0)return 0;O!==f.length&&(v=!1)}if(v)return 2;for(let b=0;b<3;b++){let M=Number.MAX_VALUE,O=-Number.MAX_VALUE;for(let F=0;Fthis.max[b]-this.min[b])return 0}return 1}}class mu{constructor(l=0,f=0,v=0,b=0){if(isNaN(l)||l<0||isNaN(f)||f<0||isNaN(v)||v<0||isNaN(b)||b<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=l,this.bottom=f,this.left=v,this.right=b}interpolate(l,f,v){return f.top!=null&&l.top!=null&&(this.top=s.z.number(l.top,f.top,v)),f.bottom!=null&&l.bottom!=null&&(this.bottom=s.z.number(l.bottom,f.bottom,v)),f.left!=null&&l.left!=null&&(this.left=s.z.number(l.left,f.left,v)),f.right!=null&&l.right!=null&&(this.right=s.z.number(l.right,f.right,v)),this}getCenter(l,f){let v=s.ac((this.left+l-this.right)/2,0,l),b=s.ac((this.top+f-this.bottom)/2,0,f);return new s.P(v,b)}equals(l){return this.top===l.top&&this.bottom===l.bottom&&this.left===l.left&&this.right===l.right}clone(){return new mu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class bf{constructor(l,f,v,b,M){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=M===void 0||!!M,this._minZoom=l||0,this._maxZoom=f||22,this._minPitch=v??0,this._maxPitch=b??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new s.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new mu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){let l=new bf(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return l.apply(this),l}apply(l){this.tileSize=l.tileSize,this.latRange=l.latRange,this.width=l.width,this.height=l.height,this._center=l._center,this._elevation=l._elevation,this.minElevationForCurrentTile=l.minElevationForCurrentTile,this.zoom=l.zoom,this.angle=l.angle,this._fov=l._fov,this._pitch=l._pitch,this._unmodified=l._unmodified,this._edgeInsets=l._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(l){this._minZoom!==l&&(this._minZoom=l,this.zoom=Math.max(this.zoom,l))}get maxZoom(){return this._maxZoom}set maxZoom(l){this._maxZoom!==l&&(this._maxZoom=l,this.zoom=Math.min(this.zoom,l))}get minPitch(){return this._minPitch}set minPitch(l){this._minPitch!==l&&(this._minPitch=l,this.pitch=Math.max(this.pitch,l))}get maxPitch(){return this._maxPitch}set maxPitch(l){this._maxPitch!==l&&(this._maxPitch=l,this.pitch=Math.min(this.pitch,l))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(l){l===void 0?l=!0:l===null&&(l=!1),this._renderWorldCopies=l}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(l){let f=-s.b0(l,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var v=new s.A(4);return s.A!=Float32Array&&(v[1]=0,v[2]=0),v[0]=1,v[3]=1,v}(),function(v,b,M){var O=b[0],F=b[1],U=b[2],W=b[3],$=Math.sin(M),X=Math.cos(M);v[0]=O*X+U*$,v[1]=F*X+W*$,v[2]=O*-$+U*X,v[3]=F*-$+W*X}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(l){let f=s.ac(l,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(l){l=Math.max(.01,Math.min(60,l)),this._fov!==l&&(this._unmodified=!1,this._fov=l/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(l){let f=Math.min(Math.max(l,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(l){l.lat===this._center.lat&&l.lng===this._center.lng||(this._unmodified=!1,this._center=l,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(l){l!==this._elevation&&(this._elevation=l,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(l){this._edgeInsets.equals(l)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,l,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(l){return this._edgeInsets.equals(l)}interpolatePadding(l,f,v){this._unmodified=!1,this._edgeInsets.interpolate(l,f,v),this._constrain(),this._calcMatrices()}coveringZoomLevel(l){let f=(l.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/l.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(l){let f=[new s.b1(0,l)];if(this._renderWorldCopies){let v=this.pointCoordinate(new s.P(0,0)),b=this.pointCoordinate(new s.P(this.width,0)),M=this.pointCoordinate(new s.P(this.width,this.height)),O=this.pointCoordinate(new s.P(0,this.height)),F=Math.floor(Math.min(v.x,b.x,M.x,O.x)),U=Math.floor(Math.max(v.x,b.x,M.x,O.x)),W=1;for(let $=F-W;$<=U+W;$++)$!==0&&f.push(new s.b1($,l))}return f}coveringTiles(l){var f,v;let b=this.coveringZoomLevel(l),M=b;if(l.minzoom!==void 0&&bl.maxzoom&&(b=l.maxzoom);let O=this.pointCoordinate(this.getCameraPoint()),F=s.Y.fromLngLat(this.center),U=Math.pow(2,b),W=[U*O.x,U*O.y,0],$=[U*F.x,U*F.y,0],X=Au.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,b),at=l.minzoom||0;!l.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(at=b);let gt=l.terrain?2/Math.min(this.tileSize,l.tileSize)*this.tileSize:3,_t=St=>({aabb:new Lc([St*U,0,0],[(St+1)*U,U,0]),zoom:0,x:0,y:0,wrap:St,fullyVisible:!1}),yt=[],At=[],kt=b,Wt=l.reparseOverscaled?M:b;if(this._renderWorldCopies)for(let St=1;St<=3;St++)yt.push(_t(-St)),yt.push(_t(St));for(yt.push(_t(0));yt.length>0;){let St=yt.pop(),Nt=St.x,Zt=St.y,Ht=St.fullyVisible;if(!Ht){let Ve=St.aabb.intersects(X);if(Ve===0)continue;Ht=Ve===2}let ne=l.terrain?W:$,he=St.aabb.distanceX(ne),ce=St.aabb.distanceY(ne),_e=Math.max(Math.abs(he),Math.abs(ce));if(St.zoom===kt||_e>gt+(1<=at){let Ve=kt-St.zoom,hr=W[0]-.5-(Nt<>1),lr=St.zoom+1,qe=St.aabb.quadrant(Ve);if(l.terrain){let nn=new s.Q(lr,St.wrap,lr,hr,Ee),ti=l.terrain.getMinMaxElevation(nn),zr=(f=ti.minElevation)!==null&&f!==void 0?f:this.elevation,Qr=(v=ti.maxElevation)!==null&&v!==void 0?v:this.elevation;qe=new Lc([qe.min[0],qe.min[1],zr],[qe.max[0],qe.max[1],Qr])}yt.push({aabb:qe,zoom:lr,x:hr,y:Ee,wrap:St.wrap,fullyVisible:Ht})}}return At.sort((St,Nt)=>St.distanceSq-Nt.distanceSq).map(St=>St.tileID)}resize(l,f){this.width=l,this.height=f,this.pixelsToGLUnits=[2/l,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(l){return Math.pow(2,l)}scaleZoom(l){return Math.log(l)/Math.LN2}project(l){let f=s.ac(l.lat,-this.maxValidLatitude,this.maxValidLatitude);return new s.P(s.N(l.lng)*this.worldSize,s.O(f)*this.worldSize)}unproject(l){return new s.Y(l.x/this.worldSize,l.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(l){let f=this.pointLocation(this.centerPoint,l),v=l.getElevationForLngLatZoom(f,this.tileZoom);if(!(this.elevation-v))return;let b=this.getCameraPosition(),M=s.Y.fromLngLat(b.lngLat,b.altitude),O=s.Y.fromLngLat(f,v),F=M.x-O.x,U=M.y-O.y,W=M.z-O.z,$=Math.sqrt(F*F+U*U+W*W),X=this.scaleZoom(this.cameraToCenterDistance/$/this.tileSize);this._elevation=v,this._center=f,this.zoom=X}setLocationAtPoint(l,f){let v=this.pointCoordinate(f),b=this.pointCoordinate(this.centerPoint),M=this.locationCoordinate(l),O=new s.Y(M.x-(v.x-b.x),M.y-(v.y-b.y));this.center=this.coordinateLocation(O),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(l,f){return f?this.coordinatePoint(this.locationCoordinate(l),f.getElevationForLngLatZoom(l,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(l))}pointLocation(l,f){return this.coordinateLocation(this.pointCoordinate(l,f))}locationCoordinate(l){return s.Y.fromLngLat(l)}coordinateLocation(l){return l&&l.toLngLat()}pointCoordinate(l,f){if(f){let at=f.pointCoordinate(l);if(at!=null)return at}let v=[l.x,l.y,0,1],b=[l.x,l.y,1,1];s.af(v,v,this.pixelMatrixInverse),s.af(b,b,this.pixelMatrixInverse);let M=v[3],O=b[3],F=v[1]/M,U=b[1]/O,W=v[2]/M,$=b[2]/O,X=W===$?0:(0-W)/($-W);return new s.Y(s.z.number(v[0]/M,b[0]/O,X)/this.worldSize,s.z.number(F,U,X)/this.worldSize)}coordinatePoint(l,f=0,v=this.pixelMatrix){let b=[l.x*this.worldSize,l.y*this.worldSize,f,1];return s.af(b,b,v),new s.P(b[0]/b[3],b[1]/b[3])}getBounds(){let l=Math.max(0,this.height/2-this.getHorizon());return new ln().extend(this.pointLocation(new s.P(0,l))).extend(this.pointLocation(new s.P(this.width,l))).extend(this.pointLocation(new s.P(this.width,this.height))).extend(this.pointLocation(new s.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ln([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(l){l?(this.lngRange=[l.getWest(),l.getEast()],this.latRange=[l.getSouth(),l.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(l,f=!1){let v=l.key,b=f?this._alignedPosMatrixCache:this._posMatrixCache;if(b[v])return b[v];let M=l.canonical,O=this.worldSize/this.zoomScale(M.z),F=M.x+Math.pow(2,M.z)*l.wrap,U=s.an(new Float64Array(16));return s.H(U,U,[F*O,M.y*O,0]),s.J(U,U,[O/s.W,O/s.W,1]),s.K(U,f?this.alignedProjMatrix:this.projMatrix,U),b[v]=new Float32Array(U),b[v]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let l,f,v,b,M=-90,O=90,F=-180,U=180,W=this.size,$=this._unmodified;if(this.latRange){let gt=this.latRange;M=s.O(gt[1])*this.worldSize,O=s.O(gt[0])*this.worldSize,l=O-MO&&(b=O-_t)}if(this.lngRange){let gt=(F+U)/2,_t=s.b0(X.x,gt-this.worldSize/2,gt+this.worldSize/2),yt=W.x/2;_t-ytU&&(v=U-yt)}v===void 0&&b===void 0||(this.center=this.unproject(new s.P(v!==void 0?v:X.x,b!==void 0?b:X.y)).wrap()),this._unmodified=$,this._constraining=!1}_calcMatrices(){if(!this.height)return;let l=this.centerOffset,f=this.point.x,v=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=s.b2(1,this.center.lat)*this.worldSize;let b=s.an(new Float64Array(16));s.J(b,b,[this.width/2,-this.height/2,1]),s.H(b,b,[1,-1,0]),this.labelPlaneMatrix=b,b=s.an(new Float64Array(16)),s.J(b,b,[1,-1,1]),s.H(b,b,[-1,-1,0]),s.J(b,b,[2/this.width,2/this.height,1]),this.glCoordMatrix=b;let M=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),O=Math.min(this.elevation,this.minElevationForCurrentTile),F=M-O*this._pixelPerMeter/Math.cos(this._pitch),U=O<0?F:M,W=Math.PI/2+this._pitch,$=this._fov*(.5+l.y/this.height),X=Math.sin($)*U/Math.sin(s.ac(Math.PI-W-$,.01,Math.PI-.01)),at=this.getHorizon(),gt=2*Math.atan(at/this.cameraToCenterDistance)*(.5+l.y/(2*at)),_t=Math.sin(gt)*U/Math.sin(s.ac(Math.PI-W-gt,.01,Math.PI-.01)),yt=Math.min(X,_t),At=1.01*(Math.cos(Math.PI/2-this._pitch)*yt+U),kt=this.height/50;b=new Float64Array(16),s.b3(b,this._fov,this.width/this.height,kt,At),b[8]=2*-l.x/this.width,b[9]=2*l.y/this.height,s.J(b,b,[1,-1,1]),s.H(b,b,[0,0,-this.cameraToCenterDistance]),s.b4(b,b,this._pitch),s.ad(b,b,this.angle),s.H(b,b,[-f,-v,0]),this.mercatorMatrix=s.J([],b,[this.worldSize,this.worldSize,this.worldSize]),s.J(b,b,[1,1,this._pixelPerMeter]),this.pixelMatrix=s.K(new Float64Array(16),this.labelPlaneMatrix,b),s.H(b,b,[0,0,-this.elevation]),this.projMatrix=b,this.invProjMatrix=s.ar([],b),this.pixelMatrix3D=s.K(new Float64Array(16),this.labelPlaneMatrix,b);let Wt=this.width%2/2,St=this.height%2/2,Nt=Math.cos(this.angle),Zt=Math.sin(this.angle),Ht=f-Math.round(f)+Nt*Wt+Zt*St,ne=v-Math.round(v)+Nt*St+Zt*Wt,he=new Float64Array(b);if(s.H(he,he,[Ht>.5?Ht-1:Ht,ne>.5?ne-1:ne,0]),this.alignedProjMatrix=he,b=s.ar(new Float64Array(16),this.pixelMatrix),!b)throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=b,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let l=this.pointCoordinate(new s.P(0,0)),f=[l.x*this.worldSize,l.y*this.worldSize,0,1];return s.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let l=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,l))}getCameraQueryGeometry(l){let f=this.getCameraPoint();if(l.length===1)return[l[0],f];{let v=f.x,b=f.y,M=f.x,O=f.y;for(let F of l)v=Math.min(v,F.x),b=Math.min(b,F.y),M=Math.max(M,F.x),O=Math.max(O,F.y);return[new s.P(v,b),new s.P(M,b),new s.P(M,O),new s.P(v,O),new s.P(v,b)]}}lngLatToCameraDepth(l,f){let v=this.locationCoordinate(l),b=[v.x*this.worldSize,v.y*this.worldSize,f,1];return s.af(b,b,this.projMatrix),b[2]/b[3]}}function $m(T,l){let f,v=!1,b=null,M=null,O=()=>{b=null,v&&(T.apply(M,f),b=setTimeout(O,l),v=!1)};return(...F)=>(v=!0,M=this,f=F,b||O(),b)}class Qm{constructor(l){this._getCurrentHash=()=>{let f=window.location.hash.replace(\"#\",\"\");if(this._hashName){let v;return f.split(\"&\").map(b=>b.split(\"=\")).forEach(b=>{b[0]===this._hashName&&(v=b)}),(v&&v[1]||\"\").split(\"/\")}return f.split(\"/\")},this._onHashChange=()=>{let f=this._getCurrentHash();if(f.length>=3&&!f.some(v=>isNaN(v))){let v=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:v,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=$m(this._updateHashUnthrottled,300),this._hashName=l&&encodeURIComponent(l)}addTo(l){return this._map=l,addEventListener(\"hashchange\",this._onHashChange,!1),this._map.on(\"moveend\",this._updateHash),this}remove(){return removeEventListener(\"hashchange\",this._onHashChange,!1),this._map.off(\"moveend\",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(l){let f=this._map.getCenter(),v=Math.round(100*this._map.getZoom())/100,b=Math.ceil((v*Math.LN2+Math.log(512/360/.5))/Math.LN10),M=Math.pow(10,b),O=Math.round(f.lng*M)/M,F=Math.round(f.lat*M)/M,U=this._map.getBearing(),W=this._map.getPitch(),$=\"\";if($+=l?`/${O}/${F}/${v}`:`${v}/${F}/${O}`,(U||W)&&($+=\"/\"+Math.round(10*U)/10),W&&($+=`/${Math.round(W)}`),this._hashName){let X=this._hashName,at=!1,gt=window.location.hash.slice(1).split(\"&\").map(_t=>{let yt=_t.split(\"=\")[0];return yt===X?(at=!0,`${yt}=${$}`):_t}).filter(_t=>_t);return at||gt.push(`${X}=${$}`),`#${gt.join(\"&\")}`}return`#${$}`}}let wf={linearity:.3,easing:s.b5(0,0,.3,1)},Xm=s.e({deceleration:2500,maxSpeed:1400},wf),kc=s.e({deceleration:20,maxSpeed:1400},wf),s_=s.e({deceleration:1e3,maxSpeed:360},wf),o_=s.e({deceleration:1e3,maxSpeed:90},wf);class a_{constructor(l){this._map=l,this.clear()}clear(){this._inertiaBuffer=[]}record(l){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:_.now(),settings:l})}_drainInertiaBuffer(){let l=this._inertiaBuffer,f=_.now();for(;l.length>0&&f-l[0].time>160;)l.shift()}_onMoveEnd(l){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let f={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:M}of this._inertiaBuffer)f.zoom+=M.zoomDelta||0,f.bearing+=M.bearingDelta||0,f.pitch+=M.pitchDelta||0,M.panDelta&&f.pan._add(M.panDelta),M.around&&(f.around=M.around),M.pinchAround&&(f.pinchAround=M.pinchAround);let v=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,b={};if(f.pan.mag()){let M=al(f.pan.mag(),v,s.e({},Xm,l||{}));b.offset=f.pan.mult(M.amount/f.pan.mag()),b.center=this._map.transform.center,ns(b,M)}if(f.zoom){let M=al(f.zoom,v,kc);b.zoom=this._map.transform.zoom+M.amount,ns(b,M)}if(f.bearing){let M=al(f.bearing,v,s_);b.bearing=this._map.transform.bearing+s.ac(M.amount,-179,179),ns(b,M)}if(f.pitch){let M=al(f.pitch,v,o_);b.pitch=this._map.transform.pitch+M.amount,ns(b,M)}if(b.zoom||b.bearing){let M=f.pinchAround===void 0?f.around:f.pinchAround;b.around=M?this._map.unproject(M):this._map.getCenter()}return this.clear(),s.e(b,{noMoveStart:!0})}}function ns(T,l){(!T.duration||T.durationf.unproject(U)),F=M.reduce((U,W,$,X)=>U.add(W.div(X.length)),new s.P(0,0));super(l,{points:M,point:F,lngLats:O,lngLat:f.unproject(F),originalEvent:v}),this._defaultPrevented=!1}}class _u extends s.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(l,f,v){super(l,{originalEvent:v}),this._defaultPrevented=!1}}class Cd{constructor(l,f){this._map=l,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(l){return this._firePreventable(new _u(l.type,this._map,l))}mousedown(l,f){return this._mousedownPos=f,this._firePreventable(new Vi(l.type,this._map,l))}mouseup(l){this._map.fire(new Vi(l.type,this._map,l))}click(l,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new Vi(l.type,this._map,l))}dblclick(l){return this._firePreventable(new Vi(l.type,this._map,l))}mouseover(l){this._map.fire(new Vi(l.type,this._map,l))}mouseout(l){this._map.fire(new Vi(l.type,this._map,l))}touchstart(l){return this._firePreventable(new gu(l.type,this._map,l))}touchmove(l){this._map.fire(new gu(l.type,this._map,l))}touchend(l){this._map.fire(new gu(l.type,this._map,l))}touchcancel(l){this._map.fire(new gu(l.type,this._map,l))}_firePreventable(l){if(this._map.fire(l),l.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Na{constructor(l){this._map=l}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(l){this._map.fire(new Vi(l.type,this._map,l))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Vi(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(l){this._delayContextMenu?this._contextMenuEvent=l:this._ignoreContextMenu||this._map.fire(new Vi(l.type,this._map,l)),this._map.listens(\"contextmenu\")&&l.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class lo{constructor(l){this._map=l}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(l){return this.transform.pointLocation(s.P.convert(l),this._map.terrain)}}class Sf{constructor(l,f){this._map=l,this._tr=new lo(l),this._el=l.getCanvasContainer(),this._container=l.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(l,f){this.isEnabled()&&l.shiftKey&&l.button===0&&(w.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(l,f){if(!this._active)return;let v=f;if(this._lastPos.equals(v)||!this._box&&v.dist(this._startPos)M.fitScreenCoordinates(v,b,this._tr.bearing,{linear:!0})};this._fireEvent(\"boxzoomcancel\",l)}keydown(l){this._active&&l.keyCode===27&&(this.reset(),this._fireEvent(\"boxzoomcancel\",l))}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(w.remove(this._box),this._box=null),w.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(l,f){return this._map.fire(new s.k(l,{originalEvent:f}))}}function Ps(T,l){if(T.length!==l.length)throw new Error(`The number of touches and points are not equal - touches ${T.length}, points ${l.length}`);let f={};for(let v=0;vthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=l.timeStamp),v.length===this.numTouches&&(this.centroid=function(b){let M=new s.P(0,0);for(let O of b)M._add(O);return M.div(b.length)}(f),this.touches=Ps(v,f)))}touchmove(l,f,v){if(this.aborted||!this.centroid)return;let b=Ps(v,f);for(let M in this.touches){let O=b[M];(!O||O.dist(this.touches[M])>30)&&(this.aborted=!0)}}touchend(l,f,v){if((!this.centroid||l.timeStamp-this.startTime>500)&&(this.aborted=!0),v.length===0){let b=!this.aborted&&this.centroid;if(this.reset(),b)return b}}}class eA{constructor(l){this.singleTap=new Tf(l),this.numTaps=l.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(l,f,v){this.singleTap.touchstart(l,f,v)}touchmove(l,f,v){this.singleTap.touchmove(l,f,v)}touchend(l,f,v){let b=this.singleTap.touchend(l,f,v);if(b){let M=l.timeStamp-this.lastTime<500,O=!this.lastTap||this.lastTap.dist(b)<30;if(M&&O||this.reset(),this.count++,this.lastTime=l.timeStamp,this.lastTap=b,this.count===this.numTaps)return this.reset(),b}}}class rA{constructor(l){this._tr=new lo(l),this._zoomIn=new eA({numTouches:1,numTaps:2}),this._zoomOut=new eA({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(l,f,v){this._zoomIn.touchstart(l,f,v),this._zoomOut.touchstart(l,f,v)}touchmove(l,f,v){this._zoomIn.touchmove(l,f,v),this._zoomOut.touchmove(l,f,v)}touchend(l,f,v){let b=this._zoomIn.touchend(l,f,v),M=this._zoomOut.touchend(l,f,v),O=this._tr;return b?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:O.zoom+1,around:O.unproject(b)},{originalEvent:l})}):M?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:O.zoom-1,around:O.unproject(M)},{originalEvent:l})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ll{constructor(l){this._enabled=!!l.enable,this._moveStateManager=l.moveStateManager,this._clickTolerance=l.clickTolerance||1,this._moveFunction=l.move,this._activateOnStart=!!l.activateOnStart,l.assignEvents(this),this.reset()}reset(l){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(l)}_move(...l){let f=this._moveFunction(...l);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(l,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(l)&&(this._moveStateManager.startMove(l),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(l,f){if(!this.isEnabled())return;let v=this._lastPoint;if(!v)return;if(l.preventDefault(),!this._moveStateManager.isValidMoveEvent(l))return void this.reset(l);let b=f.length?f[0]:f;return!this._moved&&b.dist(v){T.mousedown=T.dragStart,T.mousemoveWindow=T.dragMove,T.mouseup=T.dragEnd,T.contextmenu=function(l){l.preventDefault()}},Km=({enable:T,clickTolerance:l,bearingDegreesPerPixelMoved:f=.8})=>{let v=new yu({checkCorrectEvent:b=>w.mouseButton(b)===0&&b.ctrlKey||w.mouseButton(b)===2});return new ll({clickTolerance:l,move:(b,M)=>({bearingDelta:(M.x-b.x)*f}),moveStateManager:v,enable:T,assignEvents:ze})},Mf=({enable:T,clickTolerance:l,pitchDegreesPerPixelMoved:f=-.5})=>{let v=new yu({checkCorrectEvent:b=>w.mouseButton(b)===0&&b.ctrlKey||w.mouseButton(b)===2});return new ll({clickTolerance:l,move:(b,M)=>({pitchDelta:(M.y-b.y)*f}),moveStateManager:v,enable:T,assignEvents:ze})};class Ef{constructor(l,f){this._clickTolerance=l.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(l,f,v){return this._calculateTransform(l,f,v)}touchmove(l,f,v){if(this._active&&!(v.length0&&(this._active=!0);let b=Ps(v,f),M=new s.P(0,0),O=new s.P(0,0),F=0;for(let W in b){let $=b[W],X=this._touches[W];X&&(M._add($),O._add($.sub(X)),F++,b[W]=$)}if(this._touches=b,FMath.abs(T.x)}class vu extends iA{constructor(l){super(),this._currentTouchCount=0,this._map=l}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(l,f,v){super.touchstart(l,f,v),this._currentTouchCount=v.length}_start(l){this._lastPoints=l,kd(l[0].sub(l[1]))&&(this._valid=!1)}_move(l,f,v){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let b=l[0].sub(this._lastPoints[0]),M=l[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(b,M,v.timeStamp),this._valid?(this._lastPoints=l,this._active=!0,{pitchDelta:(b.y+M.y)/2*-.5}):void 0}gestureBeginsVertically(l,f,v){if(this._valid!==void 0)return this._valid;let b=l.mag()>=2,M=f.mag()>=2;if(!b&&!M)return;if(!b||!M)return this._firstMove===void 0&&(this._firstMove=v),v-this._firstMove<100&&void 0;let O=l.y>0==f.y>0;return kd(l)&&kd(f)&&O}}let Mx={panStep:100,bearingStep:15,pitchStep:10};class Jm{constructor(l){this._tr=new lo(l);let f=Mx;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(l){if(l.altKey||l.ctrlKey||l.metaKey)return;let f=0,v=0,b=0,M=0,O=0;switch(l.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:l.shiftKey?v=-1:(l.preventDefault(),M=-1);break;case 39:l.shiftKey?v=1:(l.preventDefault(),M=1);break;case 38:l.shiftKey?b=1:(l.preventDefault(),O=-1);break;case 40:l.shiftKey?b=-1:(l.preventDefault(),O=1);break;default:return}return this._rotationDisabled&&(v=0,b=0),{cameraAnimation:F=>{let U=this._tr;F.easeTo({duration:300,easeId:\"keyboardHandler\",easing:xu,zoom:f?Math.round(U.zoom)+f*(l.shiftKey?2:1):U.zoom,bearing:U.bearing+v*this._bearingStep,pitch:U.pitch+b*this._pitchStep,offset:[-M*this._panStep,-O*this._panStep],center:U.center},{originalEvent:l})}}}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 xu(T){return T*(2-T)}let Ri=4.000244140625;class Ul{constructor(l,f){this._onTimeout=v=>{this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(v)},this._map=l,this._tr=new lo(l),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(l){this._defaultZoomRate=l}setWheelZoomRate(l){this._wheelZoomRate=l}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(l){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!l&&l.around===\"center\")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(l){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!l[this._map.cooperativeGestures._bypassKey])return;let f=l.deltaMode===WheelEvent.DOM_DELTA_LINE?40*l.deltaY:l.deltaY,v=_.now(),b=v-(this._lastWheelEventTime||0);this._lastWheelEventTime=v,f!==0&&f%Ri==0?this._type=\"wheel\":f!==0&&Math.abs(f)<4?this._type=\"trackpad\":b>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,l)):this._type||(this._type=Math.abs(b*f)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),l.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=l,this._delta-=f,this._active||this._start(l)),l.preventDefault()}_start(l){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);let f=w.mousePos(this._map.getCanvas(),l),v=this._tr;this._around=f.y>v.transform.height/2-v.transform.getHorizon()?s.M.convert(this._aroundCenter?v.center:v.unproject(f)):s.M.convert(v.center),this._aroundPoint=v.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let l=this._tr.transform;if(this._delta!==0){let F=this._type===\"wheel\"&&Math.abs(this._delta)>Ri?this._wheelZoomRate:this._defaultZoomRate,U=2/(1+Math.exp(-Math.abs(this._delta*F)));this._delta<0&&U!==0&&(U=1/U);let W=typeof this._targetZoom==\"number\"?l.zoomScale(this._targetZoom):l.scale;this._targetZoom=Math.min(l.maxZoom,Math.max(l.minZoom,l.scaleZoom(W*U))),this._type===\"wheel\"&&(this._startZoom=l.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let f=typeof this._targetZoom==\"number\"?this._targetZoom:l.zoom,v=this._startZoom,b=this._easing,M,O=!1;if(this._type===\"wheel\"&&v&&b){let F=Math.min((_.now()-this._lastWheelEventTime)/200,1),U=b(F);M=s.z.number(v,f,U),F<1?this._frameId||(this._frameId=!0):O=!0}else M=f,O=!0;return this._active=!0,O&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!O,zoomDelta:M-l.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(l){let f=s.b6;if(this._prevEase){let v=this._prevEase,b=(_.now()-v.start)/v.duration,M=v.easing(b+.01)-v.easing(b),O=.27/Math.sqrt(M*M+1e-4)*.01,F=Math.sqrt(.0729-O*O);f=s.b5(O,F,.25,1)}return this._prevEase={start:_.now(),duration:l,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class sA{constructor(l,f){this._clickZoom=l,this._tapZoom=f}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 If{constructor(l){this._tr=new lo(l),this.reset()}reset(){this._active=!1}dblclick(l,f){return l.preventDefault(),{cameraAnimation:v=>{v.easeTo({duration:300,zoom:this._tr.zoom+(l.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:l})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c_{constructor(){this._tap=new eA({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(l,f,v){if(!this._swipePoint)if(this._tapTime){let b=f[0],M=l.timeStamp-this._tapTime<500,O=this._tapPoint.dist(b)<30;M&&O?v.length>0&&(this._swipePoint=b,this._swipeTouch=v[0].identifier):this.reset()}else this._tap.touchstart(l,f,v)}touchmove(l,f,v){if(this._tapTime){if(this._swipePoint){if(v[0].identifier!==this._swipeTouch)return;let b=f[0],M=b.y-this._swipePoint.y;return this._swipePoint=b,l.preventDefault(),this._active=!0,{zoomDelta:M/128}}}else this._tap.touchmove(l,f,v)}touchend(l,f,v){if(this._tapTime)this._swipePoint&&v.length===0&&this.reset();else{let b=this._tap.touchend(l,f,v);b&&(this._tapTime=l.timeStamp,this._tapPoint=b)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class t0{constructor(l,f,v){this._el=l,this._mousePan=f,this._touchPan=v}enable(l){this._inertiaOptions=l||{},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 u_{constructor(l,f,v){this._pitchWithRotate=l.pitchWithRotate,this._mouseRotate=f,this._mousePitch=v}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class cl{constructor(l,f,v,b){this._el=l,this._touchZoom=f,this._touchRotate=v,this._tapDragZoom=b,this._rotationDisabled=!1,this._enabled=!0}enable(l){this._touchZoom.enable(l),this._rotationDisabled||this._touchRotate.enable(l),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 Rd{constructor(l,f){this._bypassKey=navigator.userAgent.indexOf(\"Mac\")!==-1?\"metaKey\":\"ctrlKey\",this._map=l,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let l=this._map.getCanvasContainer();l.classList.add(\"maplibregl-cooperative-gestures\"),this._container=w.create(\"div\",\"maplibregl-cooperative-gesture-screen\",l);let f=this._map._getUIString(\"CooperativeGesturesHandler.WindowsHelpText\");this._bypassKey===\"metaKey\"&&(f=this._map._getUIString(\"CooperativeGesturesHandler.MacHelpText\"));let v=this._map._getUIString(\"CooperativeGesturesHandler.MobileHelpText\"),b=document.createElement(\"div\");b.className=\"maplibregl-desktop-message\",b.textContent=f,this._container.appendChild(b);let M=document.createElement(\"div\");M.className=\"maplibregl-mobile-message\",M.textContent=v,this._container.appendChild(M),this._container.setAttribute(\"aria-hidden\",\"true\")}_destoryUI(){this._container&&(w.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._destoryUI()}isEnabled(){return this._enabled}touchmove(l){this._onCooperativeGesture(l.touches.length===1)}wheel(l){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!l[this._bypassKey])}_onCooperativeGesture(l){this._enabled&&l&&(this._container.classList.add(\"maplibregl-show\"),setTimeout(()=>{this._container.classList.remove(\"maplibregl-show\")},100))}}let Xe=T=>T.zoom||T.drag||T.pitch||T.rotate;class dr extends s.k{}function Cf(T){return T.panDelta&&T.panDelta.mag()||T.zoomDelta||T.bearingDelta||T.pitchDelta}class bu{constructor(l,f){this.handleWindowEvent=b=>{this.handleEvent(b,`${b.type}Window`)},this.handleEvent=(b,M)=>{if(b.type===\"blur\")return void this.stop(!0);this._updatingCamera=!0;let O=b.type===\"renderFrame\"?void 0:b,F={needsRenderFrame:!1},U={},W={},$=b.touches,X=$?this._getMapTouches($):void 0,at=X?w.touchPos(this._map.getCanvas(),X):w.mousePos(this._map.getCanvas(),b);for(let{handlerName:yt,handler:At,allowed:kt}of this._handlers){if(!At.isEnabled())continue;let Wt;this._blockedByActive(W,kt,yt)?At.reset():At[M||b.type]&&(Wt=At[M||b.type](b,at,X),this.mergeHandlerResult(F,U,Wt,yt,O),Wt&&Wt.needsRenderFrame&&this._triggerRenderFrame()),(Wt||At.isActive())&&(W[yt]=At)}let gt={};for(let yt in this._previousActiveHandlers)W[yt]||(gt[yt]=O);this._previousActiveHandlers=W,(Object.keys(gt).length||Cf(F))&&(this._changes.push([F,U,gt]),this._triggerRenderFrame()),(Object.keys(W).length||Cf(F))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:_t}=F;_t&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],_t(this._map))},this._map=l,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new a_(l),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);let v=this._el;this._listeners=[[v,\"touchstart\",{passive:!0}],[v,\"touchmove\",{passive:!1}],[v,\"touchend\",void 0],[v,\"touchcancel\",void 0],[v,\"mousedown\",void 0],[v,\"mousemove\",void 0],[v,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[v,\"mouseover\",void 0],[v,\"mouseout\",void 0],[v,\"dblclick\",void 0],[v,\"click\",void 0],[v,\"keydown\",{capture:!1}],[v,\"keyup\",void 0],[v,\"wheel\",{passive:!1}],[v,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(let[b,M,O]of this._listeners)w.addEventListener(b,M,b===document?this.handleWindowEvent:this.handleEvent,O)}destroy(){for(let[l,f,v]of this._listeners)w.removeEventListener(l,f,l===document?this.handleWindowEvent:this.handleEvent,v)}_addDefaultHandlers(l){let f=this._map,v=f.getCanvasContainer();this._add(\"mapEvent\",new Cd(f,l));let b=f.boxZoom=new Sf(f,l);this._add(\"boxZoom\",b),l.interactive&&l.boxZoom&&b.enable();let M=f.cooperativeGestures=new Rd(f,l.cooperativeGestures);this._add(\"cooperativeGestures\",M),l.cooperativeGestures&&M.enable();let O=new rA(f),F=new If(f);f.doubleClickZoom=new sA(F,O),this._add(\"tapZoom\",O),this._add(\"clickZoom\",F),l.interactive&&l.doubleClickZoom&&f.doubleClickZoom.enable();let U=new c_;this._add(\"tapDragZoom\",U);let W=f.touchPitch=new vu(f);this._add(\"touchPitch\",W),l.interactive&&l.touchPitch&&f.touchPitch.enable(l.touchPitch);let $=Km(l),X=Mf(l);f.dragRotate=new u_(l,$,X),this._add(\"mouseRotate\",$,[\"mousePitch\"]),this._add(\"mousePitch\",X,[\"mouseRotate\"]),l.interactive&&l.dragRotate&&f.dragRotate.enable();let at=(({enable:Wt,clickTolerance:St})=>{let Nt=new yu({checkCorrectEvent:Zt=>w.mouseButton(Zt)===0&&!Zt.ctrlKey});return new ll({clickTolerance:St,move:(Zt,Ht)=>({around:Ht,panDelta:Ht.sub(Zt)}),activateOnStart:!0,moveStateManager:Nt,enable:Wt,assignEvents:ze})})(l),gt=new Ef(l,f);f.dragPan=new t0(v,at,gt),this._add(\"mousePan\",at),this._add(\"touchPan\",gt,[\"touchZoom\",\"touchRotate\"]),l.interactive&&l.dragPan&&f.dragPan.enable(l.dragPan);let _t=new Ld,yt=new Pf;f.touchZoomRotate=new cl(v,yt,_t,U),this._add(\"touchRotate\",_t,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",yt,[\"touchPan\",\"touchRotate\"]),l.interactive&&l.touchZoomRotate&&f.touchZoomRotate.enable(l.touchZoomRotate);let At=f.scrollZoom=new Ul(f,()=>this._triggerRenderFrame());this._add(\"scrollZoom\",At,[\"mousePan\"]),l.interactive&&l.scrollZoom&&f.scrollZoom.enable(l.scrollZoom);let kt=f.keyboard=new Jm(f);this._add(\"keyboard\",kt),l.interactive&&l.keyboard&&f.keyboard.enable(),this._add(\"blockableMapEvent\",new Na(f))}_add(l,f,v){this._handlers.push({handlerName:l,handler:f,allowed:v}),this._handlersById[l]=f}stop(l){if(!this._updatingCamera){for(let{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},l),this._changes=[]}}isActive(){for(let{handler:l}of this._handlers)if(l.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Xe(this._eventsInProgress)||this.isZooming()}_blockedByActive(l,f,v){for(let b in l)if(b!==v&&(!f||f.indexOf(b)<0))return!0;return!1}_getMapTouches(l){let f=[];for(let v of l)this._el.contains(v.target)&&f.push(v);return f}mergeHandlerResult(l,f,v,b,M){if(!v)return;s.e(l,v);let O={handlerName:b,originalEvent:v.originalEvent||M};v.zoomDelta!==void 0&&(f.zoom=O),v.panDelta!==void 0&&(f.drag=O),v.pitchDelta!==void 0&&(f.pitch=O),v.bearingDelta!==void 0&&(f.rotate=O)}_applyChanges(){let l={},f={},v={};for(let[b,M,O]of this._changes)b.panDelta&&(l.panDelta=(l.panDelta||new s.P(0,0))._add(b.panDelta)),b.zoomDelta&&(l.zoomDelta=(l.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(l.bearingDelta=(l.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(l.pitchDelta=(l.pitchDelta||0)+b.pitchDelta),b.around!==void 0&&(l.around=b.around),b.pinchAround!==void 0&&(l.pinchAround=b.pinchAround),b.noInertia&&(l.noInertia=b.noInertia),s.e(f,M),s.e(v,O);this._updateMapTransform(l,f,v),this._changes=[]}_updateMapTransform(l,f,v){let b=this._map,M=b._getTransformForUpdate(),O=b.terrain;if(!(Cf(l)||O&&this._terrainMovement))return this._fireEvents(f,v,!0);let{panDelta:F,zoomDelta:U,bearingDelta:W,pitchDelta:$,around:X,pinchAround:at}=l;at!==void 0&&(X=at),b._stop(!0),X=X||b.transform.centerPoint;let gt=M.pointLocation(F?X.sub(F):X);W&&(M.bearing+=W),$&&(M.pitch+=$),U&&(M.zoom+=U),O?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?M.center=M.pointLocation(M.centerPoint.sub(F)):M.setLocationAtPoint(gt,X):(this._terrainMovement=!0,this._map._elevationFreeze=!0,M.setLocationAtPoint(gt,X),this._map.once(\"moveend\",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,M.recalculateZoom(b.terrain)})):M.setLocationAtPoint(gt,X),b._applyUpdatedTransform(M),this._map._update(),l.noInertia||this._inertia.record(l),this._fireEvents(f,v,!0)}_fireEvents(l,f,v){let b=Xe(this._eventsInProgress),M=Xe(l),O={};for(let $ in l){let{originalEvent:X}=l[$];this._eventsInProgress[$]||(O[`${$}start`]=X),this._eventsInProgress[$]=l[$]}!b&&M&&this._fireEvent(\"movestart\",M.originalEvent);for(let $ in O)this._fireEvent($,O[$]);M&&this._fireEvent(\"move\",M.originalEvent);for(let $ in l){let{originalEvent:X}=l[$];this._fireEvent($,X)}let F={},U;for(let $ in this._eventsInProgress){let{handlerName:X,originalEvent:at}=this._eventsInProgress[$];this._handlersById[X].isActive()||(delete this._eventsInProgress[$],U=f[X]||at,F[`${$}end`]=U)}for(let $ in F)this._fireEvent($,F[$]);let W=Xe(this._eventsInProgress);if(v&&(b||M)&&!W){this._updatingCamera=!0;let $=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),X=at=>at!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new dr(\"renderFrame\",{timeStamp:l})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class e0 extends s.E{constructor(l,f){super(),this._renderFrameCallback=()=>{let v=Math.min((_.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(v)),v<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=l,this._bearingSnap=f.bearingSnap,this.on(\"moveend\",()=>{delete this._requestedCameraState})}getCenter(){return new s.M(this.transform.center.lng,this.transform.center.lat)}setCenter(l,f){return this.jumpTo({center:l},f)}panBy(l,f,v){return l=s.P.convert(l).mult(-1),this.panTo(this.transform.center,s.e({offset:l},f),v)}panTo(l,f,v){return this.easeTo(s.e({center:l},f),v)}getZoom(){return this.transform.zoom}setZoom(l,f){return this.jumpTo({zoom:l},f),this}zoomTo(l,f,v){return this.easeTo(s.e({zoom:l},f),v)}zoomIn(l,f){return this.zoomTo(this.getZoom()+1,l,f),this}zoomOut(l,f){return this.zoomTo(this.getZoom()-1,l,f),this}getBearing(){return this.transform.bearing}setBearing(l,f){return this.jumpTo({bearing:l},f),this}getPadding(){return this.transform.padding}setPadding(l,f){return this.jumpTo({padding:l},f),this}rotateTo(l,f,v){return this.easeTo(s.e({bearing:l},f),v)}resetNorth(l,f){return this.rotateTo(0,s.e({duration:1e3},l),f),this}resetNorthPitch(l,f){return this.easeTo(s.e({bearing:0,pitch:0,duration:1e3},l),f),this}snapToNorth(l,f){return Math.abs(this.getBearing()){if(this._zooming&&(v.zoom=s.z.number(b,U,Ht)),this._rotating&&(v.bearing=s.z.number(M,W,Ht)),this._pitching&&(v.pitch=s.z.number(O,$,Ht)),this._padding&&(v.interpolatePadding(F,X,Ht),gt=v.centerPoint.add(at)),this.terrain&&!l.freezeElevation&&this._updateElevation(Ht),St)v.setLocationAtPoint(St,Nt);else{let ne=v.zoomScale(v.zoom-b),he=U>b?Math.min(2,Wt):Math.max(.5,Wt),ce=Math.pow(he,1-Ht),_e=v.unproject(At.add(kt.mult(Ht*ce)).mult(ne));v.setLocationAtPoint(v.renderWorldCopies?_e.wrap():_e,gt)}this._applyUpdatedTransform(v),this._fireMoveEvents(f)},Ht=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ht)},l),this}_prepareEase(l,f,v={}){this._moving=!0,f||v.moving||this.fire(new s.k(\"movestart\",l)),this._zooming&&!v.zooming&&this.fire(new s.k(\"zoomstart\",l)),this._rotating&&!v.rotating&&this.fire(new s.k(\"rotatestart\",l)),this._pitching&&!v.pitching&&this.fire(new s.k(\"pitchstart\",l))}_prepareElevation(l){this._elevationCenter=l,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(l,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(l){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(l<1&&f!==this._elevationTarget){let v=this._elevationTarget-this._elevationStart;this._elevationStart+=l*(v-(f-(v*l+this._elevationStart))/(1-l)),this._elevationTarget=f}this.transform.elevation=s.z.number(this._elevationStart,this._elevationTarget,l)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(l){if(!this.transformCameraUpdate)return;let f=l.clone(),{center:v,zoom:b,pitch:M,bearing:O,elevation:F}=this.transformCameraUpdate(f);v&&(f.center=v),b!==void 0&&(f.zoom=b),M!==void 0&&(f.pitch=M),O!==void 0&&(f.bearing=O),F!==void 0&&(f.elevation=F),this.transform.apply(f)}_fireMoveEvents(l){this.fire(new s.k(\"move\",l)),this._zooming&&this.fire(new s.k(\"zoom\",l)),this._rotating&&this.fire(new s.k(\"rotate\",l)),this._pitching&&this.fire(new s.k(\"pitch\",l))}_afterEase(l,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;let v=this._zooming,b=this._rotating,M=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,v&&this.fire(new s.k(\"zoomend\",l)),b&&this.fire(new s.k(\"rotateend\",l)),M&&this.fire(new s.k(\"pitchend\",l)),this.fire(new s.k(\"moveend\",l))}flyTo(l,f){if(!l.essential&&_.prefersReducedMotion){let qe=s.L(l,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(qe,f)}this.stop(),l=s.e({offset:[0,0],speed:1.2,curve:1.42,easing:s.b6},l);let v=this._getTransformForUpdate(),b=this.getZoom(),M=this.getBearing(),O=this.getPitch(),F=this.getPadding(),U=\"zoom\"in l?s.ac(+l.zoom,v.minZoom,v.maxZoom):b,W=\"bearing\"in l?this._normalizeBearing(l.bearing,M):M,$=\"pitch\"in l?+l.pitch:O,X=\"padding\"in l?l.padding:v.padding,at=v.zoomScale(U-b),gt=s.P.convert(l.offset),_t=v.centerPoint.add(gt),yt=v.pointLocation(_t),At=s.M.convert(l.center||yt);this._normalizeCenter(At);let kt=v.project(yt),Wt=v.project(At).sub(kt),St=l.curve,Nt=Math.max(v.width,v.height),Zt=Nt/at,Ht=Wt.mag();if(\"minZoom\"in l){let qe=s.ac(Math.min(l.minZoom,b,U),v.minZoom,v.maxZoom),nn=Nt/v.zoomScale(qe-b);St=Math.sqrt(nn/Ht*2)}let ne=St*St;function he(qe){let nn=(Zt*Zt-Nt*Nt+(qe?-1:1)*ne*ne*Ht*Ht)/(2*(qe?Zt:Nt)*ne*Ht);return Math.log(Math.sqrt(nn*nn+1)-nn)}function ce(qe){return(Math.exp(qe)-Math.exp(-qe))/2}function _e(qe){return(Math.exp(qe)+Math.exp(-qe))/2}let Ve=he(!1),hr=function(qe){return _e(Ve)/_e(Ve+St*qe)},Ee=function(qe){return Nt*((_e(Ve)*(ce(nn=Ve+St*qe)/_e(nn))-ce(Ve))/ne)/Ht;var nn},lr=(he(!0)-Ve)/St;if(Math.abs(Ht)<1e-6||!isFinite(lr)){if(Math.abs(Nt-Zt)<1e-6)return this.easeTo(l,f);let qe=Ztl.maxDuration&&(l.duration=0),this._zooming=!0,this._rotating=M!==W,this._pitching=$!==O,this._padding=!v.isPaddingEqual(X),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(At),this._ease(qe=>{let nn=qe*lr,ti=1/hr(nn);v.zoom=qe===1?U:b+v.scaleZoom(ti),this._rotating&&(v.bearing=s.z.number(M,W,qe)),this._pitching&&(v.pitch=s.z.number(O,$,qe)),this._padding&&(v.interpolatePadding(F,X,qe),_t=v.centerPoint.add(gt)),this.terrain&&!l.freezeElevation&&this._updateElevation(qe);let zr=qe===1?At:v.unproject(kt.add(Wt.mult(Ee(nn))).mult(ti));v.setLocationAtPoint(v.renderWorldCopies?zr.wrap():zr,_t),this._applyUpdatedTransform(v),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},l),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(l,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let v=this._onEaseEnd;delete this._onEaseEnd,v.call(this,f)}if(!l){let v=this.handlers;v&&v.stop(!1)}return this}_ease(l,f,v){v.animate===!1||v.duration===0?(l(1),f()):(this._easeStart=_.now(),this._easeOptions=v,this._onEaseFrame=l,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(l,f){l=s.b0(l,-180,180);let v=Math.abs(l-f);return Math.abs(l-360-f)180?-360:v<-180?360:0}queryTerrainElevation(l){return this.terrain?this.terrain.getElevationForLngLatZoom(s.M.convert(l),this.transform.tileZoom)-this.transform.elevation:null}}let So={compact:!0,customAttribution:'MapLibre'};class r0{constructor(l=So){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=f=>{!f||f.sourceDataType!==\"metadata\"&&f.sourceDataType!==\"visibility\"&&f.dataType!==\"style\"&&f.type!==\"terrain\"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute(\"open\",\"\"):this._container.classList.contains(\"maplibregl-compact\")||this._container.classList.contains(\"maplibregl-attrib-empty\")||(this._container.setAttribute(\"open\",\"\"),this._container.classList.add(\"maplibregl-compact\",\"maplibregl-compact-show\")):(this._container.setAttribute(\"open\",\"\"),this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.remove(\"maplibregl-compact\",\"maplibregl-compact-show\"))},this._updateCompactMinimize=()=>{this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.contains(\"maplibregl-compact-show\")&&this._container.classList.remove(\"maplibregl-compact-show\")},this.options=l}getDefaultPosition(){return\"bottom-right\"}onAdd(l){return this._map=l,this._compact=this.options.compact,this._container=w.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=w.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=w.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(){w.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(l,f){let v=this._map._getUIString(`AttributionControl.${f}`);l.title=v,l.setAttribute(\"aria-label\",v)}_updateAttributions(){if(!this._map.style)return;let l=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?l=l.concat(this.options.customAttribution.map(b=>typeof b!=\"string\"?\"\":b)):typeof this.options.customAttribution==\"string\"&&l.push(this.options.customAttribution)),this._map.style.stylesheet){let b=this._map.style.stylesheet;this.styleOwner=b.owner,this.styleId=b.id}let f=this._map.style.sourceCaches;for(let b in f){let M=f[b];if(M.used||M.usedForTerrain){let O=M.getSource();O.attribution&&l.indexOf(O.attribution)<0&&l.push(O.attribution)}}l=l.filter(b=>String(b).trim()),l.sort((b,M)=>b.length-M.length),l=l.filter((b,M)=>{for(let O=M+1;O=0)return!1;return!0});let v=l.join(\" | \");v!==this._attribHTML&&(this._attribHTML=v,l.length?(this._innerContainer.innerHTML=v,this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null)}}class ul{constructor(l={}){this._updateCompact=()=>{let f=this._container.children;if(f.length){let v=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&v.classList.add(\"maplibregl-compact\"):v.classList.remove(\"maplibregl-compact\")}},this.options=l}getDefaultPosition(){return\"bottom-left\"}onAdd(l){this._map=l,this._compact=this.options&&this.options.compact,this._container=w.create(\"div\",\"maplibregl-ctrl\");let f=w.create(\"a\",\"maplibregl-ctrl-logo\");return f.target=\"_blank\",f.rel=\"noopener nofollow\",f.href=\"https://maplibre.org/\",f.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),f.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(f),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){w.remove(this._container),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ex{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(l){let f=++this._id;return this._queue.push({callback:l,id:f,cancelled:!1}),f}remove(l){let f=this._currentlyRunning,v=f?this._queue.concat(f):this._queue;for(let b of v)if(b.id===l)return void(b.cancelled=!0)}run(l=0){if(this._currentlyRunning)throw new Error(\"Attempting to run(), but is already running.\");let f=this._currentlyRunning=this._queue;this._queue=[];for(let v of f)if(!v.cancelled&&(v.callback(l),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dd=s.X([{name:\"a_pos3d\",type:\"Int16\",components:3}]);class Mn extends s.E{constructor(l){super(),this.sourceCache=l,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,l.usedForTerrain=!0,l.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(l,f){this.sourceCache.update(l,f),this._renderableTilesKeys=[];let v={};for(let b of l.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))v[b.key]=!0,this._renderableTilesKeys.push(b.key),this._tiles[b.key]||(b.posMatrix=new Float64Array(16),s.aN(b.posMatrix,0,s.W,0,s.W,0,1),this._tiles[b.key]=new qo(b,this.tileSize));for(let b in this._tiles)v[b]||delete this._tiles[b]}freeRtt(l){for(let f in this._tiles){let v=this._tiles[f];(!l||v.tileID.equals(l)||v.tileID.isChildOf(l)||l.isChildOf(v.tileID))&&(v.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(l=>this.getTileByID(l))}getTileByID(l){return this._tiles[l]}getTerrainCoords(l){let f={};for(let v of this._renderableTilesKeys){let b=this._tiles[v].tileID;if(b.canonical.equals(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16),s.aN(M.posMatrix,0,s.W,0,s.W,0,1),f[v]=M}else if(b.canonical.isChildOf(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=b.canonical.z-l.canonical.z,F=b.canonical.x-(b.canonical.x>>O<>O<>O;s.aN(M.posMatrix,0,W,0,W,0,1),s.H(M.posMatrix,M.posMatrix,[-F*W,-U*W,0]),f[v]=M}else if(l.canonical.isChildOf(b.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=l.canonical.z-b.canonical.z,F=l.canonical.x-(l.canonical.x>>O<>O<>O;s.aN(M.posMatrix,0,s.W,0,s.W,0,1),s.H(M.posMatrix,M.posMatrix,[F*W,U*W,0]),s.J(M.posMatrix,M.posMatrix,[1/2**O,1/2**O,0]),f[v]=M}}return f}getSourceTile(l,f){let v=this.sourceCache._source,b=l.overscaledZ-this.deltaZoom;if(b>v.maxzoom&&(b=v.maxzoom),b=v.minzoom&&(!M||!M.dem);)M=this.sourceCache.getTileByID(l.scaledTo(b--).key);return M}tilesAfterTime(l=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=l)}}class On{constructor(l,f,v){this.painter=l,this.sourceCache=new Mn(f),this.options=v,this.exaggeration=typeof v.exaggeration==\"number\"?v.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(l,f,v,b=s.W){var M;if(!(f>=0&&f=0&&vl.canonical.z&&(l.canonical.z>=b?M=l.canonical.z-b:s.w(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));let O=l.canonical.x-(l.canonical.x>>M<>M<>8<<4|M>>8,f[O+3]=0;let v=new s.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),b=new ae(l,v,l.gl.RGBA,{premultiply:!1});return b.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._coordsTexture=b,b}pointCoordinate(l){let f=new Uint8Array(4),v=this.painter.context,b=v.gl;v.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer),b.readPixels(l.x,this.painter.height/devicePixelRatio-l.y-1,1,1,b.RGBA,b.UNSIGNED_BYTE,f),v.bindFramebuffer.set(null);let M=f[0]+(f[2]>>4<<8),O=f[1]+((15&f[2])<<8),F=this.coordsIndex[255-f[3]],U=F&&this.sourceCache.getTileByID(F);if(!U)return null;let W=this._coordsTextureSize,$=(1<l.id!==f),this._recentlyUsed.push(l.id)}stampObject(l){l.stamp=++this._stamp}getOrCreateFreeObject(){for(let f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");let l=this._createObject(this._objects.length);return this._objects.push(l),l}freeObject(l){l.inUse=!1}freeAllObjects(){for(let l of this._objects)this.freeObject(l)}isFull(){return!(this._objects.length!l.inUse)===!1}}let Ua={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class oA{constructor(l,f){this.painter=l,this.terrain=f,this.pool=new i0(l.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(l){return this.pool.getObjectForId(l.rtt[this._stacks.length-1].id).texture}prepareForRender(l,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=l._order.filter(v=>!l._layers[v].isHidden(f)),this._coordsDescendingInv={};for(let v in l.sourceCaches){this._coordsDescendingInv[v]={};let b=l.sourceCaches[v].getVisibleCoordinates();for(let M of b){let O=this.terrain.sourceCache.getTerrainCoords(M);for(let F in O)this._coordsDescendingInv[v][F]||(this._coordsDescendingInv[v][F]=[]),this._coordsDescendingInv[v][F].push(O[F])}}this._coordsDescendingInvStr={};for(let v of l._order){let b=l._layers[v],M=b.source;if(Ua[b.type]&&!this._coordsDescendingInvStr[M]){this._coordsDescendingInvStr[M]={};for(let O in this._coordsDescendingInv[M])this._coordsDescendingInvStr[M][O]=this._coordsDescendingInv[M][O].map(F=>F.key).sort().join()}}for(let v of this._renderableTiles)for(let b in this._coordsDescendingInvStr){let M=this._coordsDescendingInvStr[b][v.tileID.key];M&&M!==v.rttCoords[b]&&(v.rtt=[])}}renderLayer(l){if(l.isHidden(this.painter.transform.zoom))return!1;let f=l.type,v=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===l.id;if(Ua[f]&&(this._prevType&&Ua[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(l.id),!b))return!0;if(Ua[this._prevType]||Ua[f]&&b){this._prevType=f;let M=this._stacks.length-1,O=this._stacks[M]||[];for(let F of this._renderableTiles){if(this.pool.isFull()&&(tA(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(F),F.rtt[M]){let W=this.pool.getObjectForId(F.rtt[M].id);if(W.stamp===F.rtt[M].stamp){this.pool.useObject(W);continue}}let U=this.pool.getOrCreateFreeObject();this.pool.useObject(U),this.pool.stampObject(U),F.rtt[M]={id:U.id,stamp:U.stamp},v.context.bindFramebuffer.set(U.fbo.framebuffer),v.context.clear({color:s.aO.transparent,stencil:0}),v.currentStencilSource=void 0;for(let W=0;W{T.touchstart=T.dragStart,T.touchmoveWindow=T.dragMove,T.touchend=T.dragEnd},s0={showCompass:!0,showZoom:!0,visualizePitch:!1};class o0{constructor(l,f,v=!1){this.mousedown=O=>{this.startMouse(s.e({},O,{ctrlKey:!0,preventDefault:()=>O.preventDefault()}),w.mousePos(this.element,O)),w.addEventListener(window,\"mousemove\",this.mousemove),w.addEventListener(window,\"mouseup\",this.mouseup)},this.mousemove=O=>{this.moveMouse(O,w.mousePos(this.element,O))},this.mouseup=O=>{this.mouseRotate.dragEnd(O),this.mousePitch&&this.mousePitch.dragEnd(O),this.offTemp()},this.touchstart=O=>{O.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=w.touchPos(this.element,O.targetTouches)[0],this.startTouch(O,this._startPos),w.addEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),w.addEventListener(window,\"touchend\",this.touchend))},this.touchmove=O=>{O.targetTouches.length!==1?this.reset():(this._lastPos=w.touchPos(this.element,O.targetTouches)[0],this.moveTouch(O,this._lastPos))},this.touchend=O=>{O.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let b=l.dragRotate._mouseRotate.getClickTolerance(),M=l.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=Km({clickTolerance:b,enable:!0}),this.touchRotate=(({enable:O,clickTolerance:F,bearingDegreesPerPixelMoved:U=.8})=>{let W=new Nl;return new ll({clickTolerance:F,move:($,X)=>({bearingDelta:(X.x-$.x)*U}),moveStateManager:W,enable:O,assignEvents:Lf})})({clickTolerance:b,enable:!0}),this.map=l,v&&(this.mousePitch=Mf({clickTolerance:M,enable:!0}),this.touchPitch=(({enable:O,clickTolerance:F,pitchDegreesPerPixelMoved:U=-.5})=>{let W=new Nl;return new ll({clickTolerance:F,move:($,X)=>({pitchDelta:(X.y-$.y)*U}),moveStateManager:W,enable:O,assignEvents:Lf})})({clickTolerance:M,enable:!0})),w.addEventListener(f,\"mousedown\",this.mousedown),w.addEventListener(f,\"touchstart\",this.touchstart,{passive:!1}),w.addEventListener(f,\"touchcancel\",this.reset)}startMouse(l,f){this.mouseRotate.dragStart(l,f),this.mousePitch&&this.mousePitch.dragStart(l,f),w.disableDrag()}startTouch(l,f){this.touchRotate.dragStart(l,f),this.touchPitch&&this.touchPitch.dragStart(l,f),w.disableDrag()}moveMouse(l,f){let v=this.map,{bearingDelta:b}=this.mouseRotate.dragMove(l,f)||{};if(b&&v.setBearing(v.getBearing()+b),this.mousePitch){let{pitchDelta:M}=this.mousePitch.dragMove(l,f)||{};M&&v.setPitch(v.getPitch()+M)}}moveTouch(l,f){let v=this.map,{bearingDelta:b}=this.touchRotate.dragMove(l,f)||{};if(b&&v.setBearing(v.getBearing()+b),this.touchPitch){let{pitchDelta:M}=this.touchPitch.dragMove(l,f)||{};M&&v.setPitch(v.getPitch()+M)}}off(){let l=this.element;w.removeEventListener(l,\"mousedown\",this.mousedown),w.removeEventListener(l,\"touchstart\",this.touchstart,{passive:!1}),w.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),w.removeEventListener(window,\"touchend\",this.touchend),w.removeEventListener(l,\"touchcancel\",this.reset),this.offTemp()}offTemp(){w.enableDrag(),w.removeEventListener(window,\"mousemove\",this.mousemove),w.removeEventListener(window,\"mouseup\",this.mouseup),w.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),w.removeEventListener(window,\"touchend\",this.touchend)}}let Dc;function Vs(T,l,f){if(T=new s.M(T.lng,T.lat),l){let v=new s.M(T.lng-360,T.lat),b=new s.M(T.lng+360,T.lat),M=f.locationPoint(T).distSqr(l);f.locationPoint(v).distSqr(l)180;){let v=f.locationPoint(T);if(v.x>=0&&v.y>=0&&v.x<=f.width&&v.y<=f.height)break;T.lng>f.center.lng?T.lng-=360:T.lng+=360}return T}let fh={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 hl(T,l,f){let v=T.classList;for(let b in fh)v.remove(`maplibregl-${f}-anchor-${b}`);v.add(`maplibregl-${f}-anchor-${l}`)}class Od extends s.E{constructor(l){if(super(),this._onKeyPress=f=>{let v=f.code,b=f.charCode||f.keyCode;v!==\"Space\"&&v!==\"Enter\"&&b!==32&&b!==13||this.togglePopup()},this._onMapClick=f=>{let v=f.originalEvent.target,b=this._element;this._popup&&(v===b||b.contains(v))&&this.togglePopup()},this._update=f=>{if(!this._map)return;let v=this._map.loaded()&&!this._map.isMoving();(f?.type===\"terrain\"||f?.type===\"render\"&&!v)&&this._map.once(\"render\",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Vs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let b=\"\";this._rotationAlignment===\"viewport\"||this._rotationAlignment===\"auto\"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===\"map\"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M=\"\";this._pitchAlignment===\"viewport\"||this._pitchAlignment===\"auto\"?M=\"rotateX(0deg)\":this._pitchAlignment===\"map\"&&(M=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!==\"moveend\"||(this._pos=this._pos.round()),w.setTransform(this._element,`${fh[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${b}`),this._updateOpacity(f&&f.type===\"moveend\")},this._onMove=f=>{if(!this._isDragging){let v=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=v}this._isDragging&&(this._pos=f.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=\"none\",this._state===\"pending\"&&(this._state=\"active\",this.fire(new s.k(\"dragstart\"))),this.fire(new s.k(\"drag\")))},this._onUp=()=>{this._element.style.pointerEvents=\"auto\",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off(\"mousemove\",this._onMove),this._map.off(\"touchmove\",this._onMove),this._state===\"active\"&&this.fire(new s.k(\"dragend\")),this._state=\"inactive\"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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=l&&l.anchor||\"center\",this._color=l&&l.color||\"#3FB1CE\",this._scale=l&&l.scale||1,this._draggable=l&&l.draggable||!1,this._clickTolerance=l&&l.clickTolerance||0,this._isDragging=!1,this._state=\"inactive\",this._rotation=l&&l.rotation||0,this._rotationAlignment=l&&l.rotationAlignment||\"auto\",this._pitchAlignment=l&&l.pitchAlignment&&l.pitchAlignment!==\"auto\"?l.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(l?.opacity,l?.opacityWhenCovered),l&&l.element)this._element=l.element,this._offset=s.P.convert(l&&l.offset||[0,0]);else{this._defaultMarker=!0,this._element=w.create(\"div\"),this._element.setAttribute(\"aria-label\",\"Map marker\");let f=w.createNS(\"http://www.w3.org/2000/svg\",\"svg\"),v=41,b=27;f.setAttributeNS(null,\"display\",\"block\"),f.setAttributeNS(null,\"height\",`${v}px`),f.setAttributeNS(null,\"width\",`${b}px`),f.setAttributeNS(null,\"viewBox\",`0 0 ${b} ${v}`);let M=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");M.setAttributeNS(null,\"stroke\",\"none\"),M.setAttributeNS(null,\"stroke-width\",\"1\"),M.setAttributeNS(null,\"fill\",\"none\"),M.setAttributeNS(null,\"fill-rule\",\"evenodd\");let O=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");O.setAttributeNS(null,\"fill-rule\",\"nonzero\");let F=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");F.setAttributeNS(null,\"transform\",\"translate(3.0, 29.0)\"),F.setAttributeNS(null,\"fill\",\"#000000\");let U=[{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(let kt of U){let Wt=w.createNS(\"http://www.w3.org/2000/svg\",\"ellipse\");Wt.setAttributeNS(null,\"opacity\",\"0.04\"),Wt.setAttributeNS(null,\"cx\",\"10.5\"),Wt.setAttributeNS(null,\"cy\",\"5.80029008\"),Wt.setAttributeNS(null,\"rx\",kt.rx),Wt.setAttributeNS(null,\"ry\",kt.ry),F.appendChild(Wt)}let W=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");W.setAttributeNS(null,\"fill\",this._color);let $=w.createNS(\"http://www.w3.org/2000/svg\",\"path\");$.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\"),W.appendChild($);let X=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");X.setAttributeNS(null,\"opacity\",\"0.25\"),X.setAttributeNS(null,\"fill\",\"#000000\");let at=w.createNS(\"http://www.w3.org/2000/svg\",\"path\");at.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\"),X.appendChild(at);let gt=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");gt.setAttributeNS(null,\"transform\",\"translate(6.0, 7.0)\"),gt.setAttributeNS(null,\"fill\",\"#FFFFFF\");let _t=w.createNS(\"http://www.w3.org/2000/svg\",\"g\");_t.setAttributeNS(null,\"transform\",\"translate(8.0, 8.0)\");let yt=w.createNS(\"http://www.w3.org/2000/svg\",\"circle\");yt.setAttributeNS(null,\"fill\",\"#000000\"),yt.setAttributeNS(null,\"opacity\",\"0.25\"),yt.setAttributeNS(null,\"cx\",\"5.5\"),yt.setAttributeNS(null,\"cy\",\"5.5\"),yt.setAttributeNS(null,\"r\",\"5.4999962\");let At=w.createNS(\"http://www.w3.org/2000/svg\",\"circle\");At.setAttributeNS(null,\"fill\",\"#FFFFFF\"),At.setAttributeNS(null,\"cx\",\"5.5\"),At.setAttributeNS(null,\"cy\",\"5.5\"),At.setAttributeNS(null,\"r\",\"5.4999962\"),_t.appendChild(yt),_t.appendChild(At),O.appendChild(F),O.appendChild(W),O.appendChild(X),O.appendChild(gt),O.appendChild(_t),f.appendChild(O),f.setAttributeNS(null,\"height\",v*this._scale+\"px\"),f.setAttributeNS(null,\"width\",b*this._scale+\"px\"),this._element.appendChild(f),this._offset=s.P.convert(l&&l.offset||[0,-14])}if(this._element.classList.add(\"maplibregl-marker\"),this._element.addEventListener(\"dragstart\",f=>{f.preventDefault()}),this._element.addEventListener(\"mousedown\",f=>{f.preventDefault()}),hl(this._element,this._anchor,\"marker\"),l&&l.className)for(let f of l.className.split(\" \"))this._element.classList.add(f);this._popup=null}addTo(l){return this.remove(),this._map=l,l.getCanvasContainer().appendChild(this._element),l.on(\"move\",this._update),l.on(\"moveend\",this._update),l.on(\"terrain\",this._update),this.setDraggable(this._draggable),this._update(),this._map.on(\"click\",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off(\"click\",this._onMapClick),this._map.off(\"move\",this._update),this._map.off(\"moveend\",this._update),this._map.off(\"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),w.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=s.M.convert(l),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(l){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),l){if(!(\"offset\"in l.options)){let b=Math.abs(13.5)/Math.SQRT2;l.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-38.1],\"bottom-left\":[b,-1*(38.1-13.5+b)],\"bottom-right\":[-b,-1*(38.1-13.5+b)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=l,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let l=this._popup;return l?(l.isOpen()?l.remove():l.addTo(this._map),this):this}_updateOpacity(l=!1){if(!this._map.terrain)return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(l)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let f=this._map,v=f.terrain.depthAtPoint(this._pos),b=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,b)-v<.006)return void(this._element.style.opacity=this._opacity);let M=-this._offset.y/f.transform._pixelPerMeter,O=Math.sin(f.getPitch()*Math.PI/180)*M,F=f.terrain.depthAtPoint(new s.P(this._pos.x,this._pos.y-this._offset.y)),U=f.transform.lngLatToCameraDepth(this._lngLat,b+O);this._element.style.opacity=U-F>.006?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(l){return this._offset=s.P.convert(l),this._update(),this}addClassName(l){this._element.classList.add(l)}removeClassName(l){this._element.classList.remove(l)}toggleClassName(l){return this._element.classList.toggle(l)}setDraggable(l){return this._draggable=!!l,this._map&&(l?(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(l){return this._rotation=l||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(l){return this._rotationAlignment=l||\"auto\",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(l){return this._pitchAlignment=l&&l!==\"auto\"?l:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(l,f){return l===void 0&&f===void 0&&(this._opacity=\"1\",this._opacityWhenCovered=\"0.2\"),l!==void 0&&(this._opacity=l),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}let Bd={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},dh=0,Is=!1,aA={maxWidth:100,unit:\"metric\"};function ph(T,l,f){let v=f&&f.maxWidth||100,b=T._container.clientHeight/2,M=T.unproject([0,b]),O=T.unproject([v,b]),F=M.distanceTo(O);if(f&&f.unit===\"imperial\"){let U=3.2808*F;U>5280?fl(l,v,U/5280,T._getUIString(\"ScaleControl.Miles\")):fl(l,v,U,T._getUIString(\"ScaleControl.Feet\"))}else f&&f.unit===\"nautical\"?fl(l,v,F/1852,T._getUIString(\"ScaleControl.NauticalMiles\")):F>=1e3?fl(l,v,F/1e3,T._getUIString(\"ScaleControl.Kilometers\")):fl(l,v,F,T._getUIString(\"ScaleControl.Meters\"))}function fl(T,l,f,v){let b=function(M){let O=Math.pow(10,`${Math.floor(M)}`.length-1),F=M/O;return F=F>=10?10:F>=5?5:F>=3?3:F>=2?2:F>=1?1:function(U){let W=Math.pow(10,Math.ceil(-Math.log(U)/Math.LN10));return Math.round(U*W)/W}(F),O*F}(f);T.style.width=l*(b/f)+\"px\",T.innerHTML=`${b} ${v}`}let Oc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\"},Bc=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function lA(T){if(T){if(typeof T==\"number\"){let l=Math.round(Math.abs(T)/Math.SQRT2);return{center:new s.P(0,0),top:new s.P(0,T),\"top-left\":new s.P(l,l),\"top-right\":new s.P(-l,l),bottom:new s.P(0,-T),\"bottom-left\":new s.P(l,-l),\"bottom-right\":new s.P(-l,-l),left:new s.P(T,0),right:new s.P(-T,0)}}if(T instanceof s.P||Array.isArray(T)){let l=s.P.convert(T);return{center:l,top:l,\"top-left\":l,\"top-right\":l,bottom:l,\"bottom-left\":l,\"bottom-right\":l,left:l,right:l}}return{center:s.P.convert(T.center||[0,0]),top:s.P.convert(T.top||[0,0]),\"top-left\":s.P.convert(T[\"top-left\"]||[0,0]),\"top-right\":s.P.convert(T[\"top-right\"]||[0,0]),bottom:s.P.convert(T.bottom||[0,0]),\"bottom-left\":s.P.convert(T[\"bottom-left\"]||[0,0]),\"bottom-right\":s.P.convert(T[\"bottom-right\"]||[0,0]),left:s.P.convert(T.left||[0,0]),right:s.P.convert(T.right||[0,0])}}return lA(new s.P(0,0))}let cA=o;n.AJAXError=s.bd,n.Evented=s.E,n.LngLat=s.M,n.MercatorCoordinate=s.Y,n.Point=s.P,n.addProtocol=s.be,n.config=s.a,n.removeProtocol=s.bf,n.AttributionControl=r0,n.BoxZoomHandler=Sf,n.CanvasSource=Ol,n.CooperativeGesturesHandler=Rd,n.DoubleClickZoomHandler=sA,n.DragPanHandler=t0,n.DragRotateHandler=u_,n.EdgeInsets=mu,n.FullscreenControl=class extends s.E{constructor(T={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,T&&T.container&&(T.container instanceof HTMLElement?this._container=T.container:s.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(T){return this._map=T,this._container||(this._container=this._map.getContainer()),this._controlContainer=w.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),this._controlContainer}onRemove(){w.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let T=this._fullscreenButton=w.create(\"button\",\"maplibregl-ctrl-fullscreen\",this._controlContainer);w.create(\"span\",\"maplibregl-ctrl-icon\",T).setAttribute(\"aria-hidden\",\"true\"),T.type=\"button\",this._updateTitle(),this._fullscreenButton.addEventListener(\"click\",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let T=this._getTitle();this._fullscreenButton.setAttribute(\"aria-label\",T),this._fullscreenButton.title=T}_getTitle(){return this._map._getUIString(this._isFullscreen()?\"FullscreenControl.Exit\":\"FullscreenControl.Enter\")}_isFullscreen(){return this._fullscreen}_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 s.k(\"fullscreenstart\")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new s.k(\"fullscreenend\")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"),this._handleFullscreenChange(),this._map.resize()}},n.GeoJSONSource=ei,n.GeolocateControl=class extends s.E{constructor(T){super(),this._onSuccess=l=>{if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.k(\"outofmaxbounds\",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"BACKGROUND\":case\"BACKGROUND_ERROR\":this._watchState=\"BACKGROUND\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==\"OFF\"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!==\"ACTIVE_LOCK\"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"),this.fire(new s.k(\"geolocate\",l)),this._finish()}},this._updateCamera=l=>{let f=new s.M(l.coords.longitude,l.coords.latitude),v=l.coords.accuracy,b=this._map.getBearing(),M=s.e({bearing:b},this.options.fitBoundsOptions),O=ln.fromLngLat(f,v);this._map.fitBounds(O,M,{geolocateSource:!0})},this._updateMarker=l=>{if(l){let f=new s.M(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=l=>{if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.disabled=!0;let f=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.title=f,this._geolocateButton.setAttribute(\"aria-label\",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&Is)return;this._setErrorState()}this._watchState!==\"OFF\"&&this.options.showUserLocation&&this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"),this.fire(new s.k(\"error\",l)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=l=>{if(this._map){if(this._container.addEventListener(\"contextmenu\",f=>f.preventDefault()),this._geolocateButton=w.create(\"button\",\"maplibregl-ctrl-geolocate\",this._container),w.create(\"span\",\"maplibregl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",l===!1){s.w(\"Geolocation support is not available so the GeolocateControl will be disabled.\");let f=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute(\"aria-label\",f)}else{let f=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.title=f,this._geolocateButton.setAttribute(\"aria-label\",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=w.create(\"div\",\"maplibregl-user-location-dot\"),this._userLocationDotMarker=new Od({element:this._dotElement}),this._circleElement=w.create(\"div\",\"maplibregl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new Od({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on(\"movestart\",f=>{f.geolocateSource||this._watchState!==\"ACTIVE_LOCK\"||f.originalEvent&&f.originalEvent.type===\"resize\"||(this._watchState=\"BACKGROUND\",this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this.fire(new s.k(\"trackuserlocationend\")))})}},this.options=s.e({},Bd,T)}onAdd(T){return this._map=T,this._container=w.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),function(l=!1){return s._(this,void 0,void 0,function*(){if(Dc!==void 0&&!l)return Dc;if(window.navigator.permissions===void 0)return Dc=!!window.navigator.geolocation,Dc;try{Dc=(yield window.navigator.permissions.query({name:\"geolocation\"})).state!==\"denied\"}catch{Dc=!!window.navigator.geolocation}return Dc})}().then(l=>this._setupUI(l)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),w.remove(this._container),this._map.off(\"zoom\",this._onZoom),this._map=void 0,dh=0,Is=!1}_isOutOfMapMaxBounds(T){let l=this._map.getMaxBounds(),f=T.coords;return l&&(f.longitudel.getEast()||f.latitudel.getNorth())}_setErrorState(){switch(this._watchState){case\"WAITING_ACTIVE\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");break;case\"ACTIVE_LOCK\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"BACKGROUND\":this._watchState=\"BACKGROUND_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"ACTIVE_ERROR\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let T=this._map.getBounds(),l=T.getSouthEast(),f=T.getNorthEast(),v=l.distanceTo(f),b=Math.ceil(this._accuracy/(v/this._map._container.clientHeight)*2);this._circleElement.style.width=`${b}px`,this._circleElement.style.height=`${b}px`}trigger(){if(!this._setup)return s.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 s.k(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":dh--,Is=!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 s.k(\"trackuserlocationend\"));break;case\"BACKGROUND\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.k(\"trackuserlocationstart\"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case\"WAITING_ACTIVE\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"ACTIVE_LOCK\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"OFF\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===\"OFF\"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let T;this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),dh++,dh>1?(T={maximumAge:6e5,timeout:0},Is=!0):(T=this.options.positionOptions,Is=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,T)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this.options.showUserLocation&&this._updateMarker(null)}},n.Hash=Qm,n.ImageSource=bn,n.KeyboardHandler=Jm,n.LngLatBounds=ln,n.LogoControl=ul,n.Map=class extends e0{constructor(T){if(s.bb.mark(s.bc.create),(T=s.e({},n0,T)).minZoom!=null&&T.maxZoom!=null&&T.minZoom>T.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(T.minPitch!=null&&T.maxPitch!=null&&T.minPitch>T.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(T.minPitch!=null&&T.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T.maxPitch!=null&&T.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(super(new bf(T.minZoom,T.maxZoom,T.minPitch,T.maxPitch,T.renderWorldCopies),{bearingSnap:T.bearingSnap}),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new s.k(\"webglcontextlost\",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new s.k(\"webglcontextrestored\",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=T.interactive,this._maxTileCacheSize=T.maxTileCacheSize,this._maxTileCacheZoomLevels=T.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=T.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=T.preserveDrawingBuffer,this._antialias=T.antialias,this._trackResize=T.trackResize,this._bearingSnap=T.bearingSnap,this._refreshExpiredTiles=T.refreshExpiredTiles,this._fadeDuration=T.fadeDuration,this._crossSourceCollisions=T.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=T.collectResourceTiming,this._renderTaskQueue=new Ex,this._controls=[],this._mapId=s.a3(),this._locale=s.e({},co,T.locale),this._clickTolerance=T.clickTolerance,this._overridePixelRatio=T.pixelRatio,this._maxCanvasSize=T.maxCanvasSize,this.transformCameraUpdate=T.transformCameraUpdate,this._imageQueueHandle=Z.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(T.transformRequest),typeof T.container==\"string\"){if(this._container=document.getElementById(T.container),!this._container)throw new Error(`Container '${T.container}' not found.`)}else{if(!(T.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=T.container}if(T.maxBounds&&this.setMaxBounds(T.maxBounds),this._setupContainer(),this._setupPainter(),this.on(\"move\",()=>this._update(!1)),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}),typeof window<\"u\"){addEventListener(\"online\",this._onWindowOnline,!1);let l=!1,f=$m(v=>{this._trackResize&&!this._removed&&this.resize(v)._update()},50);this._resizeObserver=new ResizeObserver(v=>{l?f(v):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bu(this,T),this._hash=T.hash&&new Qm(typeof T.hash==\"string\"&&T.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:T.center,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch}),T.bounds&&(this.resize(),this.fitBounds(T.bounds,s.e({},T.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=T.localIdeographFontFamily,this._validateStyle=T.validateStyle,T.style&&this.setStyle(T.style,{localIdeographFontFamily:T.localIdeographFontFamily}),T.attributionControl&&this.addControl(new r0(typeof T.attributionControl==\"boolean\"?void 0:T.attributionControl)),T.maplibreLogo&&this.addControl(new ul,T.logoPosition),this.on(\"style.load\",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on(\"data\",l=>{this._update(l.dataType===\"style\"),this.fire(new s.k(`${l.dataType}data`,l))}),this.on(\"dataloading\",l=>{this.fire(new s.k(`${l.dataType}dataloading`,l))}),this.on(\"dataabort\",l=>{this.fire(new s.k(\"sourcedataabort\",l))})}_getMapId(){return this._mapId}addControl(T,l){if(l===void 0&&(l=T.getDefaultPosition?T.getDefaultPosition():\"top-right\"),!T||!T.onAdd)return this.fire(new s.j(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));let f=T.onAdd(this);this._controls.push(T);let v=this._controlPositions[l];return l.indexOf(\"bottom\")!==-1?v.insertBefore(f,v.firstChild):v.appendChild(f),this}removeControl(T){if(!T||!T.onRemove)return this.fire(new s.j(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));let l=this._controls.indexOf(T);return l>-1&&this._controls.splice(l,1),T.onRemove(this),this}hasControl(T){return this._controls.indexOf(T)>-1}calculateCameraOptionsFromTo(T,l,f,v){return v==null&&this.terrain&&(v=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(T,l,f,v)}resize(T){var l;let f=this._containerDimensions(),v=f[0],b=f[1],M=this._getClampedPixelRatio(v,b);if(this._resizeCanvas(v,b,M),this.painter.resize(v,b,M),this.painter.overLimit()){let F=this.painter.context.gl;this._maxCanvasSize=[F.drawingBufferWidth,F.drawingBufferHeight];let U=this._getClampedPixelRatio(v,b);this._resizeCanvas(v,b,U),this.painter.resize(v,b,U)}this.transform.resize(v,b),(l=this._requestedCameraState)===null||l===void 0||l.resize(v,b);let O=!this._moving;return O&&(this.stop(),this.fire(new s.k(\"movestart\",T)).fire(new s.k(\"move\",T))),this.fire(new s.k(\"resize\",T)),O&&this.fire(new s.k(\"moveend\",T)),this}_getClampedPixelRatio(T,l){let{0:f,1:v}=this._maxCanvasSize,b=this.getPixelRatio(),M=T*b,O=l*b;return Math.min(M>f?f/M:1,O>v?v/O:1)*b}getPixelRatio(){var T;return(T=this._overridePixelRatio)!==null&&T!==void 0?T:devicePixelRatio}setPixelRatio(T){this._overridePixelRatio=T,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(T){return this.transform.setMaxBounds(ln.convert(T)),this._update()}setMinZoom(T){if((T=T??-2)>=-2&&T<=this.transform.maxZoom)return this.transform.minZoom=T,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=T,this._update(),this.getZoom()>T&&this.setZoom(T),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(T){if((T=T??0)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T>=0&&T<=this.transform.maxPitch)return this.transform.minPitch=T,this._update(),this.getPitch()85)throw new Error(\"maxPitch must be less than or equal to 85\");if(T>=this.transform.minPitch)return this.transform.maxPitch=T,this._update(),this.getPitch()>T&&this.setPitch(T),this;throw new Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(T){return this.transform.renderWorldCopies=T,this._update()}project(T){return this.transform.locationPoint(s.M.convert(T),this.style&&this.terrain)}unproject(T){return this.transform.pointLocation(s.P.convert(T),this.terrain)}isMoving(){var T;return this._moving||((T=this.handlers)===null||T===void 0?void 0:T.isMoving())}isZooming(){var T;return this._zooming||((T=this.handlers)===null||T===void 0?void 0:T.isZooming())}isRotating(){var T;return this._rotating||((T=this.handlers)===null||T===void 0?void 0:T.isRotating())}_createDelegatedListener(T,l,f){if(T===\"mouseenter\"||T===\"mouseover\"){let v=!1;return{layer:l,listener:f,delegates:{mousemove:M=>{let O=this.getLayer(l)?this.queryRenderedFeatures(M.point,{layers:[l]}):[];O.length?v||(v=!0,f.call(this,new Vi(T,this,M.originalEvent,{features:O}))):v=!1},mouseout:()=>{v=!1}}}}if(T===\"mouseleave\"||T===\"mouseout\"){let v=!1;return{layer:l,listener:f,delegates:{mousemove:O=>{(this.getLayer(l)?this.queryRenderedFeatures(O.point,{layers:[l]}):[]).length?v=!0:v&&(v=!1,f.call(this,new Vi(T,this,O.originalEvent)))},mouseout:O=>{v&&(v=!1,f.call(this,new Vi(T,this,O.originalEvent)))}}}}{let v=b=>{let M=this.getLayer(l)?this.queryRenderedFeatures(b.point,{layers:[l]}):[];M.length&&(b.features=M,f.call(this,b),delete b.features)};return{layer:l,listener:f,delegates:{[T]:v}}}}on(T,l,f){if(f===void 0)return super.on(T,l);let v=this._createDelegatedListener(T,l,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[T]=this._delegatedListeners[T]||[],this._delegatedListeners[T].push(v);for(let b in v.delegates)this.on(b,v.delegates[b]);return this}once(T,l,f){if(f===void 0)return super.once(T,l);let v=this._createDelegatedListener(T,l,f);for(let b in v.delegates)this.once(b,v.delegates[b]);return this}off(T,l,f){return f===void 0?super.off(T,l):(this._delegatedListeners&&this._delegatedListeners[T]&&(v=>{let b=this._delegatedListeners[T];for(let M=0;Mthis._updateStyle(T,l));let f=this.style&&l.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!T)),T?(this.style=new oo(this,l||{}),this.style.setEventedParent(this,{style:this.style}),typeof T==\"string\"?this.style.loadURL(T,l,f):this.style.loadJSON(T,l,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new oo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(T,l){if(typeof T==\"string\"){let f=this._requestManager.transformRequest(T,K.Style);s.h(f,new AbortController).then(v=>{this._updateDiff(v.data,l)}).catch(v=>{v&&this.fire(new s.j(v))})}else typeof T==\"object\"&&this._updateDiff(T,l)}_updateDiff(T,l){try{this.style.setState(T,l)&&this._update(!0)}catch(f){s.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(T,l)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():s.w(\"There is no style added to the map.\")}addSource(T,l){return this._lazyInitEmptyStyle(),this.style.addSource(T,l),this._update(!0)}isSourceLoaded(T){let l=this.style&&this.style.sourceCaches[T];if(l!==void 0)return l.loaded();this.fire(new s.j(new Error(`There is no source with ID '${T}'`)))}setTerrain(T){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),T){let l=this.style.sourceCaches[T.source];if(!l)throw new Error(`cannot load terrain, because there exists no source with ID: ${T.source}`);this.terrain===null&&l.reload();for(let f in this.style._layers){let v=this.style._layers[f];v.type===\"hillshade\"&&v.source===T.source&&s.w(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\")}this.terrain=new On(this.painter,l,T),this.painter.renderToTexture=new oA(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType===\"style\"?this.terrain.sourceCache.freeRtt():f.dataType===\"source\"&&f.tile&&(f.sourceId!==T.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on(\"data\",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new s.k(\"terrain\",{terrain:T})),this}getTerrain(){var T,l;return(l=(T=this.terrain)===null||T===void 0?void 0:T.options)!==null&&l!==void 0?l:null}areTilesLoaded(){let T=this.style&&this.style.sourceCaches;for(let l in T){let f=T[l]._tiles;for(let v in f){let b=f[v];if(b.state!==\"loaded\"&&b.state!==\"errored\")return!1}}return!0}removeSource(T){return this.style.removeSource(T),this._update(!0)}getSource(T){return this.style.getSource(T)}addImage(T,l,f={}){let{pixelRatio:v=1,sdf:b=!1,stretchX:M,stretchY:O,content:F}=f;if(this._lazyInitEmptyStyle(),!(l instanceof HTMLImageElement||s.b(l))){if(l.width===void 0||l.height===void 0)return this.fire(new s.j(new Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));{let{width:U,height:W,data:$}=l,X=l;return this.style.addImage(T,{data:new s.R({width:U,height:W},new Uint8Array($)),pixelRatio:v,stretchX:M,stretchY:O,content:F,sdf:b,version:0,userImage:X}),X.onAdd&&X.onAdd(this,T),this}}{let{width:U,height:W,data:$}=_.getImageData(l);this.style.addImage(T,{data:new s.R({width:U,height:W},$),pixelRatio:v,stretchX:M,stretchY:O,content:F,sdf:b,version:0})}}updateImage(T,l){let f=this.style.getImage(T);if(!f)return this.fire(new s.j(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));let v=l instanceof HTMLImageElement||s.b(l)?_.getImageData(l):l,{width:b,height:M,data:O}=v;if(b===void 0||M===void 0)return this.fire(new s.j(new Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));if(b!==f.data.width||M!==f.data.height)return this.fire(new s.j(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));let F=!(l instanceof HTMLImageElement||s.b(l));return f.data.replace(O,F),this.style.updateImage(T,f),this}getImage(T){return this.style.getImage(T)}hasImage(T){return T?!!this.style.getImage(T):(this.fire(new s.j(new Error(\"Missing required image id\"))),!1)}removeImage(T){this.style.removeImage(T)}loadImage(T){return Z.getImage(this._requestManager.transformRequest(T,K.Image),new AbortController)}listImages(){return this.style.listImages()}addLayer(T,l){return this._lazyInitEmptyStyle(),this.style.addLayer(T,l),this._update(!0)}moveLayer(T,l){return this.style.moveLayer(T,l),this._update(!0)}removeLayer(T){return this.style.removeLayer(T),this._update(!0)}getLayer(T){return this.style.getLayer(T)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(T,l,f){return this.style.setLayerZoomRange(T,l,f),this._update(!0)}setFilter(T,l,f={}){return this.style.setFilter(T,l,f),this._update(!0)}getFilter(T){return this.style.getFilter(T)}setPaintProperty(T,l,f,v={}){return this.style.setPaintProperty(T,l,f,v),this._update(!0)}getPaintProperty(T,l){return this.style.getPaintProperty(T,l)}setLayoutProperty(T,l,f,v={}){return this.style.setLayoutProperty(T,l,f,v),this._update(!0)}getLayoutProperty(T,l){return this.style.getLayoutProperty(T,l)}setGlyphs(T,l={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(T,l),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(T,l,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(T,l,f,v=>{v||this._update(!0)}),this}removeSprite(T){return this._lazyInitEmptyStyle(),this.style.removeSprite(T),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(T,l={}){return this._lazyInitEmptyStyle(),this.style.setSprite(T,l,f=>{f||this._update(!0)}),this}setLight(T,l={}){return this._lazyInitEmptyStyle(),this.style.setLight(T,l),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(T,l){return this.style.setFeatureState(T,l),this._update()}removeFeatureState(T,l){return this.style.removeFeatureState(T,l),this._update()}getFeatureState(T){return this.style.getFeatureState(T)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let T=0,l=0;return this._container&&(T=this._container.clientWidth||400,l=this._container.clientHeight||300),[T,l]}_setupContainer(){let T=this._container;T.classList.add(\"maplibregl-map\");let l=this._canvasContainer=w.create(\"div\",\"maplibregl-canvas-container\",T);this._interactive&&l.classList.add(\"maplibregl-interactive\"),this._canvas=w.create(\"canvas\",\"maplibregl-canvas\",l),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",\"0\"),this._canvas.setAttribute(\"aria-label\",\"Map\"),this._canvas.setAttribute(\"role\",\"region\");let f=this._containerDimensions(),v=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],v);let b=this._controlContainer=w.create(\"div\",\"maplibregl-control-container\",T),M=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach(O=>{M[O]=w.create(\"div\",`maplibregl-ctrl-${O} `,b)}),this._container.addEventListener(\"scroll\",this._onMapScroll,!1)}_resizeCanvas(T,l,f){this._canvas.width=Math.floor(f*T),this._canvas.height=Math.floor(f*l),this._canvas.style.width=`${T}px`,this._canvas.style.height=`${l}px`}_setupPainter(){let T={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},l=null;this._canvas.addEventListener(\"webglcontextcreationerror\",v=>{l={requestedAttributes:T},v&&(l.statusMessage=v.statusMessage,l.type=v.type)},{once:!0});let f=this._canvas.getContext(\"webgl2\",T)||this._canvas.getContext(\"webgl\",T);if(!f){let v=\"Failed to initialize WebGL\";throw l?(l.message=v,new Error(JSON.stringify(l))):new Error(v)}this.painter=new n_(f,this.transform),I.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(T){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||T,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(T){return this._update(),this._renderTaskQueue.add(T)}_cancelRenderFrame(T){this._renderTaskQueue.remove(T)}_render(T){let l=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(T),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let b=this.transform.zoom,M=_.now();this.style.zoomHistory.update(b,M);let O=new s.a8(b,{now:M,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),F=O.crossFadingFactor();F===1&&F===this._crossFadingFactor||(f=!0,this._crossFadingFactor=F),this.style.update(O)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new s.k(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.bb.mark(s.bc.load),this.fire(new s.k(\"load\"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let v=this._sourcesDirty||this._styleDirty||this._placementDirty;return v||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.k(\"idle\")),!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,s.bb.mark(s.bc.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var T;this._hash&&this._hash.remove();for(let f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<\"u\"&&removeEventListener(\"online\",this._onWindowOnline,!1),Z.removeThrottleControl(this._imageQueueHandle),(T=this._resizeObserver)===null||T===void 0||T.disconnect();let l=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");l&&l.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),w.remove(this._canvasContainer),w.remove(this._controlContainer),this._container.classList.remove(\"maplibregl-map\"),s.bb.clearMetrics(),this._removed=!0,this.fire(new s.k(\"remove\"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,_.frameAsync(this._frameRequest).then(T=>{s.bb.frame(T),this._frameRequest=null,this._render(T)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(T){this._showTileBoundaries!==T&&(this._showTileBoundaries=T,this._update())}get showPadding(){return!!this._showPadding}set showPadding(T){this._showPadding!==T&&(this._showPadding=T,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(T){this._showCollisionBoxes!==T&&(this._showCollisionBoxes=T,T?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(T){this._showOverdrawInspector!==T&&(this._showOverdrawInspector=T,this._update())}get repaint(){return!!this._repaint}set repaint(T){this._repaint!==T&&(this._repaint=T,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(T){this._vertices=T,this._update()}get version(){return Zn}getCameraTargetElevation(){return this.transform.elevation}},n.MapMouseEvent=Vi,n.MapTouchEvent=gu,n.MapWheelEvent=_u,n.Marker=Od,n.NavigationControl=class{constructor(T){this._updateZoomButtons=()=>{let l=this._map.getZoom(),f=l===this._map.getMaxZoom(),v=l===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=v,this._zoomInButton.setAttribute(\"aria-disabled\",f.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",v.toString())},this._rotateCompassArrow=()=>{let l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l},this._setButtonTitle=(l,f)=>{let v=this._map._getUIString(`NavigationControl.${f}`);l.title=v,l.setAttribute(\"aria-label\",v)},this.options=s.e({},s0,T),this._container=w.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",l=>l.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton(\"maplibregl-ctrl-zoom-in\",l=>this._map.zoomIn({},{originalEvent:l})),w.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"maplibregl-ctrl-zoom-out\",l=>this._map.zoomOut({},{originalEvent:l})),w.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(this._compass=this._createButton(\"maplibregl-ctrl-compass\",l=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:l}):this._map.resetNorth({},{originalEvent:l})}),this._compassIcon=w.create(\"span\",\"maplibregl-ctrl-icon\",this._compass),this._compassIcon.setAttribute(\"aria-hidden\",\"true\"))}onAdd(T){return this._map=T,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,\"ZoomIn\"),this._setButtonTitle(this._zoomOutButton,\"ZoomOut\"),this._map.on(\"zoom\",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,\"ResetBearing\"),this.options.visualizePitch&&this._map.on(\"pitch\",this._rotateCompassArrow),this._map.on(\"rotate\",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new o0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){w.remove(this._container),this.options.showZoom&&this._map.off(\"zoom\",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(\"pitch\",this._rotateCompassArrow),this._map.off(\"rotate\",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(T,l){let f=w.create(\"button\",T,this._container);return f.type=\"button\",f.addEventListener(\"click\",l),f}},n.Popup=class extends s.E{constructor(T){super(),this.remove=()=>(this._content&&w.remove(this._content),this._container&&(w.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 s.k(\"close\")),this),this._onMouseUp=l=>{this._update(l.point)},this._onMouseMove=l=>{this._update(l.point)},this._onDrag=l=>{this._update(l.point)},this._update=l=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=w.create(\"div\",\"maplibregl-popup\",this._map.getContainer()),this._tip=w.create(\"div\",\"maplibregl-popup-tip\",this._container),this._container.appendChild(this._content),this.options.className)for(let O of this.options.className.split(\" \"))this._container.classList.add(O);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Vs(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l)return;let f=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat),v=this.options.anchor,b=lA(this.options.offset);if(!v){let O=this._container.offsetWidth,F=this._container.offsetHeight,U;U=f.y+b.bottom.ythis._map.transform.height-F?[\"bottom\"]:[],f.xthis._map.transform.width-O/2&&U.push(\"right\"),v=U.length===0?\"bottom\":U.join(\"-\")}let M=f.add(b[v]).round();w.setTransform(this._container,`${fh[v]} translate(${M.x}px,${M.y}px)`),hl(this._container,v,\"popup\")},this._onClose=()=>{this.remove()},this.options=s.e(Object.create(Oc),T)}addTo(T){return this._map&&this.remove(),this._map=T,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 s.k(\"open\")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(T){return this._lngLat=s.M.convert(T),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(\"move\",this._update),this._map.off(\"mousemove\",this._onMouseMove),this._container&&this._container.classList.remove(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off(\"move\",this._update),this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"drag\",this._onDrag),this._container&&this._container.classList.add(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")),this}getElement(){return this._container}setText(T){return this.setDOMContent(document.createTextNode(T))}setHTML(T){let l=document.createDocumentFragment(),f=document.createElement(\"body\"),v;for(f.innerHTML=T;v=f.firstChild,v;)l.appendChild(v);return this.setDOMContent(l)}getMaxWidth(){var T;return(T=this._container)===null||T===void 0?void 0:T.style.maxWidth}setMaxWidth(T){return this.options.maxWidth=T,this._update(),this}setDOMContent(T){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=w.create(\"div\",\"maplibregl-popup-content\",this._container);return this._content.appendChild(T),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(T){this._container&&this._container.classList.add(T)}removeClassName(T){this._container&&this._container.classList.remove(T)}setOffset(T){return this.options.offset=T,this._update(),this}toggleClassName(T){if(this._container)return this._container.classList.toggle(T)}_createCloseButton(){this.options.closeButton&&(this._closeButton=w.create(\"button\",\"maplibregl-popup-close-button\",this._content),this._closeButton.type=\"button\",this._closeButton.setAttribute(\"aria-label\",\"Close popup\"),this._closeButton.innerHTML=\"×\",this._closeButton.addEventListener(\"click\",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let T=this._container.querySelector(Bc);T&&T.focus()}},n.RasterDEMTileSource=fu,n.RasterTileSource=xo,n.ScaleControl=class{constructor(T){this._onMove=()=>{ph(this._map,this._container,this.options)},this.setUnit=l=>{this.options.unit=l,ph(this._map,this._container,this.options)},this.options=s.e({},aA,T)}getDefaultPosition(){return\"bottom-left\"}onAdd(T){return this._map=T,this._container=w.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-scale\",T.getContainer()),this._map.on(\"move\",this._onMove),this._onMove(),this._container}onRemove(){w.remove(this._container),this._map.off(\"move\",this._onMove),this._map=void 0}},n.ScrollZoomHandler=Ul,n.Style=oo,n.TerrainControl=class{constructor(T){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=T}onAdd(T){return this._map=T,this._container=w.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._terrainButton=w.create(\"button\",\"maplibregl-ctrl-terrain\",this._container),w.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(){w.remove(this._container),this._map.off(\"terrain\",this._updateTerrainIcon),this._map=void 0}},n.TwoFingersTouchPitchHandler=vu,n.TwoFingersTouchRotateHandler=Ld,n.TwoFingersTouchZoomHandler=Pf,n.TwoFingersTouchZoomRotateHandler=cl,n.VectorTileSource=Jt,n.VideoSource=Ho,n.addSourceType=(T,l)=>s._(void 0,void 0,void 0,function*(){if(Mc(T))throw new Error(`A source type called \"${T}\" already exists.`);((f,v)=>{La[f]=v})(T,l)}),n.clearPrewarmedResources=function(){let T=Ca;T&&(T.isPreloaded()&&T.numActive()===1?(T.release(yo),Ca=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()\"))},n.getMaxParallelImageRequests=function(){return s.a.MAX_PARALLEL_IMAGE_REQUESTS},n.getRTLTextPluginStatus=function(){return me().getRTLTextPluginStatus()},n.getVersion=function(){return cA},n.getWorkerCount=function(){return aa.workerCount},n.getWorkerUrl=function(){return s.a.WORKER_URL},n.importScriptInWorkers=function(T){return Bi().broadcast(\"importScript\",T)},n.prewarm=function(){Li().acquire(yo)},n.setMaxParallelImageRequests=function(T){s.a.MAX_PARALLEL_IMAGE_REQUESTS=T},n.setRTLTextPlugin=function(T,l){return me().setRTLTextPlugin(T,l)},n.setWorkerCount=function(T){aa.workerCount=T},n.setWorkerUrl=function(T){s.a.WORKER_URL=T}});var i=e;return i})});var Z7=Nr((n6t,VE)=>{(function(e,t,r,i){\"use strict\";var n=[\"\",\"webkit\",\"Moz\",\"MS\",\"ms\",\"o\"],s=t.createElement(\"div\"),o=\"function\",c=Math.round,d=Math.abs,_=Date.now;function w(ut,dt,Ct){return setTimeout(K(ut,Ct),dt)}function I(ut,dt,Ct){return Array.isArray(ut)?(R(ut,Ct[dt],Ct),!0):!1}function R(ut,dt,Ct){var $t;if(ut)if(ut.forEach)ut.forEach(dt,Ct);else if(ut.length!==i)for($t=0;$t\\s*\\(/gm,\"{anonymous}()@\"):\"Unknown Stack Trace\",si=e.console&&(e.console.warn||e.console.log);return si&&si.call(e.console,$t,Ye),ut.apply(this,arguments)}}var j;typeof Object.assign!=\"function\"?j=function(dt){if(dt===i||dt===null)throw new TypeError(\"Cannot convert undefined or null to object\");for(var Ct=Object(dt),$t=1;$t-1}function oe(ut){return ut.trim().split(/\\s+/g)}function ae(ut,dt,Ct){if(ut.indexOf&&!Ct)return ut.indexOf(dt);for(var $t=0;$tNs[dt]}):$t=$t.sort()),$t}function cr(ut,dt){for(var Ct,$t,ge=dt[0].toUpperCase()+dt.slice(1),Ye=0;Ye1&&!Ct.firstMultiple?Ct.firstMultiple=Ms(dt):ge===1&&(Ct.firstMultiple=!1);var Ye=Ct.firstInput,si=Ct.firstMultiple,is=si?si.center:Ye.center,qn=dt.center=me($t);dt.timeStamp=_(),dt.deltaTime=dt.timeStamp-Ye.timeStamp,dt.angle=es(is,qn),dt.distance=ka(is,qn),Mc(Ct,dt),dt.offsetDirection=jn(dt.deltaX,dt.deltaY);var Ns=qo(dt.deltaTime,dt.deltaX,dt.deltaY);dt.overallVelocityX=Ns.x,dt.overallVelocityY=Ns.y,dt.overallVelocity=d(Ns.x)>d(Ns.y)?Ns.x:Ns.y,dt.scale=si?kr(si.pointers,$t):1,dt.rotation=si?we(si.pointers,$t):0,dt.maxPointers=Ct.prevInput?dt.pointers.length>Ct.prevInput.maxPointers?dt.pointers.length:Ct.prevInput.maxPointers:dt.pointers.length,ff(Ct,dt);var Oa=ut.element;Yt(dt.srcEvent.target,Oa)&&(Oa=dt.srcEvent.target),dt.target=Oa}function Mc(ut,dt){var Ct=dt.center,$t=ut.offsetDelta||{},ge=ut.prevDelta||{},Ye=ut.prevInput||{};(dt.eventType===Li||Ye.eventType===Bi)&&(ge=ut.prevDelta={x:Ye.deltaX||0,y:Ye.deltaY||0},$t=ut.offsetDelta={x:Ct.x,y:Ct.y}),dt.deltaX=ge.x+(Ct.x-$t.x),dt.deltaY=ge.y+(Ct.y-$t.y)}function ff(ut,dt){var Ct=ut.lastInterval||dt,$t=dt.timeStamp-Ct.timeStamp,ge,Ye,si,is;if(dt.eventType!=cs&&($t>Vo||Ct.velocity===i)){var qn=dt.deltaX-Ct.deltaX,Ns=dt.deltaY-Ct.deltaY,Oa=qo($t,qn,Ns);Ye=Oa.x,si=Oa.y,ge=d(Oa.x)>d(Oa.y)?Oa.x:Oa.y,is=jn(qn,Ns),ut.lastInterval=dt}else ge=Ct.velocity,Ye=Ct.velocityX,si=Ct.velocityY,is=Ct.direction;dt.velocity=ge,dt.velocityX=Ye,dt.velocityY=si,dt.direction=is}function Ms(ut){for(var dt=[],Ct=0;Ct=d(dt)?ut<0?Go:Wo:dt<0?ln:la}function ka(ut,dt,Ct){Ct||(Ct=ei);var $t=dt[Ct[0]]-ut[Ct[0]],ge=dt[Ct[1]]-ut[Ct[1]];return Math.sqrt($t*$t+ge*ge)}function es(ut,dt,Ct){Ct||(Ct=ei);var $t=dt[Ct[0]]-ut[Ct[0]],ge=dt[Ct[1]]-ut[Ct[1]];return Math.atan2(ge,$t)*180/Math.PI}function we(ut,dt){return es(dt[1],dt[0],Cn)+es(ut[1],ut[0],Cn)}function kr(ut,dt){return ka(dt[0],dt[1],Cn)/ka(ut[0],ut[1],Cn)}var Sr={mousedown:Li,mousemove:vo,mouseup:Bi},Ln=\"mousedown\",Ra=\"mousemove mouseup\";function gr(){this.evEl=Ln,this.evWin=Ra,this.pressed=!1,bn.apply(this,arguments)}Z(gr,bn,{handler:function(dt){var Ct=Sr[dt.type];Ct&Li&&dt.button===0&&(this.pressed=!0),Ct&vo&&dt.which!==1&&(Ct=Bi),this.pressed&&(Ct&Bi&&(this.pressed=!1),this.callback(this.manager,Ct,{pointers:[dt],changedPointers:[dt],pointerType:ol,srcEvent:dt}))}});var Ec={pointerdown:Li,pointermove:vo,pointerup:Bi,pointercancel:cs,pointerout:cs},Gn={2:yo,3:aa,4:ol,5:Ca},vt=\"pointerdown\",tt=\"pointermove pointerup pointercancel\";e.MSPointerEvent&&!e.PointerEvent&&(vt=\"MSPointerDown\",tt=\"MSPointerMove MSPointerUp MSPointerCancel\");function nt(){this.evEl=vt,this.evWin=tt,bn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}Z(nt,bn,{handler:function(dt){var Ct=this.store,$t=!1,ge=dt.type.toLowerCase().replace(\"ms\",\"\"),Ye=Ec[ge],si=Gn[dt.pointerType]||dt.pointerType,is=si==yo,qn=ae(Ct,dt.pointerId,\"pointerId\");Ye&Li&&(dt.button===0||is)?qn<0&&(Ct.push(dt),qn=Ct.length-1):Ye&(Bi|cs)&&($t=!0),!(qn<0)&&(Ct[qn]=dt,this.callback(this.manager,Ye,{pointers:Ct,changedPointers:[dt],pointerType:si,srcEvent:dt}),$t&&Ct.splice(qn,1))}});var ct={touchstart:Li,touchmove:vo,touchend:Bi,touchcancel:cs},mt=\"touchstart\",Rt=\"touchstart touchmove touchend touchcancel\";function Dt(){this.evTarget=mt,this.evWin=Rt,this.started=!1,bn.apply(this,arguments)}Z(Dt,bn,{handler:function(dt){var Ct=ct[dt.type];if(Ct===Li&&(this.started=!0),!!this.started){var $t=Ut.call(this,dt,Ct);Ct&(Bi|cs)&&$t[0].length-$t[1].length===0&&(this.started=!1),this.callback(this.manager,Ct,{pointers:$t[0],changedPointers:$t[1],pointerType:yo,srcEvent:dt})}}});function Ut(ut,dt){var Ct=ke(ut.touches),$t=ke(ut.changedTouches);return dt&(Bi|cs)&&(Ct=or(Ct.concat($t),\"identifier\",!0)),[Ct,$t]}var ft={touchstart:Li,touchmove:vo,touchend:Bi,touchcancel:cs},jt=\"touchstart touchmove touchend touchcancel\";function le(){this.evTarget=jt,this.targetIds={},bn.apply(this,arguments)}Z(le,bn,{handler:function(dt){var Ct=ft[dt.type],$t=ee.call(this,dt,Ct);$t&&this.callback(this.manager,Ct,{pointers:$t[0],changedPointers:$t[1],pointerType:yo,srcEvent:dt})}});function ee(ut,dt){var Ct=ke(ut.touches),$t=this.targetIds;if(dt&(Li|vo)&&Ct.length===1)return $t[Ct[0].identifier]=!0,[Ct,Ct];var ge,Ye,si=ke(ut.changedTouches),is=[],qn=this.target;if(Ye=Ct.filter(function(Ns){return Yt(Ns.target,qn)}),dt===Li)for(ge=0;ge-1&&$t.splice(Ye,1)};setTimeout(ge,re)}}function ni(ut){for(var dt=ut.srcEvent.clientX,Ct=ut.srcEvent.clientY,$t=0;$t-1&&this.requireFail.splice(dt,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(ut){return!!this.simultaneous[ut.id]},emit:function(ut){var dt=this,Ct=this.state;function $t(ge){dt.manager.emit(ge,ut)}Ct=Wn&&$t(dt.options.event+du(Ct))},tryEmit:function(ut){if(this.canEmit())return this.emit(ut);this.state=Rn},canEmit:function(){for(var ut=0;utdt.threshold&&ge&dt.direction},attrTest:function(ut){return so.prototype.attrTest.call(this,ut)&&(this.state&bo||!(this.state&bo)&&this.directionTest(ut))},emit:function(ut){this.pX=ut.deltaX,this.pY=ut.deltaY;var dt=df(ut.direction);dt&&(ut.additionalEvent=this.options.event+dt),this._super.emit.call(this,ut)}});function qi(){so.apply(this,arguments)}Z(qi,so,{defaults:{event:\"pinch\",threshold:0,pointers:2},getTouchAction:function(){return[en]},attrTest:function(ut){return this._super.attrTest.call(this,ut)&&(Math.abs(ut.scale-1)>this.options.threshold||this.state&bo)},emit:function(ut){if(ut.scale!==1){var dt=ut.scale<1?\"in\":\"out\";ut.additionalEvent=this.options.event+dt}this._super.emit.call(this,ut)}});function ch(){Hn.apply(this,arguments),this._timer=null,this._input=null}Z(ch,Hn,{defaults:{event:\"press\",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Dr]},process:function(ut){var dt=this.options,Ct=ut.pointers.length===dt.pointers,$t=ut.distancedt.time;if(this._input=ut,!$t||!Ct||ut.eventType&(Bi|cs)&&!ge)this.reset();else if(ut.eventType&Li)this.reset(),this._timer=w(function(){this.state=Sn,this.tryEmit()},dt.time,this);else if(ut.eventType&Bi)return Sn;return Rn},reset:function(){clearTimeout(this._timer)},emit:function(ut){this.state===Sn&&(ut&&ut.eventType&Bi?this.manager.emit(this.options.event+\"up\",ut):(this._input.timeStamp=_(),this.manager.emit(this.options.event,this._input)))}});function oo(){so.apply(this,arguments)}Z(oo,so,{defaults:{event:\"rotate\",threshold:0,pointers:2},getTouchAction:function(){return[en]},attrTest:function(ut){return this._super.attrTest.call(this,ut)&&(Math.abs(ut.rotation)>this.options.threshold||this.state&bo)}});function uh(){so.apply(this,arguments)}Z(uh,so,{defaults:{event:\"swipe\",threshold:10,velocity:.3,direction:Jt|xo,pointers:1},getTouchAction:function(){return Da.prototype.getTouchAction.call(this)},attrTest:function(ut){var dt=this.options.direction,Ct;return dt&(Jt|xo)?Ct=ut.overallVelocity:dt&Jt?Ct=ut.overallVelocityX:dt&xo&&(Ct=ut.overallVelocityY),this._super.attrTest.call(this,ut)&&dt&ut.offsetDirection&&ut.distance>this.options.threshold&&ut.maxPointers==this.options.pointers&&d(Ct)>this.options.velocity&&ut.eventType&Bi},emit:function(ut){var dt=df(ut.offsetDirection);dt&&this.manager.emit(this.options.event+dt,ut),this.manager.emit(this.options.event,ut)}});function Zo(){Hn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}Z(Zo,Hn,{defaults:{event:\"tap\",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tn]},process:function(ut){var dt=this.options,Ct=ut.pointers.length===dt.pointers,$t=ut.distance{\"use strict\";qO.exports=v3;qO.exports.default=v3;function v3(e,t,r){r=r||2;var i=t&&t.length,n=i?t[0]*r:e.length,s=OH(e,0,n,r,!0),o=[];if(!s||s.next===s.prev)return o;var c,d,_,w,I,R,N;if(i&&(s=pdt(e,t,s,r)),e.length>80*r){c=_=e[0],d=w=e[1];for(var j=r;j_&&(_=I),R>w&&(w=R);N=Math.max(_-c,w-d),N=N!==0?32767/N:0}return R2(s,o,r,c,d,N,0),o}function OH(e,t,r,i,n){var s,o;if(n===HO(e,t,r,i)>0)for(s=t;s=t;s-=i)o=DH(s,e[s],e[s+1],o);return o&&x3(o,o.next)&&(O2(o),o=o.next),o}function kg(e,t){if(!e)return e;t||(t=e);var r=e,i;do if(i=!1,!r.steiner&&(x3(r,r.next)||ys(r.prev,r,r.next)===0)){if(O2(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function R2(e,t,r,i,n,s,o){if(e){!o&&s&&ydt(e,i,n,s);for(var c=e,d,_;e.prev!==e.next;){if(d=e.prev,_=e.next,s?hdt(e,i,n,s):udt(e)){t.push(d.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),O2(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=fdt(kg(e),t,r),R2(e,t,r,i,n,s,2)):o===2&&ddt(e,t,r,i,n,s):R2(kg(e),t,r,i,n,s,1);break}}}}function udt(e){var t=e.prev,r=e,i=e.next;if(ys(t,r,i)>=0)return!1;for(var n=t.x,s=r.x,o=i.x,c=t.y,d=r.y,_=i.y,w=ns?n>o?n:o:s>o?s:o,N=c>d?c>_?c:_:d>_?d:_,j=i.next;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&Nv(n,c,s,d,o,_,j.x,j.y)&&ys(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function hdt(e,t,r,i){var n=e.prev,s=e,o=e.next;if(ys(n,s,o)>=0)return!1;for(var c=n.x,d=s.x,_=o.x,w=n.y,I=s.y,R=o.y,N=cd?c>_?c:_:d>_?d:_,it=w>I?w>R?w:R:I>R?I:R,Z=GO(N,j,t,r,i),K=GO(Y,it,t,r,i),J=e.prevZ,ht=e.nextZ;J&&J.z>=Z&&ht&&ht.z<=K;){if(J.x>=N&&J.x<=Y&&J.y>=j&&J.y<=it&&J!==n&&J!==o&&Nv(c,w,d,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0||(J=J.prevZ,ht.x>=N&&ht.x<=Y&&ht.y>=j&&ht.y<=it&&ht!==n&&ht!==o&&Nv(c,w,d,I,_,R,ht.x,ht.y)&&ys(ht.prev,ht,ht.next)>=0))return!1;ht=ht.nextZ}for(;J&&J.z>=Z;){if(J.x>=N&&J.x<=Y&&J.y>=j&&J.y<=it&&J!==n&&J!==o&&Nv(c,w,d,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ht&&ht.z<=K;){if(ht.x>=N&&ht.x<=Y&&ht.y>=j&&ht.y<=it&&ht!==n&&ht!==o&&Nv(c,w,d,I,_,R,ht.x,ht.y)&&ys(ht.prev,ht,ht.next)>=0)return!1;ht=ht.nextZ}return!0}function fdt(e,t,r){var i=e;do{var n=i.prev,s=i.next.next;!x3(n,s)&&BH(n,i,i.next,s)&&D2(n,s)&&D2(s,n)&&(t.push(n.i/r|0),t.push(i.i/r|0),t.push(s.i/r|0),O2(i),O2(i.next),i=e=s),i=i.next}while(i!==e);return kg(i)}function ddt(e,t,r,i,n,s){var o=e;do{for(var c=o.next.next;c!==o.prev;){if(o.i!==c.i&&bdt(o,c)){var d=FH(o,c);o=kg(o,o.next),d=kg(d,d.next),R2(o,t,r,i,n,s,0),R2(d,t,r,i,n,s,0);return}c=c.next}o=o.next}while(o!==e)}function pdt(e,t,r,i){var n=[],s,o,c,d,_;for(s=0,o=t.length;s=r.next.y&&r.next.y!==r.y){var c=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(c<=i&&c>s&&(s=c,o=r.x=r.x&&r.x>=_&&i!==r.x&&Nv(no.x||r.x===o.x&&_dt(o,r)))&&(o=r,I=R)),r=r.next;while(r!==d);return o}function _dt(e,t){return ys(e.prev,e,t.prev)<0&&ys(t.next,e,e.next)<0}function ydt(e,t,r,i){var n=e;do n.z===0&&(n.z=GO(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,vdt(n)}function vdt(e){var t,r,i,n,s,o,c,d,_=1;do{for(r=e,e=null,s=null,o=0;r;){for(o++,i=r,c=0,t=0;t<_&&(c++,i=i.nextZ,!!i);t++);for(d=_;c>0||d>0&&i;)c!==0&&(d===0||!i||r.z<=i.z)?(n=r,r=r.nextZ,c--):(n=i,i=i.nextZ,d--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;r=i}s.nextZ=null,_*=2}while(o>1);return e}function GO(e,t,r,i,n){return e=(e-r)*n|0,t=(t-i)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function xdt(e){var t=e,r=e;do(t.x=(e-o)*(s-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(s-c)>=(n-o)*(i-c)}function bdt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!wdt(e,t)&&(D2(e,t)&&D2(t,e)&&Sdt(e,t)&&(ys(e.prev,e,t.prev)||ys(e,t.prev,t))||x3(e,t)&&ys(e.prev,e,e.next)>0&&ys(t.prev,t,t.next)>0)}function ys(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function x3(e,t){return e.x===t.x&&e.y===t.y}function BH(e,t,r,i){var n=y3(ys(e,t,r)),s=y3(ys(e,t,i)),o=y3(ys(r,i,e)),c=y3(ys(r,i,t));return!!(n!==s&&o!==c||n===0&&_3(e,r,t)||s===0&&_3(e,i,t)||o===0&&_3(r,e,i)||c===0&&_3(r,t,i))}function _3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function y3(e){return e>0?1:e<0?-1:0}function wdt(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&BH(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function D2(e,t){return ys(e.prev,e,e.next)<0?ys(e,t,e.next)>=0&&ys(e,e.prev,t)>=0:ys(e,t,e.prev)<0||ys(e,e.next,t)<0}function Sdt(e,t){var r=e,i=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function FH(e,t){var r=new WO(e.i,e.x,e.y),i=new WO(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function DH(e,t,r,i){var n=new WO(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function O2(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 WO(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}v3.deviation=function(e,t,r,i){var n=t&&t.length,s=n?t[0]*r:e.length,o=Math.abs(HO(e,0,s,r));if(n)for(var c=0,d=t.length;c0&&(i+=e[n-1].length,r.holes.push(i))}return r}});var zB=Nr(fx=>{\"use strict\";Object.defineProperty(fx,\"__esModule\",{value:!0});fx.DefaultSerializer=fx.extendSerializer=void 0;function D_t(e,t){let r=e.deserialize.bind(e),i=e.serialize.bind(e);return{deserialize(n){return t.deserialize(n,r)},serialize(n){return t.serialize(n,i)}}}fx.extendSerializer=D_t;var M$={deserialize(e){return Object.assign(Error(e.message),{name:e.name,stack:e.stack})},serialize(e){return{__error_marker:\"$$error\",message:e.message,name:e.name,stack:e.stack}}},O_t=e=>e&&typeof e==\"object\"&&\"__error_marker\"in e&&e.__error_marker===\"$$error\";fx.DefaultSerializer={deserialize(e){return O_t(e)?M$.deserialize(e):e},serialize(e){return e instanceof Error?M$.serialize(e):e}}});var dx=Nr(Cm=>{\"use strict\";Object.defineProperty(Cm,\"__esModule\",{value:!0});Cm.serialize=Cm.deserialize=Cm.registerSerializer=void 0;var E$=zB(),yI=E$.DefaultSerializer;function B_t(e){yI=E$.extendSerializer(yI,e)}Cm.registerSerializer=B_t;function F_t(e){return yI.deserialize(e)}Cm.deserialize=F_t;function z_t(e){return yI.serialize(e)}Cm.serialize=z_t});var I$=Nr(px=>{\"use strict\";Object.defineProperty(px,\"__esModule\",{value:!0});px.getBundleURL=px.getBaseURL=void 0;var NB;function N_t(){return NB||(NB=U_t()),NB}px.getBundleURL=N_t;function U_t(){try{throw new Error}catch(e){let t=(\"\"+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\\/\\/[^)\\n]+/g);if(t)return P$(t[0])}return\"/\"}function P$(e){return(\"\"+e).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\\/\\/.+)?\\/[^/]+(?:\\?.*)?$/,\"$1\")+\"/\"}px.getBaseURL=P$});var VB=Nr(Lm=>{\"use strict\";Object.defineProperty(Lm,\"__esModule\",{value:!0});Lm.isWorkerRuntime=Lm.getWorkerImplementation=Lm.defaultPoolSize=void 0;var C$=I$();Lm.defaultPoolSize=typeof navigator<\"u\"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;var L$=e=>/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(e);function k$(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function V_t(){if(typeof Worker>\"u\")return class{constructor(){throw Error(\"No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.\")}};class e extends Worker{constructor(i,n){var s,o;typeof i==\"string\"&&n&&n._baseURL?i=new URL(i,n._baseURL):typeof i==\"string\"&&!L$(i)&&C$.getBundleURL().match(/^file:\\/\\//i)&&(i=new URL(i,C$.getBundleURL().replace(/\\/[^\\/]+$/,\"/\")),(!((s=n?.CORSWorkaround)!==null&&s!==void 0)||s)&&(i=k$(`importScripts(${JSON.stringify(i)});`))),typeof i==\"string\"&&L$(i)&&(!((o=n?.CORSWorkaround)!==null&&o!==void 0)||o)&&(i=k$(`importScripts(${JSON.stringify(i)});`)),super(i,n)}}class t extends e{constructor(i,n){let s=window.URL.createObjectURL(i);super(s,n)}static fromText(i,n){let s=new window.Blob([i],{type:\"text/javascript\"});return new t(s,n)}}return{blob:t,default:e}}var UB;function j_t(){return UB||(UB=V_t()),UB}Lm.getWorkerImplementation=j_t;function G_t(){let e=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!e)}Lm.isWorkerRuntime=G_t});var D$=Nr((Uoe,R$)=>{var Ax=1e3,mx=Ax*60,gx=mx*60,Hg=gx*24,W_t=Hg*7,H_t=Hg*365.25;R$.exports=function(e,t){t=t||{};var r=typeof e;if(r===\"string\"&&e.length>0)return q_t(e);if(r===\"number\"&&isFinite(e))return t.long?Y_t(e):Z_t(e);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(e))};function q_t(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),i=(t[2]||\"ms\").toLowerCase();switch(i){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return r*H_t;case\"weeks\":case\"week\":case\"w\":return r*W_t;case\"days\":case\"day\":case\"d\":return r*Hg;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return r*gx;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return r*mx;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return r*Ax;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return r;default:return}}}}function Z_t(e){var t=Math.abs(e);return t>=Hg?Math.round(e/Hg)+\"d\":t>=gx?Math.round(e/gx)+\"h\":t>=mx?Math.round(e/mx)+\"m\":t>=Ax?Math.round(e/Ax)+\"s\":e+\"ms\"}function Y_t(e){var t=Math.abs(e);return t>=Hg?vI(e,t,Hg,\"day\"):t>=gx?vI(e,t,gx,\"hour\"):t>=mx?vI(e,t,mx,\"minute\"):t>=Ax?vI(e,t,Ax,\"second\"):e+\" ms\"}function vI(e,t,r,i){var n=t>=r*1.5;return Math.round(e/r)+\" \"+i+(n?\"s\":\"\")}});var B$=Nr((Voe,O$)=>{function $_t(e){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=n,r.enabled=o,r.humanize=D$(),r.destroy=_,Object.keys(e).forEach(w=>{r[w]=e[w]}),r.names=[],r.skips=[],r.formatters={};function t(w){let I=0;for(let R=0;R{if(Ot===\"%%\")return\"%\";ht++;let te=r.formatters[Yt];if(typeof te==\"function\"){let oe=it[ht];Ot=te.call(Z,oe),it.splice(ht,1),ht--}return Ot}),r.formatArgs.call(Z,it),(Z.log||r.log).apply(Z,it)}return Y.namespace=w,Y.useColors=r.useColors(),Y.color=r.selectColor(w),Y.extend=i,Y.destroy=r.destroy,Object.defineProperty(Y,\"enabled\",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(N!==r.namespaces&&(N=r.namespaces,j=r.enabled(w)),j),set:it=>{R=it}}),typeof r.init==\"function\"&&r.init(Y),Y}function i(w,I){let R=r(this.namespace+(typeof I>\"u\"?\":\":I)+w);return R.log=this.log,R}function n(w){r.save(w),r.namespaces=w,r.names=[],r.skips=[];let I,R=(typeof w==\"string\"?w:\"\").split(/[\\s,]+/),N=R.length;for(I=0;I\"-\"+I)].join(\",\");return r.enable(\"\"),w}function o(w){if(w[w.length-1]===\"*\")return!0;let I,R;for(I=0,R=r.skips.length;I{uu.formatArgs=X_t;uu.save=K_t;uu.load=J_t;uu.useColors=Q_t;uu.storage=tyt();uu.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})();uu.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"];function Q_t(){return typeof window<\"u\"&&window.process&&(window.process.type===\"renderer\"||window.process.__nwjs)?!0:typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<\"u\"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<\"u\"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function X_t(e){if(e[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+e[0]+(this.useColors?\"%c \":\" \")+\"+\"+xI.exports.humanize(this.diff),!this.useColors)return;let t=\"color: \"+this.color;e.splice(1,0,t,\"color: inherit\");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,n=>{n!==\"%%\"&&(r++,n===\"%c\"&&(i=r))}),e.splice(i,0,t)}uu.log=console.debug||console.log||(()=>{});function K_t(e){try{e?uu.storage.setItem(\"debug\",e):uu.storage.removeItem(\"debug\")}catch{}}function J_t(){let e;try{e=uu.storage.getItem(\"debug\")}catch{}return!e&&typeof process<\"u\"&&\"env\"in process&&(e=process.env.DEBUG),e}function tyt(){try{return localStorage}catch{}}xI.exports=B$()(uu);var{formatters:eyt}=xI.exports;eyt.j=function(e){try{return JSON.stringify(e)}catch(t){return\"[UnexpectedJSONParseError]: \"+t.message}}});var dS=Nr(_x=>{\"use strict\";var ryt=_x&&_x.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(_x,\"__esModule\",{value:!0});_x.AsyncSerialScheduler=void 0;var jB=class{constructor(t){this._baseObserver=t,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(t=>this._baseObserver.error(t))}error(t){this._baseObserver.error(t)}schedule(t){let r=Promise.all(this._pendingPromises),i=[],n=o=>i.push(o),s=Promise.resolve().then(()=>ryt(this,void 0,void 0,function*(){yield r,yield t(n),this._pendingPromises.delete(s);for(let o of i)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(s),this._baseObserver.error(o)});this._pendingPromises.add(s)}};_x.AsyncSerialScheduler=jB});var z$=Nr(F$=>{\"use strict\";Object.defineProperty(F$,\"__esModule\",{value:!0})});var GB=Nr(Rl=>{\"use strict\";Object.defineProperty(Rl,\"__esModule\",{value:!0});Rl.registerObservableSymbol=Rl.getSymbol=Rl.hasSymbol=Rl.hasSymbols=void 0;var iyt=()=>typeof Symbol==\"function\";Rl.hasSymbols=iyt;var nyt=e=>Rl.hasSymbols()&&!!Symbol[e];Rl.hasSymbol=nyt;var syt=e=>Rl.hasSymbol(e)?Symbol[e]:\"@@\"+e;Rl.getSymbol=syt;function oyt(){Rl.hasSymbols()&&!Rl.hasSymbol(\"observable\")&&(Symbol.observable=Symbol(\"observable\"))}Rl.registerObservableSymbol=oyt;Rl.hasSymbol(\"asyncIterator\")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for(\"Symbol.asyncIterator\"))});var Sd=Nr(Fp=>{\"use strict\";Object.defineProperty(Fp,\"__esModule\",{value:!0});Fp.Observable=Fp.SubscriptionObserver=Fp.Subscription=void 0;z$();var AS=GB(),ayt=AS.getSymbol(\"iterator\"),HB=AS.getSymbol(\"observable\"),N$=AS.getSymbol(\"species\");function SI(e,t){let r=e[t];if(r!=null){if(typeof r!=\"function\")throw new TypeError(r+\" is not a function\");return r}}function pS(e){let t=e.constructor;return t!==void 0&&(t=t[N$],t===null&&(t=void 0)),t!==void 0?t:qg}function lyt(e){return e instanceof qg}function yx(e){yx.log?yx.log(e):setTimeout(()=>{throw e},0)}function wI(e){Promise.resolve().then(()=>{try{e()}catch(t){yx(t)}})}function U$(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t==\"function\")t();else{let r=SI(t,\"unsubscribe\");r&&r.call(t)}}catch(r){yx(r)}}function qB(e){e._observer=void 0,e._queue=void 0,e._state=\"closed\"}function cyt(e){let t=e._queue;if(t){e._queue=void 0,e._state=\"ready\";for(let r of t)if(V$(e,r.type,r.value),e._state===\"closed\")break}}function V$(e,t,r){e._state=\"running\";let i=e._observer;try{let n=i?SI(i,t):void 0;switch(t){case\"next\":n&&n.call(i,r);break;case\"error\":if(qB(e),n)n.call(i,r);else throw r;break;case\"complete\":qB(e),n&&n.call(i);break}}catch(n){yx(n)}e._state===\"closed\"?U$(e):e._state===\"running\"&&(e._state=\"ready\")}function WB(e,t,r){if(e._state!==\"closed\"){if(e._state===\"buffering\"){e._queue=e._queue||[],e._queue.push({type:t,value:r});return}if(e._state!==\"ready\"){e._state=\"buffering\",e._queue=[{type:t,value:r}],wI(()=>cyt(e));return}V$(e,t,r)}}var TI=class{constructor(t,r){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state=\"initializing\";let i=new MI(this);try{this._cleanup=r.call(void 0,i)}catch(n){i.error(n)}this._state===\"initializing\"&&(this._state=\"ready\")}get closed(){return this._state===\"closed\"}unsubscribe(){this._state!==\"closed\"&&(qB(this),U$(this))}};Fp.Subscription=TI;var MI=class{constructor(t){this._subscription=t}get closed(){return this._subscription._state===\"closed\"}next(t){WB(this._subscription,\"next\",t)}error(t){WB(this._subscription,\"error\",t)}complete(){WB(this._subscription,\"complete\")}};Fp.SubscriptionObserver=MI;var qg=class e{constructor(t){if(!(this instanceof e))throw new TypeError(\"Observable cannot be called as a function\");if(typeof t!=\"function\")throw new TypeError(\"Observable initializer must be a function\");this._subscriber=t}subscribe(t,r,i){return(typeof t!=\"object\"||t===null)&&(t={next:t,error:r,complete:i}),new TI(t,this._subscriber)}pipe(t,...r){let i=this;for(let n of[t,...r])i=n(i);return i}tap(t,r,i){let n=typeof t!=\"object\"||t===null?{next:t,error:r,complete:i}:t;return new e(s=>this.subscribe({next(o){n.next&&n.next(o),s.next(o)},error(o){n.error&&n.error(o),s.error(o)},complete(){n.complete&&n.complete(),s.complete()},start(o){n.start&&n.start(o)}}))}forEach(t){return new Promise((r,i)=>{if(typeof t!=\"function\"){i(new TypeError(t+\" is not a function\"));return}function n(){s.unsubscribe(),r(void 0)}let s=this.subscribe({next(o){try{t(o,n)}catch(c){i(c),s.unsubscribe()}},error(o){i(o)},complete(){r(void 0)}})})}map(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=pS(this);return new r(i=>this.subscribe({next(n){let s=n;try{s=t(n)}catch(o){return i.error(o)}i.next(s)},error(n){i.error(n)},complete(){i.complete()}}))}filter(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=pS(this);return new r(i=>this.subscribe({next(n){try{if(!t(n))return}catch(s){return i.error(s)}i.next(n)},error(n){i.error(n)},complete(){i.complete()}}))}reduce(t,r){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let i=pS(this),n=arguments.length>1,s=!1,o=r;return new i(c=>this.subscribe({next(d){let _=!s;if(s=!0,!_||n)try{o=t(o,d)}catch(w){return c.error(w)}else o=d},error(d){c.error(d)},complete(){if(!s&&!n)return c.error(new TypeError(\"Cannot reduce an empty sequence\"));c.next(o),c.complete()}}))}concat(...t){let r=pS(this);return new r(i=>{let n,s=0;function o(c){n=c.subscribe({next(d){i.next(d)},error(d){i.error(d)},complete(){s===t.length?(n=void 0,i.complete()):o(r.from(t[s++]))}})}return o(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=pS(this);return new r(i=>{let n=[],s=this.subscribe({next(c){let d;if(t)try{d=t(c)}catch(w){return i.error(w)}else d=c;let _=r.from(d).subscribe({next(w){i.next(w)},error(w){i.error(w)},complete(){let w=n.indexOf(_);w>=0&&n.splice(w,1),o()}});n.push(_)},error(c){i.error(c)},complete(){o()}});function o(){s.closed&&n.length===0&&i.complete()}return()=>{n.forEach(c=>c.unsubscribe()),s.unsubscribe()}})}[(Symbol.observable,HB)](){return this}static from(t){let r=typeof this==\"function\"?this:e;if(t==null)throw new TypeError(t+\" is not an object\");let i=SI(t,HB);if(i){let n=i.call(t);if(Object(n)!==n)throw new TypeError(n+\" is not an object\");return lyt(n)&&n.constructor===r?n:new r(s=>n.subscribe(s))}if(AS.hasSymbol(\"iterator\")){let n=SI(t,ayt);if(n)return new r(s=>{wI(()=>{if(!s.closed){for(let o of n.call(t))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(t))return new r(n=>{wI(()=>{if(!n.closed){for(let s of t)if(n.next(s),n.closed)return;n.complete()}})});throw new TypeError(t+\" is not observable\")}static of(...t){let r=typeof this==\"function\"?this:e;return new r(i=>{wI(()=>{if(!i.closed){for(let n of t)if(i.next(n),i.closed)return;i.complete()}})})}static get[N$](){return this}};Fp.Observable=qg;AS.hasSymbols()&&Object.defineProperty(qg,Symbol(\"extensions\"),{value:{symbol:HB,hostReportError:yx},configurable:!0});Fp.default=qg});var km=Nr(ZB=>{\"use strict\";Object.defineProperty(ZB,\"__esModule\",{value:!0});function uyt(e){typeof e==\"function\"?e():e&&typeof e.unsubscribe==\"function\"&&e.unsubscribe()}ZB.default=uyt});var j$=Nr(mS=>{\"use strict\";var hyt=mS&&mS.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(mS,\"__esModule\",{value:!0});var fyt=dS(),dyt=Sd(),pyt=km();function Ayt(e){return t=>new dyt.default(r=>{let i=new fyt.AsyncSerialScheduler(r),n=t.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>hyt(this,void 0,void 0,function*(){(yield e(s))&&o(s)}))}});return()=>pyt.default(n)})}mS.default=Ayt});var W$=Nr(vx=>{\"use strict\";Object.defineProperty(vx,\"__esModule\",{value:!0});vx.isIterator=vx.isAsyncIterator=void 0;var G$=GB();function myt(e){return e&&G$.hasSymbol(\"asyncIterator\")&&e[Symbol.asyncIterator]}vx.isAsyncIterator=myt;function gyt(e){return e&&G$.hasSymbol(\"iterator\")&&e[Symbol.iterator]}vx.isIterator=gyt});var q$=Nr(Zg=>{\"use strict\";var _yt=Zg&&Zg.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})},yyt=Zg&&Zg.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==\"function\"?__values(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=e[s]&&function(o){return new Promise(function(c,d){o=e[s](o),n(c,d,o.done,o.value)})}}function n(s,o,c,d){Promise.resolve(d).then(function(_){s({value:_,done:c})},o)}};Object.defineProperty(Zg,\"__esModule\",{value:!0});var vyt=dS(),H$=W$(),xyt=Sd(),byt=km();function wyt(e){return t=>new xyt.default(r=>{let i=new vyt.AsyncSerialScheduler(r),n=t.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>_yt(this,void 0,void 0,function*(){var c,d;let _=yield e(s);if(H$.isIterator(_)||H$.isAsyncIterator(_))try{for(var w=yyt(_),I;I=yield w.next(),!I.done;){let R=I.value;o(R)}}catch(R){c={error:R}}finally{try{I&&!I.done&&(d=w.return)&&(yield d.call(w))}finally{if(c)throw c.error}}else _.map(R=>o(R))}))}});return()=>byt.default(n)})}Zg.default=wyt});var Z$=Nr(YB=>{\"use strict\";Object.defineProperty(YB,\"__esModule\",{value:!0});var Syt=Sd();function Tyt(e){return new Syt.Observable(t=>{let r=0,i=setInterval(()=>{t.next(r++)},e);return()=>clearInterval(i)})}YB.default=Tyt});var Y$=Nr(gS=>{\"use strict\";var Myt=gS&&gS.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(gS,\"__esModule\",{value:!0});var Eyt=dS(),Pyt=Sd(),Iyt=km();function Cyt(e){return t=>new Pyt.default(r=>{let i=new Eyt.AsyncSerialScheduler(r),n=t.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>Myt(this,void 0,void 0,function*(){let c=yield e(s);o(c)}))}});return()=>Iyt.default(n)})}gS.default=Cyt});var Q$=Nr($B=>{\"use strict\";Object.defineProperty($B,\"__esModule\",{value:!0});var $$=Sd(),Lyt=km();function kyt(...e){return e.length===0?$$.Observable.from([]):new $$.Observable(t=>{let r=0,i=e.map(s=>s.subscribe({error(o){t.error(o),n()},next(o){t.next(o)},complete(){++r===e.length&&(t.complete(),n())}})),n=()=>{i.forEach(s=>Lyt.default(s))};return n})}$B.default=kyt});var KB=Nr(XB=>{\"use strict\";Object.defineProperty(XB,\"__esModule\",{value:!0});var Ryt=Sd(),QB=class extends Ryt.default{constructor(){super(t=>(this._observers.add(t),()=>this._observers.delete(t))),this._observers=new Set}next(t){for(let r of this._observers)r.next(t)}error(t){for(let r of this._observers)r.error(t)}complete(){for(let t of this._observers)t.complete()}};XB.default=QB});var X$=Nr(JB=>{\"use strict\";Object.defineProperty(JB,\"__esModule\",{value:!0});var Dyt=Sd(),Oyt=KB(),Byt=km();function Fyt(e){let t=new Oyt.default,r,i=0;return new Dyt.default(n=>{r||(r=e.subscribe(t));let s=t.subscribe(n);return i++,()=>{i--,s.unsubscribe(),i===0&&(Byt.default(r),r=void 0)}})}JB.default=Fyt});var K$=Nr(_S=>{\"use strict\";var zyt=_S&&_S.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(_S,\"__esModule\",{value:!0});var Nyt=dS(),Uyt=Sd(),Vyt=km();function jyt(e,t){return r=>new Uyt.default(i=>{let n,s=0,o=new Nyt.AsyncSerialScheduler(i),c=r.subscribe({complete(){o.complete()},error(d){o.error(d)},next(d){o.schedule(_=>zyt(this,void 0,void 0,function*(){n=yield e(s===0?typeof t>\"u\"?d:t:n,d,s++),_(n)}))}});return()=>Vyt.default(c)})}_S.default=jyt});var J$=Nr(Fs=>{\"use strict\";Object.defineProperty(Fs,\"__esModule\",{value:!0});Fs.unsubscribe=Fs.Subject=Fs.scan=Fs.Observable=Fs.multicast=Fs.merge=Fs.map=Fs.interval=Fs.flatMap=Fs.filter=void 0;var Gyt=j$();Object.defineProperty(Fs,\"filter\",{enumerable:!0,get:function(){return Gyt.default}});var Wyt=q$();Object.defineProperty(Fs,\"flatMap\",{enumerable:!0,get:function(){return Wyt.default}});var Hyt=Z$();Object.defineProperty(Fs,\"interval\",{enumerable:!0,get:function(){return Hyt.default}});var qyt=Y$();Object.defineProperty(Fs,\"map\",{enumerable:!0,get:function(){return qyt.default}});var Zyt=Q$();Object.defineProperty(Fs,\"merge\",{enumerable:!0,get:function(){return Zyt.default}});var Yyt=X$();Object.defineProperty(Fs,\"multicast\",{enumerable:!0,get:function(){return Yyt.default}});var $yt=Sd();Object.defineProperty(Fs,\"Observable\",{enumerable:!0,get:function(){return $yt.default}});var Qyt=K$();Object.defineProperty(Fs,\"scan\",{enumerable:!0,get:function(){return Qyt.default}});var Xyt=KB();Object.defineProperty(Fs,\"Subject\",{enumerable:!0,get:function(){return Xyt.default}});var Kyt=km();Object.defineProperty(Fs,\"unsubscribe\",{enumerable:!0,get:function(){return Kyt.default}})});var yS=Nr((iae,tQ)=>{tQ.exports=J$()});var eQ=Nr(EI=>{\"use strict\";Object.defineProperty(EI,\"__esModule\",{value:!0});EI.allSettled=void 0;function Jyt(e){return Promise.all(e.map(t=>{let r=s=>({status:\"fulfilled\",value:s}),i=s=>({status:\"rejected\",reason:s}),n=Promise.resolve(t);try{return n.then(r,i)}catch(s){return Promise.reject(s)}}))}EI.allSettled=Jyt});var rQ=Nr(vS=>{\"use strict\";Object.defineProperty(vS,\"__esModule\",{value:!0});vS.PoolEventType=void 0;var tvt;(function(e){e.initialized=\"initialized\",e.taskCanceled=\"taskCanceled\",e.taskCompleted=\"taskCompleted\",e.taskFailed=\"taskFailed\",e.taskQueued=\"taskQueued\",e.taskQueueDrained=\"taskQueueDrained\",e.taskStart=\"taskStart\",e.terminated=\"terminated\"})(tvt=vS.PoolEventType||(vS.PoolEventType={}))});var xS=Nr(ah=>{\"use strict\";Object.defineProperty(ah,\"__esModule\",{value:!0});ah.$worker=ah.$transferable=ah.$terminate=ah.$events=ah.$errors=void 0;ah.$errors=Symbol(\"thread.errors\");ah.$events=Symbol(\"thread.events\");ah.$terminate=Symbol(\"thread.terminate\");ah.$transferable=Symbol(\"thread.transferable\");ah.$worker=Symbol(\"thread.worker\")});var e6=Nr(PI=>{\"use strict\";Object.defineProperty(PI,\"__esModule\",{value:!0});PI.Thread=void 0;var t6=xS();function iQ(e){throw Error(e)}PI.Thread={errors(e){return e[t6.$errors]||iQ(\"Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},events(e){return e[t6.$events]||iQ(\"Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},terminate(e){return e[t6.$terminate]()}}});var aQ=Nr(lh=>{\"use strict\";var Yg=lh&&lh.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})},evt=lh&&lh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lh,\"__esModule\",{value:!0});lh.Pool=lh.Thread=lh.PoolEventType=void 0;var rvt=evt(bI()),r6=yS(),nQ=eQ(),ivt=VB(),oa=rQ();Object.defineProperty(lh,\"PoolEventType\",{enumerable:!0,get:function(){return oa.PoolEventType}});var sQ=e6();Object.defineProperty(lh,\"Thread\",{enumerable:!0,get:function(){return sQ.Thread}});var nvt=1;function svt(e){let t=[];for(let r=0;rsetTimeout(t,e))}function avt(e,t){return e.reduce((r,i)=>[...r,...t(i)],[])}function lvt(e){return e.replace(/\\W/g,\" \").trim().replace(/\\s+/g,\"-\")}function cvt(e,t){return svt(t).map(()=>({init:e(),runningTasks:[]}))}var II=class{constructor(t,r){this.eventSubject=new r6.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];let i=typeof r==\"number\"?{size:r}:r||{},{size:n=ivt.defaultPoolSize}=i;this.debug=rvt.default(`threads:pool:${lvt(i.name||String(nvt++))}`),this.options=i,this.workers=cvt(t,n),this.eventObservable=r6.multicast(r6.Observable.from(this.eventSubject)),Promise.all(this.workers.map(s=>s.init)).then(()=>this.eventSubject.next({type:oa.PoolEventType.initialized,size:this.workers.length}),s=>{this.debug(\"Error while initializing pool worker:\",s),this.eventSubject.error(s),this.initErrors.push(s)})}findIdlingWorker(){let{concurrency:t=1}=this.options;return this.workers.find(r=>r.runningTasks.length{t.runningTasks=t.runningTasks.filter(s=>s!==i)};yield ovt(0);try{yield this.runPoolTask(t,r)}finally{n(),this.isClosing||this.scheduleWork()}});t.runningTasks.push(i)})}scheduleWork(){this.debug(\"Attempt de-queueing a task in order to run it...\");let t=this.findIdlingWorker();if(!t)return;let r=this.taskQueue.shift();if(!r){this.debug(\"Task queue is empty\"),this.eventSubject.next({type:oa.PoolEventType.taskQueueDrained});return}this.run(t,r)}taskCompletion(t){return new Promise((r,i)=>{let n=this.events().subscribe(s=>{s.type===oa.PoolEventType.taskCompleted&&s.taskID===t?(n.unsubscribe(),r(s.returnValue)):s.type===oa.PoolEventType.taskFailed&&s.taskID===t?(n.unsubscribe(),i(s.error)):s.type===oa.PoolEventType.terminated&&(n.unsubscribe(),i(Error(\"Pool has been terminated before task was run.\")))})})}settled(t=!1){return Yg(this,void 0,void 0,function*(){let r=()=>avt(this.workers,s=>s.runningTasks),i=[],n=this.eventObservable.subscribe(s=>{s.type===oa.PoolEventType.taskFailed&&i.push(s.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):t&&this.taskQueue.length===0?(yield nQ.allSettled(r()),i):(yield new Promise((s,o)=>{let c=this.eventObservable.subscribe({next(d){d.type===oa.PoolEventType.taskQueueDrained&&(c.unsubscribe(),s(void 0))},error:o})}),yield nQ.allSettled(r()),n.unsubscribe(),i)})}completed(t=!1){return Yg(this,void 0,void 0,function*(){let r=this.settled(t),i=new Promise((s,o)=>{let c=this.eventObservable.subscribe({next(d){d.type===oa.PoolEventType.taskQueueDrained?(c.unsubscribe(),s(r)):d.type===oa.PoolEventType.taskFailed&&(c.unsubscribe(),o(d.error))},error:o})}),n=yield Promise.race([r,i]);if(n.length>0)throw n[0]})}events(){return this.eventObservable}queue(t){let{maxQueuedJobs:r=1/0}=this.options;if(this.isClosing)throw Error(\"Cannot schedule pool tasks after terminate() has been called.\");if(this.initErrors.length>0)throw this.initErrors[0];let i=this.nextTaskID++,n=this.taskCompletion(i);n.catch(o=>{this.debug(`Task #${i} errored:`,o)});let s={id:i,run:t,cancel:()=>{this.taskQueue.indexOf(s)!==-1&&(this.taskQueue=this.taskQueue.filter(o=>o!==s),this.eventSubject.next({type:oa.PoolEventType.taskCanceled,taskID:s.id}))},then:n.then.bind(n)};if(this.taskQueue.length>=r)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${s.id}...`),this.taskQueue.push(s),this.eventSubject.next({type:oa.PoolEventType.taskQueued,taskID:s.id}),this.scheduleWork(),s}terminate(t){return Yg(this,void 0,void 0,function*(){this.isClosing=!0,t||(yield this.completed(!0)),this.eventSubject.next({type:oa.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(r=>Yg(this,void 0,void 0,function*(){return sQ.Thread.terminate(yield r.init)})))})}};II.EventType=oa.PoolEventType;function oQ(e,t){return new II(e,t)}oQ.EventType=oa.PoolEventType;lh.Pool=oQ});var lQ=Nr(CI=>{\"use strict\";Object.defineProperty(CI,\"__esModule\",{value:!0});CI.createPromiseWithResolver=void 0;var uvt=()=>{};function hvt(){let e=!1,t,r=uvt;return[new Promise(s=>{e?s(t):r=s}),s=>{e=!0,t=s,r(t)}]}CI.createPromiseWithResolver=hvt});var cQ=Nr(bS=>{\"use strict\";Object.defineProperty(bS,\"__esModule\",{value:!0});bS.WorkerEventType=void 0;var uae=xS(),fvt;(function(e){e.internalError=\"internalError\",e.message=\"message\",e.termination=\"termination\"})(fvt=bS.WorkerEventType||(bS.WorkerEventType={}))});var hQ=Nr(LI=>{\"use strict\";Object.defineProperty(LI,\"__esModule\",{value:!0});LI.ObservablePromise=void 0;var dvt=yS(),pvt=()=>{},Avt=e=>e,uQ=e=>Promise.resolve().then(e);function mvt(e){throw e}function gvt(e){return e&&typeof e.then==\"function\"}var i6=class e extends dvt.Observable{constructor(t){super(r=>{let i=this,n=Object.assign(Object.assign({},r),{complete(){r.complete(),i.onCompletion()},error(s){r.error(s),i.onError(s)},next(s){r.next(s),i.onNext(s)}});try{return this.initHasRun=!0,t(n)}catch(s){n.error(s)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state=\"pending\"}onNext(t){this.firstValueSet||(this.firstValue=t,this.firstValueSet=!0)}onError(t){this.state=\"rejected\",this.rejection=t;for(let r of this.rejectionCallbacks)uQ(()=>r(t))}onCompletion(){this.state=\"fulfilled\";for(let t of this.fulfillmentCallbacks)uQ(()=>t(this.firstValue))}then(t,r){let i=t||Avt,n=r||mvt,s=!1;return new Promise((o,c)=>{let d=w=>{if(!s){s=!0;try{o(n(w))}catch(I){c(I)}}},_=w=>{try{o(i(w))}catch(I){d(I)}};if(this.initHasRun||this.subscribe({error:d}),this.state===\"fulfilled\")return o(i(this.firstValue));if(this.state===\"rejected\")return s=!0,o(n(this.rejection));this.fulfillmentCallbacks.push(_),this.rejectionCallbacks.push(d)})}catch(t){return this.then(void 0,t)}finally(t){let r=t||pvt;return this.then(i=>(r(),i),()=>r())}static from(t){return gvt(t)?new e(r=>{let i=s=>{r.next(s),r.complete()},n=s=>{r.error(s)};t.then(i,n)}):super.from(t)}};LI.ObservablePromise=i6});var wS=Nr(xx=>{\"use strict\";Object.defineProperty(xx,\"__esModule\",{value:!0});xx.Transfer=xx.isTransferDescriptor=void 0;var fQ=xS();function _vt(e){return!(!e||typeof e!=\"object\")}function yvt(e){return e&&typeof e==\"object\"&&e[fQ.$transferable]}xx.isTransferDescriptor=yvt;function vvt(e,t){if(!t){if(!_vt(e))throw Error();t=[e]}return{[fQ.$transferable]:!0,send:e,transferables:t}}xx.Transfer=vvt});var n6=Nr(Rm=>{\"use strict\";Object.defineProperty(Rm,\"__esModule\",{value:!0});Rm.WorkerMessageType=Rm.MasterMessageType=void 0;var xvt;(function(e){e.cancel=\"cancel\",e.run=\"run\"})(xvt=Rm.MasterMessageType||(Rm.MasterMessageType={}));var bvt;(function(e){e.error=\"error\",e.init=\"init\",e.result=\"result\",e.running=\"running\",e.uncaughtError=\"uncaughtError\"})(bvt=Rm.WorkerMessageType||(Rm.WorkerMessageType={}))});var gQ=Nr(Dm=>{\"use strict\";var wvt=Dm&&Dm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Dm,\"__esModule\",{value:!0});Dm.createProxyModule=Dm.createProxyFunction=void 0;var Svt=wvt(bI()),pQ=yS(),SS=dx(),dQ=hQ(),Tvt=wS(),TS=n6(),AQ=Svt.default(\"threads:master:messages\"),Mvt=1,Evt=e=>Array.from(new Set(e)),Pvt=e=>e&&e.type===TS.WorkerMessageType.error,Ivt=e=>e&&e.type===TS.WorkerMessageType.result,Cvt=e=>e&&e.type===TS.WorkerMessageType.running;function Lvt(e,t){return new pQ.Observable(r=>{let i,n=s=>{if(AQ(\"Message from worker:\",s.data),!(!s.data||s.data.uid!==t)){if(Cvt(s.data))i=s.data.resultType;else if(Ivt(s.data))i===\"promise\"?(typeof s.data.payload<\"u\"&&r.next(SS.deserialize(s.data.payload)),r.complete(),e.removeEventListener(\"message\",n)):(s.data.payload&&r.next(SS.deserialize(s.data.payload)),s.data.complete&&(r.complete(),e.removeEventListener(\"message\",n)));else if(Pvt(s.data)){let o=SS.deserialize(s.data.error);r.error(o),e.removeEventListener(\"message\",n)}}};return e.addEventListener(\"message\",n),()=>{if(i===\"observable\"||!i){let s={type:TS.MasterMessageType.cancel,uid:t};e.postMessage(s)}e.removeEventListener(\"message\",n)}})}function kvt(e){if(e.length===0)return{args:[],transferables:[]};let t=[],r=[];for(let i of e)Tvt.isTransferDescriptor(i)?(t.push(SS.serialize(i.send)),r.push(...i.transferables)):t.push(SS.serialize(i));return{args:t,transferables:r.length===0?r:Evt(r)}}function mQ(e,t){return(...r)=>{let i=Mvt++,{args:n,transferables:s}=kvt(r),o={type:TS.MasterMessageType.run,uid:i,method:t,args:n};AQ(\"Sending command to run function to worker:\",o);try{e.postMessage(o,s)}catch(c){return dQ.ObservablePromise.from(Promise.reject(c))}return dQ.ObservablePromise.from(pQ.multicast(Lvt(e,i)))}}Dm.createProxyFunction=mQ;function Rvt(e,t){let r={};for(let i of t)r[i]=mQ(e,i);return r}Dm.createProxyModule=Rvt});var xQ=Nr(Om=>{\"use strict\";var s6=Om&&Om.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})},Dvt=Om&&Om.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Om,\"__esModule\",{value:!0});Om.spawn=void 0;var o6=Dvt(bI()),Ovt=yS(),Bvt=dx(),Fvt=lQ(),kI=xS(),RI=cQ(),_Q=gQ(),zvt=o6.default(\"threads:master:messages\"),Nvt=o6.default(\"threads:master:spawn\"),vQ=o6.default(\"threads:master:thread-utils\"),Uvt=e=>e&&e.type===\"init\",Vvt=e=>e&&e.type===\"uncaughtError\",jvt=typeof process<\"u\"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function Gvt(e,t,r){return s6(this,void 0,void 0,function*(){let i,n=new Promise((o,c)=>{i=setTimeout(()=>c(Error(r)),t)}),s=yield Promise.race([e,n]);return clearTimeout(i),s})}function Wvt(e){return new Promise((t,r)=>{let i=n=>{zvt(\"Message from worker before finishing initialization:\",n.data),Uvt(n.data)?(e.removeEventListener(\"message\",i),t(n.data)):Vvt(n.data)&&(e.removeEventListener(\"message\",i),r(Bvt.deserialize(n.data.error)))};e.addEventListener(\"message\",i)})}function Hvt(e,t){return new Ovt.Observable(r=>{let i=s=>{let o={type:RI.WorkerEventType.message,data:s.data};r.next(o)},n=s=>{vQ(\"Unhandled promise rejection event in thread:\",s);let o={type:RI.WorkerEventType.internalError,error:Error(s.reason)};r.next(o)};e.addEventListener(\"message\",i),e.addEventListener(\"unhandledrejection\",n),t.then(()=>{let s={type:RI.WorkerEventType.termination};e.removeEventListener(\"message\",i),e.removeEventListener(\"unhandledrejection\",n),r.next(s),r.complete()})})}function qvt(e){let[t,r]=Fvt.createPromiseWithResolver();return{terminate:()=>s6(this,void 0,void 0,function*(){vQ(\"Terminating worker\"),yield e.terminate(),r()}),termination:t}}function yQ(e,t,r,i){let n=r.filter(s=>s.type===RI.WorkerEventType.internalError).map(s=>s.error);return Object.assign(e,{[kI.$errors]:n,[kI.$events]:r,[kI.$terminate]:i,[kI.$worker]:t})}function Zvt(e,t){return s6(this,void 0,void 0,function*(){Nvt(\"Initializing new thread\");let r=t&&t.timeout?t.timeout:jvt,n=(yield Gvt(Wvt(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:s,terminate:o}=qvt(e),c=Hvt(e,s);if(n.type===\"function\"){let d=_Q.createProxyFunction(e);return yQ(d,e,c,o)}else if(n.type===\"module\"){let d=_Q.createProxyModule(e,n.methods);return yQ(d,e,c,o)}else{let d=n.type;throw Error(`Worker init message states unexpected type of expose(): ${d}`)}})}Om.spawn=Zvt});var bQ=Nr(wc=>{\"use strict\";Object.defineProperty(wc,\"__esModule\",{value:!0});wc.Worker=wc.BlobWorker=wc.isWorkerRuntime=wc.Thread=wc.spawn=wc.Pool=void 0;var a6=VB();Object.defineProperty(wc,\"isWorkerRuntime\",{enumerable:!0,get:function(){return a6.isWorkerRuntime}});var Yvt=aQ();Object.defineProperty(wc,\"Pool\",{enumerable:!0,get:function(){return Yvt.Pool}});var $vt=xQ();Object.defineProperty(wc,\"spawn\",{enumerable:!0,get:function(){return $vt.spawn}});var Qvt=e6();Object.defineProperty(wc,\"Thread\",{enumerable:!0,get:function(){return Qvt.Thread}});wc.BlobWorker=a6.getWorkerImplementation().blob;wc.Worker=a6.getWorkerImplementation().default});var SQ=Nr((_ae,wQ)=>{\"use strict\";wQ.exports=e=>e?typeof Symbol.observable==\"symbol\"&&typeof e[Symbol.observable]==\"function\"?e===e[Symbol.observable]():typeof e[\"@@observable\"]==\"function\"?e===e[\"@@observable\"]():!1:!1});var TQ=Nr(l6=>{\"use strict\";Object.defineProperty(l6,\"__esModule\",{value:!0});var Xvt=function(){let t=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!t)},Kvt=function(t,r){self.postMessage(t,r)},Jvt=function(t){let r=n=>{t(n.data)},i=()=>{self.removeEventListener(\"message\",r)};return self.addEventListener(\"message\",r),i};l6.default={isWorkerRuntime:Xvt,postMessageToMaster:Kvt,subscribeToMasterMessages:Jvt}});var kQ=Nr(Sc=>{\"use strict\";var txt=Sc&&Sc.__awaiter||function(e,t,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function d(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?s(w.value):n(w.value).then(c,d)}_((i=i.apply(e,t||[])).next())})},CQ=Sc&&Sc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sc,\"__esModule\",{value:!0});Sc.expose=Sc.isWorkerRuntime=Sc.Transfer=Sc.registerSerializer=void 0;var ext=CQ(SQ()),Bm=dx(),rxt=wS(),Fm=n6(),hu=CQ(TQ()),ixt=dx();Object.defineProperty(Sc,\"registerSerializer\",{enumerable:!0,get:function(){return ixt.registerSerializer}});var nxt=wS();Object.defineProperty(Sc,\"Transfer\",{enumerable:!0,get:function(){return nxt.Transfer}});Sc.isWorkerRuntime=hu.default.isWorkerRuntime;var MQ=!1,MS=new Map,sxt=e=>e&&e.type===Fm.MasterMessageType.cancel,EQ=e=>e&&e.type===Fm.MasterMessageType.run,PQ=e=>ext.default(e)||oxt(e);function oxt(e){return e&&typeof e==\"object\"&&typeof e.subscribe==\"function\"}function LQ(e){return rxt.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function axt(){let e={type:Fm.WorkerMessageType.init,exposed:{type:\"function\"}};hu.default.postMessageToMaster(e)}function lxt(e){let t={type:Fm.WorkerMessageType.init,exposed:{type:\"module\",methods:e}};hu.default.postMessageToMaster(t)}function c6(e,t){let{payload:r,transferables:i}=LQ(t),n={type:Fm.WorkerMessageType.error,uid:e,error:Bm.serialize(r)};hu.default.postMessageToMaster(n,i)}function u6(e,t,r){let{payload:i,transferables:n}=LQ(r),s={type:Fm.WorkerMessageType.result,uid:e,complete:t?!0:void 0,payload:i};hu.default.postMessageToMaster(s,n)}function cxt(e,t){let r={type:Fm.WorkerMessageType.running,uid:e,resultType:t};hu.default.postMessageToMaster(r)}function DI(e){try{let t={type:Fm.WorkerMessageType.uncaughtError,error:Bm.serialize(e)};hu.default.postMessageToMaster(t)}catch(t){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:`,t,`\nOriginal error:`,e)}}function IQ(e,t,r){return txt(this,void 0,void 0,function*(){let i;try{i=t(...r)}catch(s){return c6(e,s)}let n=PQ(i)?\"observable\":\"promise\";if(cxt(e,n),PQ(i)){let s=i.subscribe(o=>u6(e,!1,Bm.serialize(o)),o=>{c6(e,Bm.serialize(o)),MS.delete(e)},()=>{u6(e,!0),MS.delete(e)});MS.set(e,s)}else try{let s=yield i;u6(e,!0,Bm.serialize(s))}catch(s){c6(e,Bm.serialize(s))}})}function uxt(e){if(!hu.default.isWorkerRuntime())throw Error(\"expose() called in the master thread.\");if(MQ)throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");if(MQ=!0,typeof e==\"function\")hu.default.subscribeToMasterMessages(t=>{EQ(t)&&!t.method&&IQ(t.uid,e,t.args.map(Bm.deserialize))}),axt();else if(typeof e==\"object\"&&e){hu.default.subscribeToMasterMessages(r=>{EQ(r)&&r.method&&IQ(r.uid,e[r.method],r.args.map(Bm.deserialize))});let t=Object.keys(e).filter(r=>typeof e[r]==\"function\");lxt(t)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);hu.default.subscribeToMasterMessages(t=>{if(sxt(t)){let r=t.uid,i=MS.get(r);i&&(i.unsubscribe(),MS.delete(r))}})}Sc.expose=uxt;typeof self<\"u\"&&typeof self.addEventListener==\"function\"&&hu.default.isWorkerRuntime()&&(self.addEventListener(\"error\",e=>{setTimeout(()=>DI(e.error||e),250)}),self.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;t&&typeof t.message==\"string\"&&setTimeout(()=>DI(t),250)}));typeof process<\"u\"&&typeof process.on==\"function\"&&hu.default.isWorkerRuntime()&&(process.on(\"uncaughtException\",e=>{setTimeout(()=>DI(e),250)}),process.on(\"unhandledRejection\",e=>{e&&typeof e.message==\"string\"&&setTimeout(()=>DI(e),250)}))});var RQ=Nr(Dl=>{\"use strict\";var hxt=Dl&&Dl.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),fxt=Dl&&Dl.__exportStar||function(e,t){for(var r in e)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(t,r)&&hxt(t,e,r)};Object.defineProperty(Dl,\"__esModule\",{value:!0});Dl.Transfer=Dl.DefaultSerializer=Dl.expose=Dl.registerSerializer=void 0;var dxt=dx();Object.defineProperty(Dl,\"registerSerializer\",{enumerable:!0,get:function(){return dxt.registerSerializer}});fxt(bQ(),Dl);var pxt=kQ();Object.defineProperty(Dl,\"expose\",{enumerable:!0,get:function(){return pxt.expose}});var Axt=zB();Object.defineProperty(Dl,\"DefaultSerializer\",{enumerable:!0,get:function(){return Axt.DefaultSerializer}});var mxt=wS();Object.defineProperty(Dl,\"Transfer\",{enumerable:!0,get:function(){return mxt.Transfer}})});var GI=bi(Yi(),1),$g=bi(Yi(),1);var Yl=bi(Yi(),1),g8=bi(m8(),1),_8=Yl.createContext(null);function qk(){let e=Yl.useContext(_8);if(!e)throw new Error(\"Model not found\");return e}function E0(e){let t=qk(),[r,i]=Yl.useState(t.get(e));return Yl.useEffect(()=>{let n=()=>i(t.get(e));return t.on(`change:${e}`,n),()=>t.off(`change:${e}`,n)},[t,e]),[r,n=>{t.set(e,n),t.save_changes()}]}function y8(e){return({model:t,el:r})=>{let i=g8.createRoot(r);return i.render(Yl.createElement(Yl.StrictMode,null,Yl.createElement(_8.Provider,{value:t},Yl.createElement(e)))),()=>i.unmount()}}var R8=bi(Yi());var $_=bi(Yi()),Zc=bi(Yi());var Zk=bi(Yi()),xM=bi(Yi());var v8=Zk.createContext(null);function x8(e,t){let r=Array.isArray(e)?e[0]:e?e.x:0,i=Array.isArray(e)?e[1]:e?e.y:0,n=Array.isArray(t)?t[0]:t?t.x:0,s=Array.isArray(t)?t[1]:t?t.y:0;return r===n&&i===s}function $l(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r{let n=null;\"interactive\"in i&&(n=Object.assign({},i),delete n.interactive);let s=t[i.ref];if(s){n=n||Object.assign({},i),delete n.ref;for(let o of qtt)o in s&&(n[o]=s[o])}return n||i});return{...e,layers:r}}var w8={version:8,sources:{},layers:[]},S8={mousedown:\"onMouseDown\",mouseup:\"onMouseUp\",mouseover:\"onMouseOver\",mousemove:\"onMouseMove\",click:\"onClick\",dblclick:\"onDblClick\",mouseenter:\"onMouseEnter\",mouseleave:\"onMouseLeave\",mouseout:\"onMouseOut\",contextmenu:\"onContextMenu\",touchstart:\"onTouchStart\",touchend:\"onTouchEnd\",touchmove:\"onTouchMove\",touchcancel:\"onTouchCancel\"},Kk={movestart:\"onMoveStart\",move:\"onMove\",moveend:\"onMoveEnd\",dragstart:\"onDragStart\",drag:\"onDrag\",dragend:\"onDragEnd\",zoomstart:\"onZoomStart\",zoom:\"onZoom\",zoomend:\"onZoomEnd\",rotatestart:\"onRotateStart\",rotate:\"onRotate\",rotateend:\"onRotateEnd\",pitchstart:\"onPitchStart\",pitch:\"onPitch\",pitchend:\"onPitchEnd\"},T8={wheel:\"onWheel\",boxzoomstart:\"onBoxZoomStart\",boxzoomend:\"onBoxZoomEnd\",boxzoomcancel:\"onBoxZoomCancel\",resize:\"onResize\",load:\"onLoad\",render:\"onRender\",idle:\"onIdle\",remove:\"onRemove\",data:\"onData\",styledata:\"onStyleData\",sourcedata:\"onSourceData\",error:\"onError\"},Ztt=[\"minZoom\",\"maxZoom\",\"minPitch\",\"maxPitch\",\"maxBounds\",\"projection\",\"renderWorldCopies\"],Ytt=[\"scrollZoom\",\"boxZoom\",\"dragRotate\",\"dragPan\",\"keyboard\",\"doubleClickZoom\",\"touchZoomRotate\",\"touchPitch\"],P0=class e{constructor(t,r,i){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=n=>{let s=this.props[T8[n.type]];s?s(n):n.type===\"error\"&&console.error(n.error)},this._onPointerEvent=n=>{(n.type===\"mousemove\"||n.type===\"mouseout\")&&this._updateHover(n);let s=this.props[S8[n.type]];s&&(this.props.interactiveLayerIds&&n.type!==\"mouseover\"&&n.type!==\"mouseout\"&&(n.features=this._hoveredFeatures||this._queryRenderedFeatures(n.point)),s(n),delete n.features)},this._onCameraEvent=n=>{if(!this._internalUpdate){let s=this.props[Kk[n.type]];s&&s(n)}n.type in this._deferredEvents&&(this._deferredEvents[n.type]=!1)},this._MapClass=t,this.props=r,this._initialize(i)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){let r=this.props;this.props=t;let i=this._updateSettings(t,r);i&&this._createShadowTransform(this._map);let n=this._updateSize(t),s=this._updateViewState(t,!0);this._updateStyle(t,r),this._updateStyleComponents(t,r),this._updateHandlers(t,r),(i||n||s&&!this._map.isMoving())&&this.redraw()}static reuse(t,r){let i=e.savedMaps.pop();if(!i)return null;let n=i.map,s=n.getContainer();for(r.className=s.className;s.childNodes.length>0;)r.appendChild(s.childNodes[0]);n._container=r;let o=n._resizeObserver;o&&(o.disconnect(),o.observe(r)),i.setProps({...t,styleDiffing:!1}),n.resize();let{initialViewState:c}=t;return c&&(c.bounds?n.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):i._updateViewState(c,!1)),n.isStyleLoaded()?n.fire(\"load\"):n.once(\"styledata\",()=>n.fire(\"load\")),n._update(),i}_initialize(t){let{props:r}=this,{mapStyle:i=w8}=r,n={...r,...r.initialViewState,accessToken:r.mapboxAccessToken||$tt()||null,container:t,style:Xk(i)},s=n.initialViewState||n.viewState||n;if(Object.assign(n,{center:[s.longitude||0,s.latitude||0],zoom:s.zoom||0,pitch:s.pitch||0,bearing:s.bearing||0}),r.gl){let w=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=w,r.gl)}let o=new this._MapClass(n);s.padding&&o.setPadding(s.padding),r.cursor&&(o.getCanvas().style.cursor=r.cursor),this._createShadowTransform(o);let c=o._render;o._render=w=>{this._inRender=!0,c.call(o,w),this._inRender=!1};let d=o._renderTaskQueue.run;o._renderTaskQueue.run=w=>{d.call(o._renderTaskQueue,w),this._onBeforeRepaint()},o.on(\"render\",()=>this._onAfterRepaint());let _=o.fire;o.fire=this._fireEvent.bind(this,_),o.on(\"resize\",()=>{this._renderTransform.resize(o.transform.width,o.transform.height)}),o.on(\"styledata\",()=>{this._updateStyleComponents(this.props,{}),Yk(o.transform,this._renderTransform)}),o.on(\"sourcedata\",()=>this._updateStyleComponents(this.props,{}));for(let w in S8)o.on(w,this._onPointerEvent);for(let w in Kk)o.on(w,this._onCameraEvent);for(let w in T8)o.on(w,this._onEvent);this._map=o}recycle(){let r=this.map.getContainer().querySelector(\"[mapboxgl-children]\");r?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){let r=b8(t.transform);t.painter.transform=r,this._renderTransform=r}_updateSize(t){let{viewState:r}=t;if(r){let i=this._map;if(r.width!==i.transform.width||r.height!==i.transform.height)return i.resize(),!0}return!1}_updateViewState(t,r){if(this._internalUpdate)return!1;let i=this._map,n=this._renderTransform,{zoom:s,pitch:o,bearing:c}=n,d=i.isMoving();d&&(n.cameraElevationReference=\"sea\");let _=Qk(n,{...$k(i.transform),...t});if(d&&(n.cameraElevationReference=\"ground\"),_&&r){let w=this._deferredEvents;w.move=!0,w.zoom||(w.zoom=s!==n.zoom),w.rotate||(w.rotate=c!==n.bearing),w.pitch||(w.pitch=o!==n.pitch)}return d||Qk(i.transform,t),_}_updateSettings(t,r){let i=this._map,n=!1;for(let s of Ztt)if(s in t&&!$l(t[s],r[s])){n=!0;let o=i[`set${s[0].toUpperCase()}${s.slice(1)}`];o?.call(i,t[s])}return n}_updateStyle(t,r){if(t.cursor!==r.cursor&&(this._map.getCanvas().style.cursor=t.cursor||\"\"),t.mapStyle!==r.mapStyle){let{mapStyle:i=w8,styleDiffing:n=!0}=t,s={diff:n};return\"localIdeographFontFamily\"in t&&(s.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(Xk(i),s),!0}return!1}_updateStyleComponents(t,r){let i=this._map,n=!1;return i.isStyleLoaded()&&(\"light\"in t&&i.setLight&&!$l(t.light,r.light)&&(n=!0,i.setLight(t.light)),\"fog\"in t&&i.setFog&&!$l(t.fog,r.fog)&&(n=!0,i.setFog(t.fog)),\"terrain\"in t&&i.setTerrain&&!$l(t.terrain,r.terrain)&&(!t.terrain||i.getSource(t.terrain.source))&&(n=!0,i.setTerrain(t.terrain))),n}_updateHandlers(t,r){var i,n;let s=this._map,o=!1;for(let c of Ytt){let d=(i=t[c])!==null&&i!==void 0?i:!0,_=(n=r[c])!==null&&n!==void 0?n:!0;$l(d,_)||(o=!0,d?s[c].enable(d):s[c].disable())}return o}_queryRenderedFeatures(t){let r=this._map,i=r.transform,{interactiveLayerIds:n=[]}=this.props;try{return r.transform=this._renderTransform,r.queryRenderedFeatures(t,{layers:n.filter(r.getLayer.bind(r))})}catch{return[]}finally{r.transform=i}}_updateHover(t){var r;let{props:i}=this;if(i.interactiveLayerIds&&(i.onMouseMove||i.onMouseEnter||i.onMouseLeave)){let s=t.type,o=((r=this._hoveredFeatures)===null||r===void 0?void 0:r.length)>0,c=this._queryRenderedFeatures(t.point),d=c.length>0;!d&&o&&(t.type=\"mouseleave\",this._onPointerEvent(t)),this._hoveredFeatures=c,d&&!o&&(t.type=\"mouseenter\",this._onPointerEvent(t)),t.type=s}else this._hoveredFeatures=null}_fireEvent(t,r,i){let n=this._map,s=n.transform,o=typeof r==\"string\"?r:r.type;return o===\"move\"&&this._updateViewState(this.props,!1),o in Kk&&(typeof r==\"object\"&&(r.viewState=$k(s)),this._map.isMoving())?(n.transform=this._renderTransform,t.call(n,r,i),n.transform=s,n):(t.call(n,r,i),n)}_onBeforeRepaint(){let t=this._map;this._internalUpdate=!0;for(let i in this._deferredEvents)this._deferredEvents[i]&&t.fire(i);this._internalUpdate=!1;let r=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{Yk(this._renderTransform,r),t.transform=r}}};P0.savedMaps=[];function $tt(){let e=null;if(typeof location<\"u\"){let t=/access_token=([^&\\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}var Qtt=[\"setMaxBounds\",\"setMinZoom\",\"setMaxZoom\",\"setMinPitch\",\"setMaxPitch\",\"setRenderWorldCopies\",\"setProjection\",\"setStyle\",\"addSource\",\"removeSource\",\"addLayer\",\"removeLayer\",\"setLayerZoomRange\",\"setFilter\",\"setPaintProperty\",\"setLayoutProperty\",\"setLight\",\"setTerrain\",\"setFog\",\"remove\"];function Jk(e){if(!e)return null;let t=e.map,r={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:i=>{let n=t.transform;t.transform=e.transform;let s=t.project(i);return t.transform=n,s},unproject:i=>{let n=t.transform;t.transform=e.transform;let s=t.unproject(i);return t.transform=n,s},queryTerrainElevation:(i,n)=>{let s=t.transform;t.transform=e.transform;let o=t.queryTerrainElevation(i,n);return t.transform=s,o},queryRenderedFeatures:(i,n)=>{let s=t.transform;t.transform=e.transform;let o=t.queryRenderedFeatures(i,n);return t.transform=s,o}};for(let i of Xtt(t))!(i in r)&&!Qtt.includes(i)&&(r[i]=t[i].bind(t));return r}function Xtt(e){let t=new Set,r=e;for(;r;){for(let i of Object.getOwnPropertyNames(r))i[0]!==\"_\"&&typeof e[i]==\"function\"&&i!==\"fire\"&&i!==\"setEventedParent\"&&t.add(i);r=Object.getPrototypeOf(r)}return Array.from(t)}var bM=bi(Yi()),Ktt=typeof document<\"u\"?bM.useLayoutEffect:bM.useEffect,M8=Ktt;var Jtt=[\"baseApiUrl\",\"maxParallelImageRequests\",\"workerClass\",\"workerCount\",\"workerUrl\"];function t4(e,t){for(let i of Jtt)i in t&&(e[i]=t[i]);let{RTLTextPlugin:r=\"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js\"}=t;r&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===\"unavailable\"&&e.setRTLTextPlugin(r,i=>{i&&console.error(i)},!0)}var jf=$_.createContext(null);function e4(e,t,r){let i=(0,Zc.useContext)(v8),[n,s]=(0,Zc.useState)(null),o=(0,Zc.useRef)(),{current:c}=(0,Zc.useRef)({mapLib:null,map:null});(0,Zc.useEffect)(()=>{let w=e.mapLib,I=!0,R;return Promise.resolve(w||r).then(N=>{if(!I)return;if(!N)throw new Error(\"Invalid mapLib\");let j=\"Map\"in N?N:N.default;if(!j.Map)throw new Error(\"Invalid mapLib\");if(t4(j,e),!j.supported||j.supported(e))e.reuseMaps&&(R=P0.reuse(e,o.current)),R||(R=new P0(j.Map,e,o.current)),c.map=Jk(R),c.mapLib=j,s(R),i?.onMapMount(c.map,e.id);else throw new Error(\"Map is not supported by this browser\")}).catch(N=>{let{onError:j}=e;j?j({type:\"error\",target:null,originalEvent:null,error:N}):console.error(N)}),()=>{I=!1,R&&(i?.onMapUnmount(e.id),e.reuseMaps?R.recycle():R.destroy())}},[]),M8(()=>{n&&n.setProps(e)}),(0,Zc.useImperativeHandle)(t,()=>c.map,[n]);let d=(0,Zc.useMemo)(()=>({position:\"relative\",width:\"100%\",height:\"100%\",...e.style}),[e.style]),_={height:\"100%\"};return $_.createElement(\"div\",{id:e.id,ref:o,style:d},n&&$_.createElement(jf.Provider,{value:c},$_.createElement(\"div\",{\"mapboxgl-children\":\"\",style:_},e.children)))}var E8=bi(Yi()),P8=bi(vM()),bl=bi(Yi());var tet=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ql(e,t){if(!e||!t)return;let r=e.style;for(let i in t){let n=t[i];Number.isFinite(n)&&!tet.test(i)?r[i]=`${n}px`:r[i]=n}}function eet(e,t){let{map:r,mapLib:i}=(0,bl.useContext)(jf),n=(0,bl.useRef)({props:e});n.current.props=e;let s=(0,bl.useMemo)(()=>{let Y=!1;E8.Children.forEach(e.children,K=>{K&&(Y=!0)});let it={...e,element:Y?document.createElement(\"div\"):null},Z=new i.Marker(it);return Z.setLngLat([e.longitude,e.latitude]),Z.getElement().addEventListener(\"click\",K=>{var J,ht;(ht=(J=n.current.props).onClick)===null||ht===void 0||ht.call(J,{type:\"click\",target:Z,originalEvent:K})}),Z.on(\"dragstart\",K=>{var J,ht;let Tt=K;Tt.lngLat=s.getLngLat(),(ht=(J=n.current.props).onDragStart)===null||ht===void 0||ht.call(J,Tt)}),Z.on(\"drag\",K=>{var J,ht;let Tt=K;Tt.lngLat=s.getLngLat(),(ht=(J=n.current.props).onDrag)===null||ht===void 0||ht.call(J,Tt)}),Z.on(\"dragend\",K=>{var J,ht;let Tt=K;Tt.lngLat=s.getLngLat(),(ht=(J=n.current.props).onDragEnd)===null||ht===void 0||ht.call(J,Tt)}),Z},[]);(0,bl.useEffect)(()=>(s.addTo(r.getMap()),()=>{s.remove()}),[]);let{longitude:o,latitude:c,offset:d,style:_,draggable:w=!1,popup:I=null,rotation:R=0,rotationAlignment:N=\"auto\",pitchAlignment:j=\"auto\"}=e;return(0,bl.useEffect)(()=>{Ql(s.getElement(),_)},[_]),(0,bl.useImperativeHandle)(t,()=>s,[]),(s.getLngLat().lng!==o||s.getLngLat().lat!==c)&&s.setLngLat([o,c]),d&&!x8(s.getOffset(),d)&&s.setOffset(d),s.isDraggable()!==w&&s.setDraggable(w),s.getRotation()!==R&&s.setRotation(R),s.getRotationAlignment()!==N&&s.setRotationAlignment(N),s.getPitchAlignment()!==j&&s.setPitchAlignment(j),s.getPopup()!==I&&s.setPopup(I),(0,P8.createPortal)(e.children,s.getElement())}var ret=(0,bl.memo)((0,bl.forwardRef)(eet));var C8=bi(vM()),Xa=bi(Yi());function I8(e){return new Set(e?e.trim().split(/\\s+/):[])}function iet(e,t){let{map:r,mapLib:i}=(0,Xa.useContext)(jf),n=(0,Xa.useMemo)(()=>document.createElement(\"div\"),[]),s=(0,Xa.useRef)({props:e});s.current.props=e;let o=(0,Xa.useMemo)(()=>{let c={...e},d=new i.Popup(c);return d.setLngLat([e.longitude,e.latitude]),d.once(\"open\",_=>{var w,I;(I=(w=s.current.props).onOpen)===null||I===void 0||I.call(w,_)}),d},[]);if((0,Xa.useEffect)(()=>{let c=d=>{var _,w;(w=(_=s.current.props).onClose)===null||w===void 0||w.call(_,d)};return o.on(\"close\",c),o.setDOMContent(n).addTo(r.getMap()),()=>{o.off(\"close\",c),o.isOpen()&&o.remove()}},[]),(0,Xa.useEffect)(()=>{Ql(o.getElement(),e.style)},[e.style]),(0,Xa.useImperativeHandle)(t,()=>o,[]),o.isOpen()&&((o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!$l(o.options.offset,e.offset)&&o.setOffset(e.offset),(o.options.anchor!==e.anchor||o.options.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth)),o.options.className!==e.className)){let c=I8(o.options.className),d=I8(e.className);for(let _ of c)d.has(_)||o.removeClassName(_);for(let _ of d)c.has(_)||o.addClassName(_);o.options.className=e.className}return(0,C8.createPortal)(e.children,n)}var net=(0,Xa.memo)((0,Xa.forwardRef)(iet));var wM=bi(Yi());var Q_=bi(Yi());function set(e,t,r,i){let n=(0,Q_.useContext)(jf),s=(0,Q_.useMemo)(()=>e(n),[]);return(0,Q_.useEffect)(()=>{let o=i||r||t,c=typeof t==\"function\"&&typeof r==\"function\"?t:null,d=typeof r==\"function\"?r:typeof t==\"function\"?t:null,{map:_}=n;return _.hasControl(s)||(_.addControl(s,o?.position),c&&c(n)),()=>{d&&d(n),_.hasControl(s)&&_.removeControl(s)}},[]),s}var Ph=set;function oet(e){let t=Ph(({mapLib:r})=>new r.AttributionControl(e),{position:e.position});return(0,wM.useEffect)(()=>{Ql(t._container,e.style)},[e.style]),null}var aet=(0,wM.memo)(oet);var SM=bi(Yi());function cet(e){let t=Ph(({mapLib:r})=>new r.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,SM.useEffect)(()=>{Ql(t._controlContainer,e.style)},[e.style]),null}var uet=(0,SM.memo)(cet);var Gf=bi(Yi());function het(e,t){let r=(0,Gf.useRef)({props:e}),i=Ph(({mapLib:n})=>{let s=new n.GeolocateControl(e),o=s._setupUI;return s._setupUI=c=>{s._container.hasChildNodes()||o(c)},s.on(\"geolocate\",c=>{var d,_;(_=(d=r.current.props).onGeolocate)===null||_===void 0||_.call(d,c)}),s.on(\"error\",c=>{var d,_;(_=(d=r.current.props).onError)===null||_===void 0||_.call(d,c)}),s.on(\"outofmaxbounds\",c=>{var d,_;(_=(d=r.current.props).onOutOfMaxBounds)===null||_===void 0||_.call(d,c)}),s.on(\"trackuserlocationstart\",c=>{var d,_;(_=(d=r.current.props).onTrackUserLocationStart)===null||_===void 0||_.call(d,c)}),s.on(\"trackuserlocationend\",c=>{var d,_;(_=(d=r.current.props).onTrackUserLocationEnd)===null||_===void 0||_.call(d,c)}),s},{position:e.position});return r.current.props=e,(0,Gf.useImperativeHandle)(t,()=>i,[]),(0,Gf.useEffect)(()=>{Ql(i._container,e.style)},[e.style]),null}var fet=(0,Gf.memo)((0,Gf.forwardRef)(het));var TM=bi(Yi());function det(e){let t=Ph(({mapLib:r})=>new r.NavigationControl(e),{position:e.position});return(0,TM.useEffect)(()=>{Ql(t._container,e.style)},[e.style]),null}var pet=(0,TM.memo)(det);var X_=bi(Yi());function Aet(e){let t=Ph(({mapLib:s})=>new s.ScaleControl(e),{position:e.position}),r=(0,X_.useRef)(e),i=r.current;r.current=e;let{style:n}=e;return e.maxWidth!==void 0&&e.maxWidth!==i.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==i.unit&&t.setUnit(e.unit),(0,X_.useEffect)(()=>{Ql(t._container,n)},[n]),null}var met=(0,X_.memo)(Aet);var D1=bi(Yi());var _et=bi(Yi()),O1=bi(Yi()),yet=bi(Yi());var vet=Promise.resolve().then(()=>bi(k8())),xet=R8.forwardRef(function(t,r){return e4(t,r,vet)});var D8=xet;var ko=bi(Yi());function zA(e,t){if(!e)throw new Error(t||\"loader assertion failed.\")}var Wf={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},bet=Wf.self||Wf.window||Wf.global||{},wet=Wf.window||Wf.self||Wf.global||{},Tet=Wf.global||Wf.self||Wf.window||{},Met=Wf.document||{};var I0=!!(typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser);var O8=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),Eet=O8&&parseFloat(O8[1])||0;var B8=\"3.4.14\";function Ka(e,t){if(!e)throw new Error(t||\"loaders.gl assertion failed.\")}var Hf={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},zbt=Hf.self||Hf.window||Hf.global||{},Nbt=Hf.window||Hf.self||Hf.global||{},Ubt=Hf.global||Hf.self||Hf.window||{},Vbt=Hf.document||{};var C0=typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser;var z8=typeof window<\"u\"&&typeof window.orientation<\"u\",F8=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),jbt=F8&&parseFloat(F8[1])||0;function NA(e){\"@babel/helpers - typeof\";return NA=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},NA(e)}function n4(e,t){if(NA(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||\"default\");if(NA(i)!=\"object\")return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function s4(e){var t=n4(e,\"string\");return NA(t)==\"symbol\"?t:String(t)}function G(e,t,r){return t=s4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var B1=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"workerThread\",void 0),G(this,\"isRunning\",!0),G(this,\"result\",void 0),G(this,\"_resolve\",()=>{}),G(this,\"_reject\",()=>{}),this.name=t,this.workerThread=r,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(t,r){this.workerThread.postMessage({source:\"loaders.gl\",type:t,payload:r})}done(t){Ka(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Ka(this.isRunning),this.isRunning=!1,this._reject(t)}};var K_=class{terminate(){}};var o4=new Map;function N8(e){Ka(e.source&&!e.url||!e.source&&e.url);let t=o4.get(e.source||e.url);return t||(e.url&&(t=Pet(e.url),o4.set(e.url,t)),e.source&&(t=U8(e.source),o4.set(e.source,t))),Ka(t),t}function Pet(e){if(!e.startsWith(\"http\"))return e;let t=Iet(e);return U8(t)}function U8(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function Iet(e){return`try {\n importScripts('`.concat(e,`');\n} catch (error) {\n console.error(error);\n throw error;\n}`)}function a4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2?arguments[2]:void 0,i=r||new Set;if(e){if(V8(e))i.add(e);else if(V8(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e==\"object\")for(let n in e)a4(e[n],t,i)}}return r===void 0?Array.from(i):[]}function V8(e){return e?e instanceof ArrayBuffer||typeof MessagePort<\"u\"&&e instanceof MessagePort||typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap||typeof OffscreenCanvas<\"u\"&&e instanceof OffscreenCanvas:!1}var l4=()=>{},UA=class{static isSupported(){return typeof Worker<\"u\"&&C0||typeof K_<\"u\"&&!C0}constructor(t){G(this,\"name\",void 0),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"terminated\",!1),G(this,\"worker\",void 0),G(this,\"onMessage\",void 0),G(this,\"onError\",void 0),G(this,\"_loadableURL\",\"\");let{name:r,source:i,url:n}=t;Ka(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=l4,this.onError=s=>console.log(s),this.worker=C0?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=l4,this.onError=l4,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,r){r=r||a4(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r=\"Failed to load \";return r+=\"worker \".concat(this.name,\" from \").concat(this.url,\". \"),t.message&&(r+=\"\".concat(t.message,\" in \")),t.lineno&&(r+=\":\".concat(t.lineno,\":\").concat(t.colno)),new Error(r)}_createBrowserWorker(){this._loadableURL=N8({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error(\"No data received\"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let i=this.url.includes(\":/\")||this.url.startsWith(\"/\")?this.url:\"./\".concat(this.url);t=new K_(i,{eval:!1})}else if(this.source)t=new K_(this.source,{eval:!0});else throw new Error(\"no worker\");return t.on(\"message\",r=>{this.onMessage(r)}),t.on(\"error\",r=>{this.onError(r)}),t.on(\"exit\",r=>{}),t}};var F1=class{static isSupported(){return UA.isSupported()}constructor(t){G(this,\"name\",\"unnamed\"),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"maxConcurrency\",1),G(this,\"maxMobileConcurrency\",1),G(this,\"onDebug\",()=>{}),G(this,\"reuseWorkers\",!0),G(this,\"props\",{}),G(this,\"jobQueue\",[]),G(this,\"idleQueue\",[]),G(this,\"count\",0),G(this,\"isDestroyed\",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,o,c)=>s.done(c),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,o)=>s.error(o),n=new Promise(s=>(this.jobQueue.push({name:t,onMessage:r,onError:i,onStart:s}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:\"Starting job\",name:r.name,workerThread:t,backlog:this.jobQueue.length});let i=new B1(r.name,t);t.onMessage=n=>r.onMessage(i,n.type,n.payload),t.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}},VA=class e{static isSupported(){return UA.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}constructor(t){G(this,\"props\",void 0),G(this,\"workerPools\",new Map),this.props={...Cet},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:i,url:n}=t,s=this.workerPools.get(r);return s||(s=new F1({name:r,source:i,url:n}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};G(VA,\"_workerFarm\",void 0);var Let=\"latest\";function c4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t[e.id]||{},i=\"\".concat(e.id,\"-worker.js\"),n=r.workerUrl;if(!n&&e.id===\"compression\"&&(n=t.workerUrl),t._workerType===\"test\"&&(n=\"modules/\".concat(e.module,\"/dist/\").concat(i)),!n){let s=e.version;s===\"latest\"&&(s=Let);let o=s?\"@\".concat(s):\"\";n=\"https://unpkg.com/@loaders.gl/\".concat(e.module).concat(o,\"/dist/\").concat(i)}return Ka(n),n}function u4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:B8;Ka(e,\"no worker provided\");let r=e.version;return!(!t||!r)}function h4(e,t){return!VA.isSupported()||!C0&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&t?.worker}async function f4(e,t,r,i,n){let s=e.id,o=c4(e,r),d=VA.getWorkerFarm(r).getWorkerPool({name:s,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let _=await d.startJob(\"process-on-worker\",ket.bind(null,n));return _.postMessage(\"process\",{input:t,options:r,context:i}),await(await _.result).result}async function ket(e,t,r,i){switch(r){case\"done\":t.done(i);break;case\"error\":t.error(new Error(i.error));break;case\"process\":let{id:n,input:s,options:o}=i;try{let c=await e(s,o);t.postMessage(\"done\",{id:n,result:c})}catch(c){let d=c instanceof Error?c.message:\"unknown error\";t.postMessage(\"error\",{id:n,error:d})}break;default:console.warn(\"parse-with-worker unknown message \".concat(r))}}function d4(e,t,r){if(r=r||e.byteLength,e.byteLengthc instanceof ArrayBuffer?new Uint8Array(c):c),n=i.reduce((c,d)=>c+d.byteLength,0),s=new Uint8Array(n),o=0;for(let c of i)s.set(c,o),o+=c.byteLength;return s.buffer}async function A4(e){let t=[];for await(let r of e)t.push(r);return p4(...t)}function z1(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var L0=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=z1(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(z1()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var J_=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,n=this.stats[r];return n||(t instanceof L0?n=t:n=new L0(r,i),this.stats[r]=n),n}};var Ret=\"Queued Requests\",Det=\"Active Requests\",Oet=\"Cancelled Requests\",Bet=\"Queued Requests Ever\",Fet=\"Active Requests Ever\",zet={id:\"request-scheduler\",throttleRequests:!0,maxRequests:6},ty=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};G(this,\"props\",void 0),G(this,\"stats\",void 0),G(this,\"activeRequestCount\",0),G(this,\"requestQueue\",[]),G(this,\"requestMap\",new Map),G(this,\"deferredUpdate\",null),this.props={...zet,...t},this.stats=new J_({id:this.props.id}),this.stats.get(Ret),this.stats.get(Det),this.stats.get(Oet),this.stats.get(Bet),this.stats.get(Fet)}scheduleRequest(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let i={handle:t,priority:0,getPriority:r},n=new Promise(s=>(i.resolve=s,i));return this.requestQueue.push(i),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){let{handle:r,resolve:i}=t,n=!1,s=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;rr.priority-i.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Net=\"\",j8={};function m4(e){for(let t in j8)if(e.startsWith(t)){let r=j8[t];e=e.replace(t,r)}return!e.startsWith(\"http://\")&&!e.startsWith(\"https://\")&&(e=\"\".concat(Net).concat(e)),e}function G8(e){return e&&typeof e==\"object\"&&e.isBuffer}function MM(e){if(G8(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e==\"string\"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e==\"object\"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(\"toArrayBuffer\")}var k0={};mA(k0,{dirname:()=>Vet,filename:()=>Uet,join:()=>jet,resolve:()=>Get});function W8(){var e;if(typeof process<\"u\"&&typeof process.cwd<\"u\")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf(\"/\")+1)||\"\"}function Uet(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(t+1):\"\"}function Vet(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(0,t):\"\"}function jet(){for(var e=arguments.length,t=new Array(e),r=0;r(s&&(n=n.replace(new RegExp(\"^\".concat(i)),\"\")),s!==t.length-1&&(n=n.replace(new RegExp(\"\".concat(i,\"$\")),\"\")),n)),t.join(i)}function Get(){let e=[];for(let n=0;n=-1&&!r;n--){let s;n>=0?s=e[n]:(i===void 0&&(i=W8()),s=i),s.length!==0&&(t=\"\".concat(s,\"/\").concat(t),r=s.charCodeAt(0)===N1)}return t=Wet(t,!r),r?\"/\".concat(t):t.length>0?t:\".\"}var N1=47,g4=46;function Wet(e,t){let r=\"\",i=-1,n=0,s,o=!1;for(let c=0;c<=e.length;++c){if(c2){let d=r.length-1,_=d;for(;_>=0&&r.charCodeAt(_)!==N1;--_);if(_!==d){r=_===-1?\"\":r.slice(0,_),i=c,n=0,o=!1;continue}}else if(r.length===2||r.length===1){r=\"\",i=c,n=0,o=!1;continue}}t&&(r.length>0?r+=\"/..\":r=\"..\",o=!0)}else{let d=e.slice(i+1,c);r.length>0?r+=\"/\".concat(d):r=d,o=!1}i=c,n=0}else s===g4&&n!==-1?++n:n=-1}return r}var Het=e=>typeof e==\"boolean\",U1=e=>typeof e==\"function\",R0=e=>e!==null&&typeof e==\"object\",_4=e=>R0(e)&&e.constructor==={}.constructor;var H8=e=>e&&typeof e[Symbol.iterator]==\"function\",q8=e=>e&&typeof e[Symbol.asyncIterator]==\"function\";var Du=e=>typeof Response<\"u\"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Ou=e=>typeof Blob<\"u\"&&e instanceof Blob,Z8=e=>e&&typeof e==\"object\"&&e.isBuffer;var qet=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream||R0(e)&&U1(e.tee)&&U1(e.cancel)&&U1(e.getReader);var Zet=e=>R0(e)&&U1(e.read)&&U1(e.pipe)&&Het(e.readable),EM=e=>qet(e)||Zet(e);var Yet=/^data:([-\\w.]+\\/[-\\w.+]+)(;|,)/,$et=/^([-\\w.]+\\/[-\\w.+]+)/;function Y8(e){let t=$et.exec(e);return t?t[1]:e}function y4(e){let t=Yet.exec(e);return t?t[1]:\"\"}var $8=/\\?.*/;function Q8(e){let t=e.match($8);return t&&t[0]}function ey(e){return e.replace($8,\"\")}function D0(e){return Du(e)?e.url:Ou(e)?e.name||\"\":typeof e==\"string\"?e:\"\"}function V1(e){if(Du(e)){let t=e,r=t.headers.get(\"content-type\")||\"\",i=ey(t.url);return Y8(r)||y4(i)}return Ou(e)?e.type||\"\":typeof e==\"string\"?y4(e):\"\"}function X8(e){return Du(e)?e.headers[\"content-length\"]||-1:Ou(e)?e.size:typeof e==\"string\"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function PM(e){if(Du(e))return e;let t={},r=X8(e);r>=0&&(t[\"content-length\"]=String(r));let i=D0(e),n=V1(e);n&&(t[\"content-type\"]=n);let s=await Xet(e);s&&(t[\"x-first-bytes\"]=s),typeof e==\"string\"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,\"url\",{value:i}),o}async function K8(e){if(!e.ok){let t=await Qet(e);throw new Error(t)}}async function Qet(e){let t=\"Failed to fetch resource \".concat(e.url,\" (\").concat(e.status,\"): \");try{let r=e.headers.get(\"Content-Type\"),i=e.statusText;r.includes(\"application/json\")&&(i+=\" \".concat(await e.text())),t+=i,t=t.length>60?\"\".concat(t.slice(0,60),\"...\"):t}catch{}return t}async function Xet(e){if(typeof e==\"string\")return\"data:,\".concat(e.slice(0,5));if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=s=>{var o;return i(s==null||(o=s.target)===null||o===void 0?void 0:o.result)},n.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5),i=Ket(r);return\"data:base64,\".concat(i)}return null}function Ket(e){let t=\"\",r=new Uint8Array(e);for(let i=0;i=0)}function Ih(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||x4()}var Jet=globalThis.self||globalThis.window||globalThis.global,ry=globalThis.window||globalThis.self||globalThis.global,trt=globalThis.document||{},O0=globalThis.process||{},ert=globalThis.console,R2t=globalThis.navigator||{};var IM=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",B2t=Ih();function rrt(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var CM=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=rrt(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function J8(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function tU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function LM(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let s=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(s/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(n,\");\"),\"background-size:\".concat(s,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var kM;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(kM||(kM={}));var irt=10;function eU(e){return typeof e!=\"string\"?e:(e=e.toUpperCase(),kM[e]||kM.WHITE)}function rU(e,t,r){if(!Ih&&typeof e==\"string\"){if(t){let i=eU(t);e=\"\\x1B[\".concat(i,\"m\").concat(e,\"\\x1B[39m\")}if(r){let i=eU(r);e=\"\\x1B[\".concat(i+irt,\"m\").concat(e,\"\\x1B[49m\")}}return e}function iU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),n=e;for(let s of i){let o=n[s];typeof o==\"function\"&&(t.find(c=>s===c)||(n[s]=o.bind(e)))}}function iy(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function B0(){let e;if(Ih()&&ry.performance){var t,r;e=ry===null||ry===void 0||(t=ry.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in O0){var i;let n=O0===null||O0===void 0||(i=O0.hrtime)===null||i===void 0?void 0:i.call(O0);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var ny={debug:Ih()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nrt={enabled:!0,level:0};function Bu(){}var nU={},sU={once:!0},qf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};this.id=void 0,this.VERSION=IM,this._startTs=B0(),this._deltaTs=B0(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new CM(\"__probe-\".concat(this.id,\"__\"),nrt),this.timeStamp(\"\".concat(this.id,\" started\")),iU(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((B0()-this._startTs).toPrecision(10))}getDelta(){return Number((B0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){iy(t,r)}warn(t){return this._getLogFunction(0,t,ny.warn,arguments,sU)}error(t){return this._getLogFunction(0,t,ny.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,ny.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ny.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ny.debug||ny.info,arguments,sU)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||Bu,i&&[i],{tag:lrt(r)}):Bu}image(t){let{logLevel:r,priority:i,image:n,message:s=\"\",scale:o=1}=t;return this._shouldLog(r||i)?Ih()?art({image:n,message:s,scale:o}):ort({image:n,message:s,scale:o}):Bu}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Bu)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=oU({logLevel:t,message:r,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||Bu)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=aU(t)}_getLogFunction(t,r,i,n,s){if(this._shouldLog(t)){s=oU({logLevel:t,message:r,args:n,opts:s}),i=i||s.method,iy(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=B0();let o=s.tag||s.message;if(s.once&&o)if(!nU[o])nU[o]=B0();else return Bu;return r=srt(this.id,s.message,s),i.bind(console,r,...s.args)}return Bu}};qf.VERSION=IM;function aU(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return iy(Number.isFinite(t)&&t>=0),t}function oU(e){let{logLevel:t,message:r}=e;e.logLevel=aU(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let n=typeof e.message;return iy(n===\"string\"||n===\"object\"),Object.assign(e,{args:i},e.opts)}function srt(e,t,r){if(typeof t==\"string\"){let i=r.time?tU(J8(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=rU(t,r.color,r.background)}return t}function ort(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),Bu}function art(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let s=new Image;return s.onload=()=>{let o=LM(s,r,i);console.log(...o)},s.src=t,Bu}let n=t.nodeName||\"\";if(n.toLowerCase()===\"img\")return console.log(...LM(t,r,i)),Bu;if(n.toLowerCase()===\"canvas\"){let s=new Image;return s.onload=()=>console.log(...LM(s,r,i)),s.src=t.toDataURL(),Bu}return Bu}function lrt(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var aSt=new qf({id:\"@probe.gl/log\"});var b4=new qf({id:\"loaders.gl\"}),RM=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},DM=class{constructor(){G(this,\"console\",void 0),this.console=console}log(){for(var t=arguments.length,r=new Array(t),i=0;i{let e=S4();return e.globalOptions=e.globalOptions||{...w4},e.globalOptions};function hU(e,t,r,i){return r=r||[],r=Array.isArray(r)?r:[r],crt(e,r),hrt(t,e,i)}function crt(e,t){cU(e,null,w4,lU,t);for(let r of t){let i=e&&e[r.id]||{},n=r.options&&r.options[r.id]||{},s=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};cU(i,r.id,n,s,t)}}function cU(e,t,r,i,n){let s=t||\"Top level\",o=t?\"\".concat(t,\".\"):\"\";for(let c in e){let d=!t&&R0(e[c]),_=c===\"baseUri\"&&!t,w=c===\"workerUrl\"&&t;if(!(c in r)&&!_&&!w){if(c in i)b4.warn(\"\".concat(s,\" loader option '\").concat(o).concat(c,\"' no longer supported, use '\").concat(i[c],\"'\"))();else if(!d){let I=urt(c,n);b4.warn(\"\".concat(s,\" loader option '\").concat(o).concat(c,\"' not recognized. \").concat(I))()}}}}function urt(e,t){let r=e.toLowerCase(),i=\"\";for(let n of t)for(let s in n.options){if(e===s)return\"Did you mean '\".concat(n.id,\".\").concat(s,\"'?\");let o=s.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||\"Did you mean '\".concat(n.id,\".\").concat(s,\"'?\"))}return i}function hrt(e,t,r){let n={...e.options||{}};return frt(n,r),n.log===null&&(n.log=new RM),uU(n,T4()),uU(n,t),n}function uU(e,t){for(let r in t)if(r in t){let i=t[r];_4(i)&&_4(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function frt(e,t){t&&!(\"baseUri\"in e)&&(e.baseUri=t)}function j1(e){var t;return e?(Array.isArray(e)&&(e=e[0]),Array.isArray((t=e)===null||t===void 0?void 0:t.extensions)):!1}function G1(e){var t,r;zA(e,\"null loader\"),zA(j1(e),\"invalid loader\");let i;return Array.isArray(e)&&(i=e[1],e=e[0],e={...e,options:{...e.options,...i}}),((t=e)!==null&&t!==void 0&&t.parseTextSync||(r=e)!==null&&r!==void 0&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var fU=()=>{let e=S4();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function M4(e){let t=fU();e=Array.isArray(e)?e:[e];for(let r of e){let i=G1(r);t.find(n=>i===n)||t.unshift(i)}}function dU(){return fU()}var pU=new qf({id:\"loaders.gl\"});var drt=/\\.([^.]+)$/;async function gU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!_U(e))return null;let n=AU(e,t,{...r,nothrow:!0},i);if(n)return n;if(Ou(e)&&(e=await e.slice(0,10).arrayBuffer(),n=AU(e,t,r,i)),!n&&!(r!=null&&r.nothrow))throw new Error(yU(e));return n}function AU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!_U(e))return null;if(t&&!Array.isArray(t))return G1(t);let n=[];t&&(n=n.concat(t)),r!=null&&r.ignoreRegisteredLoaders||n.push(...dU()),Art(n);let s=prt(e,n,r,i);if(!s&&!(r!=null&&r.nothrow))throw new Error(yU(e));return s}function prt(e,t,r,i){let n=D0(e),s=V1(e),o=ey(n)||i?.url,c=null,d=\"\";if(r!=null&&r.mimeType&&(c=E4(t,r?.mimeType),d=\"match forced by supplied MIME type \".concat(r?.mimeType)),c=c||mrt(t,o),d=d||(c?\"matched url \".concat(o):\"\"),c=c||E4(t,s),d=d||(c?\"matched MIME type \".concat(s):\"\"),c=c||_rt(t,e),d=d||(c?\"matched initial data \".concat(vU(e)):\"\"),c=c||E4(t,r?.fallbackMimeType),d=d||(c?\"matched fallback MIME type \".concat(s):\"\"),d){var _;pU.log(1,\"selectLoader selected \".concat((_=c)===null||_===void 0?void 0:_.name,\": \").concat(d,\".\"))}return c}function _U(e){return!(e instanceof Response&&e.status===204)}function yU(e){let t=D0(e),r=V1(e),i=\"No valid loader found (\";i+=t?\"\".concat(k0.filename(t),\", \"):\"no url provided, \",i+=\"MIME type: \".concat(r?'\"'.concat(r,'\"'):\"not provided\",\", \");let n=e?vU(e):\"\";return i+=n?' first bytes: \"'.concat(n,'\"'):\"first bytes: not available\",i+=\")\",i}function Art(e){for(let t of e)G1(t)}function mrt(e,t){let r=t&&drt.exec(t),i=r&&r[1];return i?grt(e,i):null}function grt(e,t){t=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(i.toLowerCase()===t)return r;return null}function E4(e,t){for(let r of e)if(r.mimeTypes&&r.mimeTypes.includes(t)||t===\"application/x.\".concat(r.id))return r;return null}function _rt(e,t){if(!t)return null;for(let r of e)if(typeof t==\"string\"){if(yrt(t,r))return r}else if(ArrayBuffer.isView(t)){if(mU(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&mU(t,0,r))return r;return null}function yrt(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>e.startsWith(i))}function mU(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>vrt(e,t,r,n))}function vrt(e,t,r,i){if(i instanceof ArrayBuffer)return d4(i,e,i.byteLength);switch(typeof i){case\"function\":return i(e,r);case\"string\":let n=P4(e,t,i.length);return i===n;default:return!1}}function vU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e==\"string\"?e.slice(0,t):ArrayBuffer.isView(e)?P4(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?P4(e,0,t):\"\"}function P4(e,t,r){if(e.byteLength1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let{chunkSize:r=262144}=t,i=0;for(;iv4(n,i):t!=null&&t.fetch?t?.fetch:v4}function EU(e,t,r){if(r)return r;let i={fetch:OM(t,e),...e};if(i.url){let n=ey(i.url);i.baseUrl=n,i.queryString=Q8(i.url),i.filename=k0.filename(n),i.baseUrl=k0.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function PU(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let i=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...i]:i}return r&&r.length?r:null}async function BM(e,t,r,i){Ka(!i||typeof i==\"object\"),t&&!Array.isArray(t)&&!j1(t)&&(i=void 0,r=t,t=void 0),e=await e,r=r||{};let n=D0(e),o=PU(t,i),c=await gU(e,o,r);return c?(r=hU(r,c,o,n),i=EU({url:n,parse:BM,loaders:o},r,i||null),await Srt(c,e,r,i)):null}async function Srt(e,t,r,i){if(u4(e),Du(t)){let n=t,{ok:s,redirected:o,status:c,statusText:d,type:_,url:w}=n,I=Object.fromEntries(n.headers.entries());i.response={headers:I,ok:s,redirected:o,status:c,statusText:d,type:_,url:w}}if(t=await MU(t,e,r),e.parseTextSync&&typeof t==\"string\")return r.dataType=\"text\",e.parseTextSync(t,r,i,e);if(h4(e,r))return await f4(e,t,r,i,BM);if(e.parseText&&typeof t==\"string\")return await e.parseText(t,r,i,e);if(e.parse)return await e.parse(t,r,i,e);throw Ka(!e.parseSync),new Error(\"\".concat(e.id,\" loader - no parser found and worker is disabled\"))}async function jA(e,t,r,i){!Array.isArray(t)&&!j1(t)&&(i=void 0,r=t,t=void 0);let n=OM(r),s=e;return typeof e==\"string\"&&(s=await n(e)),Ou(e)&&(s=await n(e)),await BM(s,t,r)}var IU=\"3.4.14\";var{_parseImageNode:Trt}=globalThis,C4=typeof Image<\"u\",L4=typeof ImageBitmap<\"u\",Mrt=!!Trt,k4=I0?!0:Mrt;function CU(e){switch(e){case\"auto\":return L4||C4||k4;case\"imagebitmap\":return L4;case\"image\":return C4;case\"data\":return k4;default:throw new Error(\"@loaders.gl/images: image \".concat(e,\" not supported in this environment\"))}}function LU(){if(L4)return\"imagebitmap\";if(C4)return\"image\";if(k4)return\"data\";throw new Error(\"Install '@loaders.gl/polyfills' to parse images under Node.js\")}function Ert(e){let t=Prt(e);if(!t)throw new Error(\"Not an image\");return t}function kU(e){switch(Ert(e)){case\"data\":return e;case\"image\":case\"imagebitmap\":let t=document.createElement(\"canvas\"),r=t.getContext(\"2d\");if(!r)throw new Error(\"getImageData\");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error(\"getImageData\")}}function Prt(e){return typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap?\"imagebitmap\":typeof Image<\"u\"&&e instanceof Image?\"image\":e&&typeof e==\"object\"&&e.data&&e.width&&e.height?\"data\":null}var Irt=/^data:image\\/svg\\+xml/,Crt=/\\.svg((\\?|#).*)?$/;function FM(e){return e&&(Irt.test(e)||Crt.test(e))}function RU(e,t){if(FM(t)){let i=new TextDecoder().decode(e);try{typeof unescape==\"function\"&&typeof encodeURIComponent==\"function\"&&(i=unescape(encodeURIComponent(i)))}catch(s){throw new Error(s.message)}return\"data:image/svg+xml;base64,\".concat(btoa(i))}return R4(e,t)}function R4(e,t){if(FM(t))throw new Error(\"SVG cannot be parsed directly to imagebitmap\");return new Blob([new Uint8Array(e)])}async function zM(e,t,r){let i=RU(e,r),n=self.URL||self.webkitURL,s=typeof i!=\"string\"&&n.createObjectURL(i);try{return await Lrt(s||i,t)}finally{s&&n.revokeObjectURL(s)}}async function Lrt(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=s=>n(new Error(\"Could not load image \".concat(e,\": \").concat(s)))}catch(s){n(s)}})}var krt={},DU=!0;async function OU(e,t,r){let i;FM(r)?i=await zM(e,t,r):i=R4(e,r);let n=t&&t.imagebitmap;return await Rrt(i,n)}async function Rrt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Drt(t)||!DU)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),DU=!1}return await createImageBitmap(e)}function Drt(e){for(let t in e||krt)return!1;return!0}function BU(e){return!zrt(e,\"ftyp\",4)||!(e[8]&96)?null:Ort(e)}function Ort(e){switch(Brt(e,8,12).replace(\"\\0\",\" \").trim()){case\"avif\":case\"avis\":return{extension:\"avif\",mimeType:\"image/avif\"};default:return null}}function Brt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function Frt(e){return[...e].map(t=>t.charCodeAt(0))}function zrt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Frt(t);for(let n=0;n=24&&t.getUint32(0,Zf)===2303741511?{mimeType:\"image/png\",width:t.getUint32(16,Zf),height:t.getUint32(20,Zf)}:null}function Vrt(e){let t=H1(e);return t.byteLength>=10&&t.getUint32(0,Zf)===1195984440?{mimeType:\"image/gif\",width:t.getUint16(6,W1),height:t.getUint16(8,W1)}:null}function jrt(e){let t=H1(e);return t.byteLength>=14&&t.getUint16(0,Zf)===16973&&t.getUint32(2,W1)===t.byteLength?{mimeType:\"image/bmp\",width:t.getUint32(18,W1),height:t.getUint32(22,W1)}:null}function Grt(e){let t=H1(e);if(!(t.byteLength>=3&&t.getUint16(0,Zf)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Wrt(),s=2;for(;s+9!!NM(new DataView(e))],options:Yrt};function q1(e){if(typeof window<\"u\"&&typeof window.process==\"object\"&&window.process.type===\"renderer\"||typeof process<\"u\"&&typeof process.versions==\"object\"&&process.versions.electron)return!0;let t=typeof navigator==\"object\"&&typeof navigator.userAgent==\"string\"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf(\"Electron\")>=0)}function Io(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||q1()}var GA={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document,process:typeof process==\"object\"&&process};var $rt=GA.self||GA.window||GA.global,sy=GA.window||GA.self||GA.global,Qrt=GA.document||{},F0=GA.process||{};var UM=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",nMt=Io();var O4=globalThis;function oy(e){if(!e&&!Io())return\"Node\";if(q1(e))return\"Electron\";let r=e||(typeof navigator<\"u\"?navigator:{}).userAgent||\"\";if(r.indexOf(\"Edge\")>-1)return\"Edge\";let i=r.indexOf(\"MSIE \")!==-1,n=r.indexOf(\"Trident/\")!==-1;return i||n?\"IE\":O4.chrome?\"Chrome\":O4.safari?\"Safari\":O4.mozInnerScreenX?\"Firefox\":\"Unknown\"}function Xrt(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var VM=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";G(this,\"storage\",void 0),G(this,\"id\",void 0),G(this,\"config\",void 0),this.storage=Xrt(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function NU(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function UU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function jM(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,n=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let s=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(s/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(n,\");\"),\"background-size:\".concat(s,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var GM;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(GM||(GM={}));function VU(e){return typeof e==\"string\"?GM[e.toUpperCase()]||GM.WHITE:e}function jU(e,t,r){return!Io&&typeof e==\"string\"&&(t&&(t=VU(t),e=\"\\x1B[\".concat(t,\"m\").concat(e,\"\\x1B[39m\")),r&&(t=VU(r),e=\"\\x1B[\".concat(r+10,\"m\").concat(e,\"\\x1B[49m\"))),e}function GU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r);for(let n of i)typeof e[n]==\"function\"&&(t.find(s=>n===s)||(e[n]=e[n].bind(e)))}function ay(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function z0(){let e;if(Io&&\"performance\"in sy){var t,r;e=sy===null||sy===void 0||(t=sy.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in F0){var i;let n=F0===null||F0===void 0||(i=F0.hrtime)===null||i===void 0?void 0:i.call(F0);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}var ly={debug:Io&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Krt={enabled:!0,level:0};function Fu(){}var WU={},HU={once:!0},Yf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};G(this,\"id\",void 0),G(this,\"VERSION\",UM),G(this,\"_startTs\",z0()),G(this,\"_deltaTs\",z0()),G(this,\"_storage\",void 0),G(this,\"userData\",{}),G(this,\"LOG_THROTTLE_TIMEOUT\",0),this.id=t,this.userData={},this._storage=new VM(\"__probe-\".concat(this.id,\"__\"),Krt),this.timeStamp(\"\".concat(this.id,\" started\")),GU(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((z0()-this._startTs).toPrecision(10))}getDelta(){return Number((z0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){ay(t,r)}warn(t){return this._getLogFunction(0,t,ly.warn,arguments,HU)}error(t){return this._getLogFunction(0,t,ly.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,ly.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ly.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;s2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},n=qU({logLevel:t,message:r,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||Fu)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=ZU(t)}_getLogFunction(t,r,i,n,s){if(this._shouldLog(t)){s=qU({logLevel:t,message:r,args:n,opts:s}),i=i||s.method,ay(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=z0();let o=s.tag||s.message;if(s.once)if(!WU[o])WU[o]=z0();else return Fu;return r=Jrt(this.id,s.message,s),i.bind(console,r,...s.args)}return Fu}};G(Yf,\"VERSION\",UM);function ZU(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return ay(Number.isFinite(t)&&t>=0),t}function qU(e){let{logLevel:t,message:r}=e;e.logLevel=ZU(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let n=typeof e.message;return ay(n===\"string\"||n===\"object\"),Object.assign(e,{args:i},e.opts)}function Jrt(e,t,r){if(typeof t==\"string\"){let i=r.time?UU(NU(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=jU(t,r.color,r.background)}return t}function tit(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),Fu}function eit(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let s=new Image;return s.onload=()=>{let o=jM(s,r,i);console.log(...o)},s.src=t,Fu}let n=t.nodeName||\"\";if(n.toLowerCase()===\"img\")return console.log(...jM(t,r,i)),Fu;if(n.toLowerCase()===\"canvas\"){let s=new Image;return s.onload=()=>console.log(...jM(s,r,i)),s.src=t.toDataURL(),Fu}return Fu}function rit(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var FMt=new Yf({id:\"@probe.gl/log\"});var rr=new Yf({id:\"deck\"});var B4={};function YU(e){B4=e}function Ds(e,t,r,i){rr.level>0&&B4[e]&&B4[e].call(null,t,r,i)}function iit(e){let t=e[0],r=e[e.length-1];return t===\"{\"&&r===\"}\"||t===\"[\"&&r===\"]\"}var $U={id:\"JSON\",name:\"JSON\",module:\"\",version:\"\",options:{},extensions:[\"json\",\"geojson\"],mimeTypes:[\"application/json\",\"application/geo+json\"],testText:iit,parseTextSync:JSON.parse};function nit(){let e=\"8.9.34\",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(\"deck.gl - multiple versions detected: \".concat(t,\" vs \").concat(e));return t||(rr.log(1,\"deck.gl \".concat(e))(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:rr,_registerLoggers:YU},M4([$U,[D4,{imagebitmap:{premultiplyAlpha:\"none\"}}]])),e}var QU=nit();var Hr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Hr,\"IDENTITY\",{get:()=>(rr.deprecated(\"COORDINATE_SYSTEM.IDENTITY\",\"COORDINATE_SYSTEM.CARTESIAN\")(),0)});var Ja={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},ea={common:0,meters:1,pixels:2},F4={click:{handler:\"onClick\"},panstart:{handler:\"onDragStart\"},panmove:{handler:\"onDrag\"},panend:{handler:\"onDragEnd\"}};var Ge=new Yf({id:\"luma.gl\"});function Xs(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}var sit=\"Invalid WebGLRenderingContext\";var oit=\"Requires WebGL2\";function Xd(e){return typeof WebGLRenderingContext<\"u\"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&Number.isFinite(e._version))}function fr(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function z4(e){return fr(e)?e:null}function Kd(e){return Xs(Xd(e),sit),e}function Xn(e){return Xs(fr(e),oit),e}var Z1={};function ait(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function lit(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function cit(e,t){Z1[e]=!0,t!==void 0&&ait(t)}function uit(e){let t=e.getError;e.getError=function(){let i;do i=t.apply(e),i!==0&&(Z1[i]=!0);while(i!==0);for(i in Z1)if(Z1[i])return delete Z1[i],parseInt(i,10);return 0}}var Y1=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let i=0;i{lit(\"OESVertexArrayObject emulation library context restored\"),r.reset_()},!0),this.reset_()};N0.prototype.VERTEX_ARRAY_BINDING_OES=34229;N0.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let i=0;ifr(e)?void 0:0,vit={3074:e=>fr(e)?void 0:36064,[pit]:e=>fr(e)?void 0:Ait,35977:Un,32937:Un,[mit]:(e,t)=>{let r=fr(e)?e.getExtension(fit):e.getExtension(hit);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[_it]:(e,t)=>{let r=e.getExtension(tV);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[yit]:(e,t)=>{let r=e.getExtension(tV);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[git]:(e,t)=>{let r=e.luma.extensions[dit];return r?t(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:Un,35071:Un,37447:Un,36063:(e,t)=>{if(!fr(e)){let r=e.getExtension(JU);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:Un,35374:Un,35377:Un,34852:e=>{if(!fr(e)){let t=e.getExtension(JU);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},36203:e=>e.getExtension(KU)?2147483647:65535,33001:e=>e.getExtension(KU)?16777216:65535,33e3:e=>16777216,37157:Un,35373:Un,35657:Un,36183:Un,37137:Un,34045:Un,35978:Un,35979:Un,35968:Un,35376:Un,35375:Un,35659:Un,37154:Un,35371:Un,35658:Un,35076:Un,35077:Un,35380:Un};function eV(e,t,r){let i=vit[r],n=typeof i==\"function\"?i(e,t,r):i;return n!==void 0?n:t(r)}var xit=\"OES_vertex_array_object\",rV=\"ANGLE_instanced_arrays\",bit=\"WEBGL_draw_buffers\",wit=\"EXT_disjoint_timer_query\",Sit=\"EXT_texture_filter_anisotropic\",Tit=\"VertexArray requires WebGL2 or OES_vertex_array_object extension\";function Mit(e,t){return{webgl2:fr(e),ext:e.getExtension(t)}}var N4={[xit]:{meta:{suffix:\"OES\"},createVertexArray:()=>{Xs(!1,Tit)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[rV]:{meta:{suffix:\"ANGLE\"},vertexAttribDivisor(e,t){Xs(t===0,\"WebGL instanced rendering not supported\")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[bit]:{meta:{suffix:\"WEBGL\"},drawBuffers:()=>{Xs(!1)}},[wit]:{meta:{suffix:\"EXT\"},createQuery:()=>{Xs(!1)},deleteQuery:()=>{Xs(!1)},beginQuery:()=>{Xs(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:()=>{}}},WM={readBuffer:(e,t,r)=>{fr(e)&&t(r)},getVertexAttrib:(e,t,r,i)=>{let{webgl2:n,ext:s}=Mit(e,rV),o;switch(i){case 35069:o=n?void 0:!1;break;case 35070:o=!n&&!s?0:void 0;break;default:}return o!==void 0?o:t(r,i)},getProgramParameter:(e,t,r,i)=>{if(!fr(e))switch(i){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,i)},getInternalformatParameter:(e,t,r,i,n)=>{if(!fr(e))switch(n){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,i,n)},getTexParameter(e,t,r,i){switch(i){case 34046:let{extensions:n}=e.luma,s=n[Sit];i=s&&s.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,i)},getParameter:eV,hint(e,t,r,i){return t(r,i)}};function iV(e){e.luma=e.luma||{};let{luma:t}=e;return t.polyfilled||(XU(e),Eit(e),Iit(e,N4),Pit(e,{target:t,target2:e}),t.polyfilled=!0),e}globalThis.polyfillContext=iV;function Eit(e){e.luma.extensions={};let t=e.getSupportedExtensions()||[];for(let r of t)e.luma[r]=e.getExtension(r)}function Pit(e,t){let{target:r,target2:i}=t;Object.keys(WM).forEach(n=>{if(typeof WM[n]==\"function\"){let s=e[n]?e[n].bind(e):()=>{},o=WM[n].bind(null,e,s);r[n]=o,i[n]=o}})}function Iit(e,t){for(let r of Object.getOwnPropertyNames(t))r!==\"overrides\"&&Cit(e,{extension:r,target:e.luma,target2:e})}function Cit(e,t){let{extension:r,target:i,target2:n}=t,s=N4[r];Xs(s);let{meta:o={}}=s,{suffix:c=\"\"}=o,d=e.getExtension(r);for(let _ of Object.keys(s)){let w=\"\".concat(_).concat(c),I=null;_===\"meta\"||typeof e[_]==\"function\"||(d&&typeof d[w]==\"function\"?I=function(){return d[w](...arguments)}:typeof s[_]==\"function\"&&(I=s[_].bind(i))),I&&(i[_]=I,n[_]=I)}}var Q1={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},WA=(e,t,r)=>t?e.enable(r):e.disable(r),nV=(e,t,r)=>e.hint(r,t),Yc=(e,t,r)=>e.pixelStorei(r,t),Lit=(e,t)=>{let r=fr(e)?36009:36160;return e.bindFramebuffer(r,t)},kit=(e,t)=>e.bindFramebuffer(36008,t);function $1(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var sV={3042:WA,32773:(e,t)=>e.blendColor(...t),32777:\"blendEquation\",34877:\"blendEquation\",32969:\"blendFunc\",32968:\"blendFunc\",32971:\"blendFunc\",32970:\"blendFunc\",3106:(e,t)=>e.clearColor(...t),3107:(e,t)=>e.colorMask(...t),2884:WA,2885:(e,t)=>e.cullFace(t),2929:WA,2931:(e,t)=>e.clearDepth(t),2932:(e,t)=>e.depthFunc(t),2928:(e,t)=>e.depthRange(...t),2930:(e,t)=>e.depthMask(t),3024:WA,35723:nV,36006:Lit,2886:(e,t)=>e.frontFace(t),33170:nV,2849:(e,t)=>e.lineWidth(t),32823:WA,32824:\"polygonOffset\",10752:\"polygonOffset\",35977:WA,32938:\"sampleCoverage\",32939:\"sampleCoverage\",3089:WA,3088:(e,t)=>e.scissor(...t),2960:WA,2961:(e,t)=>e.clearStencil(t),2968:(e,t)=>e.stencilMaskSeparate(1028,t),36005:(e,t)=>e.stencilMaskSeparate(1029,t),2962:\"stencilFuncFront\",2967:\"stencilFuncFront\",2963:\"stencilFuncFront\",34816:\"stencilFuncBack\",36003:\"stencilFuncBack\",36004:\"stencilFuncBack\",2964:\"stencilOpFront\",2965:\"stencilOpFront\",2966:\"stencilOpFront\",34817:\"stencilOpBack\",34818:\"stencilOpBack\",34819:\"stencilOpBack\",2978:(e,t)=>e.viewport(...t),3333:Yc,3317:Yc,37440:Yc,37441:Yc,37443:Yc,3330:Yc,3332:Yc,3331:Yc,36010:kit,3314:Yc,32878:Yc,3316:Yc,3315:Yc,32877:Yc,framebuffer:(e,t)=>{let r=t&&\"handle\"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{t=$1(t)?t:[t,t],e.blendEquationSeparate(...t)},blendFunc:(e,t)=>{t=$1(t)&&t.length===2?[...t,...t]:t,e.blendFuncSeparate(...t)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=$1(t)?t:[t,t];let[r,i]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,i)},stencilFunc:(e,t)=>{t=$1(t)&&t.length===3?[...t,...t]:t;let[r,i,n,s,o,c]=t;e.stencilFuncSeparate(1028,r,i,n),e.stencilFuncSeparate(1029,s,o,c)},stencilOp:(e,t)=>{t=$1(t)&&t.length===3?[...t,...t]:t;let[r,i,n,s,o,c]=t;e.stencilOpSeparate(1028,r,i,n),e.stencilOpSeparate(1029,s,o,c)},viewport:(e,t)=>e.viewport(...t)};function Os(e,t,r){return t[e]!==void 0?t[e]:r[e]}var oV={blendEquation:(e,t,r)=>e.blendEquationSeparate(Os(32777,t,r),Os(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(Os(32969,t,r),Os(32968,t,r),Os(32971,t,r),Os(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(Os(32824,t,r),Os(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(Os(32938,t,r),Os(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,Os(2962,t,r),Os(2967,t,r),Os(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,Os(34816,t,r),Os(36003,t,r),Os(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,Os(2964,t,r),Os(2965,t,r),Os(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,Os(34817,t,r),Os(34818,t,r),Os(34819,t,r))},U4={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({36006:r,36010:r});case 36009:return e({36006:r});case 36008:return e({36010:r});default:return null}},blendColor:(e,t,r,i,n)=>e({32773:new Float32Array([t,r,i,n])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,r)=>e({32777:t,34877:r}),blendFunc:(e,t,r)=>e({32969:t,32968:r,32971:t,32970:r}),blendFuncSeparate:(e,t,r,i,n)=>e({32969:t,32968:r,32971:i,32970:n}),clearColor:(e,t,r,i,n)=>e({3106:new Float32Array([t,r,i,n])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,r,i,n)=>e({3107:[t,r,i,n]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,r)=>e({2928:new Float32Array([t,r])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,r)=>e({32824:t,10752:r}),sampleCoverage:(e,t,r)=>e({32938:t,32939:r}),scissor:(e,t,r,i,n)=>e({3088:new Int32Array([t,r,i,n])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,i)=>e({2962:t,2967:r,2963:i,34816:t,36003:r,36004:i}),stencilFuncSeparate:(e,t,r,i,n)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:i,[t===1028?2963:36004]:n}),stencilOp:(e,t,r,i)=>e({2964:t,2965:r,2966:i,34817:t,34818:r,34819:i}),stencilOpSeparate:(e,t,r,i,n)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:i,[t===1028?2966:34819]:n}),viewport:(e,t,r,i,n)=>e({2978:[t,r,i,n]})},$f=(e,t)=>e.isEnabled(t),V4={3042:$f,2884:$f,2929:$f,3024:$f,32823:$f,32926:$f,32928:$f,3089:$f,2960:$f,35977:$f};function j4(e){for(let t in e)return!1;return!0}function aV(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),i=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&i&&e.length===t.length){for(let n=0;n{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=r?cy(t):Object.assign({},Q1),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){Xs(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];wl(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,i,n=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(let s in t){Xs(s!==void 0);let o=t[s],c=this.cache[s];aV(o,c)||(r=!0,i=c,n&&!(s in n)&&(n[s]=c),this.cache[s]=o)}return{valueChanged:r,oldValue:i}}};function HM(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{enable:r=!0,copyState:i}=t;if(Xs(i!==void 0),!e.state){let{polyfillContext:n}=globalThis;n&&n(e),e.state=new G4(e,{copyState:i}),Dit(e);for(let s in U4){let o=U4[s];Rit(e,s,o)}lV(e,\"getParameter\"),lV(e,\"isEnabled\")}return e.state.enable=r,e}function W4(e){e.state||HM(e,{copyState:!1}),e.state.push()}function qM(e){Xs(e.state),e.state.pop()}function wl(e,t){if(Xs(Xd(e),\"setParameters requires a WebGL context\"),j4(t))return;let r={};for(let n in t){let s=Number(n),o=sV[n];o&&(typeof o==\"string\"?r[o]=!0:o(e,t[n],s))}let i=e.state&&e.state.cache;if(i)for(let n in r){let s=oV[n];s(e,t,i)}}function cy(e,t){if(t=t||Q1,typeof t==\"number\"){let n=t,s=V4[n];return s?s(e,n):e.getParameter(n)}let r=Array.isArray(t)?t:Object.keys(t),i={};for(let n of r){let s=V4[n];i[n]=s?s(e,Number(n)):e.getParameter(Number(n))}return i}function ZM(e){wl(e,Q1)}function mn(e,t,r){if(j4(t))return r(e);let{nocatch:i=!0}=t;W4(e),wl(e,t);let n;if(i)n=r(e),qM(e);else try{n=r(e)}finally{qM(e)}return n}function Sl(e){let{luma:t}=e;if(e.canvas&&t){let r=t.canvasSizeInfo,i=\"clientWidth\"in r?r.clientWidth:e.canvas.clientWidth;return i?e.drawingBufferWidth/i:1}return 1}function uy(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Sl(e),n=e.drawingBufferWidth,s=e.drawingBufferHeight;return Oit(t,i,n,s,r)}function hV(e){let t=typeof window>\"u\"?1:window.devicePixelRatio||1;return Number.isFinite(e)?e<=0?1:e:e?t:1}function Oit(e,t,r,i,n){let s=cV(e[0],t,r),o=uV(e[1],t,i,n),c=cV(e[0]+1,t,r),d=c===r-1?c:c-1;c=uV(e[1]+1,t,i,n);let _;return n?(c=c===0?c:c+1,_=o,o=c):_=c===i-1?c:c-1,{x:s,y:o,width:Math.max(d-s+1,1),height:Math.max(_-o+1,1)}}function cV(e,t,r){return Math.min(Math.round(e*t),r-1)}function uV(e,t,r,i){return i?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var H4=Io(),Bit=H4&&typeof document<\"u\",fV={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function hy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(H4,`createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils`),e=Object.assign({},fV,e);let{width:t,height:r}=e;function i(c){if(e.throwOnError)throw new Error(c);return console.error(c),null}e.onError=i;let n,{canvas:s}=e,o=zit({canvas:s,width:t,height:r,onError:i});return n=Fit(o,e),n?(n=U0(n,e),Nit(n),n):null}function U0(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||e._instrumented)return e;e._version=e._version||Uit(e),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{},t=Object.assign({},fV,t);let{manageState:r,debug:i}=t;return r&&HM(e,{copyState:!1,log:function(){for(var n=arguments.length,s=new Array(n),o=0;o1&&arguments[1]!==void 0?arguments[1]:{};if(e.canvas){let i=hV(t.useDevicePixels);Vit(e,i,t);return}let r=e.getExtension(\"STACKGL_resize_drawingbuffer\");r&&\"width\"in t&&\"height\"in t&&r.resize(t.width,t.height)}function Fit(e,t){let{onError:r}=t,i=null,n=d=>i=d.statusMessage||i;e.addEventListener(\"webglcontextcreationerror\",n,!1);let{webgl1:s=!0,webgl2:o=!0}=t,c=null;return o&&(c=c||e.getContext(\"webgl2\",t),c=c||e.getContext(\"experimental-webgl2\",t)),s&&(c=c||e.getContext(\"webgl\",t),c=c||e.getContext(\"experimental-webgl\",t)),e.removeEventListener(\"webglcontextcreationerror\",n,!1),c?(t.onContextLost&&e.addEventListener(\"webglcontextlost\",t.onContextLost,!1),t.onContextRestored&&e.addEventListener(\"webglcontextrestored\",t.onContextRestored,!1),c):r(\"Failed to create \".concat(o&&!s?\"WebGL2\":\"WebGL\",\" context: \").concat(i||\"Unknown error\"))}function zit(e){let{canvas:t,width:r=800,height:i=600,onError:n}=e,s;return typeof t==\"string\"?(Bit&&document.readyState===\"complete\"||n(\"createGLContext called on canvas '\".concat(t,\"' before page was loaded\")),s=document.getElementById(t)):t?s=t:(s=document.createElement(\"canvas\"),s.id=\"lumagl-canvas\",s.style.width=Number.isFinite(r)?\"\".concat(r,\"px\"):\"100%\",s.style.height=Number.isFinite(i)?\"\".concat(i,\"px\"):\"100%\",document.body.insertBefore(s,document.body.firstChild)),s}function Nit(e){let t=fr(e)?\"WebGL2\":\"WebGL1\",r=dV(e),i=r?\"(\".concat(r.vendor,\",\").concat(r.renderer,\")\"):\"\",n=e.debug?\" debug\":\"\";Ge.info(1,\"\".concat(t).concat(n,\" context \").concat(i))()}function Uit(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?2:1}function Vit(e,t,r){let i=\"width\"in r?r.width:e.canvas.clientWidth,n=\"height\"in r?r.height:e.canvas.clientHeight;(!i||!n)&&(Ge.log(1,\"Canvas clientWidth/clientHeight is 0\")(),t=1,i=e.canvas.width||1,n=e.canvas.height||1),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{};let s=e.luma.canvasSizeInfo;if(s.clientWidth!==i||s.clientHeight!==n||s.devicePixelRatio!==t){let o=t,c=Math.floor(i*o),d=Math.floor(n*o);e.canvas.width=c,e.canvas.height=d,(e.drawingBufferWidth!==c||e.drawingBufferHeight!==d)&&(Ge.warn(\"Device pixel ratio clamped\")(),o=Math.min(e.drawingBufferWidth/i,e.drawingBufferHeight/n),e.canvas.width=Math.floor(i*o),e.canvas.height=Math.floor(n*o)),Object.assign(e.luma.canvasSizeInfo,{clientWidth:i,clientHeight:n,devicePixelRatio:t})}}function X1(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var V0=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"type\",void 0),G(this,\"sampleSize\",1),G(this,\"time\",void 0),G(this,\"count\",void 0),G(this,\"samples\",void 0),G(this,\"lastTiming\",void 0),G(this,\"lastSampleTime\",void 0),G(this,\"lastSampleCount\",void 0),G(this,\"_count\",0),G(this,\"_time\",0),G(this,\"_samples\",0),G(this,\"_startTime\",0),G(this,\"_timerPending\",!1),this.name=t,this.type=r,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=X1(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(X1()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Qf=class{constructor(t){G(this,\"id\",void 0),G(this,\"stats\",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t in this.stats)this.stats[t].reset();return this}forEach(t){for(let r in this.stats)t(this.stats[r])}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){if(!t||!t.name)return null;let{name:r,type:i}=t;return this.stats[r]||(t instanceof V0?this.stats[r]=t:this.stats[r]=new V0(r,i)),this.stats[r]}};var K1=\"8.5.21\",jit=\"set luma.log.level=1 (or higher) to trace rendering\",Z4=class{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new Qf({id:t})),this.stats.get(t)}},zu=new Z4;if(globalThis.luma&&globalThis.luma.VERSION!==K1)throw new Error(\"luma.gl - multiple VERSIONs detected: \".concat(globalThis.luma.VERSION,\" vs \").concat(K1));globalThis.luma||(Io()&&Ge.log(1,\"luma.gl \".concat(K1,\" - \").concat(jit))(),globalThis.luma=globalThis.luma||{VERSION:K1,version:K1,log:Ge,stats:zu,globals:{modules:{},nodeIO:{}}});var sPt=globalThis.luma;function Y4(e){return typeof window<\"u\"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function $4(e){return typeof window<\"u\"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}function ye(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}function YM(e,t){if(typeof t!=\"string\")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\\./,\"\");let i=e[t];return ye(i!==void 0,\"Accessing undefined constant GL.\".concat(t)),i}function Nu(e,t){t=Number(t);for(let r in e)if(e[r]===t)return\"GL.\".concat(r);return String(t)}var Q4={};function ra(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:\"id\";Q4[e]=Q4[e]||1;let t=Q4[e]++;return\"\".concat(e,\"-\").concat(t)}function X4(e){return ye(typeof e==\"number\",\"Input must be a number\"),e&&(e&e-1)===0}function Xf(e){let t=!0;for(let r in e){t=!1;break}return t}function $M(e,t,r,i){let n=\"See luma.gl \".concat(r,\" Upgrade Guide at https://luma.gl/docs/upgrade-guide\"),s=Object.getPrototypeOf(e);i.forEach(o=>{s.methodName||(s[o]=()=>{throw Ge.removed(\"Calling removed method \".concat(t,\".\").concat(o,\": \"),n)(),new Error(o)})})}var fy=\"Resource subclass must define virtual methods\",Ks=class{get[Symbol.toStringTag](){return\"Resource\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Kd(t);let{id:i,userData:n={}}=r;this.gl=t,this.gl2=t,this.id=i||ra(this[Symbol.toStringTag]),this.userData=n,this._bound=!1,this._handle=r.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return\"\".concat(this[Symbol.toStringTag]||this.constructor.name,\"(\").concat(this.id,\")\")}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(i=>i.delete()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!=\"function\")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=YM(this.gl,t),ye(t);let n=(this.constructor.PARAMETERS||{})[t];if(n){let s=fr(this.gl);if(!((!(\"webgl2\"in n)||s)&&(!(\"extension\"in n)||this.gl.getExtension(n.extension)))){let c=n.webgl1,d=\"webgl2\"in n?n.webgl2:n.webgl1;return s?d:c}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:i}=t,n=this.constructor.PARAMETERS||{},s=fr(this.gl),o={},c=r||Object.keys(n);for(let d of c){let _=n[d];if(_&&(!(\"webgl2\"in _)||s)&&(!(\"extension\"in _)||this.gl.getExtension(_.extension))){let I=i?Nu(this.gl,d):d;o[I]=this.getParameter(d,t),i&&_.type===\"GLenum\"&&(o[I]=Nu(this.gl,o[I]))}}return o}setParameter(t,r){t=YM(this.gl,t),ye(t);let n=(this.constructor.PARAMETERS||{})[t];if(n){let s=fr(this.gl);if(!((!(\"webgl2\"in n)||s)&&(!(\"extension\"in n)||this.gl.getExtension(n.extension))))throw new Error(\"Parameter not available on this platform\");n.type===\"GLenum\"&&(r=YM(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,i){return $M(this,t,r,i)}initialize(t){}_createHandle(){throw new Error(fy)}_deleteHandle(){throw new Error(fy)}_bindHandle(t){throw new Error(fy)}_getOptsFromHandle(){throw new Error(fy)}_getParameter(t,r){throw new Error(fy)}_setParameter(t,r){throw new Error(fy)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){let t=this[Symbol.toStringTag],r=zu.get(\"Resource Counts\");r.get(\"Resources Created\").incrementCount(),r.get(\"\".concat(t,\"s Created\")).incrementCount(),r.get(\"\".concat(t,\"s Active\")).incrementCount()}_removeStats(){let t=this[Symbol.toStringTag];zu.get(\"Resource Counts\").get(\"\".concat(t,\"s Active\")).decrementCount()}_trackAllocatedMemory(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(t,r),this._trackAllocatedMemoryForContext(t,r,this.gl.canvas&&this.gl.canvas.id),this.byteLength=t}_trackAllocatedMemoryForContext(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"\",n=zu.get(\"Memory Usage\".concat(i));n.get(\"GPU Memory\").addCount(t),n.get(\"\".concat(r,\" Memory\")).addCount(t)}_trackDeallocatedMemory(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(t),this._trackDeallocatedMemoryForContext(t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\",i=zu.get(\"Memory Usage\".concat(r));i.get(\"GPU Memory\").subtractCount(this.byteLength),i.get(\"\".concat(t,\" Memory\")).subtractCount(this.byteLength)}};var Git=\"Failed to deduce GL constant from typed array\";function J1(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Git)}}function HA(e){let{clamped:t=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error(\"Failed to deduce typed array type from GL constant\")}}function pV(e){let{data:t,width:r,height:i,bytesPerPixel:n=4,temp:s}=e,o=r*n;s=s||new Uint8Array(o);for(let c=0;cthis._assign(n)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return e.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return e.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=tb(\"Accessor\",t,Hit),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index==\"boolean\"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this}};var mV=10,gV={offset:\"accessor.offset\",stride:\"accessor.stride\",type:\"accessor.type\",size:\"accessor.size\",divisor:\"accessor.divisor\",normalized:\"accessor.normalized\",integer:\"accessor.integer\",instanced:\"accessor.divisor\",isInstanced:\"accessor.divisor\"},qit={removedProps:{},replacedProps:{bytes:\"byteLength\"},deprecatedProps:gV},Zit={removedProps:gV},Ur=class extends Ks{get[Symbol.toStringTag](){return\"Buffer\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Buffer\",\"v6.0\",[\"layout\",\"setLayout\",\"getIndexedParameter\"]),this.target=r.target||(this.gl.webgl2?36662:34962),this.initialize(r),Object.seal(this)}getElementCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Tl.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Tl.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=tb(\"Buffer\",t,qit),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return t=tb(\"Buffer\",t,Zit),\"accessor\"in t&&this.setAccessor(t.accessor),this}setAccessor(t){return t=Object.assign({},t),delete t.buffer,this.accessor=new Tl(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});let{data:r,offset:i=0,srcOffset:n=0}=t,s=t.byteLength||t.length;ye(r);let o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),n!==0||s!==void 0?(Xn(this.gl),this.gl.bufferSubData(this.target,i,r,n,s)):this.gl.bufferSubData(o,i,r),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(r),this}copyData(t){let{sourceBuffer:r,readOffset:i=0,writeOffset:n=0,size:s}=t,{gl:o}=this;return Xn(o),o.bindBuffer(36662,r.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,i,n,s),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:t=null,srcByteOffset:r=0,dstOffset:i=0,length:n=0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(this.gl);let s=HA(this.accessor.type||5126,{clamped:!1}),o=this._getAvailableElementCount(r),c=i,d,_;t?(_=t.length,d=_-c):(d=Math.min(o,n||o),_=c+d);let w=Math.min(o,d);return n=n||w,ye(n<=w),t=t||new s(_),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,r,t,i,n),this.gl.bindBuffer(36662,null),t}bind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index,offset:i=0,size:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?n!==void 0?this.gl.bindBufferRange(t,r,this.handle,i,n):(ye(i===0),this.gl.bindBufferBase(t,r,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?this.gl.bindBufferBase(t,r,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(mV,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;ye(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();let n=this._getTarget();this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.usage),this.gl.bufferSubData(n,r,t),this.gl.bindBuffer(n,null),this.debugData=t.slice(0,mV),this.bytesUsed=i,this._trackAllocatedMemory(i);let s=J1(t);return ye(s),this.setAccessor(new Tl(this.accessor,{type:s})),this}_setByteLength(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.usage;ye(t>=0),this._trackDeallocatedMemory();let i=t;t===0&&(i=new Float32Array(0));let n=this._getTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,r),this.gl.bindBuffer(n,null),this.usage=r,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){let r=HA(this.accessor.type||5126,{clamped:!1}),i=t/r.BYTES_PER_ELEMENT;return this.getElementCount()-i}_inferType(t){this.accessor.type||this.setAccessor(new Tl(this.accessor,{type:J1(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);let r=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),r}get type(){return Ge.deprecated(\"Buffer.type\",\"Buffer.accessor.type\")(),this.accessor.type}get bytes(){return Ge.deprecated(\"Buffer.bytes\",\"Buffer.byteLength\")(),this.byteLength}setByteLength(t){return Ge.deprecated(\"setByteLength\",\"reallocate\")(),this.reallocate(t)}updateAccessor(t){return Ge.deprecated(\"updateAccessor(...)\",\"setAccessor(new Accessor(buffer.accessor, ...)\")(),this.accessor=new Tl(this.accessor,t),this}};var QM={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},XM={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},KM={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function _V(e,t){let r=QM[t];if(!r)return!1;if(r.gl1===void 0&&r.gl2===void 0)return!0;let i=fr(e)&&r.gl2||r.gl1;return typeof i==\"string\"?e.getExtension(i):i}function yV(e,t){let r=QM[t];switch(r&&r.types[0]){case 5126:return e.getExtension(\"OES_texture_float_linear\");case 5131:return e.getExtension(\"OES_texture_half_float_linear\");default:return!0}}var Yit=[9729,9728],vV=globalThis.WebGLBuffer||function(){},tl=class extends Ks{get[Symbol.toStringTag](){return\"Texture\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{format:i,linearFiltering:n}=r,s=!0;return i&&(s=s&&_V(t,i),s=s&&(!n||yV(t,i))),s}constructor(t,r){let{id:i=ra(\"texture\"),handle:n,target:s}=r;super(t,{id:i,handle:n}),this.target=s,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return\"Texture(\".concat(this.id,\",\").concat(this.width,\"x\").concat(this.height,\")\")}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.data;if(r instanceof Promise)return r.then(K=>this.initialize(Object.assign({},t,{pixels:K,data:K}))),this;let i=typeof HTMLVideoElement<\"u\"&&r instanceof HTMLVideoElement;if(i&&r.readyStatethis.initialize(t)),this;let{pixels:n=null,format:s=6408,border:o=0,recreate:c=!1,parameters:d={},pixelStore:_={},textureUnit:w=void 0}=t;r||(r=n);let{width:I,height:R,dataFormat:N,type:j,compressed:Y=!1,mipmaps:it=!0}=t,{depth:Z=0}=t;return{width:I,height:R,compressed:Y,dataFormat:N,type:j}=this._deduceParameters({format:s,type:j,dataFormat:N,compressed:Y,data:r,width:I,height:R}),this.width=I,this.height=R,this.depth=Z,this.format=s,this.type=j,this.dataFormat=N,this.border=o,this.textureUnit=w,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),it&&this._isNPOT()&&(Ge.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),it=!1,this._updateForNPOT(d)),this.mipmaps=it,this.setImageData({data:r,width:I,height:R,depth:Z,format:s,type:j,dataFormat:N,border:o,mipmaps:it,parameters:_,compressed:Y}),it&&this.generateMipmap(),this.setParameters(d),c&&(this.data=r),i&&(this._video={video:r,parameters:d,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}update(){if(this._video){let{video:t,parameters:r,lastTime:i}=this._video;if(i===t.currentTime||t.readyState0&&arguments[0]!==void 0?arguments[0]:{};return this._isNPOT()?(Ge.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),mn(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory(\"Texture\");let{target:r=this.target,pixels:i=null,level:n=0,format:s=this.format,border:o=this.border,offset:c=0,parameters:d={}}=t,{data:_=null,type:w=this.type,width:I=this.width,height:R=this.height,dataFormat:N=this.dataFormat,compressed:j=!1}=t;_||(_=i),{type:w,dataFormat:N,compressed:j,width:I,height:R}=this._deduceParameters({format:s,type:w,dataFormat:N,compressed:j,data:_,width:I,height:R});let{gl:Y}=this;Y.bindTexture(this.target,this.handle);let it=null;({data:_,dataType:it}=this._getDataType({data:_,compressed:j}));let Z,K=0;if(mn(this.gl,d,()=>{switch(it){case\"null\":Y.texImage2D(r,n,s,I,R,o,N,w,_);break;case\"typed-array\":Y.texImage2D(r,n,s,I,R,o,N,w,_,c);break;case\"buffer\":Z=Xn(Y),Z.bindBuffer(35052,_.handle||_),Z.texImage2D(r,n,s,I,R,o,N,w,c),Z.bindBuffer(35052,null);break;case\"browser-object\":fr(Y)?Y.texImage2D(r,n,s,I,R,o,N,w,_):Y.texImage2D(r,n,s,N,w,_);break;case\"compressed\":for(let[J,ht]of _.entries())Y.compressedTexImage2D(r,J,ht.format,ht.width,ht.height,o,ht.data),K+=ht.levelSize;break;default:ye(!1,\"Unknown image data type\")}}),it===\"compressed\")this._trackAllocatedMemory(K,\"Texture\");else if(_&&_.byteLength)this._trackAllocatedMemory(_.byteLength,\"Texture\");else{let J=XM[this.dataFormat]||4,ht=KM[this.type]||1;this._trackAllocatedMemory(this.width*this.height*J*ht,\"Texture\")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:i=null,data:n=null,x:s=0,y:o=0,width:c=this.width,height:d=this.height,level:_=0,format:w=this.format,type:I=this.type,dataFormat:R=this.dataFormat,compressed:N=!1,offset:j=0,border:Y=this.border,parameters:it={}}=t;if({type:I,dataFormat:R,compressed:N,width:c,height:d}=this._deduceParameters({format:w,type:I,dataFormat:R,compressed:N,data:n,width:c,height:d}),ye(this.depth===0,\"texSubImage not supported for 3D textures\"),n||(n=i),n&&n.data){let Z=n;n=Z.data,c=Z.shape[0],d=Z.shape[1]}n instanceof Ur&&(n=n.handle),this.gl.bindTexture(this.target,this.handle),mn(this.gl,it,()=>{if(N)this.gl.compressedTexSubImage2D(r,_,s,o,c,d,w,n);else if(n===null)this.gl.texSubImage2D(r,_,s,o,c,d,R,I,null);else if(ArrayBuffer.isView(n))this.gl.texSubImage2D(r,_,s,o,c,d,R,I,n,j);else if(n instanceof vV){let Z=Xn(this.gl);Z.bindBuffer(35052,n),Z.texSubImage2D(r,_,s,o,c,d,R,I,j),Z.bindBuffer(35052,null)}else fr(this.gl)?Xn(this.gl).texSubImage2D(r,_,s,o,c,d,R,I,n):this.gl.texSubImage2D(r,_,s,o,R,I,n)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:i=!1}=t;return i?{data:r,dataType:\"compressed\"}:r===null?{data:r,dataType:\"null\"}:ArrayBuffer.isView(r)?{data:r,dataType:\"typed-array\"}:r instanceof Ur?{data:r.handle,dataType:\"buffer\"}:r instanceof vV?{data:r,dataType:\"buffer\"}:{data:r,dataType:\"browser-object\"}}_deduceParameters(t){let{format:r,data:i}=t,{width:n,height:s,dataFormat:o,type:c,compressed:d}=t,_=QM[r];return o=o||_&&_.dataFormat,c=c||_&&_.types[0],d=d||_&&_.compressed,{width:n,height:s}=this._deduceImageSize(i,n,s),{dataFormat:o,type:c,compressed:d,width:n,height:s,format:r,data:i}}_deduceImageSize(t,r,i){let n;return typeof ImageData<\"u\"&&t instanceof ImageData?n={width:t.width,height:t.height}:typeof HTMLImageElement<\"u\"&&t instanceof HTMLImageElement?n={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<\"u\"&&t instanceof HTMLCanvasElement?n={width:t.width,height:t.height}:typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap?n={width:t.width,height:t.height}:typeof HTMLVideoElement<\"u\"&&t instanceof HTMLVideoElement?n={width:t.videoWidth,height:t.videoHeight}:t?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},ye(n,\"Could not deduced texture size\"),ye(r===void 0||n.width===r,\"Deduced texture width does not match supplied width\"),ye(i===void 0||n.height===i,\"Deduced texture height does not match supplied height\"),n}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory(\"Texture\")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);let r=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),r}}_setParameter(t,r){switch(this.gl.bindTexture(this.target,this.handle),r=this._getNPOTParam(t,r),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,r);break;case 4096:case 4097:ye(!1);break;default:this.gl.texParameteri(this.target,t,r);break}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return fr(this.gl)||!this.width||!this.height?!1:!X4(this.width)||!X4(this.height)}_updateForNPOT(t){t[this.gl.TEXTURE_MIN_FILTER]===void 0&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),t[this.gl.TEXTURE_WRAP_S]===void 0&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),t[this.gl.TEXTURE_WRAP_T]===void 0&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,r){if(this._isNPOT())switch(t){case 10241:Yit.indexOf(r)===-1&&(r=9729);break;case 10242:case 10243:r!==33071&&(r=33071);break;default:break}return r}};var $it=\"\";function xV(e,t){return ye(typeof e==\"string\"),e=$it+e,new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(\"Could not load image \".concat(e,\".\"))),n.crossOrigin=t&&t.crossOrigin||\"anonymous\",n.src=e}catch(n){i(n)}})}var ui=class extends tl{get[Symbol.toStringTag](){return\"Texture2D\"}static isSupported(t,r){return tl.isSupported(t,r)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Kd(t),(r instanceof Promise||typeof r==\"string\")&&(r={data:r}),typeof r.data==\"string\"&&(r=Object.assign({},r,{data:xV(r.data)})),super(t,Object.assign({},r,{target:3553})),this.initialize(r),Object.seal(this)}};var K4=[34069,34070,34071,34072,34073,34074],j0=class extends tl{get[Symbol.toStringTag](){return\"TextureCube\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Kd(t),super(t,Object.assign({},r,{target:34067})),this.initialize(r),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{mipmaps:r=!0,parameters:i={}}=t;return this.opts=t,this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setParameters(i)}),this}subImage(t){let{face:r,data:i,x:n=0,y:s=0,mipmapLevel:o=0}=t;return this._subImage({target:r,data:i,x:n,y:s,mipmapLevel:o})}async setCubeMapImageData(t){let{width:r,height:i,pixels:n,data:s,border:o=0,format:c=6408,type:d=5121}=t,{gl:_}=this,w=n||s,I=await Promise.all(K4.map(R=>{let N=w[R];return Promise.all(Array.isArray(N)?N:[N])}));this.bind(),K4.forEach((R,N)=>{I[N].length>1&&this.opts.mipmaps!==!1&&Ge.warn(\"\".concat(this.id,\" has mipmap and multiple LODs.\"))(),I[N].forEach((j,Y)=>{r&&i?_.texImage2D(R,Y,c,r,i,o,c,d,j):_.texImage2D(R,Y,c,c,d,j)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:i,height:n,pixels:s,data:o,border:c=0,format:d=6408,type:_=5121}=t,{gl:w}=this,I=s||o;return this.bind(),I instanceof Promise?I.then(R=>this.setImageDataForFace(Object.assign({},t,{face:r,data:R,pixels:R}))):this.width||this.height?w.texImage2D(r,0,d,i,n,c,d,_,I):w.texImage2D(r,0,d,d,_,I),this}};j0.FACES=K4;var dy=class extends tl{get[Symbol.toStringTag](){return\"Texture3D\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xn(t),r=Object.assign({depth:1},r,{target:32879,unpackFlipY:!1}),super(t,r),this.initialize(r),Object.seal(this)}setImageData(t){let{level:r=0,dataFormat:i=6408,width:n,height:s,depth:o=1,border:c=0,format:d,type:_=5121,offset:w=0,data:I,parameters:R={}}=t;if(this._trackDeallocatedMemory(\"Texture\"),this.gl.bindTexture(this.target,this.handle),mn(this.gl,R,()=>{ArrayBuffer.isView(I)&&this.gl.texImage3D(this.target,r,i,n,s,o,c,d,_,I),I instanceof Ur&&(this.gl.bindBuffer(35052,I.handle),this.gl.texImage3D(this.target,r,i,n,s,o,c,d,_,w))}),I&&I.byteLength)this._trackAllocatedMemory(I.byteLength,\"Texture\");else{let N=XM[this.dataFormat]||4,j=KM[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*N*j,\"Texture\")}return this.loaded=!0,this}};var G0=\"EXT_color_buffer_float\",J4={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:G0,bpp:2},33327:{gl2:G0,bpp:4},34842:{gl2:G0,bpp:8},33326:{gl2:G0,bpp:4},33328:{gl2:G0,bpp:8},34836:{gl2:G0,bpp:16},35898:{gl2:G0,bpp:4}};function Qit(e,t,r){let i=r[t];if(!i)return!1;let n=fr(e)&&i.gl2||i.gl1;return typeof n==\"string\"?e.getExtension(n):n}var el=class extends Ks{get[Symbol.toStringTag](){return\"Renderbuffer\"}static isSupported(t){let{format:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{format:null};return!r||Qit(t,r,J4)}static getSamplesForFormat(t,r){let{format:i}=r;return t.getInternalformatParameter(36161,i,32937)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.initialize(r),Object.seal(this)}initialize(t){let{format:r,width:i=1,height:n=1,samples:s=0}=t;return ye(r,\"Needs format\"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),s!==0&&fr(this.gl)?this.gl.renderbufferStorageMultisample(36161,s,r,i,n):this.gl.renderbufferStorage(36161,r,i,n),this.format=r,this.width=i,this.height=n,this.samples=s,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*J4[this.format].bpp),this}resize(t){let{width:r,height:i}=t;return r!==this.width||i!==this.height?this.initialize({width:r,height:i,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}};var Xit=256,Kit=1024,Jit=16384,bV=6144,wV=6145,SV=6146,TV=34041,MV=\"clear: bad arguments\";function Kf(e){let{framebuffer:t=null,color:r=null,depth:i=null,stencil:n=null}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s={};t&&(s.framebuffer=t);let o=0;r&&(o|=Jit,r!==!0&&(s.clearColor=r)),i&&(o|=Xit,i!==!0&&(s.clearDepth=i)),n&&(o|=Kit,i!==!0&&(s.clearStencil=i)),ye(o!==0,MV),mn(e,s,()=>{e.clear(o)})}function tR(e){let{framebuffer:t=null,buffer:r=bV,drawBuffer:i=0,value:n=[0,0,0,0]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xn(e),mn(e,{framebuffer:t},()=>{switch(r){case bV:switch(n.constructor){case Int32Array:e.clearBufferiv(r,i,n);break;case Uint32Array:e.clearBufferuiv(r,i,n);break;case Float32Array:default:e.clearBufferfv(r,i,n)}break;case wV:e.clearBufferfv(wV,0,[n]);break;case SV:e.clearBufferiv(SV,0,[n]);break;case TV:let[s,o]=n;e.clearBufferfi(TV,0,s,o);break;default:ye(!1,MV)}})}function EV(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return ye(!1),0}}function Ch(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408}=t,{sourceAttachment:s=36064,target:o=null,sourceWidth:c,sourceHeight:d,sourceType:_}=t,{framebuffer:w,deleteFramebuffer:I}=PV(e);ye(w);let{gl:R,handle:N,attachments:j}=w;c=c||w.width,d=d||w.height,s===36064&&N===null&&(s=1028),ye(j[s]),_=_||j[s].type,o=tnt(o,_,n,c,d),_=_||J1(o);let Y=R.bindFramebuffer(36160,N);return R.readPixels(r,i,c,d,n,_,o),R.bindFramebuffer(36160,Y||null),I&&w.delete(),o}function JM(e){let{sourceAttachment:t=36064,targetMaxHeight:r=Number.MAX_SAFE_INTEGER}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=Ch(e,{sourceAttachment:t}),{width:n,height:s}=e;for(;s>r;)({data:i,width:n,height:s}=AV({data:i,width:n,height:s}));pV({data:i,width:n,height:s});let o=document.createElement(\"canvas\");o.width=n,o.height=s;let c=o.getContext(\"2d\"),d=c.createImageData(n,s);return d.data.set(i),c.putImageData(d,0,0),o.toDataURL()}function tE(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{sourceX:i=0,sourceY:n=0,targetMipmaplevel:s=0,targetInternalFormat:o=6408}=r,{targetX:c,targetY:d,targetZ:_,width:w,height:I}=r,{framebuffer:R,deleteFramebuffer:N}=PV(e);ye(R);let{gl:j,handle:Y}=R,it=typeof c<\"u\"||typeof d<\"u\"||typeof _<\"u\";c=c||0,d=d||0,_=_||0;let Z=j.bindFramebuffer(36160,Y);ye(t);let K=null;if(t instanceof tl&&(K=t,w=Number.isFinite(w)?w:K.width,I=Number.isFinite(I)?I:K.height,K.bind(0),t=K.target),!it)j.copyTexImage2D(t,s,o,i,n,w,I,0);else switch(t){case 3553:case 34067:j.copyTexSubImage2D(t,s,c,d,i,n,w,I);break;case 35866:case 32879:Xn(j).copyTexSubImage3D(t,s,c,d,_,i,n,w,I);break;default:}return K&&K.unbind(),j.bindFramebuffer(36160,Z||null),N&&R.delete(),K}function PV(e){return e instanceof pi?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:IV(e),deleteFramebuffer:!0}}function tnt(e,t,r,i,n){if(e)return e;t=t||5121;let s=HA(t,{clamped:!1}),o=EV(r);return new s(i*n*o)}var _i={WEBGL2:\"WEBGL2\",VERTEX_ARRAY_OBJECT:\"VERTEX_ARRAY_OBJECT\",TIMER_QUERY:\"TIMER_QUERY\",INSTANCED_RENDERING:\"INSTANCED_RENDERING\",MULTIPLE_RENDER_TARGETS:\"MULTIPLE_RENDER_TARGETS\",ELEMENT_INDEX_UINT32:\"ELEMENT_INDEX_UINT32\",BLEND_EQUATION_MINMAX:\"BLEND_EQUATION_MINMAX\",FLOAT_BLEND:\"FLOAT_BLEND\",COLOR_ENCODING_SRGB:\"COLOR_ENCODING_SRGB\",TEXTURE_DEPTH:\"TEXTURE_DEPTH\",TEXTURE_FLOAT:\"TEXTURE_FLOAT\",TEXTURE_HALF_FLOAT:\"TEXTURE_HALF_FLOAT\",TEXTURE_FILTER_LINEAR_FLOAT:\"TEXTURE_FILTER_LINEAR_FLOAT\",TEXTURE_FILTER_LINEAR_HALF_FLOAT:\"TEXTURE_FILTER_LINEAR_HALF_FLOAT\",TEXTURE_FILTER_ANISOTROPIC:\"TEXTURE_FILTER_ANISOTROPIC\",COLOR_ATTACHMENT_RGBA32F:\"COLOR_ATTACHMENT_RGBA32F\",COLOR_ATTACHMENT_FLOAT:\"COLOR_ATTACHMENT_FLOAT\",COLOR_ATTACHMENT_HALF_FLOAT:\"COLOR_ATTACHMENT_HALF_FLOAT\",GLSL_FRAG_DATA:\"GLSL_FRAG_DATA\",GLSL_FRAG_DEPTH:\"GLSL_FRAG_DEPTH\",GLSL_DERIVATIVES:\"GLSL_DERIVATIVES\",GLSL_TEXTURE_LOD:\"GLSL_TEXTURE_LOD\"};function ent(e){let t=new ui(e,{format:6408,type:5126,dataFormat:6408}),r=new pi(e,{id:\"test-framebuffer\",check:!1,attachments:{36064:t}}),i=r.getStatus();return t.delete(),r.delete(),i===36053}var eR={[_i.WEBGL2]:[!1,!0],[_i.VERTEX_ARRAY_OBJECT]:[\"OES_vertex_array_object\",!0],[_i.TIMER_QUERY]:[\"EXT_disjoint_timer_query\",\"EXT_disjoint_timer_query_webgl2\"],[_i.INSTANCED_RENDERING]:[\"ANGLE_instanced_arrays\",!0],[_i.MULTIPLE_RENDER_TARGETS]:[\"WEBGL_draw_buffers\",!0],[_i.ELEMENT_INDEX_UINT32]:[\"OES_element_index_uint\",!0],[_i.BLEND_EQUATION_MINMAX]:[\"EXT_blend_minmax\",!0],[_i.FLOAT_BLEND]:[\"EXT_float_blend\"],[_i.COLOR_ENCODING_SRGB]:[\"EXT_sRGB\",!0],[_i.TEXTURE_DEPTH]:[\"WEBGL_depth_texture\",!0],[_i.TEXTURE_FLOAT]:[\"OES_texture_float\",!0],[_i.TEXTURE_HALF_FLOAT]:[\"OES_texture_half_float\",!0],[_i.TEXTURE_FILTER_LINEAR_FLOAT]:[\"OES_texture_float_linear\"],[_i.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:[\"OES_texture_half_float_linear\"],[_i.TEXTURE_FILTER_ANISOTROPIC]:[\"EXT_texture_filter_anisotropic\"],[_i.COLOR_ATTACHMENT_RGBA32F]:[ent,\"EXT_color_buffer_float\"],[_i.COLOR_ATTACHMENT_FLOAT]:[!1,\"EXT_color_buffer_float\"],[_i.COLOR_ATTACHMENT_HALF_FLOAT]:[\"EXT_color_buffer_half_float\"],[_i.GLSL_FRAG_DATA]:[\"WEBGL_draw_buffers\",!0],[_i.GLSL_FRAG_DEPTH]:[\"EXT_frag_depth\",!0],[_i.GLSL_DERIVATIVES]:[\"OES_standard_derivatives\",!0],[_i.GLSL_TEXTURE_LOD]:[\"EXT_shader_texture_lod\",!0]};var rnt=2;function W0(e,t){return Lh(e,t)}function Lh(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>CV(e,r))}function eE(e){e.luma=e.luma||{},e.luma.caps=e.luma.caps||{};for(let t in eR)e.luma.caps[t]===void 0&&(e.luma.caps[t]=CV(e,t));return e.luma.caps}function CV(e,t){return e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},e.luma.caps[t]===void 0&&(e.luma.caps[t]=int(e,t)),e.luma.caps[t]||Ge.log(rnt,\"Feature: \".concat(t,\" not supported\"))(),e.luma.caps[t]}function int(e,t){let r=eR[t];ye(r,t);let i,n=fr(e)&&r[1]||r[0];if(typeof n==\"function\")i=n(e);else if(Array.isArray(n)){i=!0;for(let s of n)i=i&&!!e.getExtension(s)}else typeof n==\"string\"?i=!!e.getExtension(n):typeof n==\"boolean\"?i=n:ye(!1);return i}var LV=\"Multiple render targets not supported\",pi=class e extends Ks{get[Symbol.toStringTag](){return\"Framebuffer\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{colorBufferFloat:i,colorBufferHalfFloat:n}=r,s=!0;return i&&(s=!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"WEBGL_color_buffer_float\")||t.getExtension(\"OES_texture_float\"))),n&&(s=s&&!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"EXT_color_buffer_half_float\"))),s}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new e(t,{id:\"default-framebuffer\",handle:null,attachments:{}}),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){let t=Xn(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){let t=Xn(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(r),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(t){let{width:r=1,height:i=1,attachments:n=null,color:s=!0,depth:o=!0,stencil:c=!1,check:d=!0,readBuffer:_=void 0,drawBuffers:w=void 0}=t;if(ye(r>=0&&i>=0,\"Width and height need to be integers\"),this.width=r,this.height=i,n)for(let I in n){let R=n[I];(Array.isArray(R)?R[0]:R).resize({width:r,height:i})}else n=this._createDefaultAttachments(s,o,c,r,i);this.update({clearAttachments:!0,attachments:n,readBuffer:_,drawBuffers:w}),n&&d&&this.checkStatus()}delete(){for(let t of this.ownResources)t.delete();return super.delete(),this}update(t){let{attachments:r={},readBuffer:i,drawBuffers:n,clearAttachments:s=!1,resizeAttachments:o=!0}=t;this.attach(r,{clearAttachments:s,resizeAttachments:o});let{gl:c}=this,d=c.bindFramebuffer(36160,this.handle);return i&&this._setReadBuffer(i),n&&this._setDrawBuffers(n),c.bindFramebuffer(36160,d||null),this}resize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{width:r,height:i}=t;if(this.handle===null)return ye(r===void 0&&i===void 0),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;r===void 0&&(r=this.gl.drawingBufferWidth),i===void 0&&(i=this.gl.drawingBufferHeight),r!==this.width&&i!==this.height&&Ge.log(2,\"Resizing framebuffer \".concat(this.id,\" to \").concat(r,\"x\").concat(i))();for(let n in this.attachments)this.attachments[n].resize({width:r,height:i});return this.width=r,this.height=i,this}attach(t){let{clearAttachments:r=!1,resizeAttachments:i=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={};r&&Object.keys(this.attachments).forEach(o=>{n[o]=null}),Object.assign(n,t);let s=this.gl.bindFramebuffer(36160,this.handle);for(let o in n){ye(o!==void 0,\"Misspelled framebuffer binding point?\");let c=Number(o),d=n[c],_=d;if(!_)this._unattach(c);else if(_ instanceof el)this._attachRenderbuffer({attachment:c,renderbuffer:_});else if(Array.isArray(d)){let[w,I=0,R=0]=d;_=w,this._attachTexture({attachment:c,texture:w,layer:I,level:R})}else this._attachTexture({attachment:c,texture:_,layer:0,level:0});i&&_&&_.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,s||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter(o=>!this.attachments[o]).forEach(o=>{delete this.attachments[o]})}checkStatus(){let{gl:t}=this,r=this.getStatus();if(r!==36053)throw new Error(snt(r));return this}getStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),i=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,r||null),i}clear(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:r,depth:i,stencil:n,drawBuffers:s=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(r||i||n)&&Kf(this.gl,{color:r,depth:i,stencil:n}),s.forEach((c,d)=>{tR(this.gl,{drawBuffer:d,value:c})}),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)\")(),null}readPixelsToBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)\")(),null}copyToDataUrl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)\")(),null}copyToImage(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)\")(),null}copyToTexture(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}blit(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.error(\"Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)\")(),null}invalidate(t){let{attachments:r=[],x:i=0,y:n=0,width:s,height:o}=t,c=Xn(this.gl),d=c.bindFramebuffer(36008,this.handle);return i===0&&n===0&&s===void 0&&o===void 0?c.invalidateFramebuffer(36008,r):c.invalidateFramebuffer(36008,r,i,n,s,o),c.bindFramebuffer(36008,d),this}getAttachmentParameter(t,r,i){let n=this._getAttachmentParameterFallback(r);return n===null&&(this.gl.bindFramebuffer(36160,this.handle),n=this.gl.getFramebufferAttachmentParameter(36160,t,r),this.gl.bindFramebuffer(36160,null)),i&&n>1e3&&(n=Nu(this.gl,n)),n}getAttachmentParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:36064,r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[],n={};for(let s of i){let o=r?Nu(this.gl,s):s;n[o]=this.getAttachmentParameter(t,s,r)}return n}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=Object.keys(this.attachments),i={};for(let n of r){let s=Number(n),o=t?Nu(this.gl,s):s;i[o]=this.getAttachmentParameters(s,t)}return i}show(){return typeof window<\"u\"&&window.open(JM(this),\"luma-debug-texture\"),this}log(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\";if(t>Ge.level||typeof window>\"u\")return this;r=r||\"Framebuffer \".concat(this.id);let i=JM(this,{targetMaxHeight:100});return Ge.image({logLevel:t,message:r,image:i},r)(),this}bind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,this.handle),this}unbind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,r,i,n,s){let o=null;return t&&(o=o||{},o[36064]=new ui(this.gl,{id:\"\".concat(this.id,\"-color0\"),pixels:null,format:6408,type:5121,width:n,height:s,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(o[36064])),r&&i?(o=o||{},o[33306]=new el(this.gl,{id:\"\".concat(this.id,\"-depth-stencil\"),format:35056,width:n,height:111}),this.ownResources.push(o[33306])):r?(o=o||{},o[36096]=new el(this.gl,{id:\"\".concat(this.id,\"-depth\"),format:33189,width:n,height:s}),this.ownResources.push(o[36096])):i&&ye(!1),o}_unattach(t){let r=this.attachments[t];r&&(r instanceof el?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer(t){let{attachment:r=36064,renderbuffer:i}=t,{gl:n}=this;n.framebufferRenderbuffer(36160,r,36161,i.handle),this.attachments[r]=i}_attachTexture(t){let{attachment:r=36064,texture:i,layer:n,level:s}=t,{gl:o}=this;switch(o.bindTexture(i.target,i.handle),i.target){case 35866:case 32879:Xn(o).framebufferTextureLayer(36160,r,i.target,s,n);break;case 34067:let d=nnt(n);o.framebufferTexture2D(36160,r,d,i.handle,s);break;case 3553:o.framebufferTexture2D(36160,r,3553,i.handle,s);break;default:ye(!1,\"Illegal texture type\")}o.bindTexture(i.target,null),this.attachments[r]=i}_setReadBuffer(t){let r=z4(this.gl);r?r.readBuffer(t):ye(t===36064||t===1029,LV),this.readBuffer=t}_setDrawBuffers(t){let{gl:r}=this,i=Xn(r);if(i)i.drawBuffers(t);else{let n=r.getExtension(\"WEBGL_draw_buffers\");n?n.drawBuffersWEBGL(t):ye(t.length===1&&(t[0]===36064||t[0]===1029),LV)}this.drawBuffers=t}_getAttachmentParameterFallback(t){let r=eE(this.gl);switch(t){case 36052:return r.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return r.WEBGL2?null:8;case 33297:return r.WEBGL2?null:5125;case 33296:return!r.WEBGL2&&!r.EXT_sRGB?9729:null;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}};function nnt(e){return e<34069?e+34069:e}function snt(e){return(pi.STATUS||{})[e]||\"Framebuffer error \".concat(e)}var ont=[36049,36048,33296,33298,33299,33300,33301,33302,33303];pi.ATTACHMENT_PARAMETERS=ont;function rE(e,t){ye(e instanceof ui||e instanceof j0||e instanceof dy);let r=e.constructor,{gl:i,width:n,height:s,format:o,type:c,dataFormat:d,border:_,mipmaps:w}=e,I=Object.assign({width:n,height:s,format:o,type:c,dataFormat:d,border:_,mipmaps:w},t);return new r(i,I)}function IV(e,t){let{gl:r,width:i,height:n,id:s}=e;return new pi(r,Object.assign({},t,{id:\"framebuffer-for-\".concat(s),width:i,height:n,attachments:{36064:e}}))}function qA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"unnamed\",r=/#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/,i=e.match(r);return i?i[1]:t}function rR(e){switch(e){case 35632:return\"fragment\";case 35633:return\"vertex\";default:return\"unknown type\"}}function iR(e,t,r,i){let n=e.split(/\\r?\\n/),s={},o={},c=i||qA(t)||\"(unnamed)\",d=\"\".concat(rR(r),\" shader \").concat(c);for(let w=0;w1&&arguments[1]!==void 0?arguments[1]:1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\": \",i=e.split(/\\r?\\n/),n=String(i.length+t-1).length;return i.map((s,o)=>{let c=String(o+t),d=c.length;return RV(c,n-d)+r+s})}function RV(e,t){let r=\"\";for(let i=0;i=2&&r[0]===\"#version\"){let i=parseInt(r[1],10);Number.isFinite(i)&&(t=i)}return t}var lnt=\"Shader: GLSL source code must be a JavaScript string\",iE=class e extends Ks{get[Symbol.toStringTag](){return\"Shader\"}static getTypeName(t){switch(t){case 35633:return\"vertex-shader\";case 35632:return\"fragment-shader\";default:return ye(!1),\"unknown\"}}constructor(t,r){Kd(t),ye(typeof r.source==\"string\",lnt);let i=qA(r.source,null)||r.id||ra(\"unnamed \".concat(e.getTypeName(r.shaderType)));super(t,{id:i}),this.shaderType=r.shaderType,this.source=r.source,this.initialize(r)}initialize(t){let{source:r}=t,i=qA(r,null);i&&(this.id=ra(i)),this._compile(r)}getParameter(t){return this.gl.getShaderParameter(this.handle,t)}toString(){return\"\".concat(e.getTypeName(this.shaderType),\":\").concat(this.id)}getName(){return qA(this.source)||\"unnamed-shader\"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){let t=this.gl.getExtension(\"WEBGL_debug_shaders\");return t?t.getTranslatedShaderSource(this.handle):\"No translated source available. WEBGL_debug_shaders not implemented\"}_compile(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.source;if(t.startsWith(\"#version \")||(t=`#version 100\n`.concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){let i=this.gl.getShaderInfoLog(this.handle),{shaderName:n,errors:s,warnings:o}=iR(i,this.source,this.shaderType,this.id);throw Ge.error(\"GLSL compilation errors in \".concat(n,`\n`).concat(s))(),Ge.warn(\"GLSL compilation warnings in \".concat(n,`\n`).concat(o))(),new Error(\"GLSL compilation errors in \".concat(n))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}},H0=class extends iE{get[Symbol.toStringTag](){return\"VertexShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}},q0=class extends iE{get[Symbol.toStringTag](){return\"FragmentShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}};var cnt={5126:Kn.bind(null,\"uniform1fv\",$c,1,rl),35664:Kn.bind(null,\"uniform2fv\",$c,2,rl),35665:Kn.bind(null,\"uniform3fv\",$c,3,rl),35666:Kn.bind(null,\"uniform4fv\",$c,4,rl),5124:Kn.bind(null,\"uniform1iv\",ZA,1,rl),35667:Kn.bind(null,\"uniform2iv\",ZA,2,rl),35668:Kn.bind(null,\"uniform3iv\",ZA,3,rl),35669:Kn.bind(null,\"uniform4iv\",ZA,4,rl),35670:Kn.bind(null,\"uniform1iv\",ZA,1,rl),35671:Kn.bind(null,\"uniform2iv\",ZA,2,rl),35672:Kn.bind(null,\"uniform3iv\",ZA,3,rl),35673:Kn.bind(null,\"uniform4iv\",ZA,4,rl),35674:Kn.bind(null,\"uniformMatrix2fv\",$c,4,Jd),35675:Kn.bind(null,\"uniformMatrix3fv\",$c,9,Jd),35676:Kn.bind(null,\"uniformMatrix4fv\",$c,16,Jd),35678:xa,35680:xa,5125:Kn.bind(null,\"uniform1uiv\",nE,1,rl),36294:Kn.bind(null,\"uniform2uiv\",nE,2,rl),36295:Kn.bind(null,\"uniform3uiv\",nE,3,rl),36296:Kn.bind(null,\"uniform4uiv\",nE,4,rl),35685:Kn.bind(null,\"uniformMatrix2x3fv\",$c,6,Jd),35686:Kn.bind(null,\"uniformMatrix2x4fv\",$c,8,Jd),35687:Kn.bind(null,\"uniformMatrix3x2fv\",$c,6,Jd),35688:Kn.bind(null,\"uniformMatrix3x4fv\",$c,12,Jd),35689:Kn.bind(null,\"uniformMatrix4x2fv\",$c,8,Jd),35690:Kn.bind(null,\"uniformMatrix4x3fv\",$c,12,Jd),35678:xa,35680:xa,35679:xa,35682:xa,36289:xa,36292:xa,36293:xa,36298:xa,36299:xa,36300:xa,36303:xa,36306:xa,36307:xa,36308:xa,36311:xa},unt={},hnt={},fnt={},DV=[0];function nR(e,t,r,i){t===1&&typeof e==\"boolean\"&&(e=e?1:0),Number.isFinite(e)&&(DV[0]=e,e=DV);let n=e.length;if(n%t&&Ge.warn(\"Uniform size should be multiples of \".concat(t),e)(),e instanceof r)return e;let s=i[n];s||(s=new r(n),i[n]=s);for(let o=0;o{let n=e!==i;return n&&(t.uniform1i(r,i),e=i),n}}function Kn(e,t,r,i){let n=null,s=null;return(o,c,d)=>{let _=t(d,r),w=_.length,I=!1;if(n===null)n=new Float32Array(w),s=w,I=!0;else{ye(s===w,\"Uniform length cannot change.\");for(let R=0;R=0&&this._addAttribute(d,s,o,c)}this.attributeInfos.sort((n,s)=>n.location-s.location)}_readVaryingsFromProgram(t){let{gl:r}=t;if(!fr(r))return;let i=r.getProgramParameter(t.handle,35971);for(let n=0;nn.location-s.location)}_addAttribute(t,r,i,n){let{type:s,components:o}=aR(i),c={type:s,size:n*o};this._inferProperties(t,r,c);let d={location:t,name:r,accessor:new Tl(c)};this.attributeInfos.push(d),this.attributeInfosByLocation[t]=d,this.attributeInfosByName[d.name]=d}_inferProperties(t,r,i){/instance/i.test(r)&&(i.divisor=1)}_addVarying(t,r,i,n){let{type:s,components:o}=aR(i),c=new Tl({type:s,size:n*o}),d={location:t,name:r,accessor:c};this.varyingInfos.push(d),this.varyingInfosByName[d.name]=d}};var UV=4,Hnt=35981,qnt=[\"setVertexArray\",\"setAttributes\",\"setBuffers\",\"unsetBuffers\",\"use\",\"getUniformCount\",\"getUniformInfo\",\"getUniformLocation\",\"getUniformValue\",\"getVarying\",\"getFragDataLocation\",\"getAttachedShaders\",\"getAttributeCount\",\"getAttributeLocation\",\"getAttributeInfo\"],tp=class extends Ks{get[Symbol.toStringTag](){return\"Program\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Program\",\"v6.0\",qnt),this._isCached=!1,this.initialize(r),Object.seal(this),this._setId(r.id)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{hash:r,vs:i,fs:n,varyings:s,bufferMode:o=Hnt}=t;return this.hash=r||\"\",this.vs=typeof i==\"string\"?new H0(this.gl,{id:\"\".concat(t.id,\"-vs\"),source:i}):i,this.fs=typeof n==\"string\"?new q0(this.gl,{id:\"\".concat(t.id,\"-fs\"),source:n}):n,ye(this.vs instanceof H0),ye(this.fs instanceof q0),this.uniforms={},this._textureUniforms={},s&&s.length>0&&(Xn(this.gl),this.varyings=s,this.gl2.transformFeedbackVaryings(this.handle,s,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new ib(this),this.setProps(t)}delete(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._isCached?this:super.delete(t)}setProps(t){return\"uniforms\"in t&&this.setUniforms(t.uniforms),this}draw(t){let{logPriority:r,drawMode:i=4,vertexCount:n,offset:s=0,start:o,end:c,isIndexed:d=!1,indexType:_=5123,instanceCount:w=0,isInstanced:I=w>0,vertexArray:R=null,transformFeedback:N,framebuffer:j,parameters:Y={},uniforms:it,samplers:Z}=t;if((it||Z)&&(Ge.deprecated(\"Program.draw({uniforms})\",\"Program.setUniforms(uniforms)\")(),this.setUniforms(it||{})),Ge.priority>=r){let K=j?j.id:\"default\",J=\"mode=\".concat(Nu(this.gl,i),\" verts=\").concat(n,\" \")+\"instances=\".concat(w,\" indexType=\").concat(Nu(this.gl,_),\" \")+\"isInstanced=\".concat(I,\" isIndexed=\").concat(d,\" \")+\"Framebuffer=\".concat(K);Ge.log(r,J)()}return ye(R),this.gl.useProgram(this.handle),!this._areTexturesRenderable()||n===0||I&&w===0?!1:(R.bindForDraw(n,w,()=>{if(j!==void 0&&(Y=Object.assign({},Y,{framebuffer:j})),N){let K=NV(i);N.begin(K)}this._bindTextures(),mn(this.gl,Y,()=>{d&&I?this.gl2.drawElementsInstanced(i,n,_,s,w):d&&fr(this.gl)&&!isNaN(o)&&!isNaN(c)?this.gl2.drawRangeElements(i,o,c,n,_,s):d?this.gl.drawElements(i,n,_,s):I?this.gl2.drawArraysInstanced(i,s,n,w):this.gl.drawArrays(i,s,n)}),N&&N.end()}),!0)}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ge.priority>=2&&BV(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(let r in t){let i=t[r],n=this._uniformSetters[r];if(n){let s=i,o=!1;if(s instanceof pi&&(s=s.texture),s instanceof tl)if(o=this.uniforms[r]!==i,o){n.textureIndex===void 0&&(n.textureIndex=this._textureIndexCounter++);let c=s,{textureIndex:d}=n;c.bind(d),s=d,this._textureUniforms[r]=c}else s=n.textureIndex;else this._textureUniforms[r]&&delete this._textureUniforms[r];(n(s)||o)&&FV(this.uniforms,r,i)}}return this}_areTexturesRenderable(){let t=!0;for(let r in this._textureUniforms){let i=this._textureUniforms[r];i.update(),t=t&&i.loaded}return t}_bindTextures(){for(let t in this._textureUniforms){let r=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(r)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){let r=this.gl.getAttachedShaders(t),i={};for(let n of r)switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:i.vs=new H0({handle:n});break;case 35632:i.fs=new q0({handle:n});break;default:}return i}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){let r=this._getName();this.id=ra(r)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,\"\"),t=t?\"\".concat(t,\"-program\"):\"program\",t}_compileAndLink(){let{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),Ge.time(UV,\"linkProgram for \".concat(this._getName()))(),t.linkProgram(this.handle),Ge.timeEnd(UV,\"linkProgram for \".concat(this._getName()))(),t.debug||Ge.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error(\"Error linking: \".concat(t.getProgramInfoLog(this.handle)));if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(\"Error validating: \".concat(t.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){let{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let r=0;r1)for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:[],i=fr(t),n=Lh(t,_i.TIMER_QUERY),s=i||n;for(let o of r)switch(o){case\"queries\":s=s&&i;break;case\"timers\":s=s&&n;break;default:ye(!1)}return s}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin($nt)}beginOcclusionQuery(){let{conservative:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.begin(t?Jnt:Knt)}beginTransformFeedbackQuery(){return this.begin(Xnt)}begin(t){return this._queryPending?this:(this.target=t,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.gl2.getQueryParameter(this.handle,Ynt);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(Qnt)}getResult(){return this.gl2.getQueryParameter(this.handle,Znt)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let s=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>t?(n(\"Timed out\"),this._pollingPromise=null):requestAnimationFrame(s)};requestAnimationFrame(s)}),this._pollingPromise}_createHandle(){return e.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}};var ep=class extends Ks{get[Symbol.toStringTag](){return\"TransformFeedback\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xn(t),super(t,r),this.initialize(r),this.stubRemovedMethods(\"TransformFeedback\",\"v6.0\",[\"pause\",\"resume\"]),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Xf(this.buffers)||this.bind(()=>this._unbindBuffers()),this.setProps(t),this}setProps(t){\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"bindOnUse\"in t&&(t=t.bindOnUse),\"buffers\"in t&&this.setBuffers(t.buffers)}setBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])}),this}setBuffer(t,r){let i=this._getVaryingIndex(t),{buffer:n,byteSize:s,byteOffset:o}=this._getBufferParams(r);return i<0?(this.unused[t]=n,Ge.warn(\"\".concat(this.id,\" unused varying buffer \").concat(t))(),this):(this.buffers[i]=r,this.bindOnUse||this._bindBuffer(i,n,o,s),this)}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let r,i,n;return t instanceof Ur?n=t:(n=t.buffer,i=t.byteSize,r=t.byteOffset),(r!==void 0||i!==void 0)&&(r=r||0,i=i||n.byteLength-r),{buffer:n,byteOffset:r,byteSize:i}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;let r=Number(t);return Number.isFinite(r)?r:-1}_bindBuffers(){if(this.bindOnUse)for(let t in this.buffers){let{buffer:r,byteSize:i,byteOffset:n}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,r,n,i)}}_unbindBuffers(){if(this.bindOnUse)for(let t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0,s=r&&r.handle;return!s||n===void 0?this.gl.bindBufferBase(35982,t,s):this.gl.bindBufferRange(35982,t,s,i,n),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}};var lE=null;function tst(e){return(!lE||lE.byteLength1&&arguments[1]!==void 0?arguments[1]:{}).constantAttributeZero?fr(t)||oy()===\"Chrome\":!0}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new e(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return e.MAX_ATTRIBUTES=e.MAX_ATTRIBUTES||t.getParameter(34921),e.MAX_ATTRIBUTES}static setConstant(t,r,i){switch(i.constructor){case Float32Array:e._setConstantFloatArray(t,r,i);break;case Int32Array:e._setConstantIntArray(t,r,i);break;case Uint32Array:e._setConstantUintArray(t,r,i);break;default:ye(!1)}}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;super(t,Object.assign({},r,{id:i})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=r.isDefaultArray||!1,this.gl2=t,this.initialize(r),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return e.getMaxAttributes(this.gl)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.setProps(t)}setProps(t){return this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ye(!t||t.target===34963,est),this.bind(()=>{this.gl.bindBuffer(34963,t?t.handle:null)}),this}setBuffer(t,r,i){if(r.target===34963)return this.setElementBuffer(r,i);let{size:n,type:s,stride:o,offset:c,normalized:d,integer:_,divisor:w}=i,{gl:I,gl2:R}=this;return t=Number(t),this.bind(()=>{I.bindBuffer(34962,r.handle),_?(ye(fr(I)),R.vertexAttribIPointer(t,n,s,o,c)):I.vertexAttribPointer(t,n,s,d,o,c),I.enableVertexAttribArray(t),R.vertexAttribDivisor(t,w||0)}),this}enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return!r&&t===0&&!e.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind(()=>r?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t))),this}getConstantBuffer(t,r){let i=this._normalizeConstantArrayValue(r),n=i.byteLength*t,s=i.length*t,o=!this.buffer;if(this.buffer=this.buffer||new Ur(this.gl,n),o=o||this.buffer.reallocate(n),o=o||!this._compareConstantArrayValues(i,this.bufferValue),o){let c=VV(r.constructor,s);jV({target:c,source:i,start:0,count:s}),this.buffer.subData(c),this.bufferValue=r}return this.buffer}_normalizeConstantArrayValue(t){return Array.isArray(t)?new Float32Array(t):t}_compareConstantArrayValues(t,r){if(!t||!r||t.length!==r.length||t.constructor!==r.constructor)return!1;for(let i=0;i{switch(t){case 34373:return this.gl.getVertexAttribOffset(i,t);default:return this.gl.getVertexAttrib(i,t)}})}};var rst=\"VertexArray: attributes must be Buffers or constants (i.e. typed array)\",ist=/^(.+)__LOCATION_([0-9]+)$/,nst=[\"setBuffers\",\"setGeneric\",\"clearBindings\",\"setLocations\",\"setGenericValues\",\"setDivisor\",\"enable\",\"disable\"],Ay=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;this.id=i,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new Y0(t),$M(this,\"VertexArray\",\"v6.0\",nst),this.initialize(r),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;let{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"attributes\"in t&&this.setAttributes(t.attributes),\"elements\"in t&&this.setElementBuffer(t.elements),\"bindOnUse\"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind(()=>{for(let r in t){let i=t[r];this._setAttribute(r,i)}this.gl.bindBuffer(34962,null)}),this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.elements=t,this.elementsAccessor=r,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,r),this}setBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(r.target===34963)return this.setElementBuffer(r,i);let{location:n,accessor:s}=this._resolveLocationAndAccessor(t,r,r.accessor,i);return n>=0&&(this.values[n]=r,this.accessors[n]=s,this.clearDrawParams(),this.vertexArrayObject.setBuffer(n,r,s)),this}setConstant(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{location:n,accessor:s}=this._resolveLocationAndAccessor(t,r,Object.assign({size:r.length},i));return n>=0&&(r=this.vertexArrayObject._normalizeConstantArrayValue(r),this.values[n]=r,this.accessors[n]=s,this.clearDrawParams(),this.vertexArrayObject.enable(n,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new Ur(this.gl,{accessor:{size:4}});for(let t=0;t{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t{this._setConstantAttributes(t,r),n=i()}),n}_resolveLocationAndAccessor(t,r,i,n){let s={location:-1,accessor:null},{location:o,name:c}=this._getAttributeIndex(t);if(!Number.isFinite(o)||o<0)return this.unused[t]=r,Ge.once(3,()=>\"unused value \".concat(t,\" in \").concat(this.id))(),s;let d=this._getAttributeInfo(c||o);if(!d)return s;let _=this.accessors[o]||{},w=Tl.resolve(d.accessor,_,i,n),{size:I,type:R}=w;return ye(Number.isFinite(I)&&Number.isFinite(R)),{location:o,accessor:w}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){let r=Number(t);if(Number.isFinite(r))return{location:r};let i=ist.exec(t),n=i?i[1]:t,s=i?Number(i[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(n)+s,name:n}:{location:-1}}_setAttribute(t,r){if(r instanceof Ur)this.setBuffer(t,r);else if(Array.isArray(r)&&r.length&&r[0]instanceof Ur){let i=r[0],n=r[1];this.setBuffer(t,i,n)}else if(ArrayBuffer.isView(r)||Array.isArray(r)){let i=r;this.setConstant(t,i)}else if(r.buffer instanceof Ur){let i=r;this.setBuffer(t,i.buffer,i)}else throw new Error(rst)}_setConstantAttributes(t,r){let i=Math.max(t|0,r|0),n=this.values[0];ArrayBuffer.isView(n)&&this._setConstantAttributeZero(n,i);for(let s=1;s0;if(t.isInstanced=t.isInstanced||o,i instanceof Ur){let c=i;if(o){let d=c.getVertexCount(n);t.instanceCount=Math.min(t.instanceCount,d)}else{let d=c.getVertexCount(n);t.vertexCount=Math.min(t.vertexCount,d)}}}setElements(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ge.deprecated(\"setElements\",\"setElementBuffer\")(),this.setElementBuffer(t,r)}};function sst(e,t){let{maxElts:r=16,size:i=1}=t,n=\"[\";for(let o=0;o0&&(n+=\",\".concat(o%i===0?\" \":\"\")),n+=$0(e[o],t);let s=e.length>r?\"...\":\"]\";return\"\".concat(n).concat(s)}function $0(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=1e-16,{isInteger:i=!1}=t;if(Array.isArray(e)||ArrayBuffer.isView(e))return sst(e,t);if(!Number.isFinite(e))return String(e);if(Math.abs(e)100&&Math.abs(e)<1e4)return e.toFixed(0);let n=e.toPrecision(2);return n.indexOf(\".0\")===n.length-2?n.slice(0,-1):n}function cE(e){let{header:t=\"Uniforms\",program:r,uniforms:i,undefinedOnly:n=!1}=e;ye(r);let s=\".*_.*\",o=\".*Matrix\",c=r._uniformSetters,d={},_=Object.keys(c).sort(),w=0;for(let N of _)!N.match(s)&&!N.match(o)&&lR({table:d,header:t,uniforms:i,uniformName:N,undefinedOnly:n})&&w++;for(let N of _)N.match(o)&&lR({table:d,header:t,uniforms:i,uniformName:N,undefinedOnly:n})&&w++;for(let N of _)d[N]||lR({table:d,header:t,uniforms:i,uniformName:N,undefinedOnly:n})&&w++;let I=0,R={};if(!n)for(let N in i){let j=i[N];d[N]||(I++,R[N]={Type:\"NOT USED: \".concat(j),[t]:$0(j)})}return{table:d,count:w,unusedTable:R,unusedCount:I}}function lR(e){let{table:t,header:r,uniforms:i,uniformName:n,undefinedOnly:s}=e,o=i[n],c=ost(o);return!s||!c?(t[n]={[r]:c?$0(o):\"N/A\",\"Uniform Type\":c?o:\"NOT PROVIDED\"},!0):!1}function ost(e){return e!=null}function cR(e){let{vertexArray:t,header:r=\"Attributes\"}=e;if(!t.configuration)return{};let i={};t.elements&&(i.ELEMENT_ARRAY_BUFFER=GV(t,t.elements,null,r));let n=t.values;for(let s in n){let o=t._getAttributeInfo(s);if(o){let c=\"\".concat(s,\": \").concat(o.name),d=t.accessors[o.location];d&&(c=\"\".concat(s,\": \").concat(ast(o.name,d))),i[c]=GV(t,n[s],d,r)}}return i}function GV(e,t,r,i){let{gl:n}=e;if(!t)return{[i]:\"null\",\"Format \":\"N/A\"};let s=\"NOT PROVIDED\",o=1,c=0,d=0,_,w,I;if(r&&(s=r.type,o=r.size,s=String(s).replace(\"Array\",\"\"),_=s.indexOf(\"nt\")!==-1),t instanceof Ur){let R=t,{data:N,changed:j}=R.getDebugData();w=j?\"*\":\"\",I=N,d=R.byteLength,c=d/N.BYTES_PER_ELEMENT/o;let Y;if(r){let it=r.divisor>0;Y=\"\".concat(it?\"I \":\"P \",\" \").concat(c,\" (x\").concat(o,\"=\").concat(d,\" bytes \").concat(Nu(n,s),\")\")}else _=!0,Y=\"\".concat(d,\" bytes\");return{[i]:\"\".concat(w).concat($0(I,{size:o,isInteger:_})),\"Format \":Y}}return I=t,o=t.length,s=String(t.constructor.name).replace(\"Array\",\"\"),_=s.indexOf(\"nt\")!==-1,{[i]:\"\".concat($0(I,{size:o,isInteger:_}),\" (constant)\"),\"Format \":\"\".concat(o,\"x\").concat(s,\" (constant)\")}}function ast(e,t){let{type:r,size:i}=t,n=aE(r,i);return n?\"\".concat(e,\" (\").concat(n.name,\")\"):e}function uR(e){let t={},r=\"Accessors for \".concat(e.id);for(let i of e.attributeInfos)if(i){let n=WV(i);t[\"in \".concat(n)]={[r]:JSON.stringify(i.accessor)}}for(let i of e.varyingInfos)if(i){let n=WV(i);t[\"out \".concat(n)]={[r]:JSON.stringify(i.accessor)}}return t}function WV(e){let{type:t,size:r}=e.accessor,i=aE(t,r);return i?\"\".concat(i.name,\" \").concat(e.name):e.name}var HV=Io()&&typeof document<\"u\",cst=0,Q0=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{onCreateContext:r=it=>hy(it),onAddHTML:i=null,onInitialize:n=()=>{},onRender:s=()=>{},onFinalize:o=()=>{},onError:c,gl:d=null,glOptions:_={},debug:w=!1,createFramebuffer:I=!1,autoResizeViewport:R=!0,autoResizeDrawingBuffer:N=!0,stats:j=zu.get(\"animation-loop-\".concat(cst++))}=t,{useDevicePixels:Y=!0}=t;\"useDevicePixelRatio\"in t&&(Ge.deprecated(\"useDevicePixelRatio\",\"useDevicePixels\")(),Y=t.useDevicePixelRatio),this.props={onCreateContext:r,onAddHTML:i,onInitialize:n,onRender:s,onFinalize:o,onError:c,gl:d,glOptions:_,debug:w,createFramebuffer:I},this.gl=d,this.needsRedraw=null,this.timeline=null,this.stats=j,this.cpuTime=this.stats.get(\"CPU Time\"),this.gpuTime=this.stats.get(\"GPU Time\"),this.frameRate=this.stats.get(\"Frame Rate\"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:R,autoResizeDrawingBuffer:N,useDevicePixels:Y}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return ye(typeof t==\"string\"),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return\"autoResizeViewport\"in t&&(this.autoResizeViewport=t.autoResizeViewport),\"autoResizeDrawingBuffer\"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),\"useDevicePixels\"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._running)return this;this._running=!0;let r=this._getPageLoadPromise().then(()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=Z0.isSupported(this.gl,[\"timers\"])?new Z0(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(i=>{this._running&&(this._addCallbackData(i||{}),i!==!1&&this._startLoop())});return this.props.onError&&r.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw(\"waitForRender\"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw(\"toDataURL\"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,i=document.getElementById(t);return i?Number(i.value):r}setViewParameters(){return Ge.removed(\"AnimationLoop.setViewParameters\",\"AnimationLoop.setProps\")(),this}_startLoop(){let t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=HV?new Promise((t,r)=>{if(HV&&document.readyState===\"complete\"){t(document);return}window.addEventListener(\"load\",()=>{t(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):$4(t)}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):Y4(t)}_renderFrame(){if(this.display){this.display._renderFrame(...arguments);return}this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){let{width:t,height:r,aspect:i}=this._getSizeAndAspect();(t!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw(\"drawing buffer resized\"),i!==this.animationProps.aspect&&this.setNeedsRedraw(\"drawing buffer aspect changed\"),this.animationProps.width=t,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){typeof t==\"object\"&&t!==null&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&typeof OffscreenCanvas<\"u\"&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?U0(this.props.gl,t):this.onCreateContext(t),!Xd(this.gl))throw new Error(\"AnimationLoop.onCreateContext - illegal context returned\");ZM(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){let t=document.createElement(\"div\");document.body.appendChild(t),t.style.position=\"relative\";let r=document.createElement(\"div\");r.style.position=\"absolute\",r.style.left=\"10px\",r.style.bottom=\"10px\",r.style.width=\"300px\",r.style.background=\"white\",t.appendChild(this.gl.canvas),t.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){let t=this.gl.drawingBufferWidth,r=this.gl.drawingBufferHeight,i=1,{canvas:n}=this.gl;return n&&n.clientHeight?i=n.clientWidth/n.clientHeight:t>0&&r>0&&(i=t/r),{width:t,height:r,aspect:i}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&q4(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new pi(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get(\"GPU Time\").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){let{canvas:t}=this.gl;t&&(t.addEventListener(\"mousemove\",this._onMousemove),t.addEventListener(\"mouseleave\",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}};var X0=\"vs\",nb=\"fs\";function Js(e,t){if(!e)throw new Error(t||\"shadertools: assertion failed.\")}var hR={number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},array:{validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function ZV(e){let t={};for(let r in e){let i=e[r],n=ust(i);t[r]=n}return t}function ust(e){let t=qV(e);return t===\"object\"?e?\"type\"in e?Object.assign({},e,hR[e.type]):\"value\"in e?(t=qV(e.value),Object.assign({type:t},e,hR[t])):{type:\"object\",value:e}:{type:\"object\",value:null}:Object.assign({type:t,value:e},hR[t])}function qV(e){return Array.isArray(e)||ArrayBuffer.isView(e)?\"array\":typeof e}var hst=\"vs\",fst=\"fs\",my=class{constructor(t){let{name:r,vs:i,fs:n,dependencies:s=[],uniforms:o,getUniforms:c,deprecations:d=[],defines:_={},inject:w={},vertexShader:I,fragmentShader:R}=t;Js(typeof r==\"string\"),this.name=r,this.vs=i||I,this.fs=n||R,this.getModuleUniforms=c,this.dependencies=s,this.deprecations=this._parseDeprecationDefinitions(d),this.defines=_,this.injections=dst(w),o&&(this.uniforms=ZV(o))}getModuleSource(t){let r;switch(t){case hst:r=this.vs||\"\";break;case fst:r=this.fs||\"\";break;default:Js(!1)}return\"#define MODULE_\".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,\"_\"),`\n`).concat(r,\"// END MODULE_\").concat(this.name,`\n\n`)}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(i=>{i.regex.test(t)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case\"function\":r.regex=new RegExp(\"\\\\b\".concat(r.old,\"\\\\(\"));break;default:r.regex=new RegExp(\"\".concat(r.type,\" \").concat(r.old,\";\"))}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},i=this.uniforms;for(let n in i){let s=i[n];n in t&&!s.private?(s.validate&&Js(s.validate(t[n],s),\"\".concat(this.name,\": invalid \").concat(n)),r[n]=t[n]):r[n]=s.value}return r}};function dst(e){let t={vs:{},fs:{}};for(let r in e){let i=e[r],n=r.slice(0,2);typeof i==\"string\"&&(i={order:0,injection:i}),t[n][r]=i}return t}function YV(e){return pst(QV(e))}function pst(e){let t={},r={};return $V({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((i,n)=>r[n]-r[i]).map(i=>t[i])}function $V(e){let{modules:t,level:r,moduleMap:i,moduleDepth:n}=e;if(r>=5)throw new Error(\"Possible loop in shader dependency graph\");for(let s of t)i[s.name]=s,(n[s.name]===void 0||n[s.name](r instanceof my||(Js(typeof r!=\"string\",\"Shader module use by name is deprecated. Import shader module '\".concat(r,\"' and use it directly.\")),Js(r.name,\"shader module has no name\"),r=new my(r),r.dependencies=QV(r.dependencies)),r))}function fR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<\"u\"?window.navigator||{}:{},r=e.userAgent||t.userAgent||\"\",i=r.indexOf(\"MSIE \")!==-1,n=r.indexOf(\"Trident/\")!==-1;return i||n}var Ast=7936,mst=7937,gst=7938,_st=35724,pR={GLSL_FRAG_DATA:[\"WEBGL_draw_buffers\",!0],GLSL_FRAG_DEPTH:[\"EXT_frag_depth\",!0],GLSL_DERIVATIVES:[\"OES_standard_derivatives\",!0],GLSL_TEXTURE_LOD:[\"EXT_shader_texture_lod\",!0]},YA={};Object.keys(pR).forEach(e=>{YA[e]=e});function yst(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function XV(e){let t=e.getExtension(\"WEBGL_debug_renderer_info\"),r=e.getParameter(t&&t.UNMASKED_VENDOR_WEBGL||Ast),i=e.getParameter(t&&t.UNMASKED_RENDERER_WEBGL||mst);return{gpuVendor:vst(r,i),vendor:r,renderer:i,version:e.getParameter(gst),shadingLanguageVersion:e.getParameter(_st)}}function vst(e,t){return e.match(/NVIDIA/i)||t.match(/NVIDIA/i)?\"NVIDIA\":e.match(/INTEL/i)||t.match(/INTEL/i)?\"INTEL\":e.match(/AMD/i)||t.match(/AMD/i)||e.match(/ATI/i)||t.match(/ATI/i)?\"AMD\":\"UNKNOWN GPU\"}var dR={};function AR(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=pR[t];if(Js(i,t),!fR(r))return!0;if(t in dR)return dR[t];let n=i[0],s=r.behavior||\"enable\",o=\"#extension GL_\".concat(n,\" : \").concat(s,`\nvoid main(void) {}`),c=e.createShader(35633);e.shaderSource(c,o),e.compileShader(c);let d=e.getShaderParameter(c,35713);return e.deleteShader(c),dR[t]=d,d}function xst(e,t){let r=pR[t];Js(r,t);let i=yst(e)&&r[1]||r[0],n=typeof i==\"string\"?!!e.getExtension(i):i;return Js(n===!1||n===!0),n}function sb(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>xst(e,r))}function KV(e){switch(XV(e).gpuVendor.toLowerCase()){case\"nvidia\":return`#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n`;case\"intel\":return`#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;case\"amd\":return`#define AMD_GPU\n`;default:return`#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`}}function JV(e,t,r){let i=`#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n`;return sb(e,YA.GLSL_FRAG_DEPTH)&&(i+=`\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n`),sb(e,YA.GLSL_DERIVATIVES)&&AR(e,YA.GLSL_DERIVATIVES)&&(i+=`\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n`),sb(e,YA.GLSL_FRAG_DATA)&&AR(e,YA.GLSL_FRAG_DATA,{behavior:\"require\"})&&(i+=`\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n`),sb(e,YA.GLSL_TEXTURE_LOD)&&(i+=`// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n`),i}var tj=`#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n`,ej=`#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n`;var bst={[X0]:tj,[nb]:ej},ob=\"__LUMA_INJECT_DECLARATIONS__\",rj=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/,ij=/}\\n?[^{}]*$/,mR=[];function uE(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,n=t===X0;for(let s in r){let o=r[s];o.sort((d,_)=>d.order-_.order),mR.length=o.length;for(let d=0,_=o.length;d<_;++d)mR[d]=o[d].injection;let c=\"\".concat(mR.join(`\n`),`\n`);switch(s){case\"vs:#decl\":n&&(e=e.replace(ob,c));break;case\"vs:#main-start\":n&&(e=e.replace(rj,d=>d+c));break;case\"vs:#main-end\":n&&(e=e.replace(ij,d=>c+d));break;case\"fs:#decl\":n||(e=e.replace(ob,c));break;case\"fs:#main-start\":n||(e=e.replace(rj,d=>d+c));break;case\"fs:#main-end\":n||(e=e.replace(ij,d=>c+d));break;default:e=e.replace(s,d=>d+c)}}return e=e.replace(ob,\"\"),i&&(e=e.replace(/\\}\\s*$/,s=>s+bst[t])),e}function gy(e){let t={};return Js(Array.isArray(e)&&e.length>1),e.forEach(r=>{for(let i in r)t[i]=t[i]?\"\".concat(t[i],`\n`).concat(r[i]):r[i]}),t}function _y(e){return new RegExp(\"\\\\b\".concat(e,\"[ \\\\t]+(\\\\w+[ \\\\t]+\\\\w+(\\\\[\\\\w+\\\\])?;)\"),\"g\")}var nj=[[/^(#version[ \\t]+(100|300[ \\t]+es))?[ \\t]*\\n/,`#version 300 es\n`],[/\\btexture(2D|2DProj|Cube)Lod(EXT)?\\(/g,\"textureLod(\"],[/\\btexture(2D|2DProj|Cube)(EXT)?\\(/g,\"texture(\"]],wst=[...nj,[_y(\"attribute\"),\"in $1\"],[_y(\"varying\"),\"out $1\"]],Sst=[...nj,[_y(\"varying\"),\"in $1\"]],sj=[[/^#version[ \\t]+300[ \\t]+es/,\"#version 100\"],[/\\btexture(2D|2DProj|Cube)Lod\\(/g,\"texture$1LodEXT(\"],[/\\btexture\\(/g,\"texture2D(\"],[/\\btextureLod\\(/g,\"texture2DLodEXT(\"]],Tst=[...sj,[_y(\"in\"),\"attribute $1\"],[_y(\"out\"),\"varying $1\"]],Mst=[...sj,[_y(\"in\"),\"varying $1\"]],gR=\"gl_FragColor\",_R=/\\bout[ \\t]+vec4[ \\t]+(\\w+)[ \\t]*;\\n?/,Est=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/;function yR(e,t,r){switch(t){case 300:return r?hE(e,wst):Pst(e);case 100:return r?hE(e,Tst):Ist(e);default:throw new Error(\"unknown GLSL version \".concat(t))}}function hE(e,t){for(let[r,i]of t)e=e.replace(r,i);return e}function Pst(e){e=hE(e,Sst);let t=e.match(_R);if(t){let r=t[1];e=e.replace(new RegExp(\"\\\\b\".concat(gR,\"\\\\b\"),\"g\"),r)}else{let r=\"fragmentColor\";e=e.replace(Est,i=>\"out vec4 \".concat(r,`;\n`).concat(i)).replace(new RegExp(\"\\\\b\".concat(gR,\"\\\\b\"),\"g\"),r)}return e}function Ist(e){e=hE(e,Mst);let t=e.match(_R);if(t){let r=t[1];e=e.replace(_R,\"\").replace(new RegExp(\"\\\\b\".concat(r,\"\\\\b\"),\"g\"),gR)}return e}var Cst=`\n\n`.concat(ob,`\n\n`),aj={[X0]:\"vertex\",[nb]:\"fragment\"},Lst=`precision highp float;\n\n`;function vR(e,t){let{vs:r,fs:i}=t,n=YV(t.modules||[]);return{gl:e,vs:oj(e,Object.assign({},t,{source:r,type:X0,modules:n})),fs:oj(e,Object.assign({},t,{source:i,type:nb,modules:n})),getUniforms:kst(n)}}function oj(e,t){let{id:r,source:i,type:n,modules:s,defines:o={},hookFunctions:c=[],inject:d={},transpileToGLSL100:_=!1,prologue:w=!0,log:I}=t;Js(typeof i==\"string\",\"shader source must be a string\");let R=n===X0,N=i.split(`\n`),j=100,Y=\"\",it=i;N[0].indexOf(\"#version \")===0?(j=300,Y=N[0],it=N.slice(1).join(`\n`)):Y=\"#version \".concat(j);let Z={};s.forEach(Yt=>{Object.assign(Z,Yt.getDefines())}),Object.assign(Z,o);let K=w?\"\".concat(Y,`\n`).concat(Dst({id:r,source:i,type:n}),`\n`).concat(Rst({type:n}),`\n`).concat(KV(e),`\n`).concat(JV(e,j,!R),`\n`).concat(Ost(Z),`\n`).concat(R?\"\":Lst,`\n`):\"\".concat(Y,`\n`),J=Fst(c),ht={},Tt={},Ot={};for(let Yt in d){let te=typeof d[Yt]==\"string\"?{injection:d[Yt],order:0}:d[Yt],oe=Yt.match(/^(v|f)s:(#)?([\\w-]+)$/);if(oe){let ae=oe[2],ke=oe[3];ae?ke===\"decl\"?Tt[Yt]=[te]:Ot[Yt]=[te]:ht[Yt]=[te]}else Ot[Yt]=[te]}for(let Yt of s){I&&Yt.checkDeprecations(it,I);let te=Yt.getModuleSource(n,j);K+=te;let oe=Yt.injections[n];for(let ae in oe){let ke=ae.match(/^(v|f)s:#([\\w-]+)$/);if(ke){let cr=ke[2]===\"decl\"?Tt:Ot;cr[ae]=cr[ae]||[],cr[ae].push(oe[ae])}else ht[ae]=ht[ae]||[],ht[ae].push(oe[ae])}}return K+=Cst,K=uE(K,n,Tt),K+=Bst(J[n],ht),K+=it,K=uE(K,n,Ot),K=yR(K,_?100:j,R),K}function kst(e){return function(r){let i={};for(let n of e){let s=n.getUniforms(r,i);Object.assign(i,s)}return i}}function Rst(e){let{type:t}=e;return`\n#define SHADER_TYPE_`.concat(aj[t].toUpperCase(),`\n`)}function Dst(e){let{id:t,source:r,type:i}=e;return t&&typeof t==\"string\"&&r.indexOf(\"SHADER_NAME\")===-1?`\n#define SHADER_NAME `.concat(t,\"_\").concat(aj[i],`\n\n`):\"\"}function Ost(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=0,r=\"\";for(let i in e){t===0&&(r+=`\n// APPLICATION DEFINES\n`),t++;let n=e[i];(n||Number.isFinite(n))&&(r+=\"#define \".concat(i.toUpperCase(),\" \").concat(e[i],`\n`))}return t===0&&(r+=`\n`),r}function Bst(e,t){let r=\"\";for(let i in e){let n=e[i];if(r+=\"void \".concat(n.signature,` {\n`),n.header&&(r+=\" \".concat(n.header)),t[i]){let s=t[i];s.sort((o,c)=>o.order-c.order);for(let o of s)r+=\" \".concat(o.injection,`\n`)}n.footer&&(r+=\" \".concat(n.footer)),r+=`}\n`}return r}function Fst(e){let t={vs:{},fs:{}};return e.forEach(r=>{let i;typeof r!=\"string\"?(i=r,r=i.hook):i={},r=r.trim();let[n,s]=r.split(\":\"),o=r.replace(/\\(.+/,\"\");t[n][o]=Object.assign(i,{signature:s})}),t}var zst=\"void main() {gl_FragColor = vec4(0);}\",lj=`out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}`,Nst=`#version 300 es\n`.concat(lj);function fE(e,t){t=Array.isArray(t)?t:[t];let r=e.replace(/^\\s+/,\"\").split(/\\s+/),[i,n,s]=r;if(!t.includes(i)||!n||!s)return null;let o=s.split(\";\")[0];return{qualifier:i,type:n,name:o}}function ab(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{version:t=100,input:r,inputType:i,output:n}=e;if(!r)return t===300?Nst:t>300?\"#version \".concat(t,`\n`).concat(lj):zst;let s=cj(r,i);return t>=300?\"#version \".concat(t,\" \").concat(t===300?\"es\":\"\",`\nin `).concat(i,\" \").concat(r,`;\nout vec4 `).concat(n,`;\nvoid main() {\n `).concat(n,\" = \").concat(s,`;\n}`):\"varying \".concat(i,\" \").concat(r,`;\nvoid main() {\n gl_FragColor = `).concat(s,`;\n}`)}function xR(e){switch(e){case\"float\":return\"x\";case\"vec2\":return\"xy\";case\"vec3\":return\"xyz\";case\"vec4\":return\"xyzw\";default:return Js(!1),null}}function bR(e){switch(e){case\"float\":return 1;case\"vec2\":return 2;case\"vec3\":return 3;case\"vec4\":return 4;default:return Js(!1),null}}function cj(e,t){switch(t){case\"float\":return\"vec4(\".concat(e,\", 0.0, 0.0, 1.0)\");case\"vec2\":return\"vec4(\".concat(e,\", 0.0, 1.0)\");case\"vec3\":return\"vec4(\".concat(e,\", 1.0)\");case\"vec4\":return e;default:return Js(!1),null}}var Ust=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\n\nfloat sin_taylor_fp32(float a) {\n float r, s, t, x;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n x = -a * a;\n s = a;\n r = a;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_3;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_5;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_7;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_9;\n s = s + t;\n\n return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n if (a == 0.0) {\n sin_t = 0.0;\n cos_t = 1.0;\n }\n sin_t = sin_taylor_fp32(a);\n cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n float sin_a;\n float cos_a;\n\n if (a == 0.0) {\n return 0.0;\n }\n float z = floor(a / TWO_PI);\n float r = a - TWO_PI * z;\n\n float t;\n float q = floor(r / PI_2 + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return 1.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 1.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n`,dE={name:\"fp32\",vs:Ust,fs:null};function kh(e,t){if(!e)throw new Error(\"math.gl assertion \".concat(t))}var CLt=1/Math.PI*180,LLt=1/180*Math.PI,to={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function wR(e,{precision:t=to.precision}={}){return e=Vst(e),\"\".concat(parseFloat(e.toPrecision(t)))}function Rh(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ml(e,t,r){return Gst(e,i=>Math.max(t,Math.min(r,i)))}function Xl(e,t,r){return Rh(e)?e.map((i,n)=>Xl(i,t[n],r)):r*t+(1-r)*e}function Lo(e,t,r){let i=to.EPSILON;r&&(to.EPSILON=r);try{if(e===t)return!0;if(Rh(e)&&Rh(t)){if(e.length!==t.length)return!1;for(let n=0;n0?\", \":\"\")+wR(this[i],t);return\"\".concat(t.printTypes?this.constructor.name:\"\",\"[\").concat(r,\"]\")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r=0&&t=0&&t0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function ER(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function by(e,t,r){var i=t[0],n=t[1],s=t[2],o=r[0],c=r[1],d=r[2];return e[0]=n*d-s*c,e[1]=s*o-i*d,e[2]=i*c-n*o,e}function gj(e,t,r,i){var n=t[0],s=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=s+i*(r[1]-s),e[2]=o+i*(r[2]-o),e}function wy(e,t,r){var i=t[0],n=t[1],s=t[2],o=r[3]*i+r[7]*n+r[11]*s+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*s+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*s+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*s+r[14])/o,e}function _E(e,t,r){var i=t[0],n=t[1],s=t[2];return e[0]=i*r[0]+n*r[3]+s*r[6],e[1]=i*r[1]+n*r[4]+s*r[7],e[2]=i*r[2]+n*r[5]+s*r[8],e}function yE(e,t,r){var i=r[0],n=r[1],s=r[2],o=r[3],c=t[0],d=t[1],_=t[2],w=n*_-s*d,I=s*c-i*_,R=i*d-n*c,N=n*R-s*I,j=s*w-i*R,Y=i*I-n*w,it=o*2;return w*=it,I*=it,R*=it,N*=2,j*=2,Y*=2,e[0]=c+w+N,e[1]=d+I+j,e[2]=_+R+Y,e}function _j(e,t,r,i){var n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[0],s[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),s[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function yj(e,t,r,i){var n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),s[1]=n[1],s[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function vj(e,t,r,i){var n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),s[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),s[2]=n[2],e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function xj(e,t){var r=e[0],i=e[1],n=e[2],s=t[0],o=t[1],c=t[2],d=Math.sqrt(r*r+i*i+n*n),_=Math.sqrt(s*s+o*o+c*c),w=d*_,I=w&&ER(e,t)/w;return Math.acos(Math.min(Math.max(I,-1),1))}var vE=Yst;var xE=Zst,bE=$st,WLt=function(){var e=TR();return function(t,r,i,n,s,o){var c,d;for(r||(r=3),i||(i=0),n?d=Math.min(n*r+i,t.length):d=t.length,c=i;c0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(Qst)}fromObject(t){return this.check()}fromQuaternion(t){return Pj(this,t),this.check()}set(t,r,i,n,s,o,c,d,_){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this[4]=s,this[5]=o,this[6]=c,this[7]=d,this[8]=_,this.check()}setRowMajor(t,r,i,n,s,o,c,d,_){return this[0]=t,this[1]=n,this[2]=c,this[3]=r,this[4]=s,this[5]=d,this[6]=i,this[7]=o,this[8]=_,this.check()}determinant(){return Tj(this)}transpose(){return wj(this,this),this.check()}invert(){return Sj(this,this),this.check()}multiplyLeft(t){return IR(this,t,this),this.check()}multiplyRight(t){return IR(this,this,t),this.check()}rotate(t){return Ej(this,this,t),this.check()}scale(t){return Array.isArray(t)?CR(this,this,t):CR(this,this,[t,t]),this.check()}translate(t){return Mj(this,this,t),this.check()}transform(t,r){let i;switch(t.length){case 2:i=uj(r||[-0,-0],t,this);break;case 3:i=_E(r||[-0,-0,-0],t,this);break;case 4:i=gE(r||[-0,-0,-0,-0],t,this);break;default:throw new Error(\"Illegal vector\")}return $A(i,t.length),i}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},TE,ME;function Xst(){return TE||(TE=new os([0,0,0,0,0,0,0,0,0]),Object.freeze(TE)),TE}function Kst(){return ME||(ME=new os,Object.freeze(ME)),ME}function Jst(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Cj(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],s=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=s,e[11]=t[14],e[12]=n,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function cb(e,t){var r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],c=t[5],d=t[6],_=t[7],w=t[8],I=t[9],R=t[10],N=t[11],j=t[12],Y=t[13],it=t[14],Z=t[15],K=r*c-i*o,J=r*d-n*o,ht=r*_-s*o,Tt=i*d-n*c,Ot=i*_-s*c,Yt=n*_-s*d,te=w*Y-I*j,oe=w*it-R*j,ae=w*Z-N*j,ke=I*it-R*Y,or=I*Z-N*Y,cr=R*Z-N*it,Lr=K*cr-J*or+ht*ke+Tt*ae-Ot*oe+Yt*te;return Lr?(Lr=1/Lr,e[0]=(c*cr-d*or+_*ke)*Lr,e[1]=(n*or-i*cr-s*ke)*Lr,e[2]=(Y*Yt-it*Ot+Z*Tt)*Lr,e[3]=(R*Ot-I*Yt-N*Tt)*Lr,e[4]=(d*ae-o*cr-_*oe)*Lr,e[5]=(r*cr-n*ae+s*oe)*Lr,e[6]=(it*ht-j*Yt-Z*J)*Lr,e[7]=(w*Yt-R*ht+N*J)*Lr,e[8]=(o*or-c*ae+_*te)*Lr,e[9]=(i*ae-r*or-s*te)*Lr,e[10]=(j*Ot-Y*ht+Z*K)*Lr,e[11]=(I*ht-w*Ot-N*K)*Lr,e[12]=(c*oe-o*ke-d*te)*Lr,e[13]=(r*ke-i*oe+n*te)*Lr,e[14]=(Y*J-j*Tt-it*K)*Lr,e[15]=(w*Tt-I*J+R*K)*Lr,e):null}function Lj(e){var t=e[0],r=e[1],i=e[2],n=e[3],s=e[4],o=e[5],c=e[6],d=e[7],_=e[8],w=e[9],I=e[10],R=e[11],N=e[12],j=e[13],Y=e[14],it=e[15],Z=t*o-r*s,K=t*c-i*s,J=t*d-n*s,ht=r*c-i*o,Tt=r*d-n*o,Ot=i*d-n*c,Yt=_*j-w*N,te=_*Y-I*N,oe=_*it-R*N,ae=w*Y-I*j,ke=w*it-R*j,or=I*it-R*Y;return Z*or-K*ke+J*ae+ht*oe-Tt*te+Ot*Yt}function Jf(e,t,r){var i=t[0],n=t[1],s=t[2],o=t[3],c=t[4],d=t[5],_=t[6],w=t[7],I=t[8],R=t[9],N=t[10],j=t[11],Y=t[12],it=t[13],Z=t[14],K=t[15],J=r[0],ht=r[1],Tt=r[2],Ot=r[3];return e[0]=J*i+ht*c+Tt*I+Ot*Y,e[1]=J*n+ht*d+Tt*R+Ot*it,e[2]=J*s+ht*_+Tt*N+Ot*Z,e[3]=J*o+ht*w+Tt*j+Ot*K,J=r[4],ht=r[5],Tt=r[6],Ot=r[7],e[4]=J*i+ht*c+Tt*I+Ot*Y,e[5]=J*n+ht*d+Tt*R+Ot*it,e[6]=J*s+ht*_+Tt*N+Ot*Z,e[7]=J*o+ht*w+Tt*j+Ot*K,J=r[8],ht=r[9],Tt=r[10],Ot=r[11],e[8]=J*i+ht*c+Tt*I+Ot*Y,e[9]=J*n+ht*d+Tt*R+Ot*it,e[10]=J*s+ht*_+Tt*N+Ot*Z,e[11]=J*o+ht*w+Tt*j+Ot*K,J=r[12],ht=r[13],Tt=r[14],Ot=r[15],e[12]=J*i+ht*c+Tt*I+Ot*Y,e[13]=J*n+ht*d+Tt*R+Ot*it,e[14]=J*s+ht*_+Tt*N+Ot*Z,e[15]=J*o+ht*w+Tt*j+Ot*K,e}function tg(e,t,r){var i=r[0],n=r[1],s=r[2],o,c,d,_,w,I,R,N,j,Y,it,Z;return t===e?(e[12]=t[0]*i+t[4]*n+t[8]*s+t[12],e[13]=t[1]*i+t[5]*n+t[9]*s+t[13],e[14]=t[2]*i+t[6]*n+t[10]*s+t[14],e[15]=t[3]*i+t[7]*n+t[11]*s+t[15]):(o=t[0],c=t[1],d=t[2],_=t[3],w=t[4],I=t[5],R=t[6],N=t[7],j=t[8],Y=t[9],it=t[10],Z=t[11],e[0]=o,e[1]=c,e[2]=d,e[3]=_,e[4]=w,e[5]=I,e[6]=R,e[7]=N,e[8]=j,e[9]=Y,e[10]=it,e[11]=Z,e[12]=o*i+w*n+j*s+t[12],e[13]=c*i+I*n+Y*s+t[13],e[14]=d*i+R*n+it*s+t[14],e[15]=_*i+N*n+Z*s+t[15]),e}function Sy(e,t,r){var i=r[0],n=r[1],s=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function kj(e,t,r,i){var n=i[0],s=i[1],o=i[2],c=Math.hypot(n,s,o),d,_,w,I,R,N,j,Y,it,Z,K,J,ht,Tt,Ot,Yt,te,oe,ae,ke,or,cr,Lr,hn;return c0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=n*o,e[3]=s*o,e}function Gj(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Wj(e,t,r,i){var n=t[0],s=t[1],o=t[2],c=t[3];return e[0]=n+i*(r[0]-n),e[1]=s+i*(r[1]-s),e[2]=o+i*(r[2]-o),e[3]=c+i*(r[3]-c),e}function Oh(e,t,r){var i=t[0],n=t[1],s=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*s+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*s+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*s+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*s+r[15]*o,e}function Hj(e,t,r){var i=t[0],n=t[1],s=t[2],o=r[0],c=r[1],d=r[2],_=r[3],w=_*i+c*s-d*n,I=_*n+d*i-o*s,R=_*s+o*n-c*i,N=-o*i-c*n-d*s;return e[0]=w*_+N*-o+I*-d-R*-c,e[1]=I*_+N*-c+R*-o-w*-d,e[2]=R*_+N*-d+w*-c-I*-o,e[3]=t[3],e}var ckt=function(){var e=rot();return function(t,r,i,n,s,o){var c,d;for(r||(r=4),i||(i=0),n?d=Math.min(n*r+i,t.length):d=t.length,c=i;cMath.PI*2)throw Error(\"expected radians\")}function lot(e,t,r,i,n,s){let o=2*s/(r-t),c=2*s/(n-i),d=(r+t)/(r-t),_=(n+i)/(n-i),w=-1,I=-1,R=-2*s;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=d,e[9]=_,e[10]=w,e[11]=I,e[12]=0,e[13]=0,e[14]=R,e[15]=0,e}function Zj(){var e=new ba(4);return ba!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Yj(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function BR(e,t,r){r=r*.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function FR(e,t,r){var i=t[0],n=t[1],s=t[2],o=t[3],c=r[0],d=r[1],_=r[2],w=r[3];return e[0]=i*w+o*c+n*_-s*d,e[1]=n*w+o*d+s*c-i*_,e[2]=s*w+o*_+i*d-n*c,e[3]=o*w-i*c-n*d-s*_,e}function $j(e,t,r){r*=.5;var i=t[0],n=t[1],s=t[2],o=t[3],c=Math.sin(r),d=Math.cos(r);return e[0]=i*d+o*c,e[1]=n*d+s*c,e[2]=s*d-n*c,e[3]=o*d-i*c,e}function Qj(e,t,r){r*=.5;var i=t[0],n=t[1],s=t[2],o=t[3],c=Math.sin(r),d=Math.cos(r);return e[0]=i*d-s*c,e[1]=n*d+o*c,e[2]=s*d+i*c,e[3]=o*d-n*c,e}function Xj(e,t,r){r*=.5;var i=t[0],n=t[1],s=t[2],o=t[3],c=Math.sin(r),d=Math.cos(r);return e[0]=i*d+n*c,e[1]=n*d-i*c,e[2]=s*d+o*c,e[3]=o*d-s*c,e}function Kj(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e}function hb(e,t,r,i){var n=t[0],s=t[1],o=t[2],c=t[3],d=r[0],_=r[1],w=r[2],I=r[3],R,N,j,Y,it;return N=n*d+s*_+o*w+c*I,N<0&&(N=-N,d=-d,_=-_,w=-w,I=-I),1-N>Dh?(R=Math.acos(N),j=Math.sin(R),Y=Math.sin((1-i)*R)/j,it=Math.sin(i*R)/j):(Y=1-i,it=i),e[0]=Y*n+it*d,e[1]=Y*s+it*_,e[2]=Y*o+it*w,e[3]=Y*c+it*I,e}function Jj(e,t){var r=t[0],i=t[1],n=t[2],s=t[3],o=r*r+i*i+n*n+s*s,c=o?1/o:0;return e[0]=-r*c,e[1]=-i*c,e[2]=-n*c,e[3]=s*c,e}function t7(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function zR(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var s=(n+1)%3,o=(n+2)%3;i=Math.sqrt(t[n*3+n]-t[s*3+s]-t[o*3+o]+1),e[n]=.5*i,i=.5/i,e[3]=(t[s*3+o]-t[o*3+s])*i,e[s]=(t[s*3+n]+t[n*3+s])*i,e[o]=(t[o*3+n]+t[n*3+o])*i}return e}var e7=Nj;var r7=Ty,i7=Gj,n7=Wj,s7=Uj;var o7=Vj;var a7=jj;var l7=function(){var e=TR(),t=MR(1,0,0),r=MR(0,1,0);return function(i,n,s){var o=ER(n,s);return o<-.999999?(by(e,t,n),xE(e)<1e-6&&by(e,r,n),mj(e,e),BR(i,e,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(by(e,n,s),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+o,a7(i,i))}}(),vkt=function(){var e=Zj(),t=Zj();return function(r,i,n,s,o,c){return hb(e,i,o,c),hb(t,n,s,c),hb(r,e,t,2*c*(1-c)),r}}(),xkt=function(){var e=bj();return function(t,r,i,n){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],a7(t,zR(t,e))}}();var uot=[0,0,0,1],eg=class extends rp{constructor(t=0,r=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,i,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,i,n){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return zR(this,t),this.check()}fromAxisRotation(t,r){return BR(this,t,r),this.check()}identity(){return Yj(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Gi(t)}get y(){return this[1]}set y(t){this[1]=Gi(t)}get z(){return this[2]}set z(t){this[2]=Gi(t)}get w(){return this[3]}set w(t){this[3]=Gi(t)}len(){return s7(this)}lengthSquared(){return o7(this)}dot(t){return i7(this,t)}rotationTo(t,r){return l7(this,t,r),this.check()}add(t){return e7(this,this,t),this.check()}calculateW(){return Kj(this,this),this.check()}conjugate(){return t7(this,this),this.check()}invert(){return Jj(this,this),this.check()}lerp(t,r,i){return i===void 0?this.lerp(this,t,r):(n7(this,t,r,i),this.check())}multiplyRight(t){return FR(this,this,t),this.check()}multiplyLeft(t){return FR(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return $j(this,this,t),this.check()}rotateY(t){return Qj(this,this,t),this.check()}rotateZ(t){return Xj(this,this,t),this.check()}scale(t){return r7(this,this,t),this.check()}slerp(t,r,i){let n,s,o;switch(arguments.length){case 1:({start:n=uot,target:s,ratio:o}=t);break;case 2:n=this,s=t,o=r;break;default:n=t,s=r,o=i}return hb(this,n,s,o),this.check()}transformVector4(t,r=new lb){return Hj(r,t,this),$A(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var LE={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,PI_OVER_TWO:Math.PI/2,PI_OVER_FOUR:Math.PI/4,PI_OVER_SIX:Math.PI/6,TWO_PI:Math.PI*2};var NR=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n`;var hot={lightSources:{}};function UR(){let{color:e=[0,0,0],intensity:t=1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.map(r=>r*t/255)}function fot(e){let{ambientLight:t,pointLights:r=[],directionalLights:i=[]}=e,n={};return t?n[\"lighting_uAmbientLight.color\"]=UR(t):n[\"lighting_uAmbientLight.color\"]=[0,0,0],r.forEach((s,o)=>{n[\"lighting_uPointLight[\".concat(o,\"].color\")]=UR(s),n[\"lighting_uPointLight[\".concat(o,\"].position\")]=s.position,n[\"lighting_uPointLight[\".concat(o,\"].attenuation\")]=s.attenuation||[1,0,0]}),n.lighting_uPointLightCount=r.length,i.forEach((s,o)=>{n[\"lighting_uDirectionalLight[\".concat(o,\"].color\")]=UR(s),n[\"lighting_uDirectionalLight[\".concat(o,\"].direction\")]=s.direction}),n.lighting_uDirectionalLightCount=i.length,n}function c7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hot;if(\"lightSources\"in e){let{ambientLight:t,pointLights:r,directionalLights:i}=e.lightSources||{};return t||r&&r.length>0||i&&i.length>0?Object.assign({},fot({ambientLight:t,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if(\"lights\"in e){let t={pointLights:[],directionalLights:[]};for(let r of e.lights||[])switch(r.type){case\"ambient\":t.ambientLight=r;break;case\"directional\":t.directionalLights.push(r);break;case\"point\":t.pointLights.push(r);break;default:}return c7({lightSources:t})}return{}}var VR={name:\"lights\",vs:NR,fs:NR,getUniforms:c7,defines:{MAX_LIGHTS:3}};var dot=new Uint8Array([0,255,255,255]),pot={pickingSelectedColor:null,pickingHighlightColor:dot,pickingActive:!1,pickingAttribute:!1};function Aot(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pot,t={};if(e.pickingSelectedColor!==void 0)if(!e.pickingSelectedColor)t.picking_uSelectedColorValid=0;else{let r=e.pickingSelectedColor.slice(0,3);t.picking_uSelectedColorValid=1,t.picking_uSelectedColor=r}if(e.pickingHighlightColor){let r=Array.from(e.pickingHighlightColor,i=>i/255);Number.isFinite(r[3])||(r[3]=1),t.picking_uHighlightColor=r}return e.pickingActive!==void 0&&(t.picking_uActive=!!e.pickingActive,t.picking_uAttribute=!!e.pickingAttribute),t}var mot=`uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n if (picking_uActive) {\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n }\n } else {\n picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n`,got=`uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n if (picking_uActive) {\n return color;\n }\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n float highLightAlpha = picking_uHighlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n if (picking_uActive) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\nvec4 picking_filterColor(vec4 color) {\n vec4 highightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highightColor);\n}\n\n`,kE={name:\"picking\",vs:mot,fs:got,getUniforms:Aot};var jR=`\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n`;var _ot={};function yot(e){let{ambient:t=.35,diffuse:r=.6,shininess:i=32,specularColor:n=[30,30,30]}=e;return{lighting_uAmbient:t,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:n.map(s=>s/255)}}function u7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_ot;if(!(\"material\"in e))return{};let{material:t}=e;return t?yot(t):{lighting_uEnabled:!1}}var XA={name:\"gouraud-lighting\",dependencies:[VR],vs:jR,defines:{LIGHTING_VERTEX:1},getUniforms:u7},Ey={name:\"phong-lighting\",dependencies:[VR],fs:jR,defines:{LIGHTING_FRAGMENT:1},getUniforms:u7};var vot=`attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n`,GR={name:\"transform\",vs:vot,fs:null};var Bh=class e{static getDefaultProgramManager(t){return t.luma=t.luma||{},t.luma.defaultProgramManager=t.luma.defaultProgramManager||new e(t),t.luma.defaultProgramManager}constructor(t){this.gl=t,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(t){this._defaultModules.find(r=>r.name===t.name)||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){let r=typeof t==\"string\"?t:t.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r),this.stateHash++}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{vs:r=\"\",fs:i=\"\",defines:n={},inject:s={},varyings:o=[],bufferMode:c=35981,transpileToGLSL100:d=!1}=t,_=this._getModuleList(t.modules),w=this._getHash(r),I=this._getHash(i),R=_.map(J=>this._getHash(J.name)).sort(),N=o.map(J=>this._getHash(J)),j=Object.keys(n).sort(),Y=Object.keys(s).sort(),it=[],Z=[];for(let J of j)it.push(this._getHash(J)),it.push(this._getHash(n[J]));for(let J of Y)Z.push(this._getHash(J)),Z.push(this._getHash(s[J]));let K=\"\".concat(w,\"/\").concat(I,\"D\").concat(it.join(\"/\"),\"M\").concat(R.join(\"/\"),\"I\").concat(Z.join(\"/\"),\"V\").concat(N.join(\"/\"),\"H\").concat(this.stateHash,\"B\").concat(c).concat(d?\"T\":\"\");if(!this._programCache[K]){let J=vR(this.gl,{vs:r,fs:i,modules:_,inject:s,defines:n,hookFunctions:this._hookFunctions,transpileToGLSL100:d});this._programCache[K]=new tp(this.gl,{hash:K,vs:J.vs,fs:J.fs,varyings:o,bufferMode:c}),this._getUniforms[K]=J.getUniforms||(ht=>{}),this._useCounts[K]=0}return this._useCounts[K]++,this._programCache[K]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._programCache[r].delete(),delete this._programCache[r],delete this._getUniforms[r],delete this._useCounts[r])}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),i={},n=0;for(let s=0,o=this._defaultModules.length;s{},Mot={},_n=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{id:i=ra(\"model\")}=r;ye(Xd(t)),this.id=i,this.gl=t,this.id=r.id||ra(\"Model\"),this.lastLogTime=0,this.animated=!1,this.initialize(r)}initialize(t){this.props={},this.programManager=t.programManager||Bh.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;let{program:r=null,vs:i,fs:n,modules:s,defines:o,inject:c,varyings:d,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:n,modules:s,defines:o,inject:c,varyings:d,bufferMode:_,transpileToGLSL100:w},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=t.drawMode!==void 0?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},ye(this.drawMode!==void 0&&Number.isFinite(this.vertexCount),Tot)}setProps(t){this._setModelProps(t)}delete(){for(let t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){let{program:r,vs:i,fs:n,modules:s,defines:o,inject:c,varyings:d,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:n,modules:s,defines:o,inject:c,varyings:d,bufferMode:_,transpileToGLSL100:w},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return ye(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return ye(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=h7(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xf(t))return this;let r={};for(let i in t){let n=t[i];r[i]=n.getValue?n.getValue():n}return this.vertexArray.setAttributes(r),this}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();let r=this.programManager.getUniforms(this.program);return r?r(t):{}}updateModuleSettings(t){let r=this.getModuleUniforms(t||{});return this.setUniforms(r)}clear(t){return Kf(this.program.gl,t),this}draw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._checkProgram();let{moduleSettings:r=null,framebuffer:i,uniforms:n={},attributes:s={},transformFeedback:o=this.transformFeedback,parameters:c={},vertexArray:d=this.vertexArray}=t;this.setAttributes(s),this.updateModuleSettings(r),this.setUniforms(n);let _;Ge.priority>=Py&&(_=this._logDrawCallStart(Py));let w=this.vertexArray.getDrawParams(),{isIndexed:I=w.isIndexed,indexType:R=w.indexType,indexOffset:N=w.indexOffset,vertexArrayInstanced:j=w.isInstanced}=this.props;j&&!this.isInstanced&&Ge.warn(\"Found instanced attributes on non-instanced model\",this.id)();let{isInstanced:Y,instanceCount:it}=this,{onBeforeRender:Z=f7,onAfterRender:K=f7}=this.props;Z(),this.program.setUniforms(this.uniforms);let J=this.program.draw(Object.assign(Mot,t,{logPriority:_,uniforms:null,framebuffer:i,parameters:c,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:d,transformFeedback:o,isIndexed:I,indexType:R,isInstanced:Y,instanceCount:it,offset:I?N:0}));return K(),Ge.priority>=Py&&this._logDrawCallEnd(_,d,i),J}transform(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{discard:r=!0,feedbackBuffers:i,unbindModels:n=[]}=t,{parameters:s}=t;i&&this._setFeedbackBuffers(i),r&&(s=Object.assign({},s,{35977:r})),n.forEach(o=>o.vertexArray.unbindBuffers());try{this.draw(Object.assign({},t,{parameters:s}))}finally{n.forEach(o=>o.vertexArray.bindBuffers())}return this}render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ge.warn(\"Model.render() is deprecated. Use Model.setUniforms() and Model.draw()\")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),\"uniforms\"in t&&this.setUniforms(t.uniforms),\"pickable\"in t&&(this.pickable=t.pickable),\"instanceCount\"in t&&(this.instanceCount=t.instanceCount),\"geometry\"in t&&this.setGeometry(t.geometry),\"attributes\"in t&&this.setAttributes(t.attributes),\"_feedbackBuffers\"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:r}=this.programProps;if(r)this._managedProgram=!1;else{let{vs:i,fs:n,modules:s,inject:o,defines:c,varyings:d,bufferMode:_,transpileToGLSL100:w}=this.programProps;r=this.programManager.get({vs:i,fs:n,modules:s,inject:o,defines:c,varyings:d,bufferMode:_,transpileToGLSL100:w}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}ye(r instanceof tp,\"Model needs a program\"),this._programDirty=!1,r!==this.program&&(this.program=r,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new Ay(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(let t in this.geometryBuffers){let r=this.geometryBuffers[t][0]||this.geometryBuffers[t];r instanceof Ur&&r.delete()}}_setAnimationProps(t){this.animated&&ye(t,\"Model.draw(): animated uniforms but no animationProps\")}_setFeedbackBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xf(t))return this;let{gl:r}=this.program;return this.transformFeedback=this.transformFeedback||new ep(r,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){let r=t>3?0:Sot;if(!(Date.now()-this.lastLogTime>> DRAWING MODEL \".concat(this.id),{collapsed:Ge.level<=2})(),t}_logDrawCallEnd(t,r,i,n){if(t===void 0)return;let s=cR({vertexArray:r,header:\"\".concat(this.id,\" attributes\"),attributes:this._attributes}),{table:o,unusedTable:c,unusedCount:d}=cE({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i)}),{table:_,count:w}=cE({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i),undefinedOnly:!0});w>0&&Ge.log(\"MISSING UNIFORMS\",Object.keys(_))(),d>0&&Ge.log(\"UNUSED UNIFORMS\",Object.keys(c))();let I=uR(this.vertexArray.configuration);Ge.table(t,s)(),Ge.table(t,o)(),Ge.table(t+1,I)(),n&&n.log({logLevel:Py,message:\"Rendered to \".concat(n.id)}),Ge.groupEnd(Py)()}};var fb=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}setupResources(t){for(let r of this.bindings)this._setupTransformFeedback(r,t)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyings:r}=this;return r.length>0&&(t=Object.assign({},t,{varyings:r})),t}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this.bindings[this.currentIndex],{sourceBuffers:i,transformFeedback:n}=r;return{attributes:Object.assign({},i,t.attributes),transformFeedback:n}}swap(){return this.feedbackMap?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t)}getBuffer(t){let{feedbackBuffers:r}=this.bindings[this.currentIndex],i=t?r[t]:null;return i?i instanceof Ur?i:i.buffer:null}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyingName:r}=t,i=this.getBuffer(r);return i?i.getData():null}delete(){for(let t in this.resources)this.resources[t].delete()}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&ye(fr(this.gl))}_getFeedbackBuffers(t){let{sourceBuffers:r={}}=t,i={};if(this.bindings[this.currentIndex]&&Object.assign(i,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(let n in this.feedbackMap){let s=this.feedbackMap[n];n in r&&(i[s]=n)}Object.assign(i,t.feedbackBuffers);for(let n in i){let s=i[n];if(typeof s==\"string\"){let o=r[s],{byteLength:c,usage:d,accessor:_}=o;i[n]=this._createNewBuffer(n,{byteLength:c,usage:d,accessor:_})}}return i}_setupBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);let i=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:r,feedbackBuffers:i})}_setupTransformFeedback(t,r){let{model:i}=r,{program:n}=i;t.transformFeedback=new ep(this.gl,{program:n,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){let{sourceBuffers:r,feedbackBuffers:i}=this._swapBuffers(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceBuffers:r,feedbackBuffers:i})}}_updateBinding(t,r){return t?(Object.assign(t.sourceBuffers,r.sourceBuffers),Object.assign(t.feedbackBuffers,r.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},r.sourceBuffers),feedbackBuffers:Object.assign({},r.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;let r=Object.assign({},t.sourceBuffers),i=Object.assign({},t.feedbackBuffers);for(let n in this.feedbackMap){let s=this.feedbackMap[n];r[n]=t.feedbackBuffers[s],i[s]=t.sourceBuffers[n],ye(i[s]instanceof Ur)}return{sourceBuffers:r,feedbackBuffers:i}}_createNewBuffer(t,r){let i=new Ur(this.gl,r);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=i,i}_getNextIndex(){return(this.currentIndex+1)%2}};var Eot=\"transform_uSampler_\",RE=\"transform_uSize_\",d7=\"transform_position\";function p7(e){let{vs:t,sourceTextureMap:r,targetTextureVarying:i,targetTexture:n}=e,o=Object.keys(r).length,c=null,d={},_=t,w={};if(o>0||i){let I=_.split(`\n`),R=I.slice();if(I.forEach((N,j,Y)=>{if(o>0){let it=Lot(N,r);if(it){let{updatedLine:Z,inject:K}=it;R[j]=Z,w=gy([w,K]),Object.assign(d,it.samplerTextureMap),o--}}i&&!c&&(c=Cot(N,i))}),i){ye(n);let N=\"\".concat(RE).concat(i),j=\"uniform vec2 \".concat(N,`;\n`),Y=\" vec2 \".concat(d7,\" = transform_getPos(\").concat(N,`);\n gl_Position = vec4(`).concat(d7,`, 0, 1.);\n`);w=gy([w,{\"vs:#decl\":j,\"vs:#main-start\":Y}])}_=R.join(`\n`)}return{vs:_,targetTextureType:c,inject:w,samplerTextureMap:d}}function A7(e){let{sourceTextureMap:t,targetTextureVarying:r,targetTexture:i}=e,n={},s,o;r&&({width:s,height:o}=i,n[\"\".concat(RE).concat(r)]=[s,o]);for(let c in t)({width:s,height:o}=t[c]),n[\"\".concat(RE).concat(c)]=[s,o];return n}function Pot(e){return fE(e,[\"attribute\",\"in\"])}function Iot(e){let t=\"\".concat(Eot).concat(e),r=\"\".concat(RE).concat(e),i=\" uniform sampler2D \".concat(t,`;\n uniform vec2 `).concat(r,\";\");return{samplerName:t,sizeName:r,uniformDeclerations:i}}function Cot(e,t){let r=fE(e,[\"varying\",\"out\"]);return r&&r.name===t?r.type:null}function Lot(e,t){let r={},i=Pot(e);if(!i)return null;let{type:n,name:s}=i;if(s&&t[s]){let o=\"// \".concat(e,\" => Replaced by Transform with a sampler\"),{samplerName:c,sizeName:d,uniformDeclerations:_}=Iot(s),w=xR(n),I=\" \".concat(n,\" \").concat(s,\" = transform_getInput(\").concat(c,\", \").concat(d,\").\").concat(w,`;\n`);return r[c]=s,{updatedLine:o,inject:{\"vs:#decl\":_,\"vs:#main-start\":I},samplerTextureMap:r}}return null}var kot={10241:9728,10240:9728,10242:33071,10243:33071},Rot=\"transform_output\",db=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._processVertexShader(t);return Object.assign({},t,r)}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,sourceTextures:i,framebuffer:n,targetTexture:s}=this.bindings[this.currentIndex],o=Object.assign({},r,t.attributes),c=Object.assign({},t.uniforms),d=Object.assign({},t.parameters),_=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(let I in this.samplerTextureMap){let R=this.samplerTextureMap[I];c[I]=i[R]}this._setSourceTextureParameters();let w=A7({sourceTextureMap:i,targetTextureVarying:this.targetTextureVarying,targetTexture:s});Object.assign(c,w)}return this.hasTargetTexture&&(_=!1,d.viewport=[0,0,n.width,n.height]),{attributes:o,framebuffer:n,uniforms:c,discard:_,parameters:d}}swap(){return this._swapTexture?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupTextures(t)}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{framebuffer:r}=this.bindings[this.currentIndex],i=Ch(r);if(!t)return i;let n=i.constructor,s=bR(this.targetTextureType),o=new n(i.length*s/4),c=0;for(let d=0;d0&&arguments[0]!==void 0?arguments[0]:{},{_targetTextureVarying:r,_swapTexture:i}=t;this._swapTexture=i,this.targetTextureVarying=r,this.hasTargetTexture=r,this._setupTextures(t)}_createTargetTexture(t){let{sourceTextures:r,textureOrReference:i}=t;if(i instanceof ui)return i;let n=r[i];return n?(this._targetRefTexName=i,this._createNewTexture(n)):null}_setupTextures(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,_sourceTextures:i={},_targetTexture:n}=t,s=this._createTargetTexture({sourceTextures:i,textureOrReference:n});this.hasSourceTextures=this.hasSourceTextures||i&&Object.keys(i).length>0,this._updateBindings({sourceBuffers:r,sourceTextures:i,targetTexture:s}),\"elementCount\"in t&&this._updateElementIDBuffer(t.elementCount)}_updateElementIDBuffer(t){if(typeof t!=\"number\"||this.elementCount>=t)return;let r=new Float32Array(t);r.forEach((i,n,s)=>{s[n]=n}),this.elementIDBuffer?this.elementIDBuffer.setData({data:r}):this.elementIDBuffer=new Ur(this.gl,{data:r,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){let{sourceTextures:r,targetTexture:i}=this._swapTextures(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceTextures:r,targetTexture:i})}}_updateBinding(t,r){let{sourceBuffers:i,sourceTextures:n,targetTexture:s}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,n),Object.assign(t.sourceBuffers,i),s){t.targetTexture=s;let{width:o,height:c}=s,{framebuffer:d}=t;d?(d.update({attachments:{36064:s},resizeAttachments:!1}),d.resize({width:o,height:c})):t.framebuffer=new pi(this.gl,{id:\"transform-framebuffer\",width:o,height:c,attachments:{36064:s}})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let i in r)r[i].setParameters(kot)}_swapTextures(t){if(!this._swapTexture)return null;let r=Object.assign({},t.sourceTextures);r[this._swapTexture]=t.targetTexture;let i=t.sourceTextures[this._swapTexture];return{sourceTextures:r,targetTexture:i}}_createNewTexture(t){let r=rE(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=r,r}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceTextures:r,targetTexture:i}=this.bindings[this.currentIndex],{vs:n,uniforms:s,targetTextureType:o,inject:c,samplerTextureMap:d}=p7({vs:t.vs,sourceTextureMap:r,targetTextureVarying:this.targetTextureVarying,targetTexture:i}),_=gy([t.inject||{},c]);this.targetTextureType=o,this.samplerTextureMap=d;let w=t._fs||ab({version:py(n),input:this.targetTextureVarying,inputType:o,output:Rot}),I=this.hasSourceTextures||this.targetTextureVarying?[GR].concat(t.modules||[]):t.modules;return{vs:n,fs:w,modules:I,uniforms:s,inject:_}}};var Kl=class{static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(r),Object.seal(this)}delete(){let{model:t,bufferTransform:r,textureTransform:i}=this;t&&t.delete(),r&&r.delete(),i&&i.delete()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{clearRenderTarget:r=!0}=t,i=this._updateDrawOptions(t);r&&i.framebuffer&&i.framebuffer.clear({color:!0}),this.model.transform(i)}swap(){let t=!1,r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)t=t||i.swap();ye(t,\"Nothing to swap\")}getBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r){let n=i.getData(t);if(n)return n}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};\"elementCount\"in t&&this.model.setVertexCount(t.elementCount);let r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)i.update(t)}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{gl:r}=this;this._buildResourceTransforms(r,t),t=this._updateModelProps(t),this.model=new _n(r,Object.assign({},t,{fs:t.fs||ab({version:py(t.vs)}),id:t.id||\"transform-model\",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let n of i)r=n.updateModelProps(r);return r}_buildResourceTransforms(t,r){Dot(r)&&(this.bufferTransform=new fb(t,r)),Oot(r)&&(this.textureTransform=new db(t,r)),ye(this.bufferTransform||this.textureTransform,\"must provide source/feedback buffers or source/target textures\")}_updateDrawOptions(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let n of i)r=Object.assign(r,n.getDrawOptions(r));return r}};function Dot(e){return!!(!Xf(e.feedbackBuffers)||!Xf(e.feedbackMap)||e.varyings&&e.varyings.length>0)}function Oot(e){return!!(!Xf(e._sourceTextures)||e._targetTexture||e._targetTextureVarying)}var m7={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ms=class{static get DRAW_MODE(){return m7}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=ra(\"geometry\"),drawMode:i=m7.TRIANGLES,attributes:n={},indices:s=null,vertexCount:o=null}=t;this.id=r,this.drawMode=i|0,this.attributes={},this.userData={},this._setAttributes(n,s),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return\"Geometry \".concat(this.id,\" attribute \").concat(t)}_setAttributes(t,r){r&&(this.indices=ArrayBuffer.isView(r)?{value:r,size:1}:r);for(let i in t){let n=t[i];n=ArrayBuffer.isView(n)?{value:n}:n,ye(ArrayBuffer.isView(n.value),\"\".concat(this._print(i),\": must be typed array or object with value as typed array\")),(i===\"POSITION\"||i===\"positions\")&&!n.size&&(n.size=3),i===\"indices\"?(ye(!this.indices),this.indices=n):this.attributes[i]=n}return this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,r){if(r)return r.value.length;let i=1/0;for(let n in t){let s=t[n],{value:o,size:c,constant:d}=s;!d&&o&&c>=1&&(i=Math.min(i,o.length/c))}return ye(Number.isFinite(i)),i}};var Bot=1,Fot=1,KA=class{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:n=1,repeat:s=1}=t,o=Bot++,c={time:0,delay:r,duration:i,rate:n,repeat:s};return this._setChannelTime(c,this.time),this.channels.set(o,c),o}removeChannel(t){this.channels.delete(t);for(let[r,i]of this.animations)i.channel===t&&this.detachAnimation(r)}isFinished(t){let r=this.channels.get(t);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(t){if(t===void 0)return this.time;let r=this.channels.get(t);return r===void 0?-1:r.time}setTime(t){this.time=Math.max(0,t);let r=this.channels.values();for(let n of r)this._setChannelTime(n,this.time);let i=this.animations.values();for(let n of i){let{animation:s,channel:o}=n;s.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,r){let i=Fot++;return this.animations.set(i,{animation:t,channel:r}),t.setTime(this.getTime(r)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,r){let i=r-t.delay,n=t.duration*t.repeat;i>=n?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}};var zot=[255,255,255],Not=1,Uot=0,DE=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"ambient\");let{color:r=zot}=t,{intensity:i=Not}=t;this.id=t.id||\"ambient-\".concat(Uot++),this.color=r,this.intensity=i}};var Vot=[255,255,255],jot=1,Got=[0,0,-1],Wot=0,pb=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"directional\"),G(this,\"direction\",void 0),G(this,\"shadow\",void 0);let{color:r=Vot}=t,{intensity:i=jot}=t,{direction:n=Got}=t,{_shadow:s=!1}=t;this.id=t.id||\"directional-\".concat(Wot++),this.color=r,this.intensity=i,this.type=\"directional\",this.direction=new Ne(n).normalize().toArray(),this.shadow=s}getProjectedLight(t){return this}};var Ab=class{constructor(t,r={id:\"pass\"}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"props\",void 0);let{id:i}=r;this.id=i,this.gl=t,this.props={...r}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}};var Jl=class extends Ab{constructor(...t){super(...t),G(this,\"_lastRenderIndex\",-1)}render(t){let r=this.gl;return wl(r,{framebuffer:t.target}),this._drawLayers(t)}_drawLayers(t){let{target:r,moduleParameters:i,viewports:n,views:s,onViewportActive:o,clearStack:c=!0,clearCanvas:d=!0}=t;t.pass=t.pass||\"unknown\";let _=this.gl;d&&qot(_,r),c&&(this._lastRenderIndex=-1);let w=[];for(let I of n){let R=s&&s[I.id];o?.(I);let N=this._getDrawLayerParams(I,t),j=I.subViewports||[I];for(let Y of j){let it=this._drawLayersInViewport(_,{target:r,moduleParameters:i,viewport:Y,view:R,pass:t.pass,layers:t.layers},N);w.push(it)}}return w}_getDrawLayerParams(t,{layers:r,pass:i,isPicking:n=!1,layerFilter:s,cullRect:o,effects:c,moduleParameters:d},_=!1){let w=[],I=g7(this._lastRenderIndex+1),R={layer:r[0],viewport:t,isPicking:n,renderPass:i,cullRect:o},N={};for(let j=0;jKf(t,I))}let w={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};wl(t,{viewport:_});for(let I=0;I{let o=n.props._offset,c=n.id,d=n.parent&&n.parent.id,_;if(d&&!(d in t)&&i(n.parent,!1),d in r){let w=r[d]=r[d]||g7(t[d],t);_=w(n,s),r[c]=w}else Number.isFinite(o)?(_=o+(t[d]||0),r[c]=null):_=e;return s&&_>=e&&(e=_+1),t[c]=_,_};return i}function Hot(e,{moduleParameters:t,target:r,viewport:i}){let n=r&&r.id!==\"default-framebuffer\",s=t&&t.devicePixelRatio||Sl(e),o=n?r.height:e.drawingBufferHeight,c=i;return[c.x*s,o-(c.y+c.height)*s,c.width*s,c.height*s]}function qot(e,t){let r=t?t.width:e.drawingBufferWidth,i=t?t.height:e.drawingBufferHeight;wl(e,{viewport:[0,0,r,i]}),e.clear(16640)}var mb=class extends Jl{constructor(t,r){super(t,r),G(this,\"shadowMap\",void 0),G(this,\"depthBuffer\",void 0),G(this,\"fbo\",void 0),this.shadowMap=new ui(t,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new el(t,{format:33189,width:1,height:1}),this.fbo=new pi(t,{id:\"shadowmap\",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(t){let r=this.fbo;mn(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},()=>{let i=t.viewports[0],n=Sl(this.gl),s=i.width*n,o=i.height*n;(s!==r.width||o!==r.height)&&r.resize({width:s,height:o}),super.render({...t,target:r,pass:\"shadow\"})})}shouldDrawLayer(t){return t.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}};var _7=\"#define SMOOTH_EDGE_RADIUS 0.5\",Zot=`\n`.concat(_7,`\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`),Yot=`\n`.concat(_7,`\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`),y7={name:\"geometry\",vs:Zot,fs:Yot};var $ot=Object.keys(Hr).map(e=>\"const int COORDINATE_SYSTEM_\".concat(e,\" = \").concat(Hr[e],\";\")).join(\"\"),Qot=Object.keys(Ja).map(e=>\"const int PROJECTION_MODE_\".concat(e,\" = \").concat(Ja[e],\";\")).join(\"\"),Xot=Object.keys(ea).map(e=>\"const int UNIT_\".concat(e.toUpperCase(),\" = \").concat(ea[e],\";\")).join(\"\"),v7=\"\".concat($ot,`\n`).concat(Qot,`\n`).concat(Xot,`\n\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\n float y = clamp(lat, -89.9, 89.9);\n return 1.0 / cos(radians(y));\n}\n\nfloat project_size() {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n project_uPseudoMeters == false) {\n \n if (geometry.position.w == 0.0) {\n return project_size_at_latitude(geometry.worldPosition.y);\n }\n \n float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n float y2 = y * y;\n float y4 = y2 * y2;\n float y6 = y4 * y2;\n return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n }\n return 1.0;\n}\n\nfloat project_size_at_latitude(float meters, float lat) {\n return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\n return meters * project_uCommonUnitsPerMeter.z * project_size();\n}\n\nvec2 project_size(vec2 meters) {\n return meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\n\nvec3 project_size(vec3 meters) {\n return meters * project_uCommonUnitsPerMeter * project_size();\n}\n\nvec4 project_size(vec4 meters) {\n return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\n vec3 uz = normalize(up);\n vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\n vec3 uy = cross(uz, ux);\n return mat3(ux, uy, uz);\n}\n\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n transform = project_get_orientation_matrix(commonPosition);\n return true;\n }\n return false;\n}\nvec3 project_normal(vec3 vector) {\n vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\n mat3 rotation;\n if (project_needs_rotation(geometry.position.xyz, rotation)) {\n n = rotation * n;\n }\n return n;\n}\n\nvec4 project_offset_(vec4 offset) {\n float dy = offset.y;\n vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\n return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\n float x = lnglat.x;\n if (project_uWrapLongitude) {\n x = mod(x + 180., 360.0) - 180.;\n }\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\nvec3 project_globe_(vec3 lnglatz) {\n float lambda = radians(lnglatz.x);\n float phi = radians(lnglatz.y);\n float cosPhi = cos(phi);\n float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n\n return vec3(\n sin(lambda) * cosPhi,\n -cos(lambda) * cosPhi,\n sin(phi)\n ) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\n vec4 position_world = project_uModelMatrix * position;\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_mercator_(position_world.xy),\n project_size_at_latitude(position_world.z, position_world.y),\n position_world.w\n );\n }\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n position_world.xyz += project_uCoordinateOrigin;\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_globe_(position_world.xyz),\n position_world.w\n );\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\n return vec4(\n project_mercator_(position_world.xy) - project_uCommonOrigin.xy,\n project_size(position_world.z),\n position_world.w\n );\n }\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n position_world.xyz -= project_uCoordinateOrigin;\n }\n return project_offset_(position_world + project_uModelMatrix * vec4(position64Low, 0.0));\n}\n\nvec4 project_position(vec4 position) {\n return project_position(position, ZERO_64_LOW);\n}\n\nvec3 project_position(vec3 position, vec3 position64Low) {\n vec4 projected_position = project_position(vec4(position, 1.0), position64Low);\n return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\n return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\n return projected_position.xy;\n}\n\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\n return viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\n return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\n vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n return offset * project_uFocalDistance;\n}\n\nfloat project_size_to_pixel(float meters) {\n return project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\n if (unit == UNIT_METERS) return project_size_to_pixel(size);\n if (unit == UNIT_COMMON) return size * project_uScale;\n return size;\n}\nfloat project_pixel_size(float pixels) {\n return pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\n return pixels / project_uScale;\n}\n`);function Kot(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{for(let n in i)if(!Kot(i[n],t[n])){r=e(i),t=i;break}return r}}var x7=[0,0,0,0],Jot=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],b7=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],tat=[0,0,0],w7=[0,0,0],eat=td(iat);function WR(e,t,r=w7){r.length<3&&(r=[r[0],r[1],0]);let i=r,n,s=!0;switch(t===Hr.LNGLAT_OFFSETS||t===Hr.METER_OFFSETS?n=r:n=e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case Ja.WEB_MERCATOR:(t===Hr.LNGLAT||t===Hr.CARTESIAN)&&(n=[0,0,0],s=!1);break;case Ja.WEB_MERCATOR_AUTO_OFFSET:t===Hr.LNGLAT?i=n:t===Hr.CARTESIAN&&(i=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],n=e.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Ja.IDENTITY:i=e.position.map(Math.fround),i[2]=i[2]||0;break;case Ja.GLOBE:s=!1,n=null;break;default:s=!1}return{geospatialOrigin:n,shaderCoordinateOrigin:i,offsetMode:s}}function rat(e,t,r){let{viewMatrixUncentered:i,projectionMatrix:n}=e,{viewMatrix:s,viewProjectionMatrix:o}=e,c=x7,d=x7,_=e.cameraPosition,{geospatialOrigin:w,shaderCoordinateOrigin:I,offsetMode:R}=WR(e,t,r);return R&&(d=e.projectPosition(w||I),_=[_[0]-d[0],_[1]-d[1],_[2]-d[2]],d[3]=1,c=Oh([],d,o),s=i||s,o=Jf([],n,s),o=Jf([],o,Jot)),{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:c,originCommon:d,cameraPosCommon:_,shaderCoordinateOrigin:I,geospatialOrigin:w}}function S7({viewport:e,devicePixelRatio:t=1,modelMatrix:r=null,coordinateSystem:i=Hr.DEFAULT,coordinateOrigin:n=w7,autoWrapLongitude:s=!1}){i===Hr.DEFAULT&&(i=e.isGeospatial?Hr.LNGLAT:Hr.CARTESIAN);let o=eat({viewport:e,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:n});return o.project_uWrapLongitude=s,o.project_uModelMatrix=r||b7,o}function iat({viewport:e,devicePixelRatio:t,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:n,viewProjectionMatrix:s,originCommon:o,cameraPosCommon:c,shaderCoordinateOrigin:d,geospatialOrigin:_}=rat(e,r,i),w=e.getDistanceScales(),I=[e.width*t,e.height*t],R=Oh([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,N={project_uCoordinateSystem:r,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:d,project_uCommonOrigin:o.slice(0,3),project_uCenter:n,project_uPseudoMeters:!!e._pseudoMeters,project_uViewportSize:I,project_uDevicePixelRatio:t,project_uFocalDistance:R,project_uCommonUnitsPerMeter:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:tat,project_uScale:e.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:s,project_uModelMatrix:b7,project_uCameraPosition:c};if(_){let j=e.getDistanceScales(_);switch(r){case Hr.METER_OFFSETS:N.project_uCommonUnitsPerWorldUnit=j.unitsPerMeter,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerMeter2;break;case Hr.LNGLAT:case Hr.LNGLAT_OFFSETS:e._pseudoMeters||(N.project_uCommonUnitsPerMeter=j.unitsPerMeter),N.project_uCommonUnitsPerWorldUnit=j.unitsPerDegree,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerDegree2;break;case Hr.CARTESIAN:N.project_uCommonUnitsPerWorldUnit=[1,1,j.unitsPerMeter[2]],N.project_uCommonUnitsPerWorldUnit2=[0,0,j.unitsPerMeter2[2]];break;default:break}}return N}var nat={};function sat(e=nat){return\"viewport\"in e?S7(e):{}}var Fh={name:\"project\",dependencies:[dE,y7],vs:v7,getUniforms:sat};function HR(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function JA(e,t){let r=Oh([],t,e);return Ty(r,r,1/r[3]),r}function qR(e,t){let r=e%t;return r<0?t+r:r}function gb(e,t,r){return er?r:e}function oat(e){return Math.log(e)*Math.LOG2E}var Iy=Math.log2||oat;function Uu(e,t){if(!e)throw new Error(t||\"@math.gl/web-mercator: assertion failed.\")}var zh=Math.PI,T7=zh/4,Vu=zh/180,ZR=180/zh,Cy=512,OE=4003e4,Ly=85.051129,M7=1.5;function YR(e){return Iy(e)}function El(e){let[t,r]=e;Uu(Number.isFinite(t)),Uu(Number.isFinite(r)&&r>=-90&&r<=90,\"invalid latitude\");let i=t*Vu,n=r*Vu,s=Cy*(i+zh)/(2*zh),o=Cy*(zh+Math.log(Math.tan(T7+n*.5)))/(2*zh);return[s,o]}function Qc(e){let[t,r]=e,i=t/Cy*(2*zh)-zh,n=2*(Math.atan(Math.exp(r/Cy*(2*zh)-zh))-T7);return[i*ZR,n*ZR]}function $R(e){let{latitude:t}=e;Uu(Number.isFinite(t));let r=Math.cos(t*Vu);return YR(OE*r)-9}function _b(e){let t=Math.cos(e*Vu);return Cy/OE/t}function ky(e){let{latitude:t,longitude:r,highPrecision:i=!1}=e;Uu(Number.isFinite(t)&&Number.isFinite(r));let n=Cy,s=Math.cos(t*Vu),o=n/360,c=o/s,d=n/OE/s,_={unitsPerMeter:[d,d,d],metersPerUnit:[1/d,1/d,1/d],unitsPerDegree:[o,c,d],degreesPerUnit:[1/o,1/c,1/d]};if(i){let w=Vu*Math.tan(t*Vu)/s,I=o*w/2,R=n/OE*w,N=R/c*d;_.unitsPerDegree2=[0,I,R],_.unitsPerMeter2=[N,0,N]}return _}function yb(e,t){let[r,i,n]=e,[s,o,c]=t,{unitsPerMeter:d,unitsPerMeter2:_}=ky({longitude:r,latitude:i,highPrecision:!0}),w=El(e);w[0]+=s*(d[0]+_[0]*o),w[1]+=o*(d[1]+_[1]*o);let I=Qc(w),R=(n||0)+(c||0);return Number.isFinite(n)||Number.isFinite(c)?[I[0],I[1],R]:I}function BE(e){let{height:t,pitch:r,bearing:i,altitude:n,scale:s,center:o}=e,c=HR();tg(c,c,[0,0,-n]),EE(c,c,-r*Vu),PE(c,c,i*Vu);let d=s/t;return Sy(c,c,[d,d,d]),o&&tg(c,c,Aj([],o)),c}function QR(e){let{width:t,height:r,altitude:i,pitch:n=0,offset:s,center:o,scale:c,nearZMultiplier:d=1,farZMultiplier:_=1}=e,{fovy:w=rg(M7)}=e;i!==void 0&&(w=rg(i));let I=w*Vu,R=n*Vu,N=vb(w),j=N;o&&(j+=o[2]*c/Math.cos(R)/r);let Y=I*(.5+(s?s[1]:0)/r),it=Math.sin(Y)*j/Math.sin(gb(Math.PI/2-R-Y,.01,Math.PI-.01)),Z=Math.sin(R)*it+j,K=j*10,J=Math.min(Z*_,K);return{fov:I,aspect:t/r,focalDistance:N,near:d,far:J}}function rg(e){return 2*Math.atan(.5/e)*ZR}function vb(e){return .5/Math.tan(.5*e*Vu)}function Ry(e,t){let[r,i,n=0]=e;return Uu(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(n)),JA(t,[r,i,n,1])}function ed(e,t,r=0){let[i,n,s]=e;if(Uu(Number.isFinite(i)&&Number.isFinite(n),\"invalid pixel coordinate\"),Number.isFinite(s))return JA(t,[i,n,s,1]);let o=JA(t,[i,n,0,1]),c=JA(t,[i,n,1,1]),d=o[2],_=c[2],w=d===_?0:((r||0)-d)/(_-d);return AE([],o,c,w)}function xb(e){let{width:t,height:r,bounds:i,minExtent:n=0,maxZoom:s=24,offset:o=[0,0]}=e,[[c,d],[_,w]]=i,I=aat(e.padding),R=El([c,gb(w,-Ly,Ly)]),N=El([_,gb(d,-Ly,Ly)]),j=[Math.max(Math.abs(N[0]-R[0]),n),Math.max(Math.abs(N[1]-R[1]),n)],Y=[t-I.left-I.right-Math.abs(o[0])*2,r-I.top-I.bottom-Math.abs(o[1])*2];Uu(Y[0]>0&&Y[1]>0);let it=Y[0]/j[0],Z=Y[1]/j[1],K=(I.right-I.left)/2/it,J=(I.top-I.bottom)/2/Z,ht=[(N[0]+R[0])/2+K,(N[1]+R[1])/2+J],Tt=Qc(ht),Ot=Math.min(s,Iy(Math.abs(Math.min(it,Z))));return Uu(Number.isFinite(Ot)),{longitude:Tt[0],latitude:Tt[1],zoom:Ot}}function aat(e=0){return typeof e==\"number\"?{top:e,bottom:e,left:e,right:e}:(Uu(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e)}var E7=Math.PI/180;function bb(e,t=0){let{width:r,height:i,unproject:n}=e,s={targetZ:t},o=n([0,i],s),c=n([r,i],s),d,_,w=e.fovy?.5*e.fovy*E7:Math.atan(.5/e.altitude),I=(90-e.pitch)*E7;return w>I-.01?(d=P7(e,0,t),_=P7(e,r,t)):(d=n([0,0],s),_=n([r,0],s)),[o,c,_,d]}function P7(e,t,r){let{pixelUnprojectionMatrix:i}=e,n=JA(i,[t,0,1,1]),s=JA(i,[t,e.height,1,1]),c=(r*e.distanceScales.unitsPerMeter[2]-n[2])/(s[2]-n[2]),d=AE([],n,s,c),_=Qc(d);return _.push(r),_}var C7=512;function FE(e){let{width:t,height:r,pitch:i=0}=e,{longitude:n,latitude:s,zoom:o,bearing:c=0}=e;(n<-180||n>180)&&(n=qR(n+180,360)-180),(c<-180||c>180)&&(c=qR(c+180,360)-180);let d=Iy(r/C7);if(o<=d)o=d,s=0;else{let _=r/2/Math.pow(2,o),w=Qc([0,_])[1];if(sI&&(s=I)}}return{width:t,height:r,longitude:n,latitude:s,zoom:o,pitch:i,bearing:c}}var uat=`\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n`,hat=`\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture2D(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n`,fat=td(gat),dat=td(_at),pat=[0,0,0,1],Aat=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function mat(e,t){let[r,i,n]=e,s=ed([r,i,n],t);return Number.isFinite(n)?s:[s[0],s[1],0]}function gat({viewport:e,center:t}){return new gn(e.viewProjectionMatrix).invert().transform(t)}function _at({viewport:e,shadowMatrices:t}){let r=[],i=e.pixelUnprojectionMatrix,n=e.isGeospatial?void 0:1,s=[[0,0,n],[e.width,0,n],[0,e.height,n],[e.width,e.height,n],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map(o=>mat(o,i));for(let o of t){let c=o.clone().translate(new Ne(e.center).negate()),d=s.map(w=>c.transform(w)),_=new gn().ortho({left:Math.min(...d.map(w=>w[0])),right:Math.max(...d.map(w=>w[0])),bottom:Math.min(...d.map(w=>w[1])),top:Math.max(...d.map(w=>w[1])),near:Math.min(...d.map(w=>-w[2])),far:Math.max(...d.map(w=>-w[2]))});r.push(_.multiplyRight(o))}return r}function yat(e,t){let{shadowEnabled:r=!0}=e;if(!r||!e.shadowMatrices||!e.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};let i={shadow_uDrawShadowMap:!!e.drawToShadowMap,shadow_uUseShadowMap:e.shadowMaps?e.shadowMaps.length>0:!1,shadow_uColor:e.shadowColor||pat,shadow_uLightId:e.shadowLightId||0,shadow_uLightCount:e.shadowMatrices.length},n=fat({viewport:e.viewport,center:t.project_uCenter}),s=[],o=dat({shadowMatrices:e.shadowMatrices,viewport:e.viewport}).slice();for(let c=0;c0?i[\"shadow_uShadowMap\".concat(c)]=e.shadowMaps[c]:i[\"shadow_uShadowMap\".concat(c)]=e.dummyShadowMap;return i}var wb={name:\"shadow\",dependencies:[Fh],vs:uat,fs:hat,inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n position = shadow_setVertexPosition(geometry.position);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n color = shadow_filterShadowColor(color);\n `},getUniforms:(e={},t={})=>\"viewport\"in e&&(e.drawToShadowMap||e.shadowMaps&&e.shadowMaps.length>0)?yat(e,t):{}};var vat={color:[255,255,255],intensity:1},L7=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],xat=[0,0,0,200/255],Dy=class{constructor(t={}){G(this,\"id\",\"lighting-effect\"),G(this,\"props\",void 0),G(this,\"shadowColor\",xat),G(this,\"shadow\",void 0),G(this,\"ambientLight\",void 0),G(this,\"directionalLights\",void 0),G(this,\"pointLights\",void 0),G(this,\"shadowPasses\",[]),G(this,\"shadowMaps\",[]),G(this,\"dummyShadowMap\",null),G(this,\"programManager\",void 0),G(this,\"shadowMatrices\",void 0),this.setProps(t)}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in t){let i=t[r];switch(i.type){case\"ambient\":this.ambientLight=i;break;case\"directional\":this.directionalLights.push(i);break;case\"point\":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.props=t}preRender(t,{layers:r,layerFilter:i,viewports:n,onViewportActive:s,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices(),this.shadowPasses.length===0&&this._createShadowPasses(t),this.programManager||(this.programManager=Bh.getDefaultProgramManager(t),wb&&this.programManager.addDefaultModule(wb)),this.dummyShadowMap||(this.dummyShadowMap=new ui(t,{width:1,height:1}));for(let c=0;ci.getProjectedLight({layer:t})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:t}))},r}cleanup(){for(let t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(wb),this.programManager=null)}_calculateMatrices(){let t=[];for(let r of this.directionalLights){let i=new gn().lookAt({eye:new Ne(r.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let r=0;rn&&(s=n);let o=this._pool,c=t.BYTES_PER_ELEMENT*s,d=o.findIndex(_=>_.byteLength>=c);if(d>=0){let _=new t(o.splice(d,1)[0],0,s);return i&&_.fill(0),_}return new t(s)}_release(t){if(!ArrayBuffer.isView(t))return;let r=this._pool,{buffer:i}=t,{byteLength:n}=i,s=r.findIndex(o=>o.byteLength>=n);s<0?r.push(i):(s>0||r.lengththis.opts.poolSize&&r.shift()}},Nh=new XR;function By(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function R7(e){return[e[12],e[13],e[14]]}function D7(e){return{left:Oy(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:Oy(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:Oy(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:Oy(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:Oy(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:Oy(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}}var k7=new Ne;function Oy(e,t,r,i){k7.set(e,t,r);let n=k7.len();return{distance:i/n,normal:new Ne(-e/n,-t/n,-r/n)}}function bat(e){return e-Math.fround(e)}var Sb;function zE(e,t){let{size:r=1,startIndex:i=0}=t,n=t.endIndex!==void 0?t.endIndex:e.length,s=(n-i)/r;Sb=Nh.allocate(Sb,s,{type:Float32Array,size:r*2});let o=i,c=0;for(;osuper.render({target:o,layers:t,layerFilter:r,views:i,viewports:n,onViewportActive:s,cullRect:I,effects:R?.filter(ht=>ht.useInPicking),pass:N,isPicking:!0,moduleParameters:Y}));return this._colorEncoderState=null,{decodePickingColor:Z&&Iat.bind(null,Z),stats:K}}shouldDrawLayer(t){let{pickable:r,operation:i}=t.props;return r&&i.includes(\"draw\")||i.includes(\"terrain\")||i.includes(\"mask\")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(t,r,i){let n={...t.props.parameters},{pickable:s,operation:o}=t.props;return this._colorEncoderState?s&&o.includes(\"draw\")&&(Object.assign(n,N7),n.blend=!0,n.blendColor=Pat(this._colorEncoderState,t,i)):n.blend=!1,o.includes(\"terrain\")&&(n.blend=!1),n}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function Pat(e,t,r){let{byLayer:i,byAlpha:n}=e,s,o=i.get(t);return o?(o.viewports.push(r),s=o.a):(s=i.size+1,s<=255?(o={a:s,layer:t,viewports:[r]},i.set(t,o),n[s]=o):(rr.warn(\"Too many pickable layers, only picking the first 255\")(),s=0)),[0,0,0,s/255]}function Iat(e,t){let r=e.byAlpha[t[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(t)}}var tm={NO_STATE:\"Awaiting state\",MATCHED:\"Matched. State transferred from previous layer\",INITIALIZED:\"Initialized\",AWAITING_GC:\"Discarded. Awaiting garbage collection\",AWAITING_FINALIZATION:\"No longer matched. Awaiting garbage collection\",FINALIZED:\"Finalized! Awaiting garbage collection\"},Fy=Symbol.for(\"component\"),ju=Symbol.for(\"propTypes\"),NE=Symbol.for(\"deprecatedProps\"),ip=Symbol.for(\"asyncPropDefaults\"),rd=Symbol.for(\"asyncPropOriginal\"),Uh=Symbol.for(\"asyncPropResolved\");function np(e,t=()=>!0){return Array.isArray(e)?U7(e,t,[]):t(e)?[e]:[]}function U7(e,t,r){let i=-1;for(;++i0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let i=++this._loadCount,n=t;typeof t==\"string\"&&(n=jA(t)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(s=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=s)}).catch(s=>{this._loadCount===i&&(this.isLoaded=!0,this._error=s||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let s of this._subscribers)s.onChange(this.getData())}};var Mb=class{constructor({gl:t,protocol:r}){G(this,\"protocol\",void 0),G(this,\"_context\",void 0),G(this,\"_resources\",void 0),G(this,\"_consumers\",void 0),G(this,\"_pruneRequest\",void 0),this.protocol=r||\"resource://\",this._context={gl:t,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:r,forceUpdate:i=!1,persistent:n=!0}){let s=this._resources[t];s?s.setData(r,i):(s=new Tb(t,r,this._context),this._resources[t]=s),s.persistent=n}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let i in r){let n=r[i],s=this._resources[n.resourceId];s&&s.unsubscribe(n)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:i,requestId:n=\"default\"}){let{_resources:s,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,\"\"),s[t]||this.add({resourceId:t,data:null,persistent:!1}));let c=s[t];if(this._track(i,n,c,r),c)return c.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,i,n){let s=this._consumers,o=s[t]=s[t]||{},c=o[r]||{},d=c.resourceId&&this._resources[c.resourceId];d&&(d.unsubscribe(c),this.prune()),i&&(o[r]=c,c.onChange=n,c.resourceId=i.id,i.subscribe(c))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let r=this._resources[t];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[t])}}};var Cat=`\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n`,ho={name:\"project32\",dependencies:[Fh],vs:Cat};var ia={inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n `,\"vs:DECKGL_FILTER_COLOR\":`\n picking_setPickingColor(geometry.pickingColor);\n `,\"fs:#decl\":`\nuniform bool picking_uAttribute;\n `,\"fs:DECKGL_FILTER_COLOR\":{order:99,injection:`\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n `}},...kE};var Lat=[Fh],kat=[\"vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)\",\"fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)\"];function V7(e){let t=Bh.getDefaultProgramManager(e);for(let r of Lat)t.addDefaultModule(r);for(let r of kat)t.addShaderHook(r);return t}var Rat=\"layerManager.setLayers\",Dat=\"layerManager.activateViewport\",Eb=class{constructor(t,{deck:r,stats:i,viewport:n,timeline:s}={}){G(this,\"layers\",void 0),G(this,\"context\",void 0),G(this,\"resourceManager\",void 0),G(this,\"_lastRenderedLayers\",[]),G(this,\"_needsRedraw\",!1),G(this,\"_needsUpdate\",!1),G(this,\"_nextLayers\",null),G(this,\"_debug\",!1),G(this,\"activateViewport\",o=>{Ds(Dat,this,o),o&&(this.context.viewport=o)}),this.layers=[],this.resourceManager=new Mb({gl:t,protocol:\"deck://\"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:t,deck:r,programManager:t&&V7(t),stats:i||new Qf({id:\"deck.gl\"}),viewport:n||new tc({id:\"DEFAULT-INITIAL-VIEWPORT\"}),timeline:s||new KA,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let n=i.getNeedsRedraw(t);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?\"layers changed\":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(t){\"debug\"in t&&(this._debug=t.debug),\"userData\"in t&&(this.context.userData=t.userData),\"layers\"in t&&(this._nextLayers=t.layers),\"onError\"in t&&(this.context.onError=t.onError)}setLayers(t,r){Ds(Rat,this,r,t),this._lastRenderedLayers=t;let i=np(t,Boolean);for(let n of i)n.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(\"updating layers: \".concat(t)),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}_handleError(t,r,i){i.raiseError(r,\"\".concat(t,\" of \").concat(i))}_updateLayers(t,r){let i={};for(let o of t)i[o.id]?rr.warn(\"Multiple old layers with same id \".concat(o.id))():i[o.id]=o;let n=[];this._updateSublayersRecursively(r,i,n),this._finalizeOldLayers(i);let s=!1;for(let o of n)if(o.hasUniformTransition()){s=\"Uniform transition in \".concat(o);break}this._needsUpdate=s,this.layers=n}_updateSublayersRecursively(t,r,i){for(let n of t){n.context=this.context;let s=r[n.id];s===null&&rr.warn(\"Multiple new layers with same id \".concat(n.id))(),r[n.id]=null;let o=null;try{this._debug&&s!==n&&n.validateProps(),s?(this._transferLayerState(s,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),o=n.isComposite?n.getSubLayers():null}catch(c){this._handleError(\"matching\",c,n)}o&&this._updateSublayersRecursively(o,r,i)}}_finalizeOldLayers(t){for(let r in t){let i=t[r];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=tm.INITIALIZED}catch(r){this._handleError(\"initialization\",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle=tm.MATCHED,r!==t&&(t.lifecycle=tm.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(r){this._handleError(\"update\",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||\"finalized \".concat(t),t.lifecycle=tm.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=tm.FINALIZED}catch(r){this._handleError(\"finalization\",r,t)}}};function fo(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;ir.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r=typeof t==\"string\"?this.getView(t):t,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}unproject(t,r){let i=this.getViewports(),n={x:t[0],y:t[1]};for(let s=i.length-1;s>=0;--s){let o=i[s];if(o.containsPixel(n)){let c=t.slice();return c[0]-=o.x,c[1]-=o.y,o.unproject(c,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),(\"width\"in t||\"height\"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate(\"Size changed\"))}_setViews(t){t=np(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate(\"views changed\"),this.views=t}_setViewState(t){t?(!fo(t,this.viewState,3)&&this.setNeedsUpdate(\"viewState changed\"),this.viewState=t):rr.warn(\"missing `viewState` or `initialViewState`\")()}_onViewStateChange(t,r){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...r,viewId:t})}_createController(t,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,r.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:s=>{var o;return(o=this.getView(t.id))===null||o===void 0?void 0:o.makeViewport({viewState:s,width:this.width,height:this.height})}})}_updateController(t,r,i,n){let s=t.controller;if(s&&i){let o={...r,...s,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!n||n.constructor!==s.type)&&(n=this._createController(t,o)),n&&n.setProps(o),n}return null}_rebuildViewports(){let{views:t}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let n=t.length;n--;){let s=t[n],o=this.getViewState(s),c=s.makeViewport({viewState:o,width:this.width,height:this.height}),d=r[s.id],_=!!s.controller;_&&!d&&(i=!0),(i||!_)&&d&&(d.finalize(),d=null),this.controllers[s.id]=this._updateController(s,o,c,d),c&&this._viewports.unshift(c)}for(let n in r){let s=r[n];s&&!this.controllers[n]&&s.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length?!0:t.some((i,n)=>!t[n].equals(r[n]))}};var Oat=/([0-9]+\\.?[0-9]*)(%|px)/;function sp(e){switch(typeof e){case\"number\":return{position:e,relative:!1};case\"string\":let t=Oat.exec(e);if(t&&t.length>=3){let r=t[2]===\"%\",i=parseFloat(t[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(\"Could not parse position string \".concat(e))}}function op(e,t){return e.relative?Math.round(e.position*t):e.position}function xr(e,t){if(!e)throw new Error(t||\"deck.gl: assertion failed.\")}var Xc=class{constructor(t){G(this,\"id\",void 0),G(this,\"viewportInstance\",void 0),G(this,\"_x\",void 0),G(this,\"_y\",void 0),G(this,\"_width\",void 0),G(this,\"_height\",void 0),G(this,\"_padding\",void 0),G(this,\"props\",void 0);let{id:r,x:i=0,y:n=0,width:s=\"100%\",height:o=\"100%\",padding:c=null,viewportInstance:d}=t||{};xr(!d||d instanceof tc),this.viewportInstance=d,this.id=r||this.constructor.displayName||\"view\",this.props={...t,id:this.id},this._x=sp(i),this._y=sp(n),this._width=sp(s),this._height=sp(o),this._padding=c&&{left:sp(c.left||0),right:sp(c.right||0),top:sp(c.top||0),bottom:sp(c.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.viewportInstance?t.viewportInstance?this.viewportInstance.equals(t.viewportInstance):!1:this.ViewportType===t.ViewportType&&fo(this.props,t.props,2)}makeViewport({width:t,height:r,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);let n=this.getDimensions({width:t,height:r});return!n.height||!n.width?null:new this.ViewportType({...i,...this.props,...n})}getViewStateId(){let{viewState:t}=this.props;return typeof t==\"string\"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState==\"object\"){if(!this.props.viewState.id)return this.props.viewState;let r={...t};for(let i in this.props.viewState)i!==\"id\"&&(r[i]=this.props.viewState[i]);return r}return t}getDimensions({width:t,height:r}){let i={x:op(this._x,t),y:op(this._y,r),width:op(this._width,t),height:op(this._height,r)};return this._padding&&(i.padding={left:op(this._padding.left,t),top:op(this._padding.top,r),right:op(this._padding.right,t),bottom:op(this._padding.bottom,r)}),i}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t==\"function\"?{type:t}:{type:this.ControllerType,...t}:null}};var Kc=class{constructor(t){G(this,\"_inProgress\",void 0),G(this,\"_handle\",void 0),G(this,\"_timeline\",void 0),G(this,\"time\",void 0),G(this,\"settings\",void 0),this._inProgress=!1,this._handle=null,this._timeline=t,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(t){var r,i;this.cancel(),this.settings=t,this._inProgress=!0,(r=(i=this.settings).onStart)===null||r===void 0||r.call(i,this)}end(){if(this._inProgress){var t,r;this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(t=(r=this.settings).onEnd)===null||t===void 0||t.call(r,this)}}cancel(){if(this._inProgress){var t,r;(t=(r=this.settings).onInterrupt)===null||t===void 0||t.call(r,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1}}update(){var t,r;if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:i,settings:n}=this;this._handle=i.addChannel({delay:i.getTime(),duration:n.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(t=(r=this.settings).onUpdate)===null||t===void 0||t.call(r,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var j7=()=>{},eD={BREAK:1,SNAP_TO_END:2,IGNORE:3},Bat=e=>e,Fat=eD.BREAK,Ib=class{constructor(t){G(this,\"getControllerState\",void 0),G(this,\"props\",void 0),G(this,\"propsInTransition\",void 0),G(this,\"transition\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"_onTransitionUpdate\",r=>{let{time:i,settings:{interpolator:n,startProps:s,endProps:o,duration:c,easing:d}}=r,_=d(i/c),w=n.interpolateProps(s,o,_);this.propsInTransition=this.getControllerState({...this.props,...w}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}),this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Kc(t.timeline),this.onViewStateChange=t.onViewStateChange||j7,this.onStateChange=t.onStateChange||j7}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let n=i;if(this.transition.inProgress){let{interruption:s,endProps:o}=this.transition.settings;n={...i,...s===eD.SNAP_TO_END?o:this.propsInTransition||i}}this._triggerTransition(n,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:i}=t;return(r>0||r===\"auto\")&&!!i}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?this.transition.settings.interruption===eD.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(t,r):!0}_triggerTransition(t,r){let i=this.getControllerState(t),n=this.getControllerState(r).shortestPathFrom(i),s=r.transitionInterpolator,o=s.getDuration?s.getDuration(t,r):r.transitionDuration;if(o===0)return;let c=s.initializeProps(t,n);this.propsInTransition={};let d={duration:o,easing:r.transitionEasing||Bat,interpolator:s,interruption:r.transitionInterruption||Fat,startProps:c.start,endProps:c.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(d),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}};var Cb=class{constructor(t){G(this,\"_propsToCompare\",void 0),G(this,\"_propsToExtract\",void 0),G(this,\"_requiredProps\",void 0);let{compare:r,extract:i,required:n}=t;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(t,r){for(let i of this._propsToCompare)if(!(i in t)||!(i in r)||!Lo(t[i],r[i]))return!1;return!0}initializeProps(t,r){let i={},n={};for(let s of this._propsToExtract)(s in t||s in r)&&(i[s]=t[s],n[s]=r[s]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let i=t[r];xr(Number.isFinite(i)||Array.isArray(i),\"\".concat(r,\" is required for transition\"))})}};var zat=[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\"],Nat=[\"longitude\",\"latitude\",\"zoom\"],ng=class extends Cb{constructor(t={}){let r=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:zat,required:Nat},super(i.transitionProps),G(this,\"opts\",void 0),this.opts=i}initializeProps(t,r){let i=super.initializeProps(t,r),{makeViewport:n,around:s}=this.opts;if(n&&s){let o=n(t),c=n(r),d=o.unproject(s);i.start.around=s,Object.assign(i.end,{around:c.project(d),aroundPosition:d,width:r.width,height:r.height})}return i}interpolateProps(t,r,i){let n={};for(let s of this._propsToExtract)n[s]=Xl(t[s]||0,r[s]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let s=this.opts.makeViewport({...r,...n});Object.assign(n,s.panByPosition(r.aroundPosition,Xl(t.around,r.around,i)))}return n}};var em={transitionDuration:0},Uat=300,UE=e=>1-(1-e)*(1-e),zy={WHEEL:[\"wheel\"],PAN:[\"panstart\",\"panmove\",\"panend\"],PINCH:[\"pinchstart\",\"pinchmove\",\"pinchend\"],TRIPLE_PAN:[\"tripanstart\",\"tripanmove\",\"tripanend\"],DOUBLE_TAP:[\"doubletap\"],KEYBOARD:[\"keydown\"]},sg={},Lb=class{constructor(t){G(this,\"props\",void 0),G(this,\"state\",{}),G(this,\"transitionManager\",void 0),G(this,\"eventManager\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"makeViewport\",void 0),G(this,\"_controllerState\",void 0),G(this,\"_events\",{}),G(this,\"_interactionState\",{isDragging:!1}),G(this,\"_customEvents\",[]),G(this,\"_eventStartBlocked\",null),G(this,\"_panMove\",!1),G(this,\"invertPan\",!1),G(this,\"dragMode\",\"rotate\"),G(this,\"inertia\",0),G(this,\"scrollZoom\",!0),G(this,\"dragPan\",!0),G(this,\"dragRotate\",!0),G(this,\"doubleClickZoom\",!0),G(this,\"touchZoom\",!0),G(this,\"touchRotate\",!1),G(this,\"keyboard\",!0),this.transitionManager=new Ib({...t,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let r in this._events)if(this._events[r]){var t;(t=this.eventManager)===null||t===void 0||t.off(r,this.handleEvent)}this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case\"panstart\":return r?!1:this._onPanStart(t);case\"panmove\":return this._onPan(t);case\"panend\":return this._onPanEnd(t);case\"pinchstart\":return r?!1:this._onPinchStart(t);case\"pinchmove\":return this._onPinch(t);case\"pinchend\":return this._onPinchEnd(t);case\"tripanstart\":return r?!1:this._onTriplePanStart(t);case\"tripanmove\":return this._onTriplePan(t);case\"tripanend\":return this._onTriplePanEnd(t);case\"doubletap\":return this._onDoubleTap(t);case\"wheel\":return this._onWheel(t);case\"keydown\":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:i}=this.props,{offsetCenter:n}=t;return[n.x-r,n.y-i]}isPointInBounds(t,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let s=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=n;return s&&r&&r.stopPropagation(),s}isFunctionKeyPressed(t){let{srcEvent:r}=t;return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,\"transitionInterpolator\"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:r}=t;this.inertia=Number.isFinite(r)?r:r===!0?Uat:0;let{scrollZoom:i=!0,dragPan:n=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:c=!0,touchRotate:d=!1,keyboard:_=!0}=t,w=!!this.onViewStateChange;this.toggleEvents(zy.WHEEL,w&&i),this.toggleEvents(zy.PAN,w),this.toggleEvents(zy.PINCH,w&&(c||d)),this.toggleEvents(zy.TRIPLE_PAN,w&&d),this.toggleEvents(zy.DOUBLE_TAP,w&&o),this.toggleEvents(zy.KEYBOARD,w&&_),this.scrollZoom=i,this.dragPan=n,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=c,this.touchRotate=d,this.keyboard=_}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(t,r=null,i={}){let n={...t.getViewportProps(),...r},s=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),s){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:o})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode===\"pan\")&&(i=!i);let n=this.controllerState[i?\"panStart\":\"rotateStart\"]({pos:r});return this._panMove=i,this.updateViewport(n,em,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),i=this.controllerState.pan({pos:r});return this.updateViewport(i,em,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let i=this.getCenter(t),n=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],s=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:UE},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let i=this.getCenter(t),n=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],s=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:UE},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:s}=t,o=2/(1+Math.exp(-Math.abs(s*i)));s<0&&o!==0&&(o=1/o);let c=this.controllerState.zoom({pos:r,scale:o});return this.updateViewport(c,{...this._getTransitionProps({around:r}),transitionDuration:n?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,em,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(t);r[0]-=t.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&t.velocityY){let i=this.getCenter(t),n=[i[0],i[1]+=t.velocityY*r/2],s=this.controllerState.rotate({pos:n});this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:UE},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return sg._startPinchRotation=t.rotation,sg._lastPinchEvent=t,this.updateViewport(i,em,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=t,n=this.getCenter(t);r=r.zoom({pos:n,scale:i})}if(this.touchRotate){let{rotation:i}=t;r=r.rotate({deltaAngleX:sg._startPinchRotation-i})}return this.updateViewport(r,em,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),sg._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=sg;if(this.touchZoom&&r&&i&&t.scale!==i.scale){let n=this.getCenter(t),s=this.controllerState.rotateEnd(),o=Math.log2(t.scale),c=(o-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),d=Math.pow(2,o+c*r/2);s=s.zoom({pos:n,scale:d}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:n}),transitionDuration:r,transitionEasing:UE},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let n=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return sg._startPinchRotation=null,sg._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t),n=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(n,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(t),{zoomSpeed:i,moveSpeed:n,rotateSpeedX:s,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:c}=this,d,_={};switch(t.srcEvent.code){case\"Minus\":d=r?c.zoomOut(i).zoomOut(i):c.zoomOut(i),_.isZooming=!0;break;case\"Equal\":d=r?c.zoomIn(i).zoomIn(i):c.zoomIn(i),_.isZooming=!0;break;case\"ArrowLeft\":r?(d=c.rotateLeft(s),_.isRotating=!0):(d=c.moveLeft(n),_.isPanning=!0);break;case\"ArrowRight\":r?(d=c.rotateRight(s),_.isRotating=!0):(d=c.moveRight(n),_.isPanning=!0);break;case\"ArrowUp\":r?(d=c.rotateUp(o),_.isRotating=!0):(d=c.moveUp(n),_.isPanning=!0);break;case\"ArrowDown\":r?(d=c.rotateDown(o),_.isRotating=!0):(d=c.moveDown(n),_.isPanning=!0);break;default:return!1}return this.updateViewport(d,this._getTransitionProps(),_),!0}_getTransitionProps(t){let{transition:r}=this;return!r||!r.transitionInterpolator?em:t?{...r,transitionInterpolator:new ng({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var kb=class{constructor(t,r){G(this,\"_viewportProps\",void 0),G(this,\"_state\",void 0),this._viewportProps=this.applyConstraints(t),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var G7=5,Vat=1.2,rD=class extends kb{constructor(t){let{width:r,height:i,latitude:n,longitude:s,zoom:o,bearing:c=0,pitch:d=0,altitude:_=1.5,position:w=[0,0,0],maxZoom:I=20,minZoom:R=0,maxPitch:N=60,minPitch:j=0,startPanLngLat:Y,startZoomLngLat:it,startRotatePos:Z,startBearing:K,startPitch:J,startZoom:ht,normalize:Tt=!0}=t;xr(Number.isFinite(s)),xr(Number.isFinite(n)),xr(Number.isFinite(o)),super({width:r,height:i,latitude:n,longitude:s,zoom:o,bearing:c,pitch:d,altitude:_,maxZoom:I,minZoom:R,maxPitch:N,minPitch:j,normalize:Tt,position:w},{startPanLngLat:Y,startZoomLngLat:it,startRotatePos:Z,startBearing:K,startPitch:J,startZoom:ht}),G(this,\"makeViewport\",void 0),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let s=this.makeViewport(this.getViewportProps()).panByPosition(i,t);return this._getUpdatedState(s)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:s,startPitch:o}=this.getState();if(!n||s===void 0||o===void 0)return this;let c;return t?c=this._getNewRotation(t,n,o,s):c={bearing:s+r,pitch:o+i},this._getUpdatedState(c)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:r,scale:i}){let{startZoom:n,startZoomLngLat:s}=this.getState();if(s||(n=this.getViewportProps().zoom,s=this._unproject(r)||this._unproject(t)),!s)return this;let{maxZoom:o,minZoom:c}=this.getViewportProps(),d=n+Math.log2(i);d=Ml(d,c,o);let _=this.makeViewport({...this.getViewportProps(),zoom:d});return this._getUpdatedState({zoom:d,..._.panByPosition(s,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:s}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),Math.abs(s-r.longitude)>180&&(i.longitude=s<0?s+360:s-360),i}applyConstraints(t){let{maxZoom:r,minZoom:i,zoom:n}=t;t.zoom=Ml(n,i,r);let{maxPitch:s,minPitch:o,pitch:c}=t;t.pitch=Ml(c,o,s);let{normalize:d=!0}=t;return d&&Object.assign(t,FE(t)),t}_zoomFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:t})}_panFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+t[0],i/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_getNewRotation(t,r,i,n){let s=t[0]-r[0],o=t[1]-r[1],c=t[1],d=r[1],{width:_,height:w}=this.getViewportProps(),I=s/_,R=0;o>0?Math.abs(w-d)>G7&&(R=o/(d-w)*Vat):o<0&&d>G7&&(R=1-c/d),R=Ml(R,-1,1);let{minPitch:N,maxPitch:j}=this.getViewportProps(),Y=n+180*I,it=i;return R>0?it=i+R*(j-i):R<0&&(it=i-R*(N-i)),{pitch:it,bearing:Y}}},Rb=class extends Lb{constructor(...t){super(...t),G(this,\"ControllerState\",rD),G(this,\"transition\",{transitionDuration:300,transitionInterpolator:new ng({transitionProps:{compare:[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],required:[\"longitude\",\"latitude\",\"zoom\"]}})}),G(this,\"dragMode\",\"pan\")}setProps(t){t.position=t.position||[0,0,0];let r=this.props;super.setProps(t),(!r||r.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var Ny=class extends Xc{get ViewportType(){return ec}get ControllerType(){return Rb}};G(Ny,\"displayName\",\"MapView\");var jat=new Dy;function Gat(e,t){var r,i;let n=(r=e.order)!==null&&r!==void 0?r:1/0,s=(i=t.order)!==null&&i!==void 0?i:1/0;return n-s}var Db=class{constructor(){G(this,\"effects\",void 0),G(this,\"_resolvedEffects\",[]),G(this,\"_defaultEffects\",[]),G(this,\"_needsRedraw\",void 0),this.effects=[],this._needsRedraw=\"Initial render\",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(i=>i.id===t.id)){let i=r.findIndex(n=>Gat(n,t)>0);i<0?r.push(t):r.splice(i,0,t),this._setEffects(this.effects)}}setProps(t){\"effects\"in t&&(fo(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let n of this.effects)r[n.id]=n;let i=[];for(let n of t){let s=r[n.id];s&&s!==n?s.setProps?(s.setProps(n.props),i.push(s)):(s.cleanup(),i.push(n)):i.push(n),delete r[n.id]}for(let n in r)r[n].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(n=>n instanceof Dy)||this._resolvedEffects.push(jat),this._needsRedraw=\"effects changed\"}finalize(){for(let t of this._resolvedEffects)t.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Ob=class extends Jl{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes(\"draw\")||r.includes(\"terrain\")}};var Wat=\"deckRenderer.renderLayers\",Bb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"layerFilter\",void 0),G(this,\"drawPickingColors\",void 0),G(this,\"drawLayersPass\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"renderCount\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"renderBuffers\",void 0),G(this,\"lastPostProcessEffect\",void 0),this.gl=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Ob(t),this.pickLayersPass=new ig(t),this.renderCount=0,this._needsRedraw=\"Initial render\",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw=\"layerFilter changed\"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw=\"drawPickingColors changed\")}renderLayers(t){if(!t.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t,target:t.target||pi.getDefaultFramebuffer(this.gl)};i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target,s=r.render({...i,target:n});i.effects&&this._postRender(i.effects,i),this.renderCount++,Ds(Wat,this,s,t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_preRender(t,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of t)r.preRenderStats[i.id]=i.preRender(this.gl,r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this;t.length===0&&t.push(new pi(this.gl),new pi(this.gl));for(let r of t)r.resize()}_postRender(t,r){let{renderBuffers:i}=this,n={...r,inputBuffer:i[0],swapBuffer:i[1],target:null};for(let s of t)if(s.postRender){if(s.id===this.lastPostProcessEffect){n.target=r.target,s.postRender(this.gl,n);break}let o=s.postRender(this.gl,n);n.inputBuffer=o,n.swapBuffer=o===i[0]?i[1]:i[0]}}};var Hat={pickedColor:null,pickedObjectIndex:-1};function W7({pickedColors:e,decodePickingColor:t,deviceX:r,deviceY:i,deviceRadius:n,deviceRect:s}){let{x:o,y:c,width:d,height:_}=s,w=n*n,I=-1,R=0;for(let N=0;N<_;N++){let j=N+c-i,Y=j*j;if(Y>w)R+=4*d;else for(let it=0;it=0){let K=it+o-r,J=K*K+Y;J<=w&&(w=J,I=R)}R+=4}}if(I>=0){let N=e.slice(I,I+4),j=t(N);if(j){let Y=Math.floor(I/4/d),it=I/4-Y*d;return{...j,pickedColor:N,pickedX:o+it,pickedY:c+Y}}rr.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}return Hat}function H7({pickedColors:e,decodePickingColor:t}){let r=new Map;if(e){for(let i=0;i=0){let s=e.slice(i,i+4),o=s.join(\",\");if(!r.has(o)){let c=t(s);c?r.set(o,{...c,color:s}):rr.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}}}return Array.from(r.values())}function iD({pickInfo:e,viewports:t,pixelRatio:r,x:i,y:n,z:s}){let o=t[0];t.length>1&&(o=qat(e?.pickedViewports||t,{x:i,y:n}));let c;if(o){let d=[i-o.x,n-o.y];s!==void 0&&(d[2]=s),c=o.unproject(d)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:i,y:n,pixel:[i,n],coordinate:c,devicePixel:e&&\"pickedX\"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:r}}function q7(e){let{pickInfo:t,lastPickedInfo:r,mode:i,layers:n}=e,{pickedColor:s,pickedLayer:o,pickedObjectIndex:c}=t,d=o?[o]:[];if(i===\"hover\"){let I=r.index,R=r.layerId,N=o?o.props.id:null;if(N!==R||c!==I){if(N!==R){let j=n.find(Y=>Y.props.id===R);j&&d.unshift(j)}r.layerId=N,r.index=c,r.info=null}}let _=iD(e),w=new Map;return w.set(null,_),d.forEach(I=>{let R={..._};I===o&&(R.color=s,R.index=c,R.picked=!0),R=nD({layer:I,info:R,mode:i});let N=R.layer;I===o&&i===\"hover\"&&(r.info=R),w.set(N.id,R),i===\"hover\"&&N.updateAutoHighlight(R)}),w}function nD({layer:e,info:t,mode:r}){for(;e&&t;){let i=t.layer||null;t.sourceLayer=i,t.layer=e,t=e.getPickingInfo({info:t,mode:r,sourceLayer:i}),e=e.parent}return t}function qat(e,t){for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.containsPixel(t))return i}return e[0]}var Fb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"pickingFBO\",void 0),G(this,\"depthFBO\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"layerFilter\",void 0),G(this,\"lastPickedInfo\",void 0),G(this,\"_pickable\",!0),this.gl=t,this.pickLayersPass=new ig(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){\"layerFilter\"in t&&(this.layerFilter=t.layerFilter),\"_pickable\"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:i,viewports:n},s=this.lastPickedInfo.info){let o=s&&s.layer&&s.layer.id,c=s&&s.viewport&&s.viewport.id,d=o?i.find(R=>R.id===o):null,_=c&&n.find(R=>R.id===c)||n[0],w=_&&_.unproject([t-_.x,r-_.y]);return{...s,...{x:t,y:r,viewport:_,coordinate:w,layer:d}}}_resizeBuffer(){var t,r;let{gl:i}=this;if(!this.pickingFBO&&(this.pickingFBO=new pi(i),pi.isSupported(i,{colorBufferFloat:!0}))){let n=new pi(i);n.attach({36064:new ui(i,{format:fr(i)?34836:6408,type:5126})}),this.depthFBO=n}(t=this.pickingFBO)===null||t===void 0||t.resize({width:i.canvas.width,height:i.canvas.height}),(r=this.depthFBO)===null||r===void 0||r.resize({width:i.canvas.width,height:i.canvas.height})}_getPickable(t){if(this._pickable===!1)return null;let r=t.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:t,views:r,viewports:i,x:n,y:s,radius:o=0,depth:c=1,mode:d=\"query\",unproject3D:_,onViewportActive:w,effects:I}){let R=this._getPickable(t),N=Sl(this.gl);if(!R)return{result:[],emptyInfo:iD({viewports:i,x:n,y:s,pixelRatio:N})};this._resizeBuffer();let j=uy(this.gl,[n,s],!0),Y=[j.x+Math.floor(j.width/2),j.y+Math.floor(j.height/2)],it=Math.round(o*N),{width:Z,height:K}=this.pickingFBO,J=this._getPickingRect({deviceX:Y[0],deviceY:Y[1],deviceRadius:it,deviceWidth:Z,deviceHeight:K}),ht={x:n-o,y:s-o,width:o*2+1,height:o*2+1},Tt,Ot=[],Yt=new Set;for(let te=0;te=_)break;let ke=Ot[ae],or={color:ke.pickedColor,layer:null,index:ke.pickedObjectIndex,picked:!0,x:n,y:s,pixelRatio:N};or=nD({layer:ke.pickedLayer,info:or,mode:d});let cr=(oe=or.object)!==null&&oe!==void 0?oe:\"\".concat(or.layer.id,\"[\").concat(or.index,\"]\");Yt.has(cr)||Yt.set(cr,or)}return Array.from(Yt.values())}_drawAndSample({layers:t,views:r,viewports:i,onViewportActive:n,deviceRect:s,cullRect:o,effects:c,pass:d},_=!1){let w=_?this.depthFBO:this.pickingFBO,I={layers:t,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:w,deviceRect:s,cullRect:o,effects:c,pass:d,pickZ:_,preRenderStats:{}};for(let K of c)K.useInPicking&&(I.preRenderStats[K.id]=K.preRender(this.gl,I));let{decodePickingColor:R}=this.pickLayersPass.render(I),{x:N,y:j,width:Y,height:it}=s,Z=new(_?Float32Array:Uint8Array)(Y*it*4);return Ch(w,{sourceX:N,sourceY:j,sourceWidth:Y,sourceHeight:it,target:Z}),{pickedColors:Z,decodePickingColor:R}}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:s}){let o=Math.max(0,t-i),c=Math.max(0,r-i),d=Math.min(n,t+i+1)-o,_=Math.min(s,r+i+1)-c;return d<=0||_<=0?null:{x:o,y:c,width:d,height:_}}};var Zat={zIndex:\"1\",position:\"absolute\",pointerEvents:\"none\",color:\"#a0a7b4\",backgroundColor:\"#29323c\",padding:\"10px\",top:\"0\",left:\"0\",display:\"none\"},zb=class{constructor(t){G(this,\"el\",null),G(this,\"isVisible\",!1);let r=t.parentElement;r&&(this.el=document.createElement(\"div\"),this.el.className=\"deck-tooltip\",Object.assign(this.el.style,Zat),r.appendChild(this.el))}setTooltip(t,r,i){let n=this.el;if(n){if(typeof t==\"string\")n.innerText=t;else if(t)t.text&&(n.innerText=t.text),t.html&&(n.innerHTML=t.html),t.className&&(n.className=t.className);else{this.isVisible=!1,n.style.display=\"none\";return}this.isVisible=!0,n.style.display=\"block\",n.style.transform=\"translate(\".concat(r,\"px, \").concat(i,\"px)\"),t&&typeof t==\"object\"&&\"style\"in t&&Object.assign(n.style,t.style)}}remove(){this.el&&(this.el.remove(),this.el=null)}};var og=bi(Z7());var Yat={mousedown:1,mousemove:2,mouseup:4};function $at(e,t){for(let r=0;r0&&i.type===\"pointerdown\"&&($at(n,s=>s.pointerId===i.pointerId)||n.push(i)),t.call(this,i)}}function $7(e){e.prototype.handler=function(r){let i=Yat[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:\"mouse\",srcEvent:r}))}}Y7(og.PointerEventInput);$7(og.MouseInput);var Q7=og.Manager,Vh=og;var jh=class{constructor(t,r,i){this.element=t,this.callback=r,this.options={enable:!0,...i}}};var X7=Vh?[[Vh.Pan,{event:\"tripan\",pointers:3,threshold:0,enable:!1}],[Vh.Rotate,{enable:!1}],[Vh.Pinch,{enable:!1}],[Vh.Swipe,{enable:!1}],[Vh.Pan,{threshold:0,enable:!1}],[Vh.Press,{enable:!1}],[Vh.Tap,{event:\"doubletap\",taps:2,enable:!1}],[Vh.Tap,{event:\"anytap\",enable:!1}],[Vh.Tap,{enable:!1}]]:null,sD={tripan:[\"rotate\",\"pinch\",\"pan\"],rotate:[\"pinch\"],pinch:[\"pan\"],pan:[\"press\",\"doubletap\",\"anytap\",\"tap\"],doubletap:[\"anytap\"],anytap:[\"tap\"]},K7={doubletap:[\"tap\"]},J7={pointerdown:\"pointerdown\",pointermove:\"pointermove\",pointerup:\"pointerup\",touchstart:\"pointerdown\",touchmove:\"pointermove\",touchend:\"pointerup\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\"},Uy={KEY_EVENTS:[\"keydown\",\"keyup\"],MOUSE_EVENTS:[\"mousedown\",\"mousemove\",\"mouseup\",\"mouseover\",\"mouseout\",\"mouseleave\"],WHEEL_EVENTS:[\"wheel\",\"mousewheel\"]},tG={tap:\"tap\",anytap:\"anytap\",doubletap:\"doubletap\",press:\"press\",pinch:\"pinch\",pinchin:\"pinch\",pinchout:\"pinch\",pinchstart:\"pinch\",pinchmove:\"pinch\",pinchend:\"pinch\",pinchcancel:\"pinch\",rotate:\"rotate\",rotatestart:\"rotate\",rotatemove:\"rotate\",rotateend:\"rotate\",rotatecancel:\"rotate\",tripan:\"tripan\",tripanstart:\"tripan\",tripanmove:\"tripan\",tripanup:\"tripan\",tripandown:\"tripan\",tripanleft:\"tripan\",tripanright:\"tripan\",tripanend:\"tripan\",tripancancel:\"tripan\",pan:\"pan\",panstart:\"pan\",panmove:\"pan\",panup:\"pan\",pandown:\"pan\",panleft:\"pan\",panright:\"pan\",panend:\"pan\",pancancel:\"pan\",swipe:\"swipe\",swipeleft:\"swipe\",swiperight:\"swipe\",swipeup:\"swipe\",swipedown:\"swipe\"},oD={click:\"tap\",anyclick:\"anytap\",dblclick:\"doubletap\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\",mouseover:\"pointerover\",mouseout:\"pointerout\",mouseleave:\"pointerleave\"};var eG=typeof navigator<\"u\"&&navigator.userAgent?navigator.userAgent.toLowerCase():\"\",ag=typeof window<\"u\"?window:global;var jE=!1;try{let e={get passive(){return jE=!0,!0}};ag.addEventListener(\"test\",null,e),ag.removeEventListener(\"test\",null)}catch{jE=!1}var Qat=eG.indexOf(\"firefox\")!==-1,{WHEEL_EVENTS:Xat}=Uy,rG=\"wheel\",iG=4.000244140625,Kat=40,Jat=.25,Nb=class extends jh{constructor(t,r,i){super(t,r,i),this.handleEvent=n=>{if(!this.options.enable)return;let s=n.deltaY;ag.WheelEvent&&(Qat&&n.deltaMode===ag.WheelEvent.DOM_DELTA_PIXEL&&(s/=ag.devicePixelRatio),n.deltaMode===ag.WheelEvent.DOM_DELTA_LINE&&(s*=Kat)),s!==0&&s%iG===0&&(s=Math.floor(s/iG)),n.shiftKey&&s&&(s=s*Jat),this.callback({type:rG,center:{x:n.clientX,y:n.clientY},delta:-s,srcEvent:n,pointerType:\"mouse\",target:n.target})},this.events=(this.options.events||[]).concat(Xat),this.events.forEach(n=>t.addEventListener(n,this.handleEvent,jE?{passive:!1}:!1))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===rG&&(this.options.enable=r)}};var{MOUSE_EVENTS:tlt}=Uy,nG=\"pointermove\",sG=\"pointerover\",oG=\"pointerout\",aG=\"pointerenter\",lG=\"pointerleave\",Ub=class extends jh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{this.handleOverEvent(s),this.handleOutEvent(s),this.handleEnterEvent(s),this.handleLeaveEvent(s),this.handleMoveEvent(s)},this.pressed=!1;let{enable:n}=this.options;this.enableMoveEvent=n,this.enableLeaveEvent=n,this.enableEnterEvent=n,this.enableOutEvent=n,this.enableOverEvent=n,this.events=(this.options.events||[]).concat(tlt),this.events.forEach(s=>t.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===nG&&(this.enableMoveEvent=r),t===sG&&(this.enableOverEvent=r),t===oG&&(this.enableOutEvent=r),t===aG&&(this.enableEnterEvent=r),t===lG&&(this.enableLeaveEvent=r)}handleOverEvent(t){this.enableOverEvent&&t.type===\"mouseover\"&&this._emit(sG,t)}handleOutEvent(t){this.enableOutEvent&&t.type===\"mouseout\"&&this._emit(oG,t)}handleEnterEvent(t){this.enableEnterEvent&&t.type===\"mouseenter\"&&this._emit(aG,t)}handleLeaveEvent(t){this.enableLeaveEvent&&t.type===\"mouseleave\"&&this._emit(lG,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case\"mousedown\":t.button>=0&&(this.pressed=!0);break;case\"mousemove\":t.which===0&&(this.pressed=!1),this.pressed||this._emit(nG,t);break;case\"mouseup\":this.pressed=!1;break;default:}}_emit(t,r){this.callback({type:t,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:\"mouse\",target:r.target})}};var{KEY_EVENTS:elt}=Uy,cG=\"keydown\",uG=\"keyup\",Vb=class extends jh{constructor(t,r,i){super(t,r,i),this.handleEvent=n=>{let s=n.target||n.srcElement;s.tagName===\"INPUT\"&&s.type===\"text\"||s.tagName===\"TEXTAREA\"||(this.enableDownEvent&&n.type===\"keydown\"&&this.callback({type:cG,srcEvent:n,key:n.key,target:n.target}),this.enableUpEvent&&n.type===\"keyup\"&&this.callback({type:uG,srcEvent:n,key:n.key,target:n.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(elt),t.tabIndex=this.options.tabIndex||0,t.style.outline=\"none\",this.events.forEach(n=>t.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===cG&&(this.enableDownEvent=r),t===uG&&(this.enableUpEvent=r)}};var hG=\"contextmenu\",jb=class extends jh{constructor(t,r,i){super(t,r,i),this.handleEvent=n=>{this.options.enable&&this.callback({type:hG,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:\"mouse\",target:n.target})},t.addEventListener(\"contextmenu\",this.handleEvent)}destroy(){this.element.removeEventListener(\"contextmenu\",this.handleEvent)}enableEventType(t,r){t===hG&&(this.options.enable=r)}};var rlt={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},ilt=1,nlt=2,slt=3,olt=0,alt=1,llt=2,clt=1,ult=2,hlt=4;function fG(e){let t=rlt[e.srcEvent.type];if(!t)return null;let{buttons:r,button:i,which:n}=e.srcEvent,s=!1,o=!1,c=!1;return t===4||t===2&&!Number.isFinite(r)?(s=n===ilt,o=n===nlt,c=n===slt):t===2?(s=!!(r&clt),o=!!(r&hlt),c=!!(r&ult)):t===1&&(s=i===olt,o=i===alt,c=i===llt),{leftButton:s,middleButton:o,rightButton:c}}function dG(e,t){let r=e.center;if(!r)return null;let i=t.getBoundingClientRect(),n=i.width/t.offsetWidth||1,s=i.height/t.offsetHeight||1,o={x:(r.x-i.left-t.clientLeft)/n,y:(r.y-i.top-t.clientTop)/s};return{center:r,offsetCenter:o}}var aD={srcElement:\"root\",priority:0},Gb=class{constructor(t){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),n=r.srcEvent.target;for(;n&&n!==i.rootElement;){if(this._emit(i,n),i.handled)return;n=n.parentNode}this._emit(i,\"root\")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,r,i,n=!1,s=!1){let{handlers:o,handlersByElement:c}=this,d=aD;typeof i==\"string\"||i&&i.addEventListener?d={...aD,srcElement:i}:i&&(d={...aD,...i});let _=c.get(d.srcElement);_||(_=[],c.set(d.srcElement,_));let w={type:t,handler:r,srcElement:d.srcElement,priority:d.priority};n&&(w.once=!0),s&&(w.passive=!0),o.push(w),this._active=this._active||!w.passive;let I=_.length-1;for(;I>=0&&!(_[I].priority>=w.priority);)I--;_.splice(I+1,0,w)}remove(t,r){let{handlers:i,handlersByElement:n}=this;for(let s=i.length-1;s>=0;s--){let o=i[s];if(o.type===t&&o.handler===r){i.splice(s,1);let c=n.get(o.srcElement);c.splice(c.indexOf(o),1),c.length===0&&n.delete(o.srcElement)}}this._active=i.some(s=>!s.passive)}_emit(t,r){let i=this.handlersByElement.get(r);if(i){let n=!1,s=()=>{t.handled=!0},o=()=>{t.handled=!0,n=!0},c=[];for(let d=0;d{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var flt={events:null,recognizers:null,recognizerOptions:{},Manager:Q7,touchAction:\"none\",tabIndex:0},Vy=class{constructor(t=null,r){this._onBasicInput=n=>{let{srcEvent:s}=n,o=J7[s.type];o&&this.manager.emit(o,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={...flt,...r},this.events=new Map,this.setElement(t);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;let{options:r}=this,i=r.Manager;this.manager=new i(t,{touchAction:r.touchAction,recognizers:r.recognizers||X7}).on(\"hammer.input\",this._onBasicInput),r.recognizers||Object.keys(sD).forEach(n=>{let s=this.manager.get(n);s&&sD[n].forEach(o=>{s.recognizeWith(o)})});for(let n in r.recognizerOptions){let s=this.manager.get(n);if(s){let o=r.recognizerOptions[n];delete o.enable,s.set(o)}}this.wheelInput=new Nb(t,this._onOtherEvent,{enable:!1}),this.moveInput=new Ub(t,this._onOtherEvent,{enable:!1}),this.keyInput=new Vb(t,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new jb(t,this._onOtherEvent,{enable:!1});for(let[n,s]of this.events)s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(n,s.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,r,i){this._addEventHandler(t,r,i,!1)}once(t,r,i){this._addEventHandler(t,r,i,!0)}watch(t,r,i){this._addEventHandler(t,r,i,!1,!0)}off(t,r){this._removeEventHandler(t,r)}_toggleRecognizer(t,r){let{manager:i}=this;if(!i)return;let n=i.get(t);if(n&&n.options.enable!==r){n.set({enable:r});let s=K7[t];s&&!this.options.recognizers&&s.forEach(o=>{let c=i.get(o);r?(c.requireFailure(t),n.dropRequireFailure(o)):c.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,r),this.moveInput.enableEventType(t,r),this.keyInput.enableEventType(t,r),this.contextmenuInput.enableEventType(t,r)}_addEventHandler(t,r,i,n,s){if(typeof t!=\"string\"){i=r;for(let w in t)this._addEventHandler(w,t[w],i,n,s);return}let{manager:o,events:c}=this,d=oD[t]||t,_=c.get(d);_||(_=new Gb(this),c.set(d,_),_.recognizerName=tG[d]||d,o&&o.on(d,_.handleEvent)),_.add(t,r,i,n,s),_.isEmpty()||this._toggleRecognizer(_.recognizerName,!0)}_removeEventHandler(t,r){if(typeof t!=\"string\"){for(let o in t)this._removeEventHandler(o,t[o]);return}let{events:i}=this,n=oD[t]||t,s=i.get(n);if(s&&(s.remove(t,r),s.isEmpty())){let{recognizerName:o}=s,c=!1;for(let d of i.values())if(d.recognizerName===o&&!d.isEmpty()){c=!0;break}c||this._toggleRecognizer(o,!1)}}};function lg(){}var dlt=({isDragging:e})=>e?\"grabbing\":\"grab\",pG={id:\"\",width:\"100%\",height:\"100%\",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:\"none\",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:lg,onResize:lg,onViewStateChange:lg,onInteractionStateChange:lg,onBeforeRender:lg,onAfterRender:lg,onLoad:lg,onError:e=>rr.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:dlt,getTooltip:null,debug:!1,drawPickingColors:!1},ap=class{constructor(t){G(this,\"props\",void 0),G(this,\"width\",0),G(this,\"height\",0),G(this,\"userData\",{}),G(this,\"canvas\",null),G(this,\"viewManager\",null),G(this,\"layerManager\",null),G(this,\"effectManager\",null),G(this,\"deckRenderer\",null),G(this,\"deckPicker\",null),G(this,\"eventManager\",null),G(this,\"tooltip\",null),G(this,\"metrics\",void 0),G(this,\"animationLoop\",void 0),G(this,\"stats\",void 0),G(this,\"viewState\",void 0),G(this,\"cursorState\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"_pickRequest\",void 0),G(this,\"_lastPointerDownInfo\",null),G(this,\"_metricsCounter\",void 0),G(this,\"_onPointerMove\",r=>{let{_pickRequest:i}=this;if(r.type===\"pointerleave\")i.x=-1,i.y=-1,i.radius=0;else{if(r.leftButton||r.rightButton)return;{let n=r.offsetCenter;if(!n)return;i.x=n.x,i.y=n.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=r}),G(this,\"_onEvent\",r=>{let i=F4[r.type],n=r.offsetCenter;if(!i||!n||!this.layerManager)return;let s=this.layerManager.getLayers(),o=this.deckPicker.getLastPickedObject({x:n.x,y:n.y,layers:s,viewports:this.getViewports(n)},this._lastPointerDownInfo),{layer:c}=o,d=c&&(c[i.handler]||c.props[i.handler]),_=this.props[i.handler],w=!1;d&&(w=d.call(c,o,r)),!w&&_&&_(o,r)}),G(this,\"_onPointerDown\",r=>{let i=r.offsetCenter,n=this._pick(\"pickObject\",\"pickObject Time\",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=n.result[0]||n.emptyInfo}),this.props={...pG,...t},t=this.props,this._needsRedraw=\"Initial render\",this._pickRequest={mode:\"hover\",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},t.viewState&&t.initialViewState&&rr.warn(\"View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.\")(),oy()===\"IE\"&&rr.warn(\"IE 11 is not supported\")(),this.viewState=t.initialViewState,t.gl||typeof document<\"u\"&&(this.canvas=this._createCanvas(t)),this.animationLoop=this._createAnimationLoop(t),this.stats=new Qf({id:\"deck.gl\"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(t),t._typedArrayManagerProps&&Nh.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){var t,r,i,n,s,o,c,d;if((t=this.animationLoop)===null||t===void 0||t.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,(r=this.layerManager)===null||r===void 0||r.finalize(),this.layerManager=null,(i=this.viewManager)===null||i===void 0||i.finalize(),this.viewManager=null,(n=this.effectManager)===null||n===void 0||n.finalize(),this.effectManager=null,(s=this.deckRenderer)===null||s===void 0||s.finalize(),this.deckRenderer=null,(o=this.deckPicker)===null||o===void 0||o.finalize(),this.deckPicker=null,(c=this.eventManager)===null||c===void 0||c.destroy(),this.eventManager=null,(d=this.tooltip)===null||d===void 0||d.remove(),this.tooltip=null,!this.props.canvas&&!this.props.gl&&this.canvas){var _;(_=this.canvas.parentElement)===null||_===void 0||_.removeChild(this.canvas),this.canvas=null}}setProps(t){this.stats.get(\"setProps Time\").timeStart(),\"onLayerHover\"in t&&rr.removed(\"onLayerHover\",\"onHover\")(),\"onLayerClick\"in t&&rr.removed(\"onLayerClick\",\"onClick\")(),t.initialViewState&&!fo(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r)),this.stats.get(\"setProps Time\").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return\"Deck._animate\";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(t),n=this.layerManager.needsRedraw(t),s=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r=r||i||n||s||o,r}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=t||r,r&&(this.stats.get(\"Redraw Count\").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return xr(this.viewManager),this.viewManager.views}getViewports(t){return xr(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let r=this._pick(\"pickObject\",\"pickObject Time\",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick(\"pickObject\",\"pickMultipleObjects Time\",t).result}pickObjects(t){return this._pick(\"pickObjects\",\"pickObjects Time\",t)}_addResources(t,r=!1){for(let i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],forceUpdate:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_pick(t,r,i){xr(this.deckPicker);let{stats:n}=this;n.get(\"Pick Count\").incrementCount(),n.get(r).timeStart();let s=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return n.get(r).timeEnd(),s}_createCanvas(t){let r=t.canvas;return typeof r==\"string\"&&(r=document.getElementById(r),xr(r)),r||(r=document.createElement(\"canvas\"),r.id=t.id||\"deckgl-overlay\",(t.parent||document.body).appendChild(r)),Object.assign(r.style,t.style),r}_setCanvasSize(t){if(!this.canvas)return;let{width:r,height:i}=t;if(r||r===0){let s=Number.isFinite(r)?\"\".concat(r,\"px\"):r;this.canvas.style.width=s}if(i||i===0){var n;let s=Number.isFinite(i)?\"\".concat(i,\"px\"):i;this.canvas.style.position=((n=t.style)===null||n===void 0?void 0:n.position)||\"absolute\",this.canvas.style.height=s}}_updateCanvasSize(){var t,r;let{canvas:i}=this;if(!i)return;let n=(t=i.clientWidth)!==null&&t!==void 0?t:i.width,s=(r=i.clientHeight)!==null&&r!==void 0?r:i.height;if(n!==this.width||s!==this.height){var o,c;this.width=n,this.height=s,(o=this.viewManager)===null||o===void 0||o.setProps({width:n,height:s}),(c=this.layerManager)===null||c===void 0||c.activateViewport(this.getViewports()[0]),this.props.onResize({width:n,height:s})}}_createAnimationLoop(t){let{width:r,height:i,gl:n,glOptions:s,debug:o,onError:c,onBeforeRender:d,onAfterRender:_,useDevicePixels:w}=t;return new Q0({width:r,height:i,useDevicePixels:w,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,gl:n,onCreateContext:I=>hy({...s,...I,canvas:this.canvas,debug:o,onContextLost:()=>this._onContextLost()}),onInitialize:I=>this._setGLContext(I.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:d,onAfterRender:_,onError:c})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let t=this.props.views||[new Ny({id:\"default-view\"})];return t=Array.isArray(t)?t:[t],t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error(\"WebGL context is lost\"))}_pickAndCallback(){let{_pickRequest:t}=this;if(t.event){let{result:i,emptyInfo:n}=this._pick(\"pickObject\",\"pickObject Time\",t);this.cursorState.isHovering=i.length>0;let s=n,o=!1;for(let c of i){var r;s=c,o=((r=c.layer)===null||r===void 0?void 0:r.onHover(c,t.event))||o}if(!o&&this.props.onHover&&this.props.onHover(s,t.event),this.props.getTooltip&&this.tooltip){let c=this.props.getTooltip(s);this.tooltip.setTooltip(c,s.x,s.y)}t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(t){if(this.layerManager)return;this.canvas||(this.canvas=t.canvas,U0(t,{enable:!0,copyState:!0})),this.tooltip=new zb(this.canvas),wl(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);let r=new KA;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new Vy(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let n in F4)this.eventManager.on(n,this._onEvent);this.viewManager=new Pb({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new Eb(t,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new Db,this.deckRenderer=new Bb(t),this.deckPicker=new Fb(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,r){let{gl:i}=this.layerManager.context;wl(i,this.props.parameters),this.props.onBeforeRender({gl:i}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:\"screen\",effects:this.effectManager.getEffects(),...r}),this.props.onAfterRender({gl:i})}_onRenderFrame(t){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),rr.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get(\"frameRate\").timeEnd(),t.get(\"frameRate\").timeStart();let r=this.animationLoop.stats;t.get(\"GPU Time\").addTime(r.get(\"GPU Time\").lastTiming),t.get(\"CPU Time\").addTime(r.get(\"CPU Time\").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get(\"frameRate\").getHz(),t.setPropsTime=r.get(\"setProps Time\").time,t.updateAttributesTime=r.get(\"Update Attributes\").time,t.framesRedrawn=r.get(\"Redraw Count\").count,t.pickTime=r.get(\"pickObject Time\").time+r.get(\"pickMultipleObjects Time\").time+r.get(\"pickObjects Time\").time,t.pickCount=r.get(\"Pick Count\").count,t.gpuTime=r.get(\"GPU Time\").time,t.cpuTime=r.get(\"CPU Time\").time,t.gpuTimePerFrame=r.get(\"GPU Time\").getAverageTime(),t.cpuTimePerFrame=r.get(\"CPU Time\").getAverageTime();let i=zu.get(\"Memory Usage\");t.bufferMemory=i.get(\"Buffer Memory\").count,t.textureMemory=i.get(\"Texture Memory\").count,t.renderbufferMemory=i.get(\"Renderbuffer Memory\").count,t.gpuMemory=i.get(\"GPU Memory\").count}};G(ap,\"defaultProps\",pG);G(ap,\"VERSION\",QU);var cg=class{constructor(t,r){G(this,\"opts\",void 0),G(this,\"source\",void 0),this.opts=r,this.source=t}get value(){return this.source.value}getValue(){let t=this.source.getBuffer(),r=this.getAccessor();if(t)return[t,r];let{value:i}=this.source,{size:n}=r,s=i;if(i&&i.length!==n){s=new Float32Array(n);let o=r.elementOffset||0;for(let c=0;c=s){let o=new Array(n).fill(1/0),c=new Array(n).fill(-1/0);for(let d=0;dc[_]&&(c[_]=w)}t=[o,c]}}return this.state.bounds=t,t}setData(t){let{state:r}=this,i;ArrayBuffer.isView(t)?i={value:t}:t instanceof Ur?i={buffer:t}:i=t;let n={...this.settings,...i};if(r.bufferAccessor=n,r.bounds=null,i.constant){let s=i.value;if(s=this._normalizeValue(s,[],0),this.settings.normalized&&(s=this.normalizeConstant(s)),!(!r.constant||!this._areValuesEqual(s,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=s}else if(i.buffer){let s=i.buffer;r.externalBuffer=s,r.constant=!1,this.value=i.value||null;let o=i.value instanceof Float64Array;n.type=i.type||s.accessor.type,n.bytesPerElement=s.accessor.BYTES_PER_ELEMENT*(o?2:1),n.stride=GE(n)}else if(i.value){this._checkExternalBuffer(i);let s=i.value;r.externalBuffer=null,r.constant=!1,this.value=s,n.bytesPerElement=s.BYTES_PER_ELEMENT,n.stride=GE(n);let{buffer:o,byteOffset:c}=this;this.doublePrecision&&s instanceof Float64Array&&(s=zE(s,n));let d=s.byteLength+c+n.stride*2;o.byteLength(r+128)/255*2-1);case 5122:return new Float32Array(t).map(r=>(r+32768)/65535*2-1);case 5121:return new Float32Array(t).map(r=>r/255);case 5123:return new Float32Array(t).map(r=>r/65535);default:return t}}_normalizeValue(t,r,i){let{defaultValue:n,size:s}=this.settings;if(Number.isFinite(t))return r[i]=t,r;if(!t){let o=s;for(;--o>=0;)r[i+o]=n[o];return r}switch(s){case 4:r[i+3]=Number.isFinite(t[3])?t[3]:n[3];case 3:r[i+2]=Number.isFinite(t[2])?t[2]:n[2];case 2:r[i+1]=Number.isFinite(t[1])?t[1]:n[1];case 1:r[i+0]=Number.isFinite(t[0])?t[0]:n[0];break;default:let o=s;for(;--o>=0;)r[i+o]=Number.isFinite(t[o])?t[o]:n[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:i}=this;for(let n=0;n0&&(_G.length=e.length,i=_G):i=gG,(t>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(t,r),n.index=t-1),{iterable:i,objectInfo:n}}function WE(e){return e&&e[Symbol.asyncIterator]}function HE(e,t){let{size:r,stride:i,offset:n,startIndices:s,nested:o}=t,c=e.BYTES_PER_ELEMENT,d=i?i/c:r,_=n?n/c:0,w=Math.floor((e.length-_)/d);return(I,{index:R,target:N})=>{if(!s){let Z=R*d+_;for(let K=0;K=t[1]))return e;let r=[],i=e.length,n=0;for(let s=0;st[1]?r.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return r.splice(n,0,t),r}function lD(e){let{source:t,target:r,start:i=0,size:n,getData:s}=e,o=e.end||r.length,c=t.length,d=o-i;if(c>d){r.set(t.subarray(0,d),i);return}if(r.set(t,i),!s)return;let _=c;for(;_i(w+c,I)),_=Math.min(n.length,s.length);for(let w=1;w<_;w++){let I=n[w]*r,R=s[w]*r;lD({source:e.subarray(o,I),target:t,start:c,end:R,size:r,getData:d}),o=I,c=R}return ce},spring:{stiffness:.05,damping:.5}};function qE(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:\"interpolation\",duration:e});let r=e.type||\"interpolation\";return{...mlt[r],...t,...e,type:r}}function ZE(e,t){let r=t.getBuffer();return r?[r,{divisor:0,size:t.size,normalized:t.settings.normalized}]:t.value}function YE(e){switch(e){case 1:return\"float\";case 2:return\"vec2\";case 3:return\"vec3\";case 4:return\"vec4\";default:throw new Error('No defined attribute type for size \"'.concat(e,'\"'))}}function $E(e){e.push(e.shift())}function qb(e,t){let{doublePrecision:r,settings:i,value:n,size:s}=e,o=r&&n instanceof Float64Array?2:1;return(i.noAlloc?n.length:t*s)*o}function QE({buffer:e,numInstances:t,attribute:r,fromLength:i,fromStartIndices:n,getData:s=o=>o}){let o=r.doublePrecision&&r.value instanceof Float64Array?2:1,c=r.size*o,d=r.byteOffset,_=r.startIndices,w=n&&_,I=qb(r,t),R=r.isConstant;if(!w&&i>=I)return;let N=R?r.value:r.getBuffer().getData({srcByteOffset:d});if(r.settings.normalized&&!R){let Z=s;s=(K,J)=>r.normalizeConstant(Z(K,J))}let j=R?(Z,K)=>s(N,K):(Z,K)=>s(N.subarray(Z,Z+c),K),Y=e.getData({length:i}),it=new Float32Array(I);xG({source:Y,target:it,sourceStartIndices:n,targetStartIndices:_,size:c,getData:j}),e.byteLengtht[s])]:t[r];return qE(n,i)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:i=0,endRow:n=1/0}=r;this.state.updateRanges=vG(this.state.updateRanges,[i,n])}else this.state.updateRanges=Hb}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=yG}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(t,r.updateRanges!==Hb),!0):!1}updateBuffer({numInstances:t,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:s},settings:{update:o,noAlloc:c}}=this,d=!0;if(o){for(let[_,w]of s)o.call(n,this,{data:r,startRow:_,endRow:w,props:i,numInstances:t});if(this.value)if(this.constant||this.buffer.byteLengthw?_.set(J,Y):(t._normalizeValue(J,Z.target,0),tD({target:_,source:Z.target,start:Y,count:ht}));Y+=ht*w}else t._normalizeValue(J,_,Y),Y+=w}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||typeof t.update==\"function\"))throw new Error(\"Attribute \".concat(this.id,\" missing update or accessor\"))}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(t[3]);case 3:i=i&&Number.isFinite(t[2]);case 2:i=i&&Number.isFinite(t[1]);case 1:i=i&&Number.isFinite(t[0]);break;default:i=!1}if(!i)throw new Error(\"Illegal attribute generated for \".concat(this.id))}}};var Zb=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"interpolation\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new lp(t,r.settings),this.currentStartIndices=r.startIndices,this.currentLength=0,this.transform=_lt(t,r);let n={byteLength:0,usage:35050};this.buffers=[new Ur(t,n),new Ur(t,n)]}get inProgress(){return this.transition.inProgress}start(t,r){if(t.duration<=0){this.transition.cancel();return}this.settings=t;let{gl:i,buffers:n,attribute:s}=this;$E(n);let o={numInstances:r,attribute:s,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of n)QE({buffer:c,...o});this.currentStartIndices=s.startIndices,this.currentLength=qb(s,r),this.attributeInTransition.setData({buffer:n[1],value:s.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/s.size),sourceBuffers:{aFrom:n[0],aTo:ZE(i,s)},feedbackBuffers:{vCurrent:n[1]}})}update(){let t=this.transition.update();if(t){let{duration:r,easing:i}=this.settings,{time:n}=this.transition,s=n/r;i&&(s=i(s)),this.transform.run({uniforms:{time:s}})}return t}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0}},glt=`\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nattribute ATTRIBUTE_TYPE aFrom;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n`;function _lt(e,t){let r=YE(t.size);return new Kl(e,{vs:glt,defines:{ATTRIBUTE_TYPE:r},varyings:[\"vCurrent\"]})}var Yb=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"spring\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"texture\",void 0),G(this,\"framebuffer\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.type=\"spring\",this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new lp(t,{...r.settings,normalized:!1}),this.currentStartIndices=r.startIndices,this.currentLength=0,this.texture=vlt(t),this.framebuffer=xlt(t,this.texture),this.transform=ylt(t,r,this.framebuffer);let n={byteLength:0,usage:35050};this.buffers=[new Ur(t,n),new Ur(t,n),new Ur(t,n)]}get inProgress(){return this.transition.inProgress}start(t,r){let{gl:i,buffers:n,attribute:s}=this,o={numInstances:r,attribute:s,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of n)QE({buffer:c,...o});this.settings=t,this.currentStartIndices=s.startIndices,this.currentLength=qb(s,r),this.attributeInTransition.setData({buffer:n[1],value:s.value}),this.transition.start({...t,duration:1/0}),this.transform.update({elementCount:Math.floor(this.currentLength/s.size),sourceBuffers:{aTo:ZE(i,s)}})}update(){let{buffers:t,transform:r,framebuffer:i,transition:n}=this;if(!n.update())return!1;let o=this.settings;return r.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),r.run({framebuffer:i,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:o.stiffness,damping:o.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),$E(t),this.attributeInTransition.setData({buffer:t[1],value:this.attribute.value}),Ch(i)[0]>0||n.end(),!0}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0,this.texture.delete(),this.framebuffer.delete()}};function ylt(e,t,r){let i=YE(t.size);return new Kl(e,{framebuffer:r,vs:`\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nattribute ATTRIBUTE_TYPE aPrev;\nattribute ATTRIBUTE_TYPE aCur;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vNext;\nvarying float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n`,fs:`\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nvarying float vIsTransitioningFlag;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n gl_FragColor = vec4(1.0);\n}`,defines:{ATTRIBUTE_TYPE:i},varyings:[\"vNext\"]})}function vlt(e){return new ui(e,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}function xlt(e,t){return new pi(e,{id:\"spring-transition-is-transitioning-framebuffer\",width:1,height:1,attachments:{36064:t}})}var blt={interpolation:Zb,spring:Yb},$b=class{constructor(t,{id:r,timeline:i}){G(this,\"id\",void 0),G(this,\"isSupported\",void 0),G(this,\"gl\",void 0),G(this,\"timeline\",void 0),G(this,\"transitions\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"numInstances\",void 0),this.id=r,this.gl=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=Kl.isSupported(t)}finalize(){for(let t in this.transitions)this._removeTransition(t)}update({attributes:t,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in t){let s=t[n],o=s.getTransitionSetting(r);o&&this._updateAttribute(n,s,o)}for(let n in this.transitions){let s=t[n];(!s||!s.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(t){let r=this.transitions[t];return r&&r.inProgress}getAttributes(){let t={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(t[r]=i.attributeInTransition)}return t}run(){if(!this.isSupported||this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].cancel(),delete this.transitions[t]}_updateAttribute(t,r,i){let n=this.transitions[t],s=!n||n.type!==i.type;if(s){if(!this.isSupported){rr.warn(\"WebGL2 not supported by this browser. Transition for \".concat(t,\" is disabled.\"))();return}n&&this._removeTransition(t);let o=blt[i.type];o?this.transitions[t]=new o({attribute:r,timeline:this.timeline,gl:this.gl}):(rr.error(\"unsupported transition type '\".concat(i.type,\"'\"))(),s=!1)}(s||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(i,this.numInstances))}};var bG=\"attributeManager.invalidate\",wlt=\"attributeManager.updateStart\",Slt=\"attributeManager.updateEnd\",Tlt=\"attribute.updateStart\",Mlt=\"attribute.allocate\",Elt=\"attribute.updateEnd\",id=class{constructor(t,{id:r=\"attribute-manager\",stats:i,timeline:n}={}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"attributes\",void 0),G(this,\"updateTriggers\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"userData\",void 0),G(this,\"stats\",void 0),G(this,\"attributeTransitionManager\",void 0),G(this,\"mergeBoundsMemoized\",td(O7)),this.id=r,this.gl=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new $b(t,{id:\"\".concat(r,\"-transitions\"),timeline:n}),Object.seal(this)}finalize(){for(let t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(t={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{instanced:1})}remove(t){for(let r of t)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(t,r){let i=this._invalidateTrigger(t,r);Ds(bG,this,t,i)}invalidateAll(t){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,t);Ds(bG,this,\"all\")}update({data:t,numInstances:r,startIndices:i=null,transitions:n,props:s={},buffers:o={},context:c={}}){let d=!1;Ds(wlt,this),this.stats&&this.stats.get(\"Update Attributes\").timeStart();for(let _ in this.attributes){let w=this.attributes[_],I=w.settings.accessor;w.startIndices=i,w.numInstances=r,s[_]&&rr.removed(\"props.\".concat(_),\"data.attributes.\".concat(_))(),w.setExternalBuffer(o[_])||w.setBinaryValue(typeof I==\"string\"?o[I]:void 0,t.startIndices)||typeof I==\"string\"&&!o[I]&&w.setConstantValue(s[I])||w.needsUpdate()&&(d=!0,this._updateAttribute({attribute:w,numInstances:r,data:t,props:s,context:c})),this.needsRedraw=this.needsRedraw||w.needsRedraw()}d&&Ds(Slt,this,r),this.stats&&this.stats.get(\"Update Attributes\").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:t}=this,r=t.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return this.attributes}getBounds(t){let r=t.map(i=>{var n;return(n=this.attributes[i])===null||n===void 0?void 0:n.getBounds()});return this.mergeBoundsMemoized(r)}getChangedAttributes(t={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let s in r){let o=r[s];o.needsRedraw(t)&&!i.hasAttribute(s)&&(n[s]=o)}return n}getShaderAttributes(t,r={}){t||(t=this.getAttributes());let i={};for(let n in t)r[n]||Object.assign(i,t[n].getShaderAttributes());return i}_add(t,r={}){for(let i in t){let n=t[i];this.attributes[i]=this._createAttribute(i,n,r)}this._mapUpdateTriggersToAttributes()}_createAttribute(t,r,i){let n={...r,id:t,size:r.isIndexed&&1||r.size||1,divisor:i.instanced?1:r.divisor||0};return new lp(this.gl,n)}_mapUpdateTriggersToAttributes(){let t={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(n=>{t[n]||(t[n]=[]),t[n].push(r)});this.updateTriggers=t}_invalidateTrigger(t,r){let{attributes:i,updateTriggers:n}=this,s=n[t];return s&&s.forEach(o=>{let c=i[o];c&&c.setNeedsUpdate(c.id,r)}),s}_updateAttribute(t){let{attribute:r,numInstances:i}=t;if(Ds(Tlt,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ds(Mlt,r,i),r.updateBuffer(t)&&(this.needsRedraw=!0,Ds(Elt,r,i))}};var Qb=class extends Kc{get value(){return this._value}_onUpdate(){let{time:t,settings:{fromValue:r,toValue:i,duration:n,easing:s}}=this,o=s(t/n);this._value=Xl(r,i,o)}};var wG=1e-5;function SG(e,t,r,i,n){let s=t-e,c=(r-t)*n,d=-s*i;return c+d+s+t}function Plt(e,t,r,i,n){if(Array.isArray(r)){let s=[];for(let o=0;o0}add(t,r,i,n){let{transitions:s}=this;if(s.has(t)){let d=s.get(t),{value:_=d.settings.fromValue}=d;r=_,this.remove(t)}if(n=qE(n),!n)return;let o=Ilt[n.type];if(!o){rr.error(\"unsupported transition type '\".concat(n.type,\"'\"))();return}let c=new o(this.timeline);c.start({...n,fromValue:r,toValue:i}),s.set(t,c)}remove(t){let{transitions:r}=this;r.has(t)&&(r.get(t).cancel(),r.delete(t))}update(){let t={};for(let[r,i]of this.transitions)i.update(),t[r]=i.value,i.inProgress||this.remove(r);return t}clear(){for(let t of this.transitions.keys())this.remove(t)}};function EG(e){let t=e[ju];for(let r in t){let i=t[r],{validate:n}=i;if(n&&!n(e[r],i))throw new Error(\"Invalid prop \".concat(r,\": \").concat(e[r]))}}function PG(e,t){let r=Jb({newProps:e,oldProps:t,propTypes:e[ju],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=Llt(e,t),n=!1;return i||(n=klt(e,t)),{dataChanged:i,propsChanged:r,updateTriggersChanged:n,extensionsChanged:Rlt(e,t),transitionsChanged:Clt(e,t)}}function Clt(e,t){if(!e.transitions)return!1;let r={},i=e[ju],n=!1;for(let s in e.transitions){let o=i[s],c=o&&o.type;(c===\"number\"||c===\"color\"||c===\"array\")&&cD(e[s],t[s],o)&&(r[s]=!0,n=!0)}return n?r:!1}function Jb({newProps:e,oldProps:t,ignoreProps:r={},propTypes:i={},triggerName:n=\"props\"}){if(t===e)return!1;if(typeof e!=\"object\"||e===null||typeof t!=\"object\"||t===null)return\"\".concat(n,\" changed shallowly\");for(let s of Object.keys(e))if(!(s in r)){if(!(s in t))return\"\".concat(n,\".\").concat(s,\" added\");let o=cD(e[s],t[s],i[s]);if(o)return\"\".concat(n,\".\").concat(s,\" \").concat(o)}for(let s of Object.keys(t))if(!(s in r)){if(!(s in e))return\"\".concat(n,\".\").concat(s,\" dropped\");if(!Object.hasOwnProperty.call(e,s)){let o=cD(e[s],t[s],i[s]);if(o)return\"\".concat(n,\".\").concat(s,\" \").concat(o)}}return!1}function cD(e,t,r){let i=r&&r.equal;return i&&!i(e,t,r)||!i&&(i=e&&t&&e.equals,i&&!i.call(e,t))?\"changed deeply\":!i&&t!==e?\"changed shallowly\":null}function Llt(e,t){if(t===null)return\"oldProps is null, initial diff\";let r=!1,{dataComparator:i,_dataDiff:n}=e;return i?i(e.data,t.data)||(r=\"Data comparator detected a change\"):e.data!==t.data&&(r=\"A new data container was supplied\"),r&&n&&(r=n(e.data,t.data)||r),r}function klt(e,t){if(t===null)return{all:!0};if(\"all\"in e.updateTriggers&&MG(e,t,\"all\"))return{all:!0};let r={},i=!1;for(let n in e.updateTriggers)n!==\"all\"&&MG(e,t,n)&&(r[n]=!0,i=!0);return i?r:!1}function Rlt(e,t){if(t===null)return!0;let r=t.extensions,{extensions:i}=e;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let n=0;ni.name===\"project64\"))){let i=r.modules.findIndex(n=>n.name===\"project32\");i>=0&&r.modules.splice(i,1)}if(\"inject\"in t)if(!e.inject)r.inject=t.inject;else{let i={...e.inject};for(let n in t.inject)i[n]=(i[n]||\"\")+t.inject[n];r.inject=i}return r}var zlt={10241:9987,10240:9729,10242:33071,10243:33071},uD={};function LG(e,t,r,i){if(r instanceof ui)return r;r.constructor&&r.constructor.name!==\"Object\"&&(r={data:r});let n=null;r.compressed&&(n={10241:r.data.length>1?9985:9729});let s=new ui(t,{...r,parameters:{...zlt,...n,...i}});return uD[s.id]=e,s}function kG(e,t){!t||!(t instanceof ui)||uD[t.id]===e&&(t.delete(),delete uD[t.id])}var Nlt={boolean:{validate(e,t){return!0},equal(e,t,r){return!!e==!!t}},number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},color:{validate(e,t){return t.optional&&!e||hD(e)&&(e.length===3||e.length===4)},equal(e,t,r){return fo(e,t,1)}},accessor:{validate(e,t){let r=XE(e);return r===\"function\"||r===XE(t.value)},equal(e,t,r){return typeof t==\"function\"?!0:fo(e,t,1)}},array:{validate(e,t){return t.optional&&!e||hD(e)},equal(e,t,r){let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?fo(e,t,n):e===t}},object:{equal(e,t,r){if(r.ignore)return!0;let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?fo(e,t,n):e===t}},function:{validate(e,t){return t.optional&&!e||typeof e==\"function\"},equal(e,t,r){return!r.compare&&r.ignore!==!1||e===t}},data:{transform:(e,t,r)=>{let{dataTransform:i}=r.props;return i&&e?i(e):e}},image:{transform:(e,t,r)=>{let i=r.context;return!i||!i.gl?null:LG(r.id,i.gl,e,{...t.parameters,...r.props.textureParameters})},release:(e,t,r)=>{kG(r.id,e)}}};function RG(e){let t={},r={},i={};for(let[n,s]of Object.entries(e)){let o=s?.deprecatedFor;if(o)i[n]=Array.isArray(o)?o:[o];else{let c=Ult(n,s);t[n]=c,r[n]=c.value}}return{propTypes:t,defaultProps:r,deprecatedProps:i}}function Ult(e,t){switch(XE(t)){case\"object\":return tw(e,t);case\"array\":return tw(e,{type:\"array\",value:t,compare:!1});case\"boolean\":return tw(e,{type:\"boolean\",value:t});case\"number\":return tw(e,{type:\"number\",value:t});case\"function\":return tw(e,{type:\"function\",value:t,compare:!0});default:return{name:e,type:\"unknown\",value:t}}}function tw(e,t){return\"type\"in t?{name:e,...Nlt[t.type],...t}:\"value\"in t?{name:e,type:XE(t.value),...t}:{name:e,type:\"object\",value:t}}function hD(e){return Array.isArray(e)||ArrayBuffer.isView(e)}function XE(e){return hD(e)?\"array\":e===null?\"null\":typeof e}function DG(e,t){let r;for(let s=t.length-1;s>=0;s--){let o=t[s];\"extensions\"in o&&(r=o.extensions)}let i=fD(e.constructor,r),n=Object.create(i);n[Fy]=e,n[rd]={},n[Uh]={};for(let s=0;s{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let t in this.asyncProps){let r=this.asyncProps[t];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||$lt}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){let r=this.asyncProps[t];return r&&r.resolvedValue}isAsyncPropLoading(t){if(t){let r=this.asyncProps[t];return!!(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(t,r){this._watchPromise(t,Promise.resolve(r))}setAsyncProps(t){this.component=t[Fy]||this.component;let r=t[Uh]||{},i=t[rd]||t,n=t[ip]||{};for(let s in r){let o=r[s];this._createAsyncPropData(s,n[s]),this._updateAsyncProp(s,o),r[s]=this.getAsyncProp(s)}for(let s in i){let o=i[s];this._createAsyncPropData(s,n[s]),this._updateAsyncProp(s,o)}}_fetch(t,r){return null}_onResolve(t,r){}_onError(t,r){}_updateAsyncProp(t,r){if(this._didAsyncInputValueChange(t,r)){if(typeof r==\"string\"&&(r=this._fetch(t,r)),r instanceof Promise){this._watchPromise(t,r);return}if(WE(r)){this._resolveAsyncIterable(t,r);return}this._setPropValue(t,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,r){let i=this.asyncProps[t];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(t,r){this._freezeAsyncOldProps();let i=this.asyncProps[t];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(t,r,i){let n=this.asyncProps[t];n&&i>=n.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(t,r))}_watchPromise(t,r){let i=this.asyncProps[t];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(s=>{this.component&&(s=this._postProcessValue(i,s),this._setAsyncPropValue(t,s,n),this._onResolve(t,s))}).catch(s=>{this._onError(t,s)})}}async _resolveAsyncIterable(t,r){if(t!==\"data\"){this._setPropValue(t,r);return}let i=this.asyncProps[t];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,s=[],o=0;for await(let c of r){if(!this.component)return;let{dataTransform:d}=this.component.props;d?s=d(c,s):s=s.concat(c),Object.defineProperty(s,\"__diff\",{enumerable:!1,value:[{startRow:o,endRow:s.length}]}),o=s.length,this._setAsyncPropValue(t,s,n)}this._onResolve(t,s)}_postProcessValue(t,r){let i=t.type;return i&&this.component&&(i.release&&i.release(t.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(t,r){if(!this.asyncProps[t]){let n=this.component&&this.component.props[ju];this.asyncProps[t]={type:n&&n[t],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var rw=class extends ew{constructor({attributeManager:t,layer:r}){super(r),G(this,\"attributeManager\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"needsUpdate\",void 0),G(this,\"subLayers\",void 0),G(this,\"usesPickingColorCache\",void 0),G(this,\"hasPickingBuffer\",void 0),G(this,\"changeFlags\",void 0),G(this,\"viewport\",void 0),G(this,\"uniformTransitions\",void 0),G(this,\"propsInTransition\",void 0),this.attributeManager=t,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:t,layer:i}):super._fetch(t,r)}_onResolve(t,r){let i=this.layer;if(i){let n=i.props.onDataLoad;t===\"data\"&&n&&n(r,{propName:t,layer:i})}}_onError(t,r){let i=this.layer;i&&i.raiseError(r,\"loading \".concat(t,\" of \").concat(this.layer))}};var Qlt=\"layer.changeFlag\",Xlt=\"layer.initialize\",Klt=\"layer.update\",Jlt=\"layer.finalize\",tct=\"layer.matched\",BG=2**24-1,ect=Object.freeze([]),rct=td(({oldViewport:e,viewport:t})=>e.equals(t)),nd=new Uint8ClampedArray(0),ict={data:{type:\"data\",value:ect,async:!0},dataComparator:{type:\"function\",value:null,optional:!0},_dataDiff:{type:\"function\",value:e=>e&&e.__diff,optional:!0},dataTransform:{type:\"function\",value:null,optional:!0},onDataLoad:{type:\"function\",value:null,optional:!0},onError:{type:\"function\",value:null,optional:!0},fetch:{type:\"function\",value:(e,{propName:t,layer:r,loaders:i,loadOptions:n,signal:s})=>{let{resourceManager:o}=r.context;if(n=n||r.getLoadOptions(),i=i||r.props.loaders,s){var c;n={...n,fetch:{...(c=n)===null||c===void 0?void 0:c.fetch,signal:s}}}let d=o.contains(e);return!d&&!n&&(o.add({resourceId:e,data:jA(e,i),persistent:!1}),d=!0),d?o.subscribe({resourceId:e,onChange:_=>{var w;return(w=r.internalState)===null||w===void 0?void 0:w.reloadAsyncProp(t,_)},consumerId:r.id,requestId:t}):jA(e,i,n)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:\"number\",min:0,max:1,value:1},operation:\"draw\",onHover:{type:\"function\",value:null,optional:!0},onClick:{type:\"function\",value:null,optional:!0},onDragStart:{type:\"function\",value:null,optional:!0},onDrag:{type:\"function\",value:null,optional:!0},onDragEnd:{type:\"function\",value:null,optional:!0},coordinateSystem:Hr.DEFAULT,coordinateOrigin:{type:\"array\",value:[0,0,0],compare:!0},modelMatrix:{type:\"array\",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:\"XYZ\",colorFormat:\"RGBA\",parameters:{type:\"object\",value:{},optional:!0,compare:2},loadOptions:{type:\"object\",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:\"array\",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:\"function\",value:({layerIndex:e})=>[0,-e*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:\"accessor\",value:[0,0,128,128]}},yn=class extends ug{constructor(...t){super(...t),G(this,\"internalState\",null),G(this,\"lifecycle\",tm.NO_STATE),G(this,\"context\",void 0),G(this,\"state\",void 0),G(this,\"parent\",null)}static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"layerName\")?this.layerName:\"\"}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){let t=this.constructor.layerName||this.constructor.name;return\"\".concat(t,\"({id: '\").concat(this.props.id,\"'})\")}project(t){xr(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=JR(t,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[n,s,o]=Ry(i,r.pixelProjectionMatrix);return t.length===2?[n,s]:[n,s,o]}unproject(t){return xr(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,r){xr(this.internalState);let i=this.internalState.viewport||this.context.viewport;return z7(t,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){return this.state&&(this.state.models||this.state.model&&[this.state.model])||[]}setModuleParameters(t){for(let r of this.getModels())r.updateModuleSettings(t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:t}=this.props;return t===Hr.DEFAULT||t===Hr.LNGLAT||t===Hr.CARTESIAN}onHover(t,r){return this.props.onHover&&this.props.onHover(t,r)||!1}onClick(t,r){return this.props.onClick&&this.props.onClick(t,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t,r=[]){return r[0]=t+1&255,r[1]=t+1>>8&255,r[2]=t+1>>8>>8&255,r}decodePickingColor(t){xr(t instanceof Uint8Array);let[r,i,n]=t;return r+i*256+n*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:IG(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"positions\",\"instancePositions\"])}getShaders(t){for(let r of this.props.extensions)t=CG(t,r.getShaders.call(this,r));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){let r=this.getAttributeManager(),{dataChanged:i}=t.changeFlags;if(i&&r)if(Array.isArray(i))for(let n of i)r.invalidateAll(n);else r.invalidateAll();if(r){let{props:n}=t,s=this.internalState.hasPickingBuffer,o=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(s!==o){this.internalState.hasPickingBuffer=o;let{pickingColors:c,instancePickingColors:d}=r.attributes,_=c||d;_&&(o&&_.constant&&(_.constant=!1,r.invalidate(_.id)),!_.value&&!o&&(_.constant=!0,_.value=[0,0,0]))}}}finalizeState(t){for(let i of this.getModels())i.delete();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(let r of this.getModels())r.draw(t)}getPickingInfo({info:t,mode:r,sourceLayer:i}){let{index:n}=t;return n>=0&&Array.isArray(this.props.data)&&(t.object=this.props.data[n]),t}raiseError(t,r){var i,n;if(r&&(t=new Error(\"\".concat(r,\": \").concat(t.message),{cause:t})),!((i=(n=this.props).onError)!==null&&i!==void 0&&i.call(n,t))){var s,o;(s=this.context)===null||s===void 0||(o=s.onError)===null||o===void 0||o.call(s,t,this)}}getNeedsRedraw(t={clearRedrawFlags:!1}){return this._getNeedsRedraw(t)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var t;return((t=this.internalState)===null||t===void 0?void 0:t.uniformTransitions.active)||!1}activateViewport(t){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=t,(!r||!rct({oldViewport:r,viewport:t}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(t=\"all\"){let r=this.getAttributeManager();r&&(t===\"all\"?r.invalidateAll():r.invalidate(t))}updateAttributes(t){for(let r of this.getModels())this._setModelAttributes(r,t)}_updateAttributes(){let t=this.getAttributeManager();if(!t)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();t.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let s=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(s)}_updateAttributeTransition(){let t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){let{uniformTransitions:t}=this.internalState;if(t.active){let r=t.update(),i=Object.create(this.props);for(let n in r)Object.defineProperty(i,n,{value:r[n]});return i}return this.props}calculateInstancePickingColors(t,{numInstances:r}){if(t.constant)return;let i=Math.floor(nd.length/3);if(this.internalState.usesPickingColorCache=!0,iBG&&rr.warn(\"Layer has too many data objects. Picking might not be able to distinguish all objects.\")(),nd=Nh.allocate(nd,r,{size:3,copy:!0,maxCount:Math.max(r,BG)});let n=Math.floor(nd.length/3),s=[];for(let o=i;o(rr.deprecated(\"layer.state.attributeManager\",\"layer.getAttributeManager()\")(),t)}),this.internalState.uniformTransitions=new Kb(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:\"init\",propsChanged:\"init\",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){Ds(tct,this,this===t);let{state:r,internalState:i}=t;this!==t&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let t=this.needsUpdate();if(Ds(Klt,this,t),!t)return;let r=this.props,i=this.context,n=this.internalState,s=i.viewport,o=this._updateUniformTransition();n.propsInTransition=o,i.viewport=n.viewport||s,this.props=o;try{let c=this._getUpdateParams(),d=this.getModels();if(i.gl)this.updateState(c);else try{this.updateState(c)}catch{}for(let w of this.props.extensions)w.updateState.call(this,c,w);let _=this.getModels()[0]!==d[0];this._postUpdate(c,_)}finally{i.viewport=s,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){Ds(Jlt,this),this.finalizeState(this.context);for(let t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer({moduleParameters:t=null,uniforms:r={},parameters:i={}}){this._updateAttributeTransition();let n=this.props,s=this.context;this.props=this.internalState.propsInTransition||n;let o=this.props.opacity;r.opacity=Math.pow(o,1/2.2);try{t&&this.setModuleParameters(t);let{getPolygonOffset:c}=this.props,d=c&&c(r)||[0,0];wl(s.gl,{polygonOffset:d}),mn(s.gl,i,()=>{let _={moduleParameters:t,uniforms:r,parameters:i,context:s};for(let w of this.props.extensions)w.draw.call(this,_,w);this.draw(_)})}finally{this.props=n}}getChangeFlags(){var t;return(t=this.internalState)===null||t===void 0?void 0:t.changeFlags}setChangeFlags(t){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let n in t)if(t[n]){let s=!1;switch(n){case\"dataChanged\":let o=t[n],c=r[n];o&&Array.isArray(c)&&(r.dataChanged=Array.isArray(o)?c.concat(o):o,s=!0);default:r[n]||(r[n]=t[n],s=!0)}s&&Ds(Qlt,this,n,t)}let i=!!(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,r){let i=PG(t,r);if(i.updateTriggersChanged)for(let s in i.updateTriggersChanged)i.updateTriggersChanged[s]&&this.invalidateAttribute(s);if(i.transitionsChanged)for(let s in i.transitionsChanged){var n;this.internalState.uniformTransitions.add(s,r[s],t[s],(n=t.transitions)===null||n===void 0?void 0:n[s])}return this.setChangeFlags(i)}validateProps(){EG(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){let r={pickingSelectedColor:t.picked?t.color:null},{highlightColor:i}=this.props;t.picked&&typeof i==\"function\"&&(r.pickingHighlightColor=i(t)),this.setModuleParameters(r),this.setNeedsRedraw()}_getAttributeManager(){let t=this.context;return new id(t.gl,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,r){let{props:i,oldProps:n}=t;this.setNeedsRedraw(),this._updateAttributes();let{model:s}=this.state;s?.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:c,highlightColor:d}=i;if(r||n.autoHighlight!==o||n.highlightedObjectIndex!==c||n.highlightColor!==d){let _={};o||(_.pickingSelectedColor=null),Array.isArray(d)&&(_.pickingHighlightColor=d),(r||c!==n.highlightedObjectIndex)&&(_.pickingSelectedColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setModuleParameters(_)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=i?i.getNeedsRedraw(t):!1;if(r=r||n,r)for(let s of this.props.extensions)s.onNeedsRedraw.call(this,s);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};G(yn,\"defaultProps\",ict);G(yn,\"layerName\",\"Layer\");var nct=\"compositeLayer.renderLayers\",$i=class extends yn{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(t=>t.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo({info:t}){let{object:r}=t;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(t.object=r.__source.object,t.index=r.__source.index),t}filterSubLayer(t){return!0}shouldRenderSubLayer(t,r){return r&&r.length}getSubLayerClass(t,r){let{_subLayerProps:i}=this.props;return i&&i[t]&&i[t].type||r}getSubLayerRow(t,r,i){return t.__source={parent:this,object:r,index:i},t}getSubLayerAccessor(t){if(typeof t==\"function\"){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,t(i.__source.object,r)):t(i,n)}return t}getSubLayerProps(t={}){var r;let{opacity:i,pickable:n,visible:s,parameters:o,getPolygonOffset:c,highlightedObjectIndex:d,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Y,extensions:it,fetch:Z,operation:K,_subLayerProps:J}=this.props,ht={id:\"\",updateTriggers:{},opacity:i,pickable:n,visible:s,parameters:o,getPolygonOffset:c,highlightedObjectIndex:d,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Y,extensions:it,fetch:Z,operation:K},Tt=J&&t.id&&J[t.id],Ot=Tt&&Tt.updateTriggers,Yt=t.id||\"sublayer\";if(Tt){let te=this.props[ju],oe=t.type?t.type._propTypes:{};for(let ae in Tt){let ke=oe[ae]||te[ae];ke&&ke.type===\"accessor\"&&(Tt[ae]=this.getSubLayerAccessor(Tt[ae]))}}Object.assign(ht,t,Tt),ht.id=\"\".concat(this.props.id,\"-\").concat(Yt),ht.updateTriggers={all:(r=this.props.updateTriggers)===null||r===void 0?void 0:r.all,...t.updateTriggers,...Ot};for(let te of it){let oe=te.getSubLayerProps.call(this,te);oe&&Object.assign(ht,oe,{updateTriggers:Object.assign(ht.updateTriggers,oe.updateTriggers)})}return ht}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();if(n){let s=this.renderLayers();i=np(s,Boolean),this.internalState.subLayers=i}Ds(nct,this,n,i);for(let s of i)s.parent=this}};G($i,\"layerName\",\"CompositeLayer\");var KE=Math.PI/180,FG=180/Math.PI,JE=6370972,jy=256;function sct(){let e=jy/JE,t=Math.PI/180*jy;return{unitsPerMeter:[e,e,e],unitsPerMeter2:[0,0,0],metersPerUnit:[1/e,1/e,1/e],unitsPerDegree:[t,t,e],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,1/e]}}var Gy=class extends tc{constructor(t={}){let{latitude:r=0,longitude:i=0,zoom:n=0,nearZMultiplier:s=.1,farZMultiplier:o=2,resolution:c=10}=t,{height:d,altitude:_=1.5}=t;d=d||1,_=Math.max(.75,_);let w=new gn().lookAt({eye:[0,-_,0],up:[0,0,1]}),I=Math.pow(2,n);w.rotateX(r*KE),w.rotateZ(-i*KE),w.scale(I/d);let R=Math.atan(.5/_),N=jy*2*I/d;super({...t,height:d,viewMatrix:w,longitude:i,latitude:r,zoom:n,distanceScales:sct(),fovyRadians:R*2,focalDistance:_,near:s,far:Math.min(2,1/N+1)*_*o}),G(this,\"longitude\",void 0),G(this,\"latitude\",void 0),G(this,\"resolution\",void 0),this.latitude=r,this.longitude=i,this.resolution=c}get projectionMode(){return Ja.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(t={}){let r={targetZ:t.z||0},i=this.unproject([0,this.height/2],r),n=this.unproject([this.width/2,0],r),s=this.unproject([this.width,this.height/2],r),o=this.unproject([this.width/2,this.height],r);return s[0]this.longitude&&(i[0]-=360),[Math.min(i[0],s[0],n[0],o[0]),Math.min(i[1],s[1],n[1],o[1]),Math.max(i[0],s[0],n[0],o[0]),Math.max(i[1],s[1],n[1],o[1])]}unproject(t,{topLeft:r=!0,targetZ:i}={}){let[n,s,o]=t,c=r?s:this.height-s,{pixelUnprojectionMatrix:d}=this,_;if(Number.isFinite(o))_=pD(d,[n,c,o,1]);else{let N=pD(d,[n,c,-1,1]),j=pD(d,[n,c,1,1]),Y=((i||0)/JE+1)*jy,it=bE(vE([],N,j)),Z=bE(N),K=bE(j),ht=4*((4*Z*K-(it-Z-K)**2)/16)/it,Tt=Math.sqrt(Z-ht),Ot=Math.sqrt(Math.max(0,Y*Y-ht)),Yt=(Tt-Ot)/Math.sqrt(it);_=gj([],N,j,Yt)}let[w,I,R]=this.unprojectPosition(_);return Number.isFinite(o)?[w,I,R]:Number.isFinite(i)?[w,I,i]:[w,I]}projectPosition(t){let[r,i,n=0]=t,s=r*KE,o=i*KE,c=Math.cos(o),d=(n/JE+1)*jy;return[Math.sin(s)*c*d,-Math.cos(s)*c*d,Math.sin(o)*d]}unprojectPosition(t){let[r,i,n]=t,s=xE(t),o=Math.asin(n/s),d=Math.atan2(r,-i)*FG,_=o*FG,w=(s/jy-1)*JE;return[d,_,w]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,r){let i=this.unproject(r);return{longitude:t[0]-i[0]+this.longitude,latitude:t[1]-i[1]+this.latitude}}};function pD(e,t){let r=Oh([],t,e);return Ty(r,r,1/r[3]),r}var oct=new gn().lookAt({eye:[0,0,1]});function act({width:e,height:t,near:r,far:i,padding:n}){let s=-e/2,o=e/2,c=-t/2,d=t/2;if(n){let{left:_=0,right:w=0,top:I=0,bottom:R=0}=n,N=Ml((_+e-w)/2,0,e)-e/2,j=Ml((I+t-R)/2,0,t)-t/2;s-=N,o-=N,c+=j,d+=j}return new gn().ortho({left:s,right:o,bottom:c,top:d,near:r,far:i})}var Wy=class extends tc{constructor(t){let{width:r,height:i,near:n=.1,far:s=1e3,zoom:o=0,target:c=[0,0,0],padding:d=null,flipY:_=!0}=t,w=Array.isArray(o)?o[0]:o,I=Array.isArray(o)?o[1]:o,R=Math.min(w,I),N=Math.pow(2,R),j;if(w!==I){let Y=Math.pow(2,w),it=Math.pow(2,I);j={unitsPerMeter:[Y/N,it/N,1],metersPerUnit:[N/Y,N/it,1]}}super({...t,longitude:void 0,position:c,viewMatrix:oct.clone().scale([N,N*(_?-1:1),N]),projectionMatrix:act({width:r||1,height:i||1,padding:d,near:n,far:s}),zoom:R,distanceScales:j})}projectFlat([t,r]){let{unitsPerMeter:i}=this.distanceScales;return[t*i[0],r*i[1]]}unprojectFlat([t,r]){let{metersPerUnit:i}=this.distanceScales;return[t*i[0],r*i[1]]}panByPosition(t,r){let i=ed(r,this.pixelUnprojectionMatrix),n=this.projectFlat(t),s=vy([],n,pE([],i)),o=vy([],this.center,s);return{target:this.unprojectFlat(o)}}};var Gu=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"extensionName\")?this.extensionName:\"\"}constructor(t){G(this,\"opts\",void 0),t&&(this.opts=t)}equals(t){return this===t?!0:this.constructor===t.constructor&&fo(this.opts,t.opts,1)}getShaders(t){return null}getSubLayerProps(t){let{defaultProps:r}=t.constructor,i={updateTriggers:{}};for(let n in r)if(n in this.props){let s=r[n],o=this.props[n];i[n]=o,s&&s.type===\"accessor\"&&(i.updateTriggers[n]=this.props.updateTriggers[n],typeof o==\"function\"&&(i[n]=this.getSubLayerAccessor(o)))}return i}initializeState(t,r){}updateState(t,r){}onNeedsRedraw(t){}getNeedsPickingBuffer(t){return!1}draw(t,r){}finalizeState(t,r){}};G(Gu,\"defaultProps\",{});G(Gu,\"extensionName\",\"LayerExtension\");var rm=class{constructor(t){G(this,\"opts\",void 0),G(this,\"typedArrayManager\",void 0),G(this,\"indexStarts\",[0]),G(this,\"vertexStarts\",[0]),G(this,\"vertexCount\",0),G(this,\"instanceCount\",0),G(this,\"attributes\",void 0),G(this,\"_attributeDefs\",void 0),G(this,\"data\",void 0),G(this,\"getGeometry\",void 0),G(this,\"geometryBuffer\",void 0),G(this,\"buffers\",void 0),G(this,\"positionSize\",void 0),G(this,\"normalize\",void 0);let{attributes:r={}}=t;this.typedArrayManager=Nh,this.attributes={},this._attributeDefs=r,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:s,positionFormat:o,dataChanged:c,normalize:d=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=s&&s.size||(o===\"XY\"?2:3),this.buffers=i,this.normalize=d,s&&(xr(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(s),d||(i.positions=s)),this.geometryBuffer=i.positions,Array.isArray(c))for(let _ of c)this._rebuildGeometry(_);else this._rebuildGeometry()}updatePartialGeometry({startRow:t,endRow:r}){this._rebuildGeometry({startRow:t,endRow:r})}getGeometryFromBuffer(t){let r=t.value||t;return ArrayBuffer.isView(r)?HE(r,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,r){let{attributes:i,buffers:n,_attributeDefs:s,typedArrayManager:o}=this;for(let c in s)if(c in n)o.release(i[c]),i[c]=null;else{let d=s[c];d.copy=r,i[c]=o.allocate(i[c],t,d)}}_forEachGeometry(t,r,i){let{data:n,getGeometry:s}=this,{iterable:o,objectInfo:c}=Jc(n,r,i);for(let d of o){c.index++;let _=s?s(d,c):null;t(_,c.index)}}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:s,geometryBuffer:o}=this,{startRow:c=0,endRow:d=1/0}=t||{},_={};if(t||(r=[0],i=[0]),this.normalize||!o)this._forEachGeometry((I,R)=>{let N=I&&this.normalizeGeometry(I);_[R]=N,i[R+1]=i[R]+(N?this.getGeometrySize(N):0)},c,d),n=i[i.length-1];else if(i=s.startIndices,n=i[s.length]||0,ArrayBuffer.isView(o))n=n||o.length/this.positionSize;else if(o instanceof Ur){let I=o.accessor.stride||this.positionSize*4;n=n||o.byteLength/I}else if(o.buffer){let I=o.stride||this.positionSize*4;n=n||o.buffer.byteLength/I}else if(o.value){let I=o.value,R=o.stride/I.BYTES_PER_ELEMENT||this.positionSize;n=n||I.length/R}this._allocate(n,!!t),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let w={};this._forEachGeometry((I,R)=>{let N=_[R]||I;w.vertexStart=i[R],w.indexStart=r[R];let j=ReP(r,t));if(qy(e)){if(uct(e))return t.style=cct,(0,AD.cloneElement)(e,t);if(hct(e))return(0,AD.cloneElement)(e,t)}return e}function qy(e){return e&&typeof e==\"object\"&&\"type\"in e||!1}function uct(e){var t;return(t=e.props)===null||t===void 0?void 0:t.mapStyle}function hct(e){let t=e.type;return t&&t.deckGLViewProps}function mD(e){if(typeof e==\"function\")return(0,NG.createElement)(Xc,{},e);if(Array.isArray(e))return e.map(mD);if(qy(e)){if(e.type===rP.Fragment)return mD(e.props.children);if(Hy(e.type,Xc))return e}return e}function gD({children:e,layers:t=[],views:r=null}){let i=[],n=[],s={};return rP.Children.forEach(mD(e),o=>{if(qy(o)){let c=o.type;if(Hy(c,yn)){let d=fct(c,o.props);n.push(d)}else i.push(o);if(Hy(c,Xc)&&c!==Xc&&o.props.id){let d=new c(o.props);s[d.id]=d}}else o&&i.push(o)}),Object.keys(s).length>0&&(Array.isArray(r)?r.forEach(o=>{s[o.id]=o}):r&&(s[r.id]=r),r=Object.values(s)),t=n.length>0?[...n,...t]:t,{layers:t,children:i,views:r}}function fct(e,t){let r={},i=e.defaultProps||{};for(let n in t)i[n]!==t[n]&&(r[n]=t[n]);return new e(r)}var _D=bi(Yi());function yD({children:e,deck:t,ContextProvider:r}){let{viewManager:i}=t||{};if(!i||!i.views.length)return[];let n={},s=i.views[0].id;for(let o of e){let c=s,d=o;qy(o)&&Hy(o.type,Xc)&&(c=o.props.id||s,d=o.props.children);let _=i.getViewport(c),w=i.getViewState(c);if(_){w.padding=_.padding;let{x:I,y:R,width:N,height:j}=_;d=eP(d,{x:I,y:R,width:N,height:j,viewport:_,viewState:w}),n[c]||(n[c]={viewport:_,children:[]}),n[c].children.push(d)}}return Object.keys(n).map(o=>{let{viewport:c,children:d}=n[o],{x:_,y:w,width:I,height:R}=c,N={position:\"absolute\",left:_,top:w,width:I,height:R},j=\"view-\".concat(o),Y=(0,_D.createElement)(\"div\",{key:j,id:j,style:N},...d);if(r){let it={viewport:c,container:t.canvas.offsetParent,eventManager:t.eventManager,onViewStateChange:Z=>{Z.viewId=o,t._onViewStateChange(Z)}};return(0,_D.createElement)(r,{key:j,value:it},Y)}return Y})}var dct={mixBlendMode:null};function vD({width:e,height:t,style:r}){let i={position:\"absolute\",zIndex:0,left:0,top:0,width:e,height:t},n={left:0,top:0};if(r)for(let s in r)s in dct?n[s]=r[s]:i[s]=r[s];return{containerStyle:i,canvasStyle:n}}function pct(e){return{get deck(){return e.deck},pickObject:t=>e.deck.pickObject(t),pickMultipleObjects:t=>e.deck.pickMultipleObjects(t),pickObjects:t=>e.deck.pickObjects(t)}}function UG(e){e.redrawReason&&(e.deck._drawLayers(e.redrawReason),e.redrawReason=null)}function Act(e,t,r){let i=new t({...r,_customRender:n=>{e.redrawReason=n;let s=i.getViewports();e.lastRenderedViewports!==s?e.forceUpdate():UG(e)}});return i}var VG=(0,ko.forwardRef)((e,t)=>{let[r,i]=(0,ko.useState)(0),s=(0,ko.useRef)({control:null,version:r,forceUpdate:()=>i(Tt=>Tt+1)}).current,o=(0,ko.useRef)(null),c=(0,ko.useRef)(null),d=(0,ko.useMemo)(()=>gD(e),[e.layers,e.views,e.children]),_=!0,w=Tt=>{var Ot;return _&&e.viewState?(s.viewStateUpdateRequested=Tt,null):(s.viewStateUpdateRequested=null,(Ot=e.onViewStateChange)===null||Ot===void 0?void 0:Ot.call(e,Tt))},I=Tt=>{if(_)s.interactionStateUpdateRequested=Tt;else{var Ot;s.interactionStateUpdateRequested=null,(Ot=e.onInteractionStateChange)===null||Ot===void 0||Ot.call(e,Tt)}},R=(0,ko.useMemo)(()=>{let Tt={...e,style:null,width:\"100%\",height:\"100%\",parent:o.current,canvas:c.current,layers:d.layers,views:d.views,onViewStateChange:w,onInteractionStateChange:I};return delete Tt._customRender,s.deck&&s.deck.setProps(Tt),Tt},[e]);(0,ko.useEffect)(()=>{let Tt=e.Deck||ap;return s.deck=Act(s,Tt,{...R,parent:o.current,canvas:c.current}),()=>{var Ot;return(Ot=s.deck)===null||Ot===void 0?void 0:Ot.finalize()}},[]),zG(()=>{UG(s);let{viewStateUpdateRequested:Tt,interactionStateUpdateRequested:Ot}=s;Tt&&w(Tt),Ot&&I(Ot)}),(0,ko.useImperativeHandle)(t,()=>pct(s),[]);let N=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:j,width:Y,height:it,id:Z,style:K}=e,{containerStyle:J,canvasStyle:ht}=(0,ko.useMemo)(()=>vD({width:Y,height:it,style:K}),[Y,it,K]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===N||s.version!==r){s.lastRenderedViewports=N,s.version=r;let Tt=yD({children:d.children,deck:s.deck,ContextProvider:j}),Ot=(0,ko.createElement)(\"canvas\",{key:\"canvas\",id:Z||\"deckgl-overlay\",ref:c,style:ht});s.control=(0,ko.createElement)(\"div\",{id:\"\".concat(Z||\"deckgl\",\"-wrapper\"),ref:o,style:J},[Ot,Tt])}return _=!1,s.control});VG.defaultProps=ap.defaultProps;var xD=VG;var Xt,GG=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error(\"TextDecoder not available\")}};typeof TextDecoder<\"u\"&&GG.decode();var iw=null;function Zy(){return(iw===null||iw.byteLength===0)&&(iw=new Uint8Array(Xt.memory.buffer)),iw}function Wu(e,t){return e=e>>>0,GG.decode(Zy().subarray(e,e+t))}var cp=new Array(128).fill(void 0);cp.push(void 0,null,!0,!1);var lw=cp.length;function mr(e){lw===cp.length&&cp.push(cp.length+1);let t=lw;return lw=cp[t],cp[t]=e,t}function Qe(e){return cp[e]}function mct(e){e<132||(cp[e]=lw,lw=e)}function Jn(e){let t=Qe(e);return mct(e),t}var Gh=0,iP=typeof TextEncoder<\"u\"?new TextEncoder(\"utf-8\"):{encode:()=>{throw Error(\"TextEncoder not available\")}},gct=typeof iP.encodeInto==\"function\"?function(e,t){return iP.encodeInto(e,t)}:function(e,t){let r=iP.encode(e);return t.set(r),{read:e.length,written:r.length}};function nw(e,t,r){if(r===void 0){let c=iP.encode(e),d=t(c.length,1)>>>0;return Zy().subarray(d,d+c.length).set(c),Gh=c.length,d}let i=e.length,n=t(i,1)>>>0,s=Zy(),o=0;for(;o127)break;s[n+o]=c}if(o!==i){o!==0&&(e=e.slice(o)),n=r(n,i,i=o+e.length*3,1)>>>0;let c=Zy().subarray(n+o,n+i),d=gct(e,c);o+=d.written}return Gh=o,n}function bD(e){return e==null}var sw=null;function sr(){return(sw===null||sw.byteLength===0)&&(sw=new Int32Array(Xt.memory.buffer)),sw}function wD(e){let t=typeof e;if(t==\"number\"||t==\"boolean\"||e==null)return`${e}`;if(t==\"string\")return`\"${e}\"`;if(t==\"symbol\"){let n=e.description;return n==null?\"Symbol\":`Symbol(${n})`}if(t==\"function\"){let n=e.name;return typeof n==\"string\"&&n.length>0?`Function(${n})`:\"Function\"}if(Array.isArray(e)){let n=e.length,s=\"[\";n>0&&(s+=wD(e[0]));for(let o=1;o1)i=r[1];else return toString.call(e);if(i==\"Object\")try{return\"Object(\"+JSON.stringify(e)+\")\"}catch{return\"Object\"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:i}function _ct(e,t,r,i){let n={a:e,b:t,cnt:1,dtor:r},s=(...o)=>{n.cnt++;let c=n.a;n.a=0;try{return i(c,n.b,...o)}finally{--n.cnt===0?Xt.__wbindgen_export_2.get(n.dtor)(c,n.b):n.a=c}};return s.original=n,s}function yct(e,t,r){Xt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h896648893be04d51(e,t,mr(r))}function SD(e,t){let r=t(e.length*1,1)>>>0;return Zy().set(e,r/1),Gh=e.length,r}function WG(e){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16),s=SD(e,Xt.__wbindgen_malloc),o=Gh;Xt.readParquet(n,s,o);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return RD.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}function HG(e,t){return e=e>>>0,Zy().subarray(e/1,e/1+t)}var ow=null;function jG(){return(ow===null||ow.byteLength===0)&&(ow=new BigInt64Array(Xt.memory.buffer)),ow}var aw=null;function vct(){return(aw===null||aw.byteLength===0)&&(aw=new BigUint64Array(Xt.memory.buffer)),aw}function xct(e,t){return e=e>>>0,vct().subarray(e/8,e/8+t)}function Ro(e,t){try{return e.apply(this,t)}catch(r){Xt.__wbindgen_exn_store(mr(r))}}function bct(e,t,r,i){Xt.wasm_bindgen__convert__closures__invoke2_mut__h02232cd008ae4dfe(e,t,mr(r),mr(i))}var uNt=Object.freeze({UNCOMPRESSED:0,0:\"UNCOMPRESSED\",SNAPPY:1,1:\"SNAPPY\",GZIP:2,2:\"GZIP\",BROTLI:3,3:\"BROTLI\",LZ4:4,4:\"LZ4\",ZSTD:5,5:\"ZSTD\",LZ4_RAW:6,6:\"LZ4_RAW\"}),hNt=Object.freeze({PLAIN:0,0:\"PLAIN\",PLAIN_DICTIONARY:1,1:\"PLAIN_DICTIONARY\",RLE:2,2:\"RLE\",BIT_PACKED:3,3:\"BIT_PACKED\",DELTA_BINARY_PACKED:4,4:\"DELTA_BINARY_PACKED\",DELTA_LENGTH_BYTE_ARRAY:5,5:\"DELTA_LENGTH_BYTE_ARRAY\",DELTA_BYTE_ARRAY:6,6:\"DELTA_BYTE_ARRAY\",RLE_DICTIONARY:7,7:\"RLE_DICTIONARY\",BYTE_STREAM_SPLIT:8,8:\"BYTE_STREAM_SPLIT\"}),fNt=Object.freeze({V1:0,0:\"V1\",V2:1,1:\"V2\"}),TD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_arrowschema_free(t)}copy(){let t=Xt.arrowschema_copy(this.__wbg_ptr);return e.__wrap(t)}},MD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_columnchunkmetadata_free(t)}filePath(){try{let i=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_filePath(i,this.__wbg_ptr);var t=sr()[i/4+0],r=sr()[i/4+1];let n;return t!==0&&(n=Wu(t,r).slice(),Xt.__wbindgen_free(t,r*1)),n}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}fileOffset(){return Xt.columnchunkmetadata_fileOffset(this.__wbg_ptr)}pathInSchema(){let t,r;try{let s=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_pathInSchema(s,this.__wbg_ptr);var i=sr()[s/4+0],n=sr()[s/4+1];return t=i,r=n,Wu(i,n)}finally{Xt.__wbindgen_add_to_stack_pointer(16),Xt.__wbindgen_free(t,r,1)}}statistics_exist(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_statistics_exist(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return t!==0}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}getStatisticsMinValue(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_getStatisticsMinValue(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return Jn(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}getStatisticsMaxValue(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_getStatisticsMaxValue(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return Jn(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}getStatisticsNullCount(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_getStatisticsNullCount(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return Jn(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}numValues(){return Xt.columnchunkmetadata_numValues(this.__wbg_ptr)}compressedSize(){return Xt.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return Xt.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}dataPageOffset(){return Xt.columnchunkmetadata_dataPageOffset(this.__wbg_ptr)}hasIndexPage(){return Xt.columnchunkmetadata_hasIndexPage(this.__wbg_ptr)!==0}indexPageOffset(){try{let i=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_indexPageOffset(i,this.__wbg_ptr);var t=sr()[i/4+0],r=jG()[i/8+1];return t===0?void 0:r}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}dictionaryPageOffset(){try{let i=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_dictionaryPageOffset(i,this.__wbg_ptr);var t=sr()[i/4+0],r=jG()[i/8+1];return t===0?void 0:r}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}numColumnEncodings(){return Xt.columnchunkmetadata_numColumnEncodings(this.__wbg_ptr)>>>0}byteRange(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.columnchunkmetadata_byteRange(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=xct(t,r).slice();return Xt.__wbindgen_free(t,r*8),i}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}},ED=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_datatype_free(t)}},nP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_ffirecordbatch_free(t)}arrayAddr(){return Xt.ffirecordbatch_arrayAddr(this.__wbg_ptr)}schemaAddr(){return Xt.ffirecordbatch_schemaAddr(this.__wbg_ptr)}},sP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_ffitable_free(t)}numBatches(){return Xt.ffitable_numBatches(this.__wbg_ptr)>>>0}schemaAddr(){return Xt.ffitable_schemaAddr(this.__wbg_ptr)}arrayAddr(t){return Xt.ffitable_arrayAddr(this.__wbg_ptr,t)}drop(){let t=this.__destroy_into_raw();Xt.ffitable_drop(t)}};var PD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_filemetadata_free(t)}copy(){let t=Xt.filemetadata_copy(this.__wbg_ptr);return e.__wrap(t)}version(){return Xt.filemetadata_version(this.__wbg_ptr)}numRows(){return Xt.filemetadata_numRows(this.__wbg_ptr)>>>0}createdBy(){try{let i=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.filemetadata_createdBy(i,this.__wbg_ptr);var t=sr()[i/4+0],r=sr()[i/4+1];let n;return t!==0&&(n=Wu(t,r).slice(),Xt.__wbindgen_free(t,r*1)),n}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}numRowGroups(){return Xt.filemetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(t){let r=Xt.filemetadata_rowGroup(this.__wbg_ptr,t);return LD.__wrap(r)}schema(){let t=Xt.filemetadata_schema(this.__wbg_ptr);return kD.__wrap(t)}keyValueMetadata(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.filemetadata_keyValueMetadata(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return Jn(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}arrowSchema(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.filemetadata_arrowSchema(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return TD.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}};var ID=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_intounderlyingsource_free(t)}pull(t){let r=Xt.intounderlyingsource_pull(this.__wbg_ptr,mr(t));return Jn(r)}cancel(){let t=this.__destroy_into_raw();Xt.intounderlyingsource_cancel(t)}};var CD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_queuingstrategy_free(t)}get highWaterMark(){return Xt.queuingstrategy_highWaterMark(this.__wbg_ptr)}};var oP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_recordbatch_free(t)}get numRows(){return Xt.recordbatch_numRows(this.__wbg_ptr)>>>0}get numColumns(){return Xt.recordbatch_numColumns(this.__wbg_ptr)>>>0}get schema(){let t=Xt.recordbatch_schema(this.__wbg_ptr);return aP.__wrap(t)}column(t){let r=Xt.recordbatch_column(this.__wbg_ptr,t);return r===0?void 0:lP.__wrap(r)}column_by_name(t){let r=nw(t,Xt.__wbindgen_malloc,Xt.__wbindgen_realloc),i=Gh,n=Xt.recordbatch_column_by_name(this.__wbg_ptr,r,i);return n===0?void 0:lP.__wrap(n)}toFFI(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.recordbatch_toFFI(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return nP.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let n=this.__destroy_into_raw(),s=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.recordbatch_intoFFI(s,n);var t=sr()[s/4+0],r=sr()[s/4+1],i=sr()[s/4+2];if(i)throw Jn(r);return nP.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.recordbatch_intoIPCStream(c,o);var t=sr()[c/4+0],r=sr()[c/4+1],i=sr()[c/4+2],n=sr()[c/4+3];if(n)throw Jn(i);var s=HG(t,r).slice();return Xt.__wbindgen_free(t,r*1),s}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}},LD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_rowgroupmetadata_free(t)}numRows(){return Xt.rowgroupmetadata_numRows(this.__wbg_ptr)>>>0}numColumns(){return Xt.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}column(t){let r=Xt.rowgroupmetadata_column(this.__wbg_ptr,t);return MD.__wrap(r)}totalByteSize(){return Xt.rowgroupmetadata_totalByteSize(this.__wbg_ptr)>>>0}compressedSize(){return Xt.rowgroupmetadata_compressedSize(this.__wbg_ptr)>>>0}},aP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_schema_free(t)}},kD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_schemadescriptor_free(t)}name(){let t,r;try{let s=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.schemadescriptor_name(s,this.__wbg_ptr);var i=sr()[s/4+0],n=sr()[s/4+1];return t=i,r=n,Wu(i,n)}finally{Xt.__wbindgen_add_to_stack_pointer(16),Xt.__wbindgen_free(t,r,1)}}numColumns(){return Xt.schemadescriptor_numColumns(this.__wbg_ptr)>>>0}numFields(){return Xt.schemadescriptor_numFields(this.__wbg_ptr)>>>0}},RD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_table_free(t)}get schema(){let t=Xt.table_schema(this.__wbg_ptr);return aP.__wrap(t)}recordBatch(t){let r=Xt.table_recordBatch(this.__wbg_ptr,t);return r===0?void 0:oP.__wrap(r)}get numBatches(){return Xt.table_numBatches(this.__wbg_ptr)>>>0}toFFI(){try{let n=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.table_toFFI(n,this.__wbg_ptr);var t=sr()[n/4+0],r=sr()[n/4+1],i=sr()[n/4+2];if(i)throw Jn(r);return sP.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let n=this.__destroy_into_raw(),s=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.table_intoFFI(s,n);var t=sr()[s/4+0],r=sr()[s/4+1],i=sr()[s/4+2];if(i)throw Jn(r);return sP.__wrap(t)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=Xt.__wbindgen_add_to_stack_pointer(-16);Xt.table_intoIPCStream(c,o);var t=sr()[c/4+0],r=sr()[c/4+1],i=sr()[c/4+2],n=sr()[c/4+3];if(n)throw Jn(i);var s=HG(t,r).slice();return Xt.__wbindgen_free(t,r*1),s}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}static fromIPCFile(t){try{let s=Xt.__wbindgen_add_to_stack_pointer(-16),o=SD(t,Xt.__wbindgen_malloc),c=Gh;Xt.table_fromIPCFile(s,o,c);var r=sr()[s/4+0],i=sr()[s/4+1],n=sr()[s/4+2];if(n)throw Jn(i);return e.__wrap(r)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}static fromIPCStream(t){try{let s=Xt.__wbindgen_add_to_stack_pointer(-16),o=SD(t,Xt.__wbindgen_malloc),c=Gh;Xt.table_fromIPCStream(s,o,c);var r=sr()[s/4+0],i=sr()[s/4+1],n=sr()[s/4+2];if(n)throw Jn(i);return e.__wrap(r)}finally{Xt.__wbindgen_add_to_stack_pointer(16)}}},lP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){let t=this.__destroy_into_raw();Xt.__wbg_vector_free(t)}data_type(){let t=Xt.vector_data_type(this.__wbg_ptr);return ED.__wrap(t)}};async function wct(e,t){if(typeof Response==\"function\"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get(\"Content-Type\")!=\"application/wasm\")console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function Sct(){let e={};return e.wbg={},e.wbg.__wbg_filemetadata_new=function(t){let r=PD.__wrap(t);return mr(r)},e.wbg.__wbindgen_error_new=function(t,r){let i=new Error(Wu(t,r));return mr(i)},e.wbg.__wbindgen_object_drop_ref=function(t){Jn(t)},e.wbg.__wbindgen_string_new=function(t,r){let i=Wu(t,r);return mr(i)},e.wbg.__wbindgen_bigint_from_i64=function(t){return mr(t)},e.wbg.__wbindgen_number_new=function(t){return mr(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let r=Qe(t);return mr(r)},e.wbg.__wbg_fetch_b5d6bebed1e6c2d2=function(t){let r=fetch(Qe(t));return mr(r)},e.wbg.__wbg_newwithsource_620c192b0682807b=function(t,r){let i=new ReadableStream(ID.__wrap(t),CD.__wrap(r));return mr(i)},e.wbg.__wbg_close_e9110ca16e2567db=function(t){Qe(t).close()},e.wbg.__wbg_enqueue_d71a1a518e21f5c3=function(t,r){Qe(t).enqueue(Qe(r))},e.wbg.__wbg_byobRequest_08c18cee35def1f4=function(t){let r=Qe(t).byobRequest;return bD(r)?0:mr(r)},e.wbg.__wbg_close_da7e6fb9d9851e5a=function(t){Qe(t).close()},e.wbg.__wbg_view_231340b0dd8a2484=function(t){let r=Qe(t).view;return bD(r)?0:mr(r)},e.wbg.__wbg_respond_8fadc5f5c9d95422=function(t,r){Qe(t).respond(r>>>0)},e.wbg.__wbg_buffer_4e79326814bdd393=function(t){let r=Qe(t).buffer;return mr(r)},e.wbg.__wbg_byteOffset_b69b0a07afccce19=function(t){return Qe(t).byteOffset},e.wbg.__wbg_byteLength_5299848ed3264181=function(t){return Qe(t).byteLength},e.wbg.__wbindgen_string_get=function(t,r){let i=Qe(r),n=typeof i==\"string\"?i:void 0;var s=bD(n)?0:nw(n,Xt.__wbindgen_malloc,Xt.__wbindgen_realloc),o=Gh;sr()[t/4+1]=o,sr()[t/4+0]=s},e.wbg.__wbg_set_bd72c078edfa51ad=function(t,r,i){Qe(t)[Jn(r)]=Jn(i)},e.wbg.__wbg_String_4370c5505c674d30=function(t,r){let i=String(Qe(r)),n=nw(i,Xt.__wbindgen_malloc,Xt.__wbindgen_realloc),s=Gh;sr()[t/4+1]=s,sr()[t/4+0]=n},e.wbg.__wbindgen_cb_drop=function(t){let r=Jn(t).original;return r.cnt--==1?(r.a=0,!0):!1},e.wbg.__wbg_recordbatch_new=function(t){let r=oP.__wrap(t);return mr(r)},e.wbg.__wbg_randomFillSync_dc1e9a60c158336d=function(){return Ro(function(t,r){Qe(t).randomFillSync(Jn(r))},arguments)},e.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab=function(){return Ro(function(t,r){Qe(t).getRandomValues(Qe(r))},arguments)},e.wbg.__wbg_crypto_c48a774b022d20ac=function(t){let r=Qe(t).crypto;return mr(r)},e.wbg.__wbindgen_is_object=function(t){let r=Qe(t);return typeof r==\"object\"&&r!==null},e.wbg.__wbg_process_298734cf255a885d=function(t){let r=Qe(t).process;return mr(r)},e.wbg.__wbg_versions_e2e78e134e3e5d01=function(t){let r=Qe(t).versions;return mr(r)},e.wbg.__wbg_node_1cd7a5d853dbea79=function(t){let r=Qe(t).node;return mr(r)},e.wbg.__wbindgen_is_string=function(t){return typeof Qe(t)==\"string\"},e.wbg.__wbg_require_8f08ceecec0f4fee=function(){return Ro(function(){let t=module.require;return mr(t)},arguments)},e.wbg.__wbg_msCrypto_bcb970640f50a1e8=function(t){let r=Qe(t).msCrypto;return mr(r)},e.wbg.__wbg_signal_4bd18fb489af2d4c=function(t){let r=Qe(t).signal;return mr(r)},e.wbg.__wbg_new_55c9955722952374=function(){return Ro(function(){let t=new AbortController;return mr(t)},arguments)},e.wbg.__wbg_abort_654b796176d117aa=function(t){Qe(t).abort()},e.wbg.__wbg_new_1eead62f64ca15ce=function(){return Ro(function(){let t=new Headers;return mr(t)},arguments)},e.wbg.__wbg_append_fda9e3432e3e88da=function(){return Ro(function(t,r,i,n,s){Qe(t).append(Wu(r,i),Wu(n,s))},arguments)},e.wbg.__wbg_fetch_8eaf01857a5bb21f=function(t,r){let i=Qe(t).fetch(Qe(r));return mr(i)},e.wbg.__wbg_instanceof_Response_fc4327dbfcdf5ced=function(t){let r;try{r=Qe(t)instanceof Response}catch{r=!1}return r},e.wbg.__wbg_url_8503de97f69da463=function(t,r){let i=Qe(r).url,n=nw(i,Xt.__wbindgen_malloc,Xt.__wbindgen_realloc),s=Gh;sr()[t/4+1]=s,sr()[t/4+0]=n},e.wbg.__wbg_status_ac85a3142a84caa2=function(t){return Qe(t).status},e.wbg.__wbg_headers_b70de86b8e989bc0=function(t){let r=Qe(t).headers;return mr(r)},e.wbg.__wbg_arrayBuffer_288fb3538806e85c=function(){return Ro(function(t){let r=Qe(t).arrayBuffer();return mr(r)},arguments)},e.wbg.__wbg_newwithstrandinit_cad5cd6038c7ff5d=function(){return Ro(function(t,r,i){let n=new Request(Wu(t,r),Qe(i));return mr(n)},arguments)},e.wbg.__wbindgen_is_function=function(t){return typeof Qe(t)==\"function\"},e.wbg.__wbg_newnoargs_581967eacc0e2604=function(t,r){let i=new Function(Wu(t,r));return mr(i)},e.wbg.__wbg_new_56693dbed0c32988=function(){return mr(new Map)},e.wbg.__wbg_next_526fc47e980da008=function(t){let r=Qe(t).next;return mr(r)},e.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return Ro(function(t){let r=Qe(t).next();return mr(r)},arguments)},e.wbg.__wbg_done_5c1f01fb660d73b5=function(t){return Qe(t).done},e.wbg.__wbg_value_1695675138684bd5=function(t){let r=Qe(t).value;return mr(r)},e.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return mr(Symbol.iterator)},e.wbg.__wbg_get_97b561fb56f034b5=function(){return Ro(function(t,r){let i=Reflect.get(Qe(t),Qe(r));return mr(i)},arguments)},e.wbg.__wbg_call_cb65541d95d71282=function(){return Ro(function(t,r){let i=Qe(t).call(Qe(r));return mr(i)},arguments)},e.wbg.__wbg_new_b51585de1b234aff=function(){let t=new Object;return mr(t)},e.wbg.__wbg_self_1ff1d729e9aae938=function(){return Ro(function(){let t=self.self;return mr(t)},arguments)},e.wbg.__wbg_window_5f4faef6c12b79ec=function(){return Ro(function(){let t=window.window;return mr(t)},arguments)},e.wbg.__wbg_globalThis_1d39714405582d3c=function(){return Ro(function(){let t=globalThis.globalThis;return mr(t)},arguments)},e.wbg.__wbg_global_651f05c6a0944d1c=function(){return Ro(function(){let t=global.global;return mr(t)},arguments)},e.wbg.__wbindgen_is_undefined=function(t){return Qe(t)===void 0},e.wbg.__wbg_new_d258248ed531ff54=function(t,r){let i=new Error(Wu(t,r));return mr(i)},e.wbg.__wbg_call_01734de55d61e11d=function(){return Ro(function(t,r,i){let n=Qe(t).call(Qe(r),Qe(i));return mr(n)},arguments)},e.wbg.__wbg_set_bedc3d02d0f05eb0=function(t,r,i){let n=Qe(t).set(Qe(r),Qe(i));return mr(n)},e.wbg.__wbg_new_43f1b47c28813cbd=function(t,r){try{var i={a:t,b:r},n=(o,c)=>{let d=i.a;i.a=0;try{return bct(d,i.b,o,c)}finally{i.a=d}};let s=new Promise(n);return mr(s)}finally{i.a=i.b=0}},e.wbg.__wbg_resolve_53698b95aaf7fcf8=function(t){let r=Promise.resolve(Qe(t));return mr(r)},e.wbg.__wbg_then_f7e06ee3c11698eb=function(t,r){let i=Qe(t).then(Qe(r));return mr(i)},e.wbg.__wbg_then_b2267541e2a73865=function(t,r,i){let n=Qe(t).then(Qe(r),Qe(i));return mr(n)},e.wbg.__wbg_buffer_085ec1f694018c4f=function(t){let r=Qe(t).buffer;return mr(r)},e.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa=function(t,r,i){let n=new Uint8Array(Qe(t),r>>>0,i>>>0);return mr(n)},e.wbg.__wbg_new_8125e318e6245eed=function(t){let r=new Uint8Array(Qe(t));return mr(r)},e.wbg.__wbg_set_5cf90238115182c3=function(t,r,i){Qe(t).set(Qe(r),i>>>0)},e.wbg.__wbg_length_72e2208bbc0efc61=function(t){return Qe(t).length},e.wbg.__wbg_newwithlength_e5d69174d6984cd7=function(t){let r=new Uint8Array(t>>>0);return mr(r)},e.wbg.__wbg_subarray_13db269f57aa838d=function(t,r,i){let n=Qe(t).subarray(r>>>0,i>>>0);return mr(n)},e.wbg.__wbg_stringify_e25465938f3f611f=function(){return Ro(function(t){let r=JSON.stringify(Qe(t));return mr(r)},arguments)},e.wbg.__wbg_has_c5fcd020291e56b8=function(){return Ro(function(t,r){return Reflect.has(Qe(t),Qe(r))},arguments)},e.wbg.__wbg_set_092e06b0f9d71865=function(){return Ro(function(t,r,i){return Reflect.set(Qe(t),Qe(r),Qe(i))},arguments)},e.wbg.__wbindgen_debug_string=function(t,r){let i=wD(Qe(r)),n=nw(i,Xt.__wbindgen_malloc,Xt.__wbindgen_realloc),s=Gh;sr()[t/4+1]=s,sr()[t/4+0]=n},e.wbg.__wbindgen_throw=function(t,r){throw new Error(Wu(t,r))},e.wbg.__wbindgen_memory=function(){let t=Xt.memory;return mr(t)},e.wbg.__wbindgen_function_table=function(){let t=Xt.__wbindgen_export_2;return mr(t)},e.wbg.__wbindgen_closure_wrapper1527=function(t,r,i){let n=_ct(t,r,304,yct);return mr(n)},e}function Tct(e,t){return Xt=e.exports,qG.__wbindgen_wasm_module=t,ow=null,aw=null,sw=null,iw=null,Xt}async function qG(e){if(Xt!==void 0)return Xt;typeof e>\"u\"&&(e=new URL(\"arrow2_bg.wasm\",import.meta.url));let t=Sct();(typeof e==\"string\"||typeof Request==\"function\"&&e instanceof Request||typeof URL==\"function\"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await wct(await e,t);return Tct(r,i)}var ZG=qG;function $G(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols==\"function\")for(var n=0,i=Object.getOwnPropertySymbols(e);n=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function ii(e){return this instanceof ii?(this.v=e,this):new ii(e)}function tu(e,t,r){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var i=r.apply(e,t||[]),n,s=[];return n={},o(\"next\"),o(\"throw\"),o(\"return\"),n[Symbol.asyncIterator]=function(){return this},n;function o(R){i[R]&&(n[R]=function(N){return new Promise(function(j,Y){s.push([R,N,j,Y])>1||c(R,N)})})}function c(R,N){try{d(i[R](N))}catch(j){I(s[0][3],j)}}function d(R){R.value instanceof ii?Promise.resolve(R.value.v).then(_,w):I(s[0][2],R)}function _(R){c(\"next\",R)}function w(R){c(\"throw\",R)}function I(R,N){R(N),s.shift(),s.length&&c(s[0][0],s[0][1])}}function Yy(e){var t,r;return t={},i(\"next\"),i(\"throw\",function(n){throw n}),i(\"return\"),t[Symbol.iterator]=function(){return this},t;function i(n,s){t[n]=e[n]?function(o){return(r=!r)?{value:ii(e[n](o)),done:!1}:s?s(o):o}:s}}function Wh(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof YG==\"function\"?YG(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=e[s]&&function(o){return new Promise(function(c,d){o=e[s](o),n(c,d,o.done,o.value)})}}function n(s,o,c,d){Promise.resolve(d).then(function(_){s({value:_,done:c})},o)}}var ND={};mA(ND,{compareArrayLike:()=>zD,joinUint8Arrays:()=>ru,memcpy:()=>hw,rebaseValueOffsets:()=>mP,toArrayBufferView:()=>hi,toArrayBufferViewAsyncIterator:()=>qh,toArrayBufferViewIterator:()=>od,toBigInt64Array:()=>AP,toBigUint64Array:()=>Dct,toFloat32Array:()=>Oct,toFloat32ArrayAsyncIterator:()=>Xct,toFloat32ArrayIterator:()=>Gct,toFloat64Array:()=>Bct,toFloat64ArrayAsyncIterator:()=>Kct,toFloat64ArrayIterator:()=>Wct,toInt16Array:()=>Lct,toInt16ArrayAsyncIterator:()=>Zct,toInt16ArrayIterator:()=>Nct,toInt32Array:()=>hg,toInt32ArrayAsyncIterator:()=>Yct,toInt32ArrayIterator:()=>Uct,toInt8Array:()=>Cct,toInt8ArrayAsyncIterator:()=>qct,toInt8ArrayIterator:()=>zct,toUint16Array:()=>kct,toUint16ArrayAsyncIterator:()=>$ct,toUint16ArrayIterator:()=>Vct,toUint32Array:()=>Rct,toUint32ArrayAsyncIterator:()=>Qct,toUint32ArrayIterator:()=>jct,toUint8Array:()=>Fr,toUint8ArrayAsyncIterator:()=>FD,toUint8ArrayIterator:()=>BD,toUint8ClampedArray:()=>Fct,toUint8ClampedArrayAsyncIterator:()=>Jct,toUint8ClampedArrayIterator:()=>Hct});var Mct=new TextDecoder(\"utf-8\"),cw=e=>Mct.decode(e),Ect=new TextEncoder,sd=e=>Ect.encode(e);var Pct=e=>typeof e==\"number\",QG=e=>typeof e==\"boolean\",Do=e=>typeof e==\"function\",Pl=e=>e!=null&&Object(e)===e,eu=e=>Pl(e)&&Do(e.then);var Hh=e=>Pl(e)&&Do(e[Symbol.iterator]),Hu=e=>Pl(e)&&Do(e[Symbol.asyncIterator]),cP=e=>Pl(e)&&Pl(e.schema);var uP=e=>Pl(e)&&\"done\"in e&&\"value\"in e;var hP=e=>Pl(e)&&Do(e.stat)&&Pct(e.fd);var fP=e=>Pl(e)&&uw(e.body),dP=e=>\"_getDOMStream\"in e&&\"_getNodeStream\"in e,XG=e=>Pl(e)&&Do(e.abort)&&Do(e.getWriter)&&!dP(e),uw=e=>Pl(e)&&Do(e.cancel)&&Do(e.getReader)&&!dP(e),KG=e=>Pl(e)&&Do(e.end)&&Do(e.write)&&QG(e.writable)&&!dP(e),pP=e=>Pl(e)&&Do(e.read)&&Do(e.pipe)&&QG(e.readable)&&!dP(e),JG=e=>Pl(e)&&Do(e.clear)&&Do(e.bytes)&&Do(e.position)&&Do(e.setPosition)&&Do(e.capacity)&&Do(e.getBufferIdentifier)&&Do(e.createLong);var OD=typeof SharedArrayBuffer<\"u\"?SharedArrayBuffer:ArrayBuffer;function Ict(e){let t=e[0]?[e[0]]:[],r,i,n,s;for(let o,c,d=0,_=0,w=e.length;++dw+I.byteLength,0),n,s,o,c=0,d=-1,_=Math.min(t||Number.POSITIVE_INFINITY,i);for(let w=r.length;++dhi(Int8Array,e),Lct=e=>hi(Int16Array,e),hg=e=>hi(Int32Array,e),AP=e=>hi(BigInt64Array,e),Fr=e=>hi(Uint8Array,e),kct=e=>hi(Uint16Array,e),Rct=e=>hi(Uint32Array,e),Dct=e=>hi(BigUint64Array,e),Oct=e=>hi(Float32Array,e),Bct=e=>hi(Float64Array,e),Fct=e=>hi(Uint8ClampedArray,e),DD=e=>(e.next(),e);function*od(e,t){let r=function*(n){yield n},i=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof OD?r(t):Hh(t)?t:r(t);return yield*DD(function*(n){let s=null;do s=n.next(yield hi(e,s));while(!s.done)}(i[Symbol.iterator]())),new e}var zct=e=>od(Int8Array,e),Nct=e=>od(Int16Array,e),Uct=e=>od(Int32Array,e),BD=e=>od(Uint8Array,e),Vct=e=>od(Uint16Array,e),jct=e=>od(Uint32Array,e),Gct=e=>od(Float32Array,e),Wct=e=>od(Float64Array,e),Hct=e=>od(Uint8ClampedArray,e);function qh(e,t){return tu(this,arguments,function*(){if(eu(t))return yield ii(yield ii(yield*Yy(Wh(qh(e,yield ii(t))))));let i=function(o){return tu(this,arguments,function*(){yield yield ii(yield ii(o))})},n=function(o){return tu(this,arguments,function*(){yield ii(yield*Yy(Wh(DD(function*(c){let d=null;do d=c.next(yield d?.value);while(!d.done)}(o[Symbol.iterator]())))))})},s=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof OD?i(t):Hh(t)?n(t):Hu(t)?t:i(t);return yield ii(yield*Yy(Wh(DD(function(o){return tu(this,arguments,function*(){let c=null;do c=yield ii(o.next(yield yield ii(hi(e,c))));while(!c.done)})}(s[Symbol.asyncIterator]()))))),yield ii(new e)})}var qct=e=>qh(Int8Array,e),Zct=e=>qh(Int16Array,e),Yct=e=>qh(Int32Array,e),FD=e=>qh(Uint8Array,e),$ct=e=>qh(Uint16Array,e),Qct=e=>qh(Uint32Array,e),Xct=e=>qh(Float32Array,e),Kct=e=>qh(Float64Array,e),Jct=e=>qh(Uint8ClampedArray,e);function mP(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,n=r.length;++i0)do if(e[r]!==t[r])return!1;while(++r(e.next(),e);function*tut(e){let t,r=!1,i=[],n,s,o,c=0;function d(){return s===\"peek\"?ru(i,o)[0]:([n,i,c]=ru(i,o),n)}({cmd:s,size:o}=(yield null)||{cmd:\"read\",size:0});let _=BD(e)[Symbol.iterator]();try{do if({done:t,value:n}=Number.isNaN(o-c)?_.next():_.next(o-c),!t&&n.byteLength>0&&(i.push(n),c+=n.byteLength),t||o<=c)do({cmd:s,size:o}=yield d());while(o0&&(n.push(s),d+=s.byteLength),r||c<=d)do({cmd:o,size:c}=yield yield ii(_()));while(c0&&(n.push(Fr(s)),d+=s.byteLength),r||c<=d)do({cmd:o,size:c}=yield yield ii(_()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return ir(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return ir(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Fr(r)),r})}},UD=(e,t)=>{let r=n=>i([t,n]),i;return[t,r,new Promise(n=>(i=n)&&e.once(t,r))]};function iut(e){return tu(this,arguments,function*(){let r=[],i=\"error\",n=!1,s=null,o,c,d=0,_=[],w;function I(){return o===\"peek\"?ru(_,c)[0]:([w,_,d]=ru(_,c),w)}if({cmd:o,size:c}=(yield yield ii(null))||{cmd:\"read\",size:0},e.isTTY)return yield yield ii(new Uint8Array(0)),yield ii(null);try{r[0]=UD(e,\"end\"),r[1]=UD(e,\"error\");do{if(r[2]=UD(e,\"readable\"),[i,s]=yield ii(Promise.race(r.map(N=>N[2]))),i===\"error\")break;if((n=i===\"end\")||(Number.isFinite(c-d)?(w=Fr(e.read(c-d)),w.byteLength0&&(_.push(w),d+=w.byteLength)),n||c<=d)do({cmd:o,size:c}=yield yield ii(I()));while(c{for(let[Z,K]of N)e.off(Z,K);try{let Z=e.destroy;Z&&Z.call(e,j),j=void 0}catch(Z){j=Z||j}finally{j!=null?it(j):Y()}})}})}var Qi;(function(e){e[e.V1=0]=\"V1\",e[e.V2=1]=\"V2\",e[e.V3=2]=\"V3\",e[e.V4=3]=\"V4\",e[e.V5=4]=\"V5\"})(Qi||(Qi={}));var vn;(function(e){e[e.Sparse=0]=\"Sparse\",e[e.Dense=1]=\"Dense\"})(vn||(vn={}));var Wi;(function(e){e[e.HALF=0]=\"HALF\",e[e.SINGLE=1]=\"SINGLE\",e[e.DOUBLE=2]=\"DOUBLE\"})(Wi||(Wi={}));var eo;(function(e){e[e.DAY=0]=\"DAY\",e[e.MILLISECOND=1]=\"MILLISECOND\"})(eo||(eo={}));var pr;(function(e){e[e.SECOND=0]=\"SECOND\",e[e.MILLISECOND=1]=\"MILLISECOND\",e[e.MICROSECOND=2]=\"MICROSECOND\",e[e.NANOSECOND=3]=\"NANOSECOND\"})(pr||(pr={}));var Oo;(function(e){e[e.YEAR_MONTH=0]=\"YEAR_MONTH\",e[e.DAY_TIME=1]=\"DAY_TIME\",e[e.MONTH_DAY_NANO=2]=\"MONTH_DAY_NANO\"})(Oo||(Oo={}));var ad=new Int32Array(2),_P=new Float32Array(ad.buffer),yP=new Float64Array(ad.buffer),$y=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var fw;(function(e){e[e.UTF8_BYTES=1]=\"UTF8_BYTES\",e[e.UTF16_STRING=2]=\"UTF16_STRING\"})(fw||(fw={}));var iu=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){_P[0]=r,this.writeInt32(t,ad[0])}writeFloat64(t,r){yP[0]=r,this.writeInt32(t,ad[$y?0:1]),this.writeInt32(t+4,ad[$y?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let n=2;this.addInt16(t-this.object_start);let s=(i+n)*2;this.addInt16(s);let o=0,c=this.space;t:for(r=0;r=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+n),this.addOffset(t),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,n=i-this.bb.readInt32(i);if(!(r=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,i),e.endUnion(t)}};var ww=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var xn;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.FloatingPoint=3]=\"FloatingPoint\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct_=13]=\"Struct_\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.LargeList=21]=\"LargeList\",e[e.RunEndEncoded=22]=\"RunEndEncoded\"})(xn||(xn={}));var il=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):xn.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new ld).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new Bo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,xn.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var rc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):im.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new il).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Bo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,im.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,n,s){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,i),e.addCustomMetadata(t,n),e.addFeatures(t,s),e.endSchema(t)}};var mi;(function(e){e[e.NONE=0]=\"NONE\",e[e.Schema=1]=\"Schema\",e[e.DictionaryBatch=2]=\"DictionaryBatch\",e[e.RecordBatch=3]=\"RecordBatch\",e[e.Tensor=4]=\"Tensor\",e[e.SparseTensor=5]=\"SparseTensor\"})(mi||(mi={}));var Lt;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.Float=3]=\"Float\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct=13]=\"Struct\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.Dictionary=-1]=\"Dictionary\",e[e.Int8=-2]=\"Int8\",e[e.Int16=-3]=\"Int16\",e[e.Int32=-4]=\"Int32\",e[e.Int64=-5]=\"Int64\",e[e.Uint8=-6]=\"Uint8\",e[e.Uint16=-7]=\"Uint16\",e[e.Uint32=-8]=\"Uint32\",e[e.Uint64=-9]=\"Uint64\",e[e.Float16=-10]=\"Float16\",e[e.Float32=-11]=\"Float32\",e[e.Float64=-12]=\"Float64\",e[e.DateDay=-13]=\"DateDay\",e[e.DateMillisecond=-14]=\"DateMillisecond\",e[e.TimestampSecond=-15]=\"TimestampSecond\",e[e.TimestampMillisecond=-16]=\"TimestampMillisecond\",e[e.TimestampMicrosecond=-17]=\"TimestampMicrosecond\",e[e.TimestampNanosecond=-18]=\"TimestampNanosecond\",e[e.TimeSecond=-19]=\"TimeSecond\",e[e.TimeMillisecond=-20]=\"TimeMillisecond\",e[e.TimeMicrosecond=-21]=\"TimeMicrosecond\",e[e.TimeNanosecond=-22]=\"TimeNanosecond\",e[e.DenseUnion=-23]=\"DenseUnion\",e[e.SparseUnion=-24]=\"SparseUnion\",e[e.IntervalDayTime=-25]=\"IntervalDayTime\",e[e.IntervalYearMonth=-26]=\"IntervalYearMonth\",e[e.DurationSecond=-27]=\"DurationSecond\",e[e.DurationMillisecond=-28]=\"DurationMillisecond\",e[e.DurationMicrosecond=-29]=\"DurationMicrosecond\",e[e.DurationNanosecond=-30]=\"DurationNanosecond\"})(Lt||(Lt={}));var xi;(function(e){e[e.OFFSET=0]=\"OFFSET\",e[e.DATA=1]=\"DATA\",e[e.VALIDITY=2]=\"VALIDITY\",e[e.TYPE=3]=\"TYPE\"})(xi||(xi={}));var oO={};mA(oO,{clampIndex:()=>Wut,clampRange:()=>Bw,createElementComparator:()=>dm});var jD={};mA(jD,{valueToString:()=>Qh});function Qh(e){if(e===null)return\"null\";if(e===void 0)return\"undefined\";switch(typeof e){case\"number\":return`${e}`;case\"bigint\":return`${e}`;case\"string\":return`\"${e}\"`}return typeof e[Symbol.toPrimitive]==\"function\"?e[Symbol.toPrimitive](\"string\"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Qh(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r==\"bigint\"?`${r}`:r)}var WD={};mA(WD,{BN:()=>Tw,bigNumToBigInt:()=>r9,bigNumToString:()=>tv,isArrowBigNumSymbol:()=>t9});var t9=Symbol.for(\"isArrowBigNum\");function Xh(e,...t){return t.length===0?Object.setPrototypeOf(hi(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Xh.prototype[t9]=!0;Xh.prototype.toJSON=function(){return`\"${tv(this)}\"`};Xh.prototype.valueOf=function(){return e9(this)};Xh.prototype.toString=function(){return tv(this)};Xh.prototype[Symbol.toPrimitive]=function(e=\"default\"){switch(e){case\"number\":return e9(this);case\"string\":return tv(this);case\"default\":return r9(this)}return tv(this)};function Ky(...e){return Xh.apply(this,e)}function Jy(...e){return Xh.apply(this,e)}function Sw(...e){return Xh.apply(this,e)}Object.setPrototypeOf(Ky.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Jy.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Sw.prototype,Object.create(Uint32Array.prototype));Object.assign(Ky.prototype,Xh.prototype,{constructor:Ky,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Jy.prototype,Xh.prototype,{constructor:Jy,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Sw.prototype,Xh.prototype,{constructor:Sw,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function e9(e){let{buffer:t,byteOffset:r,length:i,signed:n}=e,s=new BigUint64Array(t,r,i),o=n&&s.at(-1)&BigInt(1)<{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return GD(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return GD(e);t=t.slice();let i=1;for(let s=0;se.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:tv(e);function GD(e){let t=\"\",r=new Uint32Array(2),i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),s=-1,o=i.length-1;do{for(r[0]=i[s=0];sNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var i9,n9,s9,o9,a9,l9,c9,u9,h9,f9,d9,p9,A9,m9,g9,_9,y9,v9,x9,b9,w9,S9,Ue=class e{static isNull(t){return t?.typeId===Lt.Null}static isInt(t){return t?.typeId===Lt.Int}static isFloat(t){return t?.typeId===Lt.Float}static isBinary(t){return t?.typeId===Lt.Binary}static isLargeBinary(t){return t?.typeId===Lt.LargeBinary}static isUtf8(t){return t?.typeId===Lt.Utf8}static isLargeUtf8(t){return t?.typeId===Lt.LargeUtf8}static isBool(t){return t?.typeId===Lt.Bool}static isDecimal(t){return t?.typeId===Lt.Decimal}static isDate(t){return t?.typeId===Lt.Date}static isTime(t){return t?.typeId===Lt.Time}static isTimestamp(t){return t?.typeId===Lt.Timestamp}static isInterval(t){return t?.typeId===Lt.Interval}static isDuration(t){return t?.typeId===Lt.Duration}static isList(t){return t?.typeId===Lt.List}static isStruct(t){return t?.typeId===Lt.Struct}static isUnion(t){return t?.typeId===Lt.Union}static isFixedSizeBinary(t){return t?.typeId===Lt.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===Lt.FixedSizeList}static isMap(t){return t?.typeId===Lt.Map}static isDictionary(t){return t?.typeId===Lt.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===vn.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===vn.Sparse}constructor(t){this.typeId=t}};i9=Symbol.toStringTag;Ue[i9]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=\"DataType\"))(Ue.prototype);var na=class extends Ue{constructor(){super(Lt.Null)}toString(){return\"Null\"}};n9=Symbol.toStringTag;na[n9]=(e=>e[Symbol.toStringTag]=\"Null\")(na.prototype);var as=class extends Ue{constructor(t,r){super(Lt.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?\"I\":\"Ui\"}nt${this.bitWidth}`}};s9=Symbol.toStringTag;as[s9]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Int\"))(as.prototype);var Mw=class extends as{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ew=class extends as{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Kh=class extends as{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Pw=class extends as{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Iw=class extends as{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Cw=class extends as{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Lw=class extends as{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},kw=class extends as{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Mw.prototype,\"ArrayType\",{value:Int8Array});Object.defineProperty(Ew.prototype,\"ArrayType\",{value:Int16Array});Object.defineProperty(Kh.prototype,\"ArrayType\",{value:Int32Array});Object.defineProperty(Pw.prototype,\"ArrayType\",{value:BigInt64Array});Object.defineProperty(Iw.prototype,\"ArrayType\",{value:Uint8Array});Object.defineProperty(Cw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty(Lw.prototype,\"ArrayType\",{value:Uint32Array});Object.defineProperty(kw.prototype,\"ArrayType\",{value:BigUint64Array});var po=class extends Ue{constructor(t){super(Lt.Float),this.precision=t}get ArrayType(){switch(this.precision){case Wi.HALF:return Uint16Array;case Wi.SINGLE:return Float32Array;case Wi.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};o9=Symbol.toStringTag;po[o9]=(e=>(e.precision=null,e[Symbol.toStringTag]=\"Float\"))(po.prototype);var Rw=class extends po{constructor(){super(Wi.HALF)}},Dw=class extends po{constructor(){super(Wi.SINGLE)}},ev=class extends po{constructor(){super(Wi.DOUBLE)}};Object.defineProperty(Rw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty(Dw.prototype,\"ArrayType\",{value:Float32Array});Object.defineProperty(ev.prototype,\"ArrayType\",{value:Float64Array});var Zu=class extends Ue{constructor(){super(Lt.Binary)}toString(){return\"Binary\"}};a9=Symbol.toStringTag;Zu[a9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Binary\"))(Zu.prototype);var ud=class extends Ue{constructor(){super(Lt.LargeBinary)}toString(){return\"LargeBinary\"}};l9=Symbol.toStringTag;ud[l9]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeBinary\"))(ud.prototype);var Yu=class extends Ue{constructor(){super(Lt.Utf8)}toString(){return\"Utf8\"}};c9=Symbol.toStringTag;Yu[c9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Utf8\"))(Yu.prototype);var hd=class extends Ue{constructor(){super(Lt.LargeUtf8)}toString(){return\"LargeUtf8\"}};u9=Symbol.toStringTag;hd[u9]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeUtf8\"))(hd.prototype);var ic=class extends Ue{constructor(){super(Lt.Bool)}toString(){return\"Bool\"}};h9=Symbol.toStringTag;ic[h9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Bool\"))(ic.prototype);var $u=class extends Ue{constructor(t,r,i=128){super(Lt.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?\"+\":\"\"}${this.scale}]`}};f9=Symbol.toStringTag;$u[f9]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=\"Decimal\"))($u.prototype);var Qu=class extends Ue{constructor(t){super(Lt.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${eo[this.unit]}>`}};d9=Symbol.toStringTag;Qu[d9]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=\"Date\"))(Qu.prototype);var nc=class extends Ue{constructor(t,r){super(Lt.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${pr[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};p9=Symbol.toStringTag;nc[p9]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Time\"))(nc.prototype);var Xu=class extends Ue{constructor(t,r){super(Lt.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${pr[this.unit]}${this.timezone?`, ${this.timezone}`:\"\"}>`}};A9=Symbol.toStringTag;Xu[A9]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=\"Timestamp\"))(Xu.prototype);var Ku=class extends Ue{constructor(t){super(Lt.Interval),this.unit=t}toString(){return`Interval<${Oo[this.unit]}>`}};m9=Symbol.toStringTag;Ku[m9]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=\"Interval\"))(Ku.prototype);var Ju=class extends Ue{constructor(t){super(Lt.Duration),this.unit=t}toString(){return`Duration<${pr[this.unit]}>`}};g9=Symbol.toStringTag;Ju[g9]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=\"Duration\"))(Ju.prototype);var sc=class extends Ue{constructor(t){super(Lt.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};_9=Symbol.toStringTag;sc[_9]=(e=>(e.children=null,e[Symbol.toStringTag]=\"List\"))(sc.prototype);var on=class extends Ue{constructor(t){super(Lt.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};y9=Symbol.toStringTag;on[y9]=(e=>(e.children=null,e[Symbol.toStringTag]=\"Struct\"))(on.prototype);var oc=class extends Ue{constructor(t,r,i){super(Lt.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((n,s,o)=>(n[s]=o)&&n||n,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(\" | \")}>`}};v9=Symbol.toStringTag;oc[v9]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=\"Union\"))(oc.prototype);var th=class extends Ue{constructor(t){super(Lt.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};x9=Symbol.toStringTag;th[x9]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"FixedSizeBinary\"))(th.prototype);var Il=class extends Ue{constructor(t,r){super(Lt.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};b9=Symbol.toStringTag;Il[b9]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=\"FixedSizeList\"))(Il.prototype);var ac=class extends Ue{constructor(t,r=!1){var i,n,s;if(super(Lt.Map),this.children=[t],this.keysSorted=r,t&&(t.name=\"entries\",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(n=t?.type)===null||n===void 0?void 0:n.children[0];o&&(o.name=\"key\");let c=(s=t?.type)===null||s===void 0?void 0:s.children[1];c&&(c.name=\"value\")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};w9=Symbol.toStringTag;ac[w9]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=\"Map_\"))(ac.prototype);var nut=(e=>()=>++e)(-1),lc=class extends Ue{constructor(t,r,i,n){super(Lt.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=n||!1,this.id=i==null?nut():gs(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};S9=Symbol.toStringTag;lc[S9]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=\"Dictionary\"))(lc.prototype);function su(e){let t=e;switch(e.typeId){case Lt.Decimal:return e.bitWidth/32;case Lt.Timestamp:return 2;case Lt.Date:return 1+t.unit;case Lt.Interval:return 1+t.unit;case Lt.FixedSizeList:return t.listSize;case Lt.FixedSizeBinary:return t.byteWidth;default:return 1}}var Mr=class{visitMany(t,...r){return t.map((i,n)=>this.visit(i,...r.map(s=>s[n])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return sut(this,t,r)}getVisitFnByTypeId(t,r=!0){return rv(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function sut(e,t,r=!0){return typeof t==\"number\"?rv(e,t,r):typeof t==\"string\"&&t in Lt?rv(e,Lt[t],r):t&&t instanceof Ue?rv(e,T9(t),r):t?.type&&t.type instanceof Ue?rv(e,T9(t.type),r):rv(e,Lt.NONE,r)}function rv(e,t,r=!0){let i=null;switch(t){case Lt.Null:i=e.visitNull;break;case Lt.Bool:i=e.visitBool;break;case Lt.Int:i=e.visitInt;break;case Lt.Int8:i=e.visitInt8||e.visitInt;break;case Lt.Int16:i=e.visitInt16||e.visitInt;break;case Lt.Int32:i=e.visitInt32||e.visitInt;break;case Lt.Int64:i=e.visitInt64||e.visitInt;break;case Lt.Uint8:i=e.visitUint8||e.visitInt;break;case Lt.Uint16:i=e.visitUint16||e.visitInt;break;case Lt.Uint32:i=e.visitUint32||e.visitInt;break;case Lt.Uint64:i=e.visitUint64||e.visitInt;break;case Lt.Float:i=e.visitFloat;break;case Lt.Float16:i=e.visitFloat16||e.visitFloat;break;case Lt.Float32:i=e.visitFloat32||e.visitFloat;break;case Lt.Float64:i=e.visitFloat64||e.visitFloat;break;case Lt.Utf8:i=e.visitUtf8;break;case Lt.LargeUtf8:i=e.visitLargeUtf8;break;case Lt.Binary:i=e.visitBinary;break;case Lt.LargeBinary:i=e.visitLargeBinary;break;case Lt.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case Lt.Date:i=e.visitDate;break;case Lt.DateDay:i=e.visitDateDay||e.visitDate;break;case Lt.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case Lt.Timestamp:i=e.visitTimestamp;break;case Lt.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case Lt.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case Lt.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case Lt.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case Lt.Time:i=e.visitTime;break;case Lt.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case Lt.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case Lt.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case Lt.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case Lt.Decimal:i=e.visitDecimal;break;case Lt.List:i=e.visitList;break;case Lt.Struct:i=e.visitStruct;break;case Lt.Union:i=e.visitUnion;break;case Lt.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case Lt.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case Lt.Dictionary:i=e.visitDictionary;break;case Lt.Interval:i=e.visitInterval;break;case Lt.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case Lt.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case Lt.Duration:i=e.visitDuration;break;case Lt.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case Lt.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case Lt.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case Lt.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case Lt.FixedSizeList:i=e.visitFixedSizeList;break;case Lt.Map:i=e.visitMap;break}if(typeof i==\"function\")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${Lt[t]}'`)}function T9(e){switch(e.typeId){case Lt.Null:return Lt.Null;case Lt.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?Lt.Int8:Lt.Uint8;case 16:return r?Lt.Int16:Lt.Uint16;case 32:return r?Lt.Int32:Lt.Uint32;case 64:return r?Lt.Int64:Lt.Uint64}return Lt.Int}case Lt.Float:switch(e.precision){case Wi.HALF:return Lt.Float16;case Wi.SINGLE:return Lt.Float32;case Wi.DOUBLE:return Lt.Float64}return Lt.Float;case Lt.Binary:return Lt.Binary;case Lt.LargeBinary:return Lt.LargeBinary;case Lt.Utf8:return Lt.Utf8;case Lt.LargeUtf8:return Lt.LargeUtf8;case Lt.Bool:return Lt.Bool;case Lt.Decimal:return Lt.Decimal;case Lt.Time:switch(e.unit){case pr.SECOND:return Lt.TimeSecond;case pr.MILLISECOND:return Lt.TimeMillisecond;case pr.MICROSECOND:return Lt.TimeMicrosecond;case pr.NANOSECOND:return Lt.TimeNanosecond}return Lt.Time;case Lt.Timestamp:switch(e.unit){case pr.SECOND:return Lt.TimestampSecond;case pr.MILLISECOND:return Lt.TimestampMillisecond;case pr.MICROSECOND:return Lt.TimestampMicrosecond;case pr.NANOSECOND:return Lt.TimestampNanosecond}return Lt.Timestamp;case Lt.Date:switch(e.unit){case eo.DAY:return Lt.DateDay;case eo.MILLISECOND:return Lt.DateMillisecond}return Lt.Date;case Lt.Interval:switch(e.unit){case Oo.DAY_TIME:return Lt.IntervalDayTime;case Oo.YEAR_MONTH:return Lt.IntervalYearMonth}return Lt.Interval;case Lt.Duration:switch(e.unit){case pr.SECOND:return Lt.DurationSecond;case pr.MILLISECOND:return Lt.DurationMillisecond;case pr.MICROSECOND:return Lt.DurationMicrosecond;case pr.NANOSECOND:return Lt.DurationNanosecond}return Lt.Duration;case Lt.Map:return Lt.Map;case Lt.List:return Lt.List;case Lt.Struct:return Lt.Struct;case Lt.Union:switch(e.mode){case vn.Dense:return Lt.DenseUnion;case vn.Sparse:return Lt.SparseUnion}return Lt.Union;case Lt.FixedSizeBinary:return Lt.FixedSizeBinary;case Lt.FixedSizeList:return Lt.FixedSizeList;case Lt.Dictionary:return Lt.Dictionary}throw new Error(`Unrecognized type '${Lt[e.typeId]}'`)}Mr.prototype.visitInt8=null;Mr.prototype.visitInt16=null;Mr.prototype.visitInt32=null;Mr.prototype.visitInt64=null;Mr.prototype.visitUint8=null;Mr.prototype.visitUint16=null;Mr.prototype.visitUint32=null;Mr.prototype.visitUint64=null;Mr.prototype.visitFloat16=null;Mr.prototype.visitFloat32=null;Mr.prototype.visitFloat64=null;Mr.prototype.visitDateDay=null;Mr.prototype.visitDateMillisecond=null;Mr.prototype.visitTimestampSecond=null;Mr.prototype.visitTimestampMillisecond=null;Mr.prototype.visitTimestampMicrosecond=null;Mr.prototype.visitTimestampNanosecond=null;Mr.prototype.visitTimeSecond=null;Mr.prototype.visitTimeMillisecond=null;Mr.prototype.visitTimeMicrosecond=null;Mr.prototype.visitTimeNanosecond=null;Mr.prototype.visitDenseUnion=null;Mr.prototype.visitSparseUnion=null;Mr.prototype.visitIntervalDayTime=null;Mr.prototype.visitIntervalYearMonth=null;Mr.prototype.visitDuration=null;Mr.prototype.visitDurationSecond=null;Mr.prototype.visitDurationMillisecond=null;Mr.prototype.visitDurationMicrosecond=null;Mr.prototype.visitDurationNanosecond=null;var HD={};mA(HD,{float64ToUint16:()=>Ow,uint16ToFloat64:()=>bP});var M9=new Float64Array(1),iv=new Uint32Array(M9.buffer);function bP(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Ow(e){if(e!==e)return 32256;M9[0]=e;let t=(iv[1]&2147483648)>>16&65535,r=iv[1]&2146435072,i=0;return r>=1089470464?iv[0]>0?r=31744:(r=(r&2080374784)>>16,i=(iv[1]&1048575)>>10):r<=1056964608?(i=1048576+(iv[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(iv[1]&1048575)+512>>10),t|r|i&65535}var Br=class extends Mr{};function Wr(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var out=(e,t,r)=>{e[t]=Math.trunc(r/864e5)},qD=(e,t,r)=>{e[t]=Math.trunc(r%4294967296),e[t+1]=Math.trunc(r/4294967296)},aut=(e,t,r)=>{e[t]=Math.trunc(r*1e3%4294967296),e[t+1]=Math.trunc(r*1e3/4294967296)},lut=(e,t,r)=>{e[t]=Math.trunc(r*1e6%4294967296),e[t+1]=Math.trunc(r*1e6/4294967296)},E9=(e,t,r,i)=>{if(r+1{let n=e+r;i?t[n>>3]|=1<>3]&=~(1<{e[t]=r},ZD=({values:e},t,r)=>{e[t]=r},P9=({values:e},t,r)=>{e[t]=Ow(r)},uut=(e,t,r)=>{switch(e.type.precision){case Wi.HALF:return P9(e,t,r);case Wi.SINGLE:case Wi.DOUBLE:return ZD(e,t,r)}},wP=({values:e},t,r)=>{out(e,t,r.valueOf())},SP=({values:e},t,r)=>{qD(e,t*2,r.valueOf())},YD=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},I9=({values:e,valueOffsets:t},r,i)=>E9(e,t,r,i),C9=({values:e,valueOffsets:t},r,i)=>E9(e,t,r,sd(i)),$D=(e,t,r)=>{e.type.unit===eo.DAY?wP(e,t,r):SP(e,t,r)},TP=({values:e},t,r)=>qD(e,t*2,r/1e3),MP=({values:e},t,r)=>qD(e,t*2,r),EP=({values:e},t,r)=>aut(e,t*2,r),PP=({values:e},t,r)=>lut(e,t*2,r),QD=(e,t,r)=>{switch(e.type.unit){case pr.SECOND:return TP(e,t,r);case pr.MILLISECOND:return MP(e,t,r);case pr.MICROSECOND:return EP(e,t,r);case pr.NANOSECOND:return PP(e,t,r)}},IP=({values:e},t,r)=>{e[t]=r},CP=({values:e},t,r)=>{e[t]=r},LP=({values:e},t,r)=>{e[t]=r},kP=({values:e},t,r)=>{e[t]=r},XD=(e,t,r)=>{switch(e.type.unit){case pr.SECOND:return IP(e,t,r);case pr.MILLISECOND:return CP(e,t,r);case pr.MICROSECOND:return LP(e,t,r);case pr.NANOSECOND:return kP(e,t,r)}},KD=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},hut=(e,t,r)=>{let i=e.children[0],n=e.valueOffsets,s=Sa.getVisitFn(i);if(Array.isArray(r))for(let o=-1,c=n[t],d=n[t+1];c{let i=e.children[0],{valueOffsets:n}=e,s=Sa.getVisitFn(i),{[t]:o,[t+1]:c}=n,d=r instanceof Map?r.entries():Object.entries(r);for(let _ of d)if(s(i,o,_),++o>=c)break},dut=(e,t)=>(r,i,n,s)=>i&&r(i,e,t[s]),put=(e,t)=>(r,i,n,s)=>i&&r(i,e,t.get(s)),Aut=(e,t)=>(r,i,n,s)=>i&&r(i,e,t.get(n.name)),mut=(e,t)=>(r,i,n,s)=>i&&r(i,e,t[n.name]),gut=(e,t,r)=>{let i=e.type.children.map(s=>Sa.getVisitFn(s.type)),n=r instanceof Map?Aut(t,r):r instanceof br?put(t,r):Array.isArray(r)?dut(t,r):mut(t,r);e.type.children.forEach((s,o)=>n(i[o],e.children[o],s,o))},_ut=(e,t,r)=>{e.type.mode===vn.Dense?L9(e,t,r):k9(e,t,r)},L9=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[i];Sa.visit(n,e.valueOffsets[t],r)},k9=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[i];Sa.visit(n,t,r)},yut=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},JD=(e,t,r)=>{e.type.unit===Oo.DAY_TIME?RP(e,t,r):DP(e,t,r)},RP=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},DP=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},OP=({values:e},t,r)=>{e[t]=r},BP=({values:e},t,r)=>{e[t]=r},FP=({values:e},t,r)=>{e[t]=r},zP=({values:e},t,r)=>{e[t]=r},tO=(e,t,r)=>{switch(e.type.unit){case pr.SECOND:return OP(e,t,r);case pr.MILLISECOND:return BP(e,t,r);case pr.MICROSECOND:return FP(e,t,r);case pr.NANOSECOND:return zP(e,t,r)}},vut=(e,t,r)=>{let{stride:i}=e,n=e.children[0],s=Sa.getVisitFn(n);if(Array.isArray(r))for(let o=-1,c=t*i;++o`${Qh(t)}: ${Qh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}[Symbol.iterator](){return new eO(this[Jh],this[nv])}},eO=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return tr.name)}has(t,r){return t[Jh].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Jh].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[Jh].type.children.findIndex(n=>n.name===r);if(i!==-1){let n=Ao.visit(t[Jh].children[i],t[nv]);return Reflect.set(t,r,n),n}}set(t,r,i){let n=t[Jh].type.children.findIndex(s=>s.name===r);return n!==-1?(Sa.visit(t[Jh].children[n],t[nv],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r==\"symbol\"?Reflect.set(t,r,i):!1}};var Er=class extends Mr{};function Vr(e){return(t,r)=>t.getValid(r)?e(t,r):null}var xut=(e,t)=>864e5*e[t],iO=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),but=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,wut=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,R9=e=>new Date(e),Sut=(e,t)=>R9(xut(e,t)),Tut=(e,t)=>R9(iO(e,t)),Mut=(e,t)=>null,D9=(e,t,r)=>{if(r+1>=t.length)return null;let i=gs(t[r]),n=gs(t[r+1]);return e.subarray(i,n)},Eut=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<Sut(e,t),B9=({values:e},t)=>Tut(e,t*2),fm=({stride:e,values:t},r)=>t[e*r],Put=({stride:e,values:t},r)=>bP(t[e*r]),F9=({values:e},t)=>e[t],Iut=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),z9=({values:e,valueOffsets:t},r)=>D9(e,t,r),N9=({values:e,valueOffsets:t},r)=>{let i=D9(e,t,r);return i!==null?cw(i):null},Cut=({values:e},t)=>e[t],Lut=({type:e,values:t},r)=>e.precision!==Wi.HALF?t[r]:bP(t[r]),kut=(e,t)=>e.type.unit===eo.DAY?O9(e,t):B9(e,t),U9=({values:e},t)=>1e3*iO(e,t*2),V9=({values:e},t)=>iO(e,t*2),j9=({values:e},t)=>but(e,t*2),G9=({values:e},t)=>wut(e,t*2),Rut=(e,t)=>{switch(e.type.unit){case pr.SECOND:return U9(e,t);case pr.MILLISECOND:return V9(e,t);case pr.MICROSECOND:return j9(e,t);case pr.NANOSECOND:return G9(e,t)}},W9=({values:e},t)=>e[t],H9=({values:e},t)=>e[t],q9=({values:e},t)=>e[t],Z9=({values:e},t)=>e[t],Dut=(e,t)=>{switch(e.type.unit){case pr.SECOND:return W9(e,t);case pr.MILLISECOND:return H9(e,t);case pr.MICROSECOND:return q9(e,t);case pr.NANOSECOND:return Z9(e,t)}},Out=({values:e,stride:t},r)=>Tw.decimal(e.subarray(t*r,t*(r+1))),But=(e,t)=>{let{valueOffsets:r,stride:i,children:n}=e,{[t*i]:s,[t*i+1]:o}=r,d=n[0].slice(s,o-s);return new br([d])},Fut=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:n,[t+1]:s}=r,o=i[0];return new fd(o.slice(n,s-n))},zut=(e,t)=>new hm(e,t),Nut=(e,t)=>e.type.mode===vn.Dense?Y9(e,t):$9(e,t),Y9=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return Ao.visit(i,e.valueOffsets[t])},$9=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return Ao.visit(i,t)},Uut=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Vut=(e,t)=>e.type.unit===Oo.DAY_TIME?Q9(e,t):X9(e,t),Q9=({values:e},t)=>e.subarray(2*t,2*(t+1)),X9=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},K9=({values:e},t)=>e[t],J9=({values:e},t)=>e[t],tW=({values:e},t)=>e[t],eW=({values:e},t)=>e[t],jut=(e,t)=>{switch(e.type.unit){case pr.SECOND:return K9(e,t);case pr.MILLISECOND:return J9(e,t);case pr.MICROSECOND:return tW(e,t);case pr.NANOSECOND:return eW(e,t)}},Gut=(e,t)=>{let{stride:r,children:i}=e,s=i[0].slice(t*r,r);return new br([s])};Er.prototype.visitNull=Vr(Mut);Er.prototype.visitBool=Vr(Eut);Er.prototype.visitInt=Vr(Cut);Er.prototype.visitInt8=Vr(fm);Er.prototype.visitInt16=Vr(fm);Er.prototype.visitInt32=Vr(fm);Er.prototype.visitInt64=Vr(F9);Er.prototype.visitUint8=Vr(fm);Er.prototype.visitUint16=Vr(fm);Er.prototype.visitUint32=Vr(fm);Er.prototype.visitUint64=Vr(F9);Er.prototype.visitFloat=Vr(Lut);Er.prototype.visitFloat16=Vr(Put);Er.prototype.visitFloat32=Vr(fm);Er.prototype.visitFloat64=Vr(fm);Er.prototype.visitUtf8=Vr(N9);Er.prototype.visitLargeUtf8=Vr(N9);Er.prototype.visitBinary=Vr(z9);Er.prototype.visitLargeBinary=Vr(z9);Er.prototype.visitFixedSizeBinary=Vr(Iut);Er.prototype.visitDate=Vr(kut);Er.prototype.visitDateDay=Vr(O9);Er.prototype.visitDateMillisecond=Vr(B9);Er.prototype.visitTimestamp=Vr(Rut);Er.prototype.visitTimestampSecond=Vr(U9);Er.prototype.visitTimestampMillisecond=Vr(V9);Er.prototype.visitTimestampMicrosecond=Vr(j9);Er.prototype.visitTimestampNanosecond=Vr(G9);Er.prototype.visitTime=Vr(Dut);Er.prototype.visitTimeSecond=Vr(W9);Er.prototype.visitTimeMillisecond=Vr(H9);Er.prototype.visitTimeMicrosecond=Vr(q9);Er.prototype.visitTimeNanosecond=Vr(Z9);Er.prototype.visitDecimal=Vr(Out);Er.prototype.visitList=Vr(But);Er.prototype.visitStruct=Vr(zut);Er.prototype.visitUnion=Vr(Nut);Er.prototype.visitDenseUnion=Vr(Y9);Er.prototype.visitSparseUnion=Vr($9);Er.prototype.visitDictionary=Vr(Uut);Er.prototype.visitInterval=Vr(Vut);Er.prototype.visitIntervalDayTime=Vr(Q9);Er.prototype.visitIntervalYearMonth=Vr(X9);Er.prototype.visitDuration=Vr(jut);Er.prototype.visitDurationSecond=Vr(K9);Er.prototype.visitDurationMillisecond=Vr(J9);Er.prototype.visitDurationMicrosecond=Vr(tW);Er.prototype.visitDurationNanosecond=Vr(eW);Er.prototype.visitFixedSizeList=Vr(Gut);Er.prototype.visitMap=Vr(Fut);var Ao=new Er;var eh=Symbol.for(\"keys\"),sv=Symbol.for(\"vals\"),fd=class{constructor(t){return this[eh]=new br([t.children[0]]).memoize(),this[sv]=t.children[1],new Proxy(this,new sO)}[Symbol.iterator](){return new nO(this[eh],this[sv])}get size(){return this[eh].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[eh],r=this[sv],i={};for(let n=-1,s=t.length;++n`${Qh(t)}: ${Qh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}},nO=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Ao.visit(this.vals,t)]})}},sO=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[eh].toArray().map(String)}has(t,r){return t[eh].includes(r)}getOwnPropertyDescriptor(t,r){if(t[eh].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[eh].indexOf(r);if(i!==-1){let n=Ao.visit(Reflect.get(t,sv),i);return Reflect.set(t,r,n),n}}set(t,r,i){let n=t[eh].indexOf(r);return n!==-1?(Sa.visit(Reflect.get(t,sv),n,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(fd.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:\"Row\"},[eh]:{writable:!0,enumerable:!1,configurable:!1,value:null},[sv]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Wut(e,t,r){let i=e.length,n=t>-1?t:i+t%i;return r?r(e,n):n}var rW;function Bw(e,t,r,i){let{length:n=0}=e,s=typeof t!=\"number\"?0:t,o=typeof r!=\"number\"?n:r;return s<0&&(s=(s%n+n)%n),o<0&&(o=(o%n+n)%n),on&&(o=n),i?i(e,s,o):[s,o]}var iW=e=>e!==e;function dm(e){if(typeof e!==\"object\"||e===null)return iW(e)?iW:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?zD(e,r):!1:e instanceof Map?qut(e):Array.isArray(e)?Hut(e):e instanceof br?Zut(e):Yut(e,!0)}function Hut(e){let t=[];for(let r=-1,i=e.length;++r!1;let i=[];for(let n=-1,s=r.length;++n{if(!r||typeof r!=\"object\")return!1;switch(r.constructor){case Array:return $ut(e,r);case Map:return nW(e,r,r.keys());case fd:case hm:case Object:case void 0:return nW(e,r,t||Object.keys(r))}return r instanceof br?Qut(e,r):!1}}function $ut(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++idg,getBit:()=>sW,getBool:()=>VP,packBools:()=>Ag,popcnt_array:()=>oW,popcnt_bit_range:()=>Fw,popcnt_uint32:()=>UP,setBool:()=>Xut,truncateBitmap:()=>pg});function VP(e,t,r,i){return(r&1<>i}function Xut(e,t,r){return r?!!(e[t>>3]|=1<>3]&=~(1<0||r.byteLength>3):Ag(new dg(r,e,t,null,VP)).subarray(0,i)),n}return r}function Ag(e){let t=[],r=0,i=0,n=0;for(let o of e)o&&(n|=1<0)&&(t[r++]=n);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var dg=class{constructor(t,r,i,n,s){this.bytes=t,this.length=i,this.context=n,this.get=s,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,n=t+(t%8===0?0:8-t%8);return Fw(e,t,n)+Fw(e,i,r)+oW(e,n>>3,i-n>>3)}function oW(e,t,r){let i=0,n=Math.trunc(t),s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:n+r;for(;o-n>=4;)i+=UP(s.getUint32(n)),n+=4;for(;o-n>=2;)i+=UP(s.getUint16(n)),n+=2;for(;o-n>=1;)i+=UP(s.getUint8(n)),n+=1;return i}function UP(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Kut=-1,Si=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return Ue.isSparseUnion(t)?this.children.some(r=>r.nullable):Ue.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:n,typeIds:s}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,c)=>o+c.byteLength,t)}get nullCount(){if(Ue.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let t=this._nullCount,r;return t<=Kut&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-Fw(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,n,s,o=[],c){this.type=t,this.children=o,this.dictionary=c,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1));let d;s instanceof e?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=su(t),s&&((d=s[0])&&(this.valueOffsets=d),(d=s[1])&&(this.values=d),(d=s[2])&&(this.nullBitmap=d),(d=s[3])&&(this.typeIds=d)))}getValid(t){let{type:r}=this;if(Ue.isUnion(r)){let i=r,n=this.children[i.typeIdToChildIndex[this.typeIds[t]]],s=i.mode===vn.Dense?this.valueOffsets[t]:t;return n.getValid(s)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<>3;(!s||s.byteLength<=w)&&(s=new Uint8Array((o+c+63&-64)>>3).fill(255),this.nullCount>0&&s.set(pg(o,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));let I=s[w];i=(I&_)!==0,r?s[w]=I|_:s[w]=I&~_}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,n=this._nullCount,s=this,o=this.children){return new e(t,r,i,n,s,o,this.dictionary)}slice(t,r){let{stride:i,typeId:n,children:s}=this,o=+(this._nullCount===0)-1,c=n===16?i:1,d=this._sliceBuffers(t,r,i,n);return this.clone(this.type,this.offset+t,r,o,d,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*t,c*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===Lt.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,n=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);n[r>>3]=(1<0&&n.set(pg(this.offset,r,this.nullBitmap),0);let s=this.buffers;return s[xi.VALIDITY]=n,this.clone(this.type,0,t,i+(t-r),s)}_sliceBuffers(t,r,i,n){let s,{buffers:o}=this;return(s=o[xi.TYPE])&&(o[xi.TYPE]=s.subarray(t,t+r)),(s=o[xi.OFFSET])&&(o[xi.OFFSET]=s.subarray(t,t+r+1))||(s=o[xi.DATA])&&(o[xi.DATA]=n===6?s:s.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(n=>n.slice(r,i))}};Si.prototype.children=Object.freeze([]);var lO=class e extends Mr{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"length\"]:n=0}=t;return new Si(r,i,n,n)}visitBool(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length>>3,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitInt(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitFloat(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.data),s=Fr(t.nullBitmap),o=hg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,n,s])}visitLargeUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.data),s=Fr(t.nullBitmap),o=AP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,n,s])}visitBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.data),s=Fr(t.nullBitmap),o=hg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,n,s])}visitLargeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.data),s=Fr(t.nullBitmap),o=AP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,n,s])}visitFixedSizeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitDate(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitTimestamp(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitTime(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitDecimal(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:n}=t,s=Fr(t.nullBitmap),o=hg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,void 0,s],[n])}visitStruct(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:n=[]}=t,s=Fr(t.nullBitmap),{length:o=n.reduce((d,{length:_})=>Math.max(d,_),0),nullCount:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,void 0,s],n)}visitUnion(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:n=[]}=t,s=hi(r.ArrayType,t.typeIds),{[\"length\"]:o=s.length,[\"nullCount\"]:c=-1}=t;if(Ue.isSparseUnion(r))return new Si(r,i,o,c,[void 0,void 0,void 0,s],n);let d=hg(t.valueOffsets);return new Si(r,i,o,c,[d,void 0,void 0,s],n)}visitDictionary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.indices.ArrayType,t.data),{[\"dictionary\"]:o=new br([new e().visit({type:r.dictionary})])}=t,{[\"length\"]:c=s.length,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[void 0,s,n],[],o)}visitInterval(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitDuration(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,n=Fr(t.nullBitmap),s=hi(r.ArrayType,t.data),{[\"length\"]:o=s.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,s,n])}visitFixedSizeList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:n=new e().visit({type:r.valueType})}=t,s=Fr(t.nullBitmap),{[\"length\"]:o=n.length/su(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Si(r,i,o,c,[void 0,void 0,s],[n])}visitMap(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:n=new e().visit({type:r.childType})}=t,s=Fr(t.nullBitmap),o=hg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:d=t.nullBitmap?-1:0}=t;return new Si(r,i,c,d,[o,void 0,s],[n])}},Jut=new lO;function _r(e){return Jut.visit(e)}var zw=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function jP(e){return e.reduce((t,r)=>t+r.nullCount,0)}function GP(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function WP(e,t,r,i){let n=[];for(let s=-1,o=e.length;++s=i)break;if(r>=d+_)continue;if(d>=r&&d+_<=i){n.push(c);continue}let w=Math.max(0,r-d),I=Math.min(i-d,_);n.push(c.slice(w,I-w))}return n.length===0&&n.push(e[0].slice(0,0)),n}function cO(e,t,r,i){let n=0,s=0,o=t.length-1;do{if(n>=o-1)return r0?0:-1}function eht(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let n of new dg(r,e.offset+(t||0),e.length,r,VP)){if(!n)return i;++i}return-1}function qr(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case Lt.Union:break;case Lt.Dictionary:break;default:return eht(e,r)}let i=Ao.getVisitFn(e),n=dm(t);for(let s=(r||0)-1,o=e.length;++s{let n=e.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let r=0;return new zw(e.data.length,i=>{let s=e.data[i].length,o=e.slice(r,r+s);return r+=s,new uO(o)})}var uO=class{constructor(t){this.vector=t,this.index=0}next(){return this.indexc.data):t;if(s.length===0||s.some(c=>!(c instanceof Si)))throw new TypeError(\"Vector constructor expects an Array of Data instances.\");let o=(r=s[0])===null||r===void 0?void 0:r.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:c,set:d,indexOf:_}=uW[o.typeId],w=s[0];this.isValid=I=>Nw(w,I),this.get=I=>c(w,I),this.set=(I,R)=>d(w,I,R),this.indexOf=I=>_(w,I),this._offsets=[0,w.length];break}default:Object.setPrototypeOf(this,hW[o.typeId]),this._offsets=GP(s);break}this.data=s,this.type=o,this.stride=su(o),this.numChildren=(n=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&n!==void 0?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return aW(this.data)}get nullCount(){return jP(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Lt[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return av.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Bw(this,t,r,({data:i,_offsets:n},s,o)=>WP(i,n,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:n,ArrayType:s}=this;switch(t.typeId){case Lt.Int:case Lt.Float:case Lt.Decimal:case Lt.Time:case Lt.Timestamp:switch(r.length){case 0:return new s;case 1:return r[0].values.subarray(0,i*n);default:return r.reduce((o,{values:c,length:d})=>(o.array.set(c.subarray(0,d*n),o.offset),o.offset+=d*n,o),{array:new s(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(\",\")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&tr[t])):null}get isMemoized(){return Ue.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ue.isDictionary(this.type)){let t=new ZP(this.data[0].dictionary),r=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new e(r)}return new ZP(this)}unmemoize(){if(Ue.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new e(r)}return this}};cW=Symbol.toStringTag;br[cW]=(e=>{e.type=Ue.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(Lt).map(r=>Lt[r]).filter(r=>typeof r==\"number\"&&r!==Lt.NONE);for(let r of t){let i=Ao.getVisitFnByTypeId(r),n=Sa.getVisitFnByTypeId(r),s=mg.getVisitFnByTypeId(r);uW[r]={get:i,set:n,indexOf:s},hW[r]=Object.create(e,{isValid:{value:ov(Nw)},get:{value:ov(Ao.getVisitFnByTypeId(r))},set:{value:HP(Sa.getVisitFnByTypeId(r))},indexOf:{value:qP(mg.getVisitFnByTypeId(r))}})}return\"Vector\"})(br.prototype);var ZP=class e extends br{constructor(t){super(t.data);let r=this.get,i=this.set,n=this.slice,s=new Array(this.length);Object.defineProperty(this,\"get\",{value(o){let c=s[o];if(c!==void 0)return c;let d=r.call(this,o);return s[o]=d,d}}),Object.defineProperty(this,\"set\",{value(o,c){i.call(this,o,c),s[o]=c}}),Object.defineProperty(this,\"slice\",{value:(o,c)=>new e(n.call(this,o,c))}),Object.defineProperty(this,\"isMemoized\",{value:!0}),Object.defineProperty(this,\"unmemoize\",{value:()=>new br(this.data)}),Object.defineProperty(this,\"memoize\",{value:()=>this})}};function fW(e){if(!e||e.length<=0)return function(n){return!0};let t=\"\",r=e.filter(i=>i===i);return r.length>0&&(t=`\n switch (x) {${r.map(i=>`\n case ${rht(i)}:`).join(\"\")}\n return false;\n }`),e.length!==r.length&&(t=`if (x !== x) return false;\n${t}`),new Function(\"x\",`${t}\nreturn true;`)}function rht(e){return typeof e!=\"bigint\"?Qh(e):`${Qh(e)}n`}function hO(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function dW(e,t=0){return e.length>=t?e.subarray(0,t):hw(new e.constructor(t),e,0)}var tf=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,n=this.buffer.length;i>=n&&this._resize(n===0?hO(i*1,this.BYTES_PER_ELEMENT):hO(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=hO(t*this.stride,this.BYTES_PER_ELEMENT);let r=dW(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=dW(this.buffer,t)}},pp=class extends tf{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},lv=class extends pp{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),n=t>>3,s=t%8,o=i[n]>>s&1;return r?o===0&&(i[n]|=1<=0&&n.fill(n[i],i,t),n[t]=n[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ts=class{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t){throw new Error('\"throughDOM\" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=su(t),this._nulls=new lv,r&&r.length>0&&(this._isValid=fW(r))}toVector(){return new br([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:n,_typeIds:s,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),o.reduce((c,d)=>c+d.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type \"${this.type}\"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,n,{type:s,length:o,nullCount:c,_typeIds:d,_offsets:_,_values:w,_nulls:I}=this;(r=d?.flush(o))?n=_?.flush(o):(n=_?.flush(o))?t=w?.flush(_.last()):t=w?.flush(o),c>0&&(i=I?.flush(o));let R=this.children.map(N=>N.flush());return this.clear(),_r({type:s,length:o,nullCount:c,children:R,child:R[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,n;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(n=this._typeIds)===null||n===void 0||n.clear();for(let s of this.children)s.clear();return this}};ts.prototype.length=1;ts.prototype.stride=1;ts.prototype.children=null;ts.prototype.finished=!1;ts.prototype.nullValues=null;ts.prototype._isValid=()=>!0;var mo=class extends ts{constructor(t){super(t),this._values=new pp(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},cc=class extends ts{constructor(t){super(t),this._pendingLength=0,this._offsets=new cv(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),n=i.get(t);n&&(this._pendingLength-=n.length),this._pendingLength+=r instanceof fd?r[eh].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var gg=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,n){return t.prep(8,24),t.writeInt64(BigInt(n??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var ou=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qi.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new rc).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new gg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new gg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Bo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Qi.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var Ki=class e{constructor(t=[],r,i,n=Qi.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=fO(t)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return\"Schema\"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(\", \")} }>`}select(t){let r=new Set(t),i=this.fields.filter(n=>r.has(n.name));return new e(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),i=[...this.fields],n=YP(YP(new Map,this.metadata),r.metadata),s=r.fields.filter(c=>{let d=i.findIndex(_=>_.name===c.name);return~d?(i[d]=c.clone({metadata:YP(YP(new Map,i[d].metadata),c.metadata)}))&&!1:!0}),o=fO(s,new Map);return new e([...i,...s],n,new Map([...this.dictionaries,...o]))}};Ki.prototype.fields=null;Ki.prototype.metadata=null;Ki.prototype.dictionaries=null;var li=class e{static new(...t){let[r,i,n,s]=t;return t[0]&&typeof t[0]==\"object\"&&({name:r}=t[0],i===void 0&&(i=t[0].type),n===void 0&&(n=t[0].nullable),s===void 0&&(s=t[0].metadata)),new e(`${r}`,i,n,s)}constructor(t,r,i=!1,n){this.name=t,this.type=r,this.nullable=i,this.metadata=n||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return\"Field\"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,n,s]=t;return!t[0]||typeof t[0]!=\"object\"?[r=this.name,i=this.type,n=this.nullable,s=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:n=this.nullable,metadata:s=this.metadata}=t[0],e.new(r,i,n,s)}};li.prototype.type=null;li.prototype.name=null;li.prototype.nullable=null;li.prototype.metadata=null;function YP(e,t){return new Map([...e||new Map,...t||new Map])}function fO(e,t=new Map){for(let r=-1,i=e.length;++r0&&fO(s.children,t)}return t}var iht=fg,nht=iu,Ap=class{static decode(t){t=new nht(Fr(t));let r=ou.getRootAsFooter(t),i=Ki.decode(r.schema(),new Map,r.version());return new dO(i,r)}static encode(t){let r=new iht,i=Ki.encode(r,t.schema);ou.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())mp.encode(r,o);let n=r.endVector();ou.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())mp.encode(r,o);let s=r.endVector();return ou.startFooter(r),ou.addSchema(r,i),ou.addVersion(r,Qi.V5),ou.addRecordBatches(r,n),ou.addDictionaries(r,s),ou.finishFooterBuffer(r,ou.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Qi.V5,i,n){this.schema=t,this.version=r,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return ir(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Vn);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return wa.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return wa.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return ir(this,void 0,void 0,function*(){return yield this.abort(t),Vn})}return(t){return ir(this,void 0,void 0,function*(){return yield this.close(),Vn})}read(t){return ir(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ir(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(Vn)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(\"AsyncQueue is closed\")}};var dd=class extends $P{write(t){if((t=Fr(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?cw(this.toUint8Array(!0)):this.toUint8Array(!1).then(cw)}toUint8Array(t=!1){return t?ru(this._values)[0]:ir(this,void 0,void 0,function*(){var r,i,n,s;let o=[],c=0;try{for(var d=!0,_=Wh(this),w;w=yield _.next(),r=w.done,!r;d=!0){s=w.value,d=!1;let I=s;o.push(I),c+=I.byteLength}}catch(I){i={error:I}}finally{try{!d&&!r&&(n=_.return)&&(yield n.call(_))}finally{if(i)throw i.error}}return ru(o,c)[0]})}},pd=class{constructor(t){t&&(this.source=new pO(wa.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},rh=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof dd?this.source=new gp(wa.fromAsyncIterable(t)):pP(t)?this.source=new gp(wa.fromNodeStream(t)):uw(t)?this.source=new gp(wa.fromDOMStream(t)):fP(t)?this.source=new gp(wa.fromDOMStream(t.body)):Hh(t)?this.source=new gp(wa.fromIterable(t)):eu(t)?this.source=new gp(wa.fromAsyncIterable(t)):Hu(t)&&(this.source=new gp(wa.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},pO=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,\"peek\").value}read(t){return this.next(t,\"read\").value}next(t,r=\"read\"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Vn)}return(t){return Object.create(this.source.return&&this.source.return(t)||Vn)}},gp=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return ir(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return ir(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ir(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(t,r=\"read\"){return ir(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:t})})}throw(t){return ir(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return ir(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Vw=class extends pd{constructor(t,r){super(),this.position=0,this.buffer=Fr(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),tjw,Int128:()=>Gw,Int64:()=>_p,Uint64:()=>_s});function uv(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var hv=8,AO=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],jw=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),n=r[3]*i[3];this.buffer[0]=n&65535;let s=n>>>16;return n=r[2]*i[3],s+=n,n=r[3]*i[2]>>>0,s+=n,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]>>0&&++r[1],r[1]>>0&&++r[2],r[2]>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${uv(this.buffer[3])} ${uv(this.buffer[2])} ${uv(this.buffer[1])} ${uv(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t==\"string\"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith(\"-\"),n=t.length,s=new e(r);for(let o=i?1:0;o0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},QP=class extends Ww{constructor(t,r,i,n,s){super(new Uint8Array(0),r,i,n,s),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Ag(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return hi(Uint8Array,hi(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return hi(Uint8Array,hi(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return Ue.isTimestamp(t)?hi(Uint8Array,_p.convertArray(i[r])):(Ue.isInt(t)||Ue.isTime(t))&&t.bitWidth===64||Ue.isDuration(t)?hi(Uint8Array,_p.convertArray(i[r])):Ue.isDate(t)&&t.unit===eo.MILLISECOND?hi(Uint8Array,_p.convertArray(i[r])):Ue.isDecimal(t)?hi(Uint8Array,Gw.convertArray(i[r])):Ue.isBinary(t)||Ue.isLargeBinary(t)||Ue.isFixedSizeBinary(t)?sht(i[r]):Ue.isBool(t)?Ag(i[r]):Ue.isUtf8(t)||Ue.isLargeUtf8(t)?sd(i[r].join(\"\")):hi(Uint8Array,hi(t.ArrayType,i[r].map(n=>+n)))}};function sht(e){let t=e.join(\"\"),r=new Uint8Array(t.length/2);for(let i=0;i>1]=Number.parseInt(t.slice(i,i+2),16);return r}var yg=class extends cc{constructor(t){super(t),this._values=new tf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Fr(r))}_flushPending(t,r){let i=this._offsets,n=this._values.reserve(r).buffer,s=0;for(let[o,c]of t)if(c===void 0)i.set(o,0);else{let d=c.length;n.set(c,s),i.set(o,d),s+=d}}};var vg=class extends cc{constructor(t){super(t),this._values=new tf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Fr(r))}_flushPending(t,r){let i=this._offsets,n=this._values.reserve(r).buffer,s=0;for(let[o,c]of t)if(c===void 0)i.set(o,BigInt(0));else{let d=c.length;n.set(c,s),i.set(o,BigInt(d)),s+=d}}};var Am=class extends ts{constructor(t){super(t),this._values=new lv}setValue(t,r){this._values.set(t,+r)}};var mm=class extends mo{};mm.prototype._setValue=$D;var fv=class extends mm{};fv.prototype._setValue=wP;var dv=class extends mm{};dv.prototype._setValue=SP;var pv=class extends mo{};pv.prototype._setValue=KD;var Hw=class extends ts{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new lc(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=xg({type:this.type.indices,nullValues:r}),this.dictionary=xg({type:this.type.dictionary,nullValues:null}),typeof i==\"function\"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,n=this.valueToKey(r),s=i[n];return s===void 0&&(i[n]=s=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),n=this.indices.flush().clone(t);return n.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=n.dictionary,this.clear(),n}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t==\"string\"?t:`${t}`}};var Av=class extends mo{};Av.prototype._setValue=YD;var qw=class extends ts{setValue(t,r){let[i]=this.children,n=t*this.stride;for(let s=-1,o=r.length;++s0)throw new Error(\"FixedSizeListBuilder can only have one child.\");let i=this.children.push(t);return this.type=new Il(this.type.listSize,new li(r,t.type,!0)),i}};var gm=class extends mo{setValue(t,r){this._values.set(t,r)}},Zw=class extends gm{setValue(t,r){super.setValue(t,Ow(r))}},Yw=class extends gm{},$w=class extends gm{};var _m=class extends mo{};_m.prototype._setValue=JD;var mv=class extends _m{};mv.prototype._setValue=RP;var gv=class extends _m{};gv.prototype._setValue=DP;var Ad=class extends mo{};Ad.prototype._setValue=tO;var _v=class extends Ad{};_v.prototype._setValue=OP;var yv=class extends Ad{};yv.prototype._setValue=BP;var vv=class extends Ad{};vv.prototype._setValue=FP;var xv=class extends Ad{};xv.prototype._setValue=zP;var au=class extends mo{setValue(t,r){this._values.set(t,r)}},Qw=class extends au{},Xw=class extends au{},Kw=class extends au{},Jw=class extends au{},t2=class extends au{},e2=class extends au{},r2=class extends au{},i2=class extends au{};var n2=class extends cc{constructor(t){super(t),this._offsets=new cv(t.type)}addChild(t,r=\"0\"){if(this.numChildren>0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new sc(new li(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[n,s]of t)if(typeof s>\"u\")r.set(n,0);else{let o=s,c=o.length,d=r.set(n,c).buffer[n];for(let _=-1;++_0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new ac(new li(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[n,s]of t)if(s===void 0)r.set(n,0);else{let{[n]:o,[n+1]:c}=r.set(n,s.size).buffer;for(let d of s.entries())if(i.set(o,d),++o>=c)break}}};var o2=class extends ts{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var a2=class extends ts{setValue(t,r){let{children:i,type:n}=this;switch(Array.isArray(r)||r.constructor){case!0:return n.children.forEach((s,o)=>i[o].set(t,r[o]));case Map:return n.children.forEach((s,o)=>i[o].set(t,r.get(s.name)));default:return n.children.forEach((s,o)=>i[o].set(t,r[s.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new on([...this.type.children,new li(r,t.type,!0)]),i}};var md=class extends mo{};md.prototype._setValue=QD;var bv=class extends md{};bv.prototype._setValue=TP;var wv=class extends md{};wv.prototype._setValue=MP;var Sv=class extends md{};Sv.prototype._setValue=EP;var Tv=class extends md{};Tv.prototype._setValue=PP;var gd=class extends mo{};gd.prototype._setValue=XD;var Mv=class extends gd{};Mv.prototype._setValue=IP;var Ev=class extends gd{};Ev.prototype._setValue=CP;var Pv=class extends gd{};Pv.prototype._setValue=LP;var Iv=class extends gd{};Iv.prototype._setValue=kP;var bg=class extends ts{constructor(t){super(t),this._typeIds=new pp(Int8Array,0,1),typeof t.valueToChildTypeId==\"function\"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let n=this.type.typeIdToChildIndex[i],s=this.children[n];s?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:n,mode:s,typeIds:o}}=this,c=[...n,new li(r,t.type)];return this.type=new oc(s,[...o,i],c),i}_valueToChildTypeId(t,r,i){throw new Error(\"Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.\")}},l2=class extends bg{},c2=class extends bg{constructor(t){super(t),this._offsets=new pp(Int32Array)}setValue(t,r,i){let n=this._typeIds.set(t,i).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[n]),o=this._offsets.set(t,s.length).buffer[t];s?.set(o,r)}};var Cv=class extends cc{constructor(t){super(t),this._values=new tf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,sd(r))}_flushPending(t,r){}};Cv.prototype._flushPending=yg.prototype._flushPending;var Lv=class extends cc{constructor(t){super(t),this._values=new tf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,sd(r))}_flushPending(t,r){}};Lv.prototype._flushPending=vg.prototype._flushPending;var gO=class extends Mr{visitNull(){return o2}visitBool(){return Am}visitInt(){return au}visitInt8(){return Qw}visitInt16(){return Xw}visitInt32(){return Kw}visitInt64(){return Jw}visitUint8(){return t2}visitUint16(){return e2}visitUint32(){return r2}visitUint64(){return i2}visitFloat(){return gm}visitFloat16(){return Zw}visitFloat32(){return Yw}visitFloat64(){return $w}visitUtf8(){return Cv}visitLargeUtf8(){return Lv}visitBinary(){return yg}visitLargeBinary(){return vg}visitFixedSizeBinary(){return Av}visitDate(){return mm}visitDateDay(){return fv}visitDateMillisecond(){return dv}visitTimestamp(){return md}visitTimestampSecond(){return bv}visitTimestampMillisecond(){return wv}visitTimestampMicrosecond(){return Sv}visitTimestampNanosecond(){return Tv}visitTime(){return gd}visitTimeSecond(){return Mv}visitTimeMillisecond(){return Ev}visitTimeMicrosecond(){return Pv}visitTimeNanosecond(){return Iv}visitDecimal(){return pv}visitList(){return n2}visitStruct(){return a2}visitUnion(){return bg}visitDenseUnion(){return c2}visitSparseUnion(){return l2}visitDictionary(){return Hw}visitInterval(){return _m}visitIntervalDayTime(){return mv}visitIntervalYearMonth(){return gv}visitDuration(){return Ad}visitDurationSecond(){return _v}visitDurationMillisecond(){return yv}visitDurationMicrosecond(){return vv}visitDurationNanosecond(){return xv}visitFixedSizeList(){return qw}visitMap(){return s2}},pW=new gO;var Cr=class extends Mr{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,n)=>this.compareFields(i,r[n]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function Cl(e,t){return t instanceof e.constructor}function wg(e,t){return e===t||Cl(e,t)}function yp(e,t){return e===t||Cl(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function XP(e,t){return e===t||Cl(e,t)&&e.precision===t.precision}function oht(e,t){return e===t||Cl(e,t)&&e.byteWidth===t.byteWidth}function _O(e,t){return e===t||Cl(e,t)&&e.unit===t.unit}function u2(e,t){return e===t||Cl(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function h2(e,t){return e===t||Cl(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function aht(e,t){return e===t||Cl(e,t)&&e.children.length===t.children.length&&_d.compareManyFields(e.children,t.children)}function lht(e,t){return e===t||Cl(e,t)&&e.children.length===t.children.length&&_d.compareManyFields(e.children,t.children)}function yO(e,t){return e===t||Cl(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&_d.compareManyFields(e.children,t.children)}function cht(e,t){return e===t||Cl(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&_d.visit(e.indices,t.indices)&&_d.visit(e.dictionary,t.dictionary)}function vO(e,t){return e===t||Cl(e,t)&&e.unit===t.unit}function f2(e,t){return e===t||Cl(e,t)&&e.unit===t.unit}function uht(e,t){return e===t||Cl(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&_d.compareManyFields(e.children,t.children)}function hht(e,t){return e===t||Cl(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&_d.compareManyFields(e.children,t.children)}Cr.prototype.visitNull=wg;Cr.prototype.visitBool=wg;Cr.prototype.visitInt=yp;Cr.prototype.visitInt8=yp;Cr.prototype.visitInt16=yp;Cr.prototype.visitInt32=yp;Cr.prototype.visitInt64=yp;Cr.prototype.visitUint8=yp;Cr.prototype.visitUint16=yp;Cr.prototype.visitUint32=yp;Cr.prototype.visitUint64=yp;Cr.prototype.visitFloat=XP;Cr.prototype.visitFloat16=XP;Cr.prototype.visitFloat32=XP;Cr.prototype.visitFloat64=XP;Cr.prototype.visitUtf8=wg;Cr.prototype.visitLargeUtf8=wg;Cr.prototype.visitBinary=wg;Cr.prototype.visitLargeBinary=wg;Cr.prototype.visitFixedSizeBinary=oht;Cr.prototype.visitDate=_O;Cr.prototype.visitDateDay=_O;Cr.prototype.visitDateMillisecond=_O;Cr.prototype.visitTimestamp=u2;Cr.prototype.visitTimestampSecond=u2;Cr.prototype.visitTimestampMillisecond=u2;Cr.prototype.visitTimestampMicrosecond=u2;Cr.prototype.visitTimestampNanosecond=u2;Cr.prototype.visitTime=h2;Cr.prototype.visitTimeSecond=h2;Cr.prototype.visitTimeMillisecond=h2;Cr.prototype.visitTimeMicrosecond=h2;Cr.prototype.visitTimeNanosecond=h2;Cr.prototype.visitDecimal=wg;Cr.prototype.visitList=aht;Cr.prototype.visitStruct=lht;Cr.prototype.visitUnion=yO;Cr.prototype.visitDenseUnion=yO;Cr.prototype.visitSparseUnion=yO;Cr.prototype.visitDictionary=cht;Cr.prototype.visitInterval=vO;Cr.prototype.visitIntervalDayTime=vO;Cr.prototype.visitIntervalYearMonth=vO;Cr.prototype.visitDuration=f2;Cr.prototype.visitDurationSecond=f2;Cr.prototype.visitDurationMillisecond=f2;Cr.prototype.visitDurationMicrosecond=f2;Cr.prototype.visitDurationNanosecond=f2;Cr.prototype.visitFixedSizeList=uht;Cr.prototype.visitMap=hht;var _d=new Cr;function Sg(e,t){return _d.compareSchemas(e,t)}function AW(e,t){return _d.compareFields(e,t)}function mW(e,t){return _d.visit(e,t)}function xg(e){let t=e.type,r=new(pW.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],n={nullValues:e.nullValues},s=Array.isArray(i)?(o,c)=>i[c]||n:({name:o})=>i[o]||n;for(let[o,c]of t.children.entries()){let{type:d}=c,_=s(c,o);r.children.push(xg(Object.assign(Object.assign({},_),{type:d})))}}return r}function KP(e,t){return fht(e,t.map(r=>r.data.concat()))}function fht(e,t){let r=[...e.fields],i=[],n={numBatches:t.reduce((I,R)=>Math.max(I,R.length),0)},s=0,o=0,c=-1,d=t.length,_,w=[];for(;n.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c0&&(i[s++]=_r({type:new on(r),length:o,nullCount:0,children:w.slice()})))}return[e=e.assign(r),i.map(I=>new Bs(e,I))]}function dht(e,t,r,i,n){var s;let o=(t+63&-64)>>3;for(let c=-1,d=i.length;++c=t)w===t?r[c]=_:(r[c]=_.slice(0,t),n.numBatches=Math.max(n.numBatches,i[c].unshift(_.slice(t,w-t))));else{let I=e[c];e[c]=I.clone({nullable:!0}),r[c]=(s=_?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:_r({type:I.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var _W,Ta=class e{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new Ki([]),this._offsets=[0],this;let n,s;t[0]instanceof Ki&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=d=>{if(d){if(d instanceof Bs)return[d];if(d instanceof e)return d.batches;if(d instanceof Si){if(d.type instanceof on)return[new Bs(new Ki(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(_=>o(_));if(typeof d[Symbol.iterator]==\"function\")return[...d].flatMap(_=>o(_));if(typeof d==\"object\"){let _=Object.keys(d),w=_.map(N=>new br([d[N]])),I=n??new Ki(_.map((N,j)=>new li(String(N),w[j].type,w[j].nullable))),[,R]=KP(I,w);return R.length===0?[new Bs(d)]:R}}}return[]},c=t.flatMap(d=>o(d));if(n=(i=n??((r=c[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new Ki([]),!(n instanceof Ki))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");for(let d of c){if(!(d instanceof Bs))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");if(!Sg(n,d.schema))throw new TypeError(\"Table and inner RecordBatch schemas must be equivalent.\")}this.schema=n,this.batches=c,this._offsets=s??GP(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=jP(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?av.visit(new br(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,\n `)}\n]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:n})=>n));return new e(r,i.map(n=>new Bs(r,n)))}slice(t,r){let i=this.schema;[t,r]=Bw({length:this.numRows},t,r);let n=WP(this.data,this._offsets,t,r);return new e(i,n.map(s=>new Bs(i,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&ti.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],n=_r({type:i,length:0,nullCount:0});r.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new br(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),r)}setChildAt(t,r){let i=this.schema,n=[...this.batches];if(t>-1&&tthis.getChildAt(_));[s[t],c[t]]=[o,r],[i,n]=KP(i,c)}return new e(i,n)}select(t){let r=this.schema.fields.reduce((i,n,s)=>i.set(n.name,s),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(n=>n.selectAt(t));return new e(r,i)}assign(t){let r=this.schema.fields,[i,n]=t.schema.fields.reduce((c,d,_)=>{let[w,I]=c,R=r.findIndex(N=>N.name===d.name);return~R?I[R]=_:w.push(_),c},[[],[]]),s=this.schema.assign(t.schema),o=[...r.map((c,d)=>[d,n[d]]).map(([c,d])=>d===void 0?this.getChildAt(c):t.getChildAt(d)),...i.map(c=>t.getChildAt(c))].filter(Boolean);return new e(...KP(s,o))}};_W=Symbol.toStringTag;Ta[_W]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ov(Nw),e.get=ov(Ao.getVisitFn(Lt.Struct)),e.set=HP(Sa.getVisitFn(Lt.Struct)),e.indexOf=qP(mg.getVisitFn(Lt.Struct)),\"Table\"))(Ta.prototype);var vW,Bs=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Ki))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");if([,this.data=_r({nullCount:0,type:new on(this.schema.fields),children:this.schema.fields.map(r=>_r({type:r.type,nullCount:0}))})]=t,!(this.data instanceof Si))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");[this.schema,this.data]=yW(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:n,length:s}=Object.keys(r).reduce((d,_,w)=>(d.children[w]=r[_],d.length=Math.max(d.length,r[_].length),d.fields[w]=li.new({name:_,type:r[_].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),o=new Ki(i),c=_r({type:new on(i),length:s,children:n,nullCount:0});[this.schema,this.data]=yW(o,c.children,s);break}default:throw new TypeError(\"RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.\")}}get dictionaries(){return this._dictionaries||(this._dictionaries=xW(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Ao.visit(this.data,t)}set(t,r){return Sa.visit(this.data,t,r)}indexOf(t,r){return mg.visit(this.data,t,r)}[Symbol.iterator](){return av.visit(new br([this.data]))}toArray(){return[...this]}concat(...t){return new Ta(this.schema,[this,...t])}slice(t,r){let[i]=new br([this.data]).slice(t,r).data;return new e(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&tn.name===t),r)}setChildAt(t,r){let i=this.schema,n=this.data;if(t>-1&&tc.name===s);~o&&(n[o]=this.data.children[o])}return new e(r,_r({type:i,length:this.numRows,children:n}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),n=_r({type:new on(r.fields),length:this.numRows,children:i});return new e(r,n)}};vW=Symbol.toStringTag;Bs[vW]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,\"RecordBatch\"))(Bs.prototype);function yW(e,t,r=t.reduce((i,n)=>Math.max(i,n.length),0)){var i;let n=[...e.fields],s=[...t],o=(r+63&-64)>>3;for(let[c,d]of e.fields.entries()){let _=t[c];(!_||_.length!==r)&&(n[c]=d.clone({nullable:!0}),s[c]=(i=_?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:_r({type:d.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(n),_r({type:new on(n),length:r,children:s})]}function xW(e,t,r=new Map){var i,n;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let s=-1,o=e.length;++s_r({type:n.type})),i=_r({type:new on(t.fields),nullCount:0,children:r});super(t,i)}};var ef=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qi.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):mi.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt(\"0\")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Bo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Qi.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,mi.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt(\"0\"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,n,s,o){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,i),e.addHeader(t,n),e.addBodyLength(t,s),e.addCustomMetadata(t,o),e.endMessage(t)}};var xO=class extends Mr{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return xw.startNull(r),xw.endNull(r)}visitInt(t,r){return Yh.startInt(r),Yh.addBitWidth(r,t.bitWidth),Yh.addIsSigned(r,t.isSigned),Yh.endInt(r)}visitFloat(t,r){return lm.startFloatingPoint(r),lm.addPrecision(r,t.precision),lm.endFloatingPoint(r)}visitBinary(t,r){return mw.startBinary(r),mw.endBinary(r)}visitLargeBinary(t,r){return _w.startLargeBinary(r),_w.endLargeBinary(r)}visitBool(t,r){return gw.startBool(r),gw.endBool(r)}visitUtf8(t,r){return ww.startUtf8(r),ww.endUtf8(r)}visitLargeUtf8(t,r){return yw.startLargeUtf8(r),yw.endLargeUtf8(r)}visitDecimal(t,r){return cd.startDecimal(r),cd.addScale(r,t.scale),cd.addPrecision(r,t.precision),cd.addBitWidth(r,t.bitWidth),cd.endDecimal(r)}visitDate(t,r){return nm.startDate(r),nm.addUnit(r,t.unit),nm.endDate(r)}visitTime(t,r){return hp.startTime(r),hp.addUnit(r,t.unit),hp.addBitWidth(r,t.bitWidth),hp.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return fp.startTimestamp(r),fp.addUnit(r,t.unit),i!==void 0&&fp.addTimezone(r,i),fp.endTimestamp(r)}visitInterval(t,r){return cm.startInterval(r),cm.addUnit(r,t.unit),cm.endInterval(r)}visitDuration(t,r){return sm.startDuration(r),sm.addUnit(r,t.unit),sm.endDuration(r)}visitList(t,r){return vw.startList(r),vw.endList(r)}visitStruct(t,r){return bw.startStruct_(r),bw.endStruct_(r)}visitUnion(t,r){$h.startTypeIdsVector(r,t.typeIds.length);let i=$h.createTypeIdsVector(r,t.typeIds);return $h.startUnion(r),$h.addMode(r,t.mode),$h.addTypeIds(r,i),$h.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return ld.startDictionaryEncoding(r),ld.addId(r,BigInt(t.id)),ld.addIsOrdered(r,t.isOrdered),i!==void 0&&ld.addIndexType(r,i),ld.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return om.startFixedSizeBinary(r),om.addByteWidth(r,t.byteWidth),om.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return am.startFixedSizeList(r),am.addListSize(r,t.listSize),am.endFixedSizeList(r)}visitMap(t,r){return um.startMap(r),um.addKeysSorted(r,t.keysSorted),um.endMap(r)}},JP=new xO;function TW(e,t=new Map){return new Ki(pht(e,t),t3(e.metadata),t)}function bO(e){return new Ma(e.count,EW(e.columns),PW(e.columns))}function MW(e){return new hc(bO(e.data),e.id,e.isDelta)}function pht(e,t){return(e.fields||[]).filter(Boolean).map(r=>li.fromJSON(r,t))}function bW(e,t){return(e.children||[]).filter(Boolean).map(r=>li.fromJSON(r,t))}function EW(e){return(e||[]).reduce((t,r)=>[...t,new ih(r.count,Aht(r.VALIDITY)),...EW(r.children)],[])}function PW(e,t=[]){for(let r=-1,i=(e||[]).length;++rt+ +(r===0),0)}function IW(e,t){let r,i,n,s,o,c;return!t||!(s=e.dictionary)?(o=SW(e,bW(e,t)),n=new li(e.name,o,e.nullable,t3(e.metadata))):t.has(r=s.id)?(i=(i=s.indexType)?wW(i):new Kh,c=new lc(t.get(r),i,r,s.isOrdered),n=new li(e.name,c,e.nullable,t3(e.metadata))):(i=(i=s.indexType)?wW(i):new Kh,t.set(r,o=SW(e,bW(e,t))),c=new lc(o,i,r,s.isOrdered),n=new li(e.name,c,e.nullable,t3(e.metadata))),n||null}function t3(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function wW(e){return new as(e.isSigned,e.bitWidth)}function SW(e,t){let r=e.type.name;switch(r){case\"NONE\":return new na;case\"null\":return new na;case\"binary\":return new Zu;case\"largebinary\":return new ud;case\"utf8\":return new Yu;case\"largeutf8\":return new hd;case\"bool\":return new ic;case\"list\":return new sc((t||[])[0]);case\"struct\":return new on(t||[]);case\"struct_\":return new on(t||[])}switch(r){case\"int\":{let i=e.type;return new as(i.isSigned,i.bitWidth)}case\"floatingpoint\":{let i=e.type;return new po(Wi[i.precision])}case\"decimal\":{let i=e.type;return new $u(i.scale,i.precision,i.bitWidth)}case\"date\":{let i=e.type;return new Qu(eo[i.unit])}case\"time\":{let i=e.type;return new nc(pr[i.unit],i.bitWidth)}case\"timestamp\":{let i=e.type;return new Xu(pr[i.unit],i.timezone)}case\"interval\":{let i=e.type;return new Ku(Oo[i.unit])}case\"duration\":{let i=e.type;return new Ju(pr[i.unit])}case\"union\":{let i=e.type,[n,...s]=(i.mode+\"\").toLowerCase(),o=n.toUpperCase()+s.join(\"\");return new oc(vn[o],i.typeIds||[],t||[])}case\"fixedsizebinary\":{let i=e.type;return new th(i.byteWidth)}case\"fixedsizelist\":{let i=e.type;return new Il(i.listSize,(t||[])[0])}case\"map\":{let i=e.type;return new ac((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: \"${r}\"`)}var mht=fg,ght=iu,fc=class e{static fromJSON(t,r){let i=new e(0,Qi.V5,r);return i._createHeader=_ht(t,r),i}static decode(t){t=new ght(Fr(t));let r=ef.getRootAsMessage(t),i=r.bodyLength(),n=r.version(),s=r.headerType(),o=new e(i,n,s);return o._createHeader=yht(r,s),o}static encode(t){let r=new mht,i=-1;return t.isSchema()?i=Ki.encode(r,t.header()):t.isRecordBatch()?i=Ma.encode(r,t.header()):t.isDictionaryBatch()&&(i=hc.encode(r,t.header())),ef.startMessage(r),ef.addVersion(r,Qi.V5),ef.addHeader(r,i),ef.addHeaderType(r,t.headerType),ef.addBodyLength(r,BigInt(t.bodyLength)),ef.finishMessageBuffer(r,ef.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof Ki)return new e(0,Qi.V5,mi.Schema,t);if(t instanceof Ma)return new e(r,Qi.V5,mi.RecordBatch,t);if(t instanceof hc)return new e(r,Qi.V5,mi.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===mi.Schema}isRecordBatch(){return this.headerType===mi.RecordBatch}isDictionaryBatch(){return this.headerType===mi.DictionaryBatch}constructor(t,r,i,n){this._version=r,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=gs(t)}},Ma=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=gs(t)}},hc=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,i=!1){this._data=t,this._isDelta=i,this._id=gs(r)}},uc=class{constructor(t,r){this.offset=gs(t),this.length=gs(r)}},ih=class{constructor(t,r){this.length=gs(t),this.nullCount=gs(r)}};function _ht(e,t){return()=>{switch(t){case mi.Schema:return Ki.fromJSON(e);case mi.RecordBatch:return Ma.fromJSON(e);case mi.DictionaryBatch:return hc.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${mi[t]}, type: ${t} }`)}}function yht(e,t){return()=>{switch(t){case mi.Schema:return Ki.decode(e.header(new rc),new Map,e.version());case mi.RecordBatch:return Ma.decode(e.header(new nu),e.version());case mi.DictionaryBatch:return hc.decode(e.header(new up),e.version())}throw new Error(`Unrecognized Message type: { name: ${mi[t]}, type: ${t} }`)}}li.encode=Cht;li.decode=Pht;li.fromJSON=IW;Ki.encode=Iht;Ki.decode=vht;Ki.fromJSON=TW;Ma.encode=Lht;Ma.decode=xht;Ma.fromJSON=bO;hc.encode=kht;hc.decode=bht;hc.fromJSON=MW;ih.encode=Rht;ih.decode=Sht;uc.encode=Dht;uc.decode=wht;function vht(e,t=new Map,r=Qi.V5){let i=Eht(e,t);return new Ki(i,e3(e),t,r)}function xht(e,t=Qi.V5){if(e.compression()!==null)throw new Error(\"Record batch compression not implemented\");return new Ma(e.length(),Tht(e),Mht(e,t))}function bht(e,t=Qi.V5){return new hc(Ma.decode(e.data(),t),e.id(),e.isDelta())}function wht(e){return new uc(e.offset(),e.length())}function Sht(e){return new ih(e.length(),e.nullCount())}function Tht(e){let t=[];for(let r,i=-1,n=-1,s=e.nodesLength();++ili.encode(e,s));rc.startFieldsVector(e,r.length);let i=rc.createFieldsVector(e,r),n=t.metadata&&t.metadata.size>0?rc.createCustomMetadataVector(e,[...t.metadata].map(([s,o])=>{let c=e.createString(`${s}`),d=e.createString(`${o}`);return Bo.startKeyValue(e),Bo.addKey(e,c),Bo.addValue(e,d),Bo.endKeyValue(e)})):-1;return rc.startSchema(e),rc.addFields(e,i),rc.addEndianness(e,Oht?im.Little:im.Big),n!==-1&&rc.addCustomMetadata(e,n),rc.endSchema(e)}function Cht(e,t){let r=-1,i=-1,n=-1,s=t.type,o=t.typeId;Ue.isDictionary(s)?(o=s.dictionary.typeId,n=JP.visit(s,e),i=JP.visit(s.dictionary,e)):i=JP.visit(s,e);let c=(s.children||[]).map(w=>li.encode(e,w)),d=il.createChildrenVector(e,c),_=t.metadata&&t.metadata.size>0?il.createCustomMetadataVector(e,[...t.metadata].map(([w,I])=>{let R=e.createString(`${w}`),N=e.createString(`${I}`);return Bo.startKeyValue(e),Bo.addKey(e,R),Bo.addValue(e,N),Bo.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),il.startField(e),il.addType(e,i),il.addTypeType(e,o),il.addChildren(e,d),il.addNullable(e,!!t.nullable),r!==-1&&il.addName(e,r),n!==-1&&il.addDictionary(e,n),_!==-1&&il.addCustomMetadata(e,_),il.endField(e)}function Lht(e,t){let r=t.nodes||[],i=t.buffers||[];nu.startNodesVector(e,r.length);for(let o of r.slice().reverse())ih.encode(e,o);let n=e.endVector();nu.startBuffersVector(e,i.length);for(let o of i.slice().reverse())uc.encode(e,o);let s=e.endVector();return nu.startRecordBatch(e),nu.addLength(e,BigInt(t.length)),nu.addNodes(e,n),nu.addBuffers(e,s),nu.endRecordBatch(e)}function kht(e,t){let r=Ma.encode(e,t.data);return up.startDictionaryBatch(e),up.addId(e,BigInt(t.id)),up.addIsDelta(e,t.isDelta),up.addData(e,r),up.endDictionaryBatch(e)}function Rht(e,t){return Xy.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Dht(e,t){return Qy.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Oht=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var SO=e=>`Expected ${mi[e]} Message in stream, but was null or length 0.`,TO=e=>`Header pointer of flatbuffer-encoded ${mi[e]} Message is null or length 0.`,RW=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,DW=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,kv=class{constructor(t){this.source=t instanceof pd?t:new pd(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Vn:t.value===-1&&(t=this.readMetadataLength()).done?Vn:(t=this.readMetadata(t.value)).done?Vn:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(SO(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Fr(this.source.read(t));if(r.byteLength[...n,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...r(s.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(SO(t));return r.value}readSchema(){let t=mi.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(TO(t));return i}},r3=4,wO=\"ARROW1\",Rv=new Uint8Array(wO.length);for(let e=0;ethis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return wa.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return wa.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}static from(t){return t instanceof e?t:cP(t)?Fht(t):hP(t)?Uht(t):eu(t)?ir(this,void 0,void 0,function*(){return yield e.from(yield t)}):fP(t)||uw(t)||pP(t)||Hu(t)?Nht(new rh(t)):zht(new pd(t))}static readAll(t){return t instanceof e?t.isSync()?BW(t):FW(t):cP(t)||ArrayBuffer.isView(t)||Hh(t)||uP(t)?BW(t):FW(t)}},vp=class extends lu{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return tu(this,arguments,function*(){yield ii(yield*Yy(Wh(this[Symbol.iterator]())))})}},Mg=class extends lu{constructor(t){super(t),this._impl=t}readAll(){var t,r,i,n;return ir(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,c=Wh(this),d;d=yield c.next(),t=d.done,!t;o=!0){n=d.value,o=!1;let _=n;s.push(_)}}catch(_){r={error:_}}finally{try{!o&&!t&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return s})}[Symbol.iterator](){throw new Error(\"AsyncRecordBatchStreamReader is not Iterable\")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Eg=class extends vp{constructor(t){super(t),this._impl=t}},n3=class extends Mg{constructor(t){super(t),this._impl=t}},s3=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),n=_r({type:new on(this.schema.fields),length:t.length,children:i});return new Bs(this.schema,n)}_loadDictionaryBatch(t,r){let{id:i,isDelta:n}=t,{dictionaries:s,schema:o}=this,c=s.get(i);if(n||!c){let d=o.dictionaries.get(i),_=this._loadVectors(t.data,r,[d]);return(c&&n?c.concat(new br(_)):new br(_)).memoize()}return c.memoize()}_loadVectors(t,r,i){return new Ww(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},Ov=class extends s3{constructor(t,r){super(r),this._reader=cP(t)?new p2(this._handle=t):new kv(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=zW(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Vn}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Vn}next(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=r.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Tg(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Bv=class extends s3{constructor(t,r){super(r),this._reader=new d2(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ir(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return ir(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=zW(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return ir(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Vn})}return(t){return ir(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Vn})}next(){return ir(this,void 0,void 0,function*(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=yield r.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Tg(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return ir(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},o3=class extends Ov{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Vw?t:new Vw(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(mi.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(mi.DictionaryBatch);if(n?.isDictionaryBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}}_readFooter(){let{_handle:t}=this,r=t.size-MO,i=t.readInt32(r),n=t.readAt(r-i,i);return Ap.decode(n)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return ir(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){var r;return ir(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(mi.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var r;return ir(this,void 0,void 0,function*(){let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(mi.DictionaryBatch);if(n?.isDictionaryBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}})}_readFooter(){return ir(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-MO,i=yield t.readInt32(r),n=yield t.readAt(r-i,i);return Ap.decode(n)})}_readNextMessageAndValidate(t){return ir(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?i3(t)?new Eg(new o3(e.read())):new vp(new Ov(e)):new vp(new Ov(function*(){}()))}function Nht(e){return ir(this,void 0,void 0,function*(){let t=yield e.peek(Dv+7&-8);return t&&t.byteLength>=4?i3(t)?new Eg(new o3(yield e.read())):new Mg(new Bv(e)):new Mg(new Bv(function(){return tu(this,arguments,function*(){})}()))})}function Uht(e){return ir(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new pm(e,t);return t>=OW&&i3(yield r.readAt(0,Dv+7&-8))?new n3(new EO(r)):new Mg(new Bv(r))})}var ls=class e extends Mr{static assemble(...t){let r=n=>n.flatMap(s=>Array.isArray(s)?r(s):s instanceof Bs?s.data.children:s.data),i=new e;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof br)return this.visitMany(t.data),this;let{type:r}=t;if(!Ue.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError(\"Cannot write arrays larger than 2^31 - 1 in length\");if(Ue.isUnion(r))this.nodes.push(new ih(i,0));else{let{nullCount:n}=t;Ue.isNull(r)||rf.call(this,n<=0?new Uint8Array(0):pg(t.offset,i,t.nullBitmap)),this.nodes.push(new ih(i,n))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function rf(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new uc(this._byteLength,t)),this._byteLength+=t,this}function Vht(e){var t;let{type:r,length:i,typeIds:n,valueOffsets:s}=e;if(rf.call(this,n),r.mode===vn.Sparse)return IO.call(this,e);if(r.mode===vn.Dense){if(e.offset<=0)return rf.call(this,s),IO.call(this,e);{let o=new Int32Array(i),c=Object.create(null),d=Object.create(null);for(let _,w,I=-1;++I{let I=r.typeIds[w],R=c[I],N=d[I];return _.slice(R,Math.min(i,N))}))}}return this}function jht(e){let t;return e.nullCount>=e.length?rf.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?rf.call(this,pg(e.offset,e.length,t)):rf.call(this,Ag(e.values))}function xp(e){return rf.call(this,e.values.subarray(0,e.length*e.stride))}function a3(e){let{length:t,values:r,valueOffsets:i}=e,n=gs(i[0]),s=gs(i[t]),o=Math.min(s-n,r.byteLength-n);return rf.call(this,mP(-n,t+1,i)),rf.call(this,r.subarray(n,n+o)),this}function CO(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:n}=r;return rf.call(this,mP(-i,t+1,r)),this.visit(e.children[0].slice(i,n-i))}return this.visit(e.children[0])}function IO(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ls.prototype.visitBool=jht;ls.prototype.visitInt=xp;ls.prototype.visitFloat=xp;ls.prototype.visitUtf8=a3;ls.prototype.visitLargeUtf8=a3;ls.prototype.visitBinary=a3;ls.prototype.visitLargeBinary=a3;ls.prototype.visitFixedSizeBinary=xp;ls.prototype.visitDate=xp;ls.prototype.visitTimestamp=xp;ls.prototype.visitTime=xp;ls.prototype.visitDecimal=xp;ls.prototype.visitList=CO;ls.prototype.visitStruct=IO;ls.prototype.visitUnion=Vht;ls.prototype.visitInterval=xp;ls.prototype.visitDuration=xp;ls.prototype.visitFixedSizeList=CO;ls.prototype.visitMap=CO;var Pg=class extends _g{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new dd,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Pl(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy==\"boolean\"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat==\"boolean\"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return eu(t)?t.then(r=>this.writeAll(r)):Hu(t)?kO(this,t):LO(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof dd?this._sink=t:(this._sink=new dd,t&&XG(t)?this.toDOMStream({type:\"bytes\"}).pipeTo(t):t&&KG(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Sg(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Ta&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Bs&&!(r=t.schema))return this.finish()&&void 0}else throw new Error(\"RecordBatchWriter is closed\");if(r&&!Sg(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Bs?t instanceof Tg||this._writeRecordBatch(t):t instanceof Ta?this.writeAll(t.batches):Hh(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,n=fc.encode(t),s=n.byteLength,o=this._writeLegacyIpcFormat?4:8,c=s+o+i&~i,d=c-s-o;return t.headerType===mi.RecordBatch?this._recordBatchBlocks.push(new mp(c,t.bodyLength,this._position)):t.headerType===mi.DictionaryBatch&&this._dictionaryBlocks.push(new mp(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),s>0&&this._write(n),this._writePadding(d)}_write(t){if(this._started){let r=Fr(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(fc.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Rv)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:n,buffers:s}=ls.assemble(t),o=new Ma(t.numRows,i,n),c=fc.from(o,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(s)}_writeDictionaryBatch(t,r,i=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:n,nodes:s,bufferRegions:o,buffers:c}=ls.assemble(new br([t])),d=new Ma(t.length,s,o),_=new hc(d,r,i),w=fc.from(_,n);return this._writeMessage(w)._writeBodyBuffers(c)}_writeBodyBuffers(t){let r,i,n;for(let s=-1,o=t.length;++s0&&(this._write(r),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){for(let[r,i]of t.dictionaries){let n=this._dictionaryDeltaOffsets.get(r)||0;if(n===0||(i=i?.slice(n)).length>0)for(let s of i.data)this._writeDictionaryBatch(s,r,n>0),n+=s.length}return this}},A2=class e extends Pg{static writeAll(t,r){let i=new e(r);return eu(t)?t.then(n=>i.writeAll(n)):Hu(t)?kO(i,t):LO(i,t)}},m2=class e extends Pg{static writeAll(t){let r=new e;return eu(t)?t.then(i=>r.writeAll(i)):Hu(t)?kO(r,t):LO(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=Ap.encode(new Ap(t,Qi.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function LO(e,t){let r=t;t instanceof Ta&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function kO(e,t){var r,i,n,s,o,c,d;return ir(this,void 0,void 0,function*(){try{for(r=!0,i=Wh(t);n=yield i.next(),s=n.done,!s;r=!0){d=n.value,r=!1;let _=d;e.write(_)}}catch(_){o={error:_}}finally{try{!r&&!s&&(c=i.return)&&(yield c.call(i))}finally{if(o)throw o.error}}return e.finish()})}function NW(e,t){if(Hu(e))return Wht(e,t);if(Hh(e))return Ght(e,t);throw new Error(\"toDOMStream() must be called with an Iterable or AsyncIterable\")}function Ght(e,t){let r=null,i=t?.type===\"bytes\"||!1,n=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,r||(r=e[Symbol.iterator]()))},pull(o){r?s(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,c){let d,_=null,w=o.desiredSize||null;for(;!(_=c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(d=Fr(_.value))&&(w!=null&&i&&(w=w-d.byteLength+1),_.value=d),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()}}function Wht(e,t){let r=null,i=t?.type===\"bytes\"||!1,n=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return ir(this,void 0,void 0,function*(){yield s(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return ir(this,void 0,void 0,function*(){r?yield s(o,r):o.close()})},cancel(){return ir(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,c){return ir(this,void 0,void 0,function*(){let d,_=null,w=o.desiredSize||null;for(;!(_=yield c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(d=Fr(_.value))&&(w!=null&&i&&(w=w-d.byteLength+1),_.value=d),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()})}}function jW(e){return new RO(e)}var RO=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{[\"readableStrategy\"]:r,[\"writableStrategy\"]:i,[\"queueingStrategy\"]:n=\"count\"}=t,s=$G(t,[\"readableStrategy\",\"writableStrategy\",\"queueingStrategy\"]);this._controller=null,this._builder=xg(s),this._getSize=n!==\"bytes\"?UW:VW;let{[\"highWaterMark\"]:o=n===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},r),{[\"highWaterMark\"]:c=n===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:d=>{this._maybeFlush(this._builder,this._controller=d)},start:d=>{this._maybeFlush(this._builder,this._controller=d)}},{highWaterMark:o,size:n!==\"bytes\"?UW:VW}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:d=>this._writeValueAndReturnChunkSize(d)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},UW=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},VW=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function l3(e,t){let r=new dd,i=null,n=new ReadableStream({cancel(){return ir(this,void 0,void 0,function*(){yield r.close()})},start(c){return ir(this,void 0,void 0,function*(){yield o(c,i||(i=yield s()))})},pull(c){return ir(this,void 0,void 0,function*(){i?yield o(c,i):c.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:n};function s(){return ir(this,void 0,void 0,function*(){return yield(yield lu.from(r)).open(t)})}function o(c,d){return ir(this,void 0,void 0,function*(){let _=c.desiredSize,w=null;for(;!(w=yield d.next()).done;)if(c.enqueue(w.value),_!=null&&--_<=0)return;c.close()})}}function c3(e,t){let r=new this(e),i=new rh(r),n=new ReadableStream({cancel(){return ir(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return ir(this,void 0,void 0,function*(){yield s(o)})},start(o){return ir(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:n};function s(o){return ir(this,void 0,void 0,function*(){let c=null,d=o.desiredSize;for(;c=yield i.read(d||null);)if(o.enqueue(c),d!=null&&(d-=c.byteLength)<=0)return;o.close()})}}function g2(e){let t=lu.from(e);return eu(t)?t.then(r=>g2(r)):t.isAsync()?t.readAll().then(r=>new Ta(r)):new Ta(t.readAll())}var fft=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},WD),mO),aO),HD),ND),oO),jD),{compareSchemas:Sg,compareFields:AW,compareTypes:mW});wa.toDOMStream=NW;ts.throughDOM=jW;lu.throughDOM=l3;Eg.throughDOM=l3;vp.throughDOM=l3;Pg.throughDOM=c3;m2.throughDOM=c3;A2.throughDOM=c3;var dft=\"0.5.0\",pft=`https://cdn.jsdelivr.net/npm/parquet-wasm@${dft}/esm/arrow2_bg.wasm`,DO=!1;async function GW(){DO||(await ZG(pft),DO=!0)}function Aft(e){if(!DO)throw new Error(\"wasm not ready\");console.time(\"readParquet\");let t=WG(new Uint8Array(e.buffer)).intoIPCStream(),r=g2(t);return console.timeEnd(\"readParquet\"),r}function _2(e){let t=[];for(let r of e){let i=Aft(r);i.batches.length!==1&&console.warn(\"Expected one batch\"),t.push(...i.batches)}return new Ta(t)}var WW=bi(Yi(),1);function OO(e){return e instanceof Array&&e?.[0]instanceof DataView?e?.[0].byteLength>0?_2(e).getChildAt(0):null:e}var Ig=class{model;callbacks;updateStateCallback;constructor(t,r){this.model=t,this.model.on(\"change\",r),this.updateStateCallback=r,this.callbacks=new Map,this.callbacks.set(\"change\",r)}async loadSubModels(){}initRegularAttribute(t,r){this[r]=this.model.get(t),this.model.off(`change:${t}`);let i=()=>{this[r]=this.model.get(t)};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}initVectorizedAccessor(t,r){this[r]=OO(this.model.get(t)),this.model.off(`change:${t}`);let i=()=>{this[r]=OO(this.model.get(t))};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}finalize(){for(let[t,r]of Object.entries(this.callbacks))this.model.off(t,r)}};async function h3(e,t){let r=[];for(let i of t)r.push(e.get_model(i.slice(10)));return await Promise.all(r)}function fe(e){return e!=null}var mft=`\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n`,gft=`\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n`,_ft={source:0,target:1,custom:2,source_target:3},yft={\"vs:DECKGL_FILTER_GL_POSITION\":`\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n `},HW={name:\"brushing\",dependencies:[Fh],vs:mft,fs:gft,inject:yft,getUniforms:e=>{if(!e||!(\"viewport\"in e))return{};let{brushingEnabled:t=!0,brushingRadius:r=1e4,brushingTarget:i=\"source\",mousePosition:n,viewport:s}=e;return{brushing_enabled:!!(t&&n&&s.containsPixel(n)),brushing_radius:r,brushing_target:_ft[i]||0,brushing_mousePos:n?s.unproject([n.x-s.x,n.y-s.y]):[0,0]}}};var vft={getBrushingTarget:{type:\"accessor\",value:[0,0]},brushingTarget:\"source\",brushingEnabled:!0,brushingRadius:1e4},ym=class extends Gu{getShaders(){return{modules:[HW]}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:\"getBrushingTarget\",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}}),this.state.onMouseMove=()=>{var n;(n=this.getCurrentLayer())===null||n===void 0||n.setNeedsRedraw()},t.deck&&t.deck.eventManager.on({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}finalizeState(t,r){t.deck&&t.deck.eventManager.off({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}};G(ym,\"defaultProps\",vft);G(ym,\"extensionName\",\"BrushingExtension\");var qW=`\nuniform DATAFILTER_TYPE filter_min;\nuniform DATAFILTER_TYPE filter_softMin;\nuniform DATAFILTER_TYPE filter_softMax;\nuniform DATAFILTER_TYPE filter_max;\nuniform bool filter_useSoftMargin;\nuniform bool filter_enabled;\nuniform bool filter_transformSize;\n\n#ifdef NON_INSTANCED_MODEL\n #define DATAFILTER_ATTRIB filterValues\n #define DATAFILTER_ATTRIB_64LOW filterValues64Low\n#else\n #define DATAFILTER_ATTRIB instanceFilterValues\n #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low\n#endif\n\nattribute DATAFILTER_TYPE DATAFILTER_ATTRIB;\n#ifdef DATAFILTER_DOUBLE\n attribute DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;\n\n uniform DATAFILTER_TYPE filter_min64High;\n uniform DATAFILTER_TYPE filter_max64High;\n#endif\n\nvarying float dataFilter_value;\n\nfloat dataFilter_reduceValue(float value) {\n return value;\n}\nfloat dataFilter_reduceValue(vec2 value) {\n return min(value.x, value.y);\n}\nfloat dataFilter_reduceValue(vec3 value) {\n return min(min(value.x, value.y), value.z);\n}\nfloat dataFilter_reduceValue(vec4 value) {\n return min(min(value.x, value.y), min(value.z, value.w));\n}\nvoid dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) {\n if (filter_enabled) {\n if (filter_useSoftMargin) {\n dataFilter_value = dataFilter_reduceValue(\n smoothstep(filter_min, filter_softMin, valueFromMin) *\n (1.0 - smoothstep(filter_softMax, filter_max, valueFromMax))\n );\n } else {\n dataFilter_value = dataFilter_reduceValue(\n step(filter_min, valueFromMin) * step(valueFromMax, filter_max)\n );\n }\n } else {\n dataFilter_value = 1.0;\n }\n}\n`,ZW=`\nuniform bool filter_transformColor;\nvarying float dataFilter_value;\n`;function YW(e){if(!e||!(\"extensions\"in e))return{};let{filterRange:t=[-1,1],filterEnabled:r=!0,filterTransformSize:i=!0,filterTransformColor:n=!0}=e,s=e.filterSoftRange||t;return{...Number.isFinite(t[0])?{filter_min:t[0],filter_softMin:s[0],filter_softMax:s[1],filter_max:t[1]}:{filter_min:t.map(o=>o[0]),filter_softMin:s.map(o=>o[0]),filter_softMax:s.map(o=>o[1]),filter_max:t.map(o=>o[1])},filter_enabled:r,filter_useSoftMargin:!!e.filterSoftRange,filter_transformSize:r&&i,filter_transformColor:r&&n}}function xft(e){if(!e||!(\"extensions\"in e))return{};let t=YW(e);if(Number.isFinite(t.filter_min)){let r=Math.fround(t.filter_min);t.filter_min-=r,t.filter_softMin-=r,t.filter_min64High=r;let i=Math.fround(t.filter_max);t.filter_max-=i,t.filter_softMax-=i,t.filter_max64High=i}else{let r=t.filter_min.map(Math.fround);t.filter_min=t.filter_min.map((n,s)=>n-r[s]),t.filter_softMin=t.filter_softMin.map((n,s)=>n-r[s]),t.filter_min64High=r;let i=t.filter_max.map(Math.fround);t.filter_max=t.filter_max.map((n,s)=>n-i[s]),t.filter_softMax=t.filter_softMax.map((n,s)=>n-i[s]),t.filter_max64High=i}return t}var $W={\"vs:#main-start\":`\n #ifdef DATAFILTER_DOUBLE\n dataFilter_setValue(\n DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,\n DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW\n );\n #else\n dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB);\n #endif\n `,\"vs:#main-end\":`\n if (dataFilter_value == 0.0) {\n gl_Position = vec4(0.);\n }\n `,\"vs:DECKGL_FILTER_SIZE\":`\n if (filter_transformSize) {\n size = size * dataFilter_value;\n }\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (dataFilter_value == 0.0) discard;\n if (filter_transformColor) {\n color.a *= dataFilter_value;\n }\n `},QW={name:\"data-filter\",vs:qW,fs:ZW,inject:$W,getUniforms:YW},XW={name:\"data-filter-fp64\",vs:qW,fs:ZW,inject:$W,getUniforms:xft};var bft=`#define SHADER_NAME data-filter-vertex-shader\n\n#ifdef FLOAT_TARGET\n attribute float filterIndices;\n attribute float filterPrevIndices;\n#else\n attribute vec2 filterIndices;\n attribute vec2 filterPrevIndices;\n#endif\n\nvarying vec4 vColor;\nconst float component = 1.0 / 255.0;\n\nvoid main() {\n #ifdef FLOAT_TARGET\n dataFilter_value *= float(filterIndices != filterPrevIndices);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n vColor = vec4(0.0, 0.0, 0.0, 1.0);\n #else\n // Float texture is not supported: pack result into 4 channels x 256 px x 64px\n dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);\n float col = filterIndices.x;\n float row = filterIndices.y * 4.0;\n float channel = floor(row);\n row = fract(row);\n vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));\n gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);\n #endif\n gl_PointSize = 1.0;\n}\n`,wft=`#define SHADER_NAME data-filter-fragment-shader\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n if (dataFilter_value < 0.5) {\n discard;\n }\n gl_FragColor = vColor;\n}\n`;function KW(e){return!!(e.getExtension(\"EXT_float_blend\")&&(e.getExtension(\"EXT_color_buffer_float\")||e.getExtension(\"WEBGL_color_buffer_float\")))}function JW(e,t){return t?new pi(e,{width:1,height:1,attachments:{36064:new ui(e,{format:fr(e)?34836:6408,type:5126,mipmaps:!1})}}):new pi(e,{width:256,height:64,depth:!1})}function tH(e,t,r){return t.defines.NON_INSTANCED_MODEL=1,r&&(t.defines.FLOAT_TARGET=1),new _n(e,{id:\"data-filter-aggregation-model\",vertexCount:1,isInstanced:!1,drawMode:0,vs:bft,fs:wft,...t})}var eH={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Tft={getFilterValue:{type:\"accessor\",value:0},onFilteredItemsChange:{type:\"function\",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterTransformSize:!0,filterTransformColor:!0},rH={1:\"float\",2:\"vec2\",3:\"vec3\",4:\"vec4\"},vm=class extends Gu{constructor({filterSize:t=1,fp64:r=!1,countItems:i=!1}={}){if(!rH[t])throw new Error(\"filterSize out of range\");super({filterSize:t,fp64:r,countItems:i})}getShaders(t){let{filterSize:r,fp64:i}=t.opts;return{modules:[i?XW:QW],defines:{DATAFILTER_TYPE:rH[r],DATAFILTER_DOUBLE:!!i}}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({filterValues:{size:r.opts.filterSize,type:r.opts.fp64?5130:5126,accessor:\"getFilterValue\",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}}});let{gl:n}=this.context;if(i&&r.opts.countItems){let s=KW(n);i.add({filterIndices:{size:s?1:2,vertexOffset:1,type:5121,normalized:!0,accessor:(d,{index:_})=>{let w=d&&d.__source?d.__source.index:_;return s?(w+1)%255:[(w+1)%255,Math.floor(w/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let o=JW(n,s),c=tH(n,r.getShaders.call(this,r),s);this.setState({filterFBO:o,filterModel:c})}}updateState({props:t,oldProps:r}){if(this.state.filterModel){let n=this.getAttributeManager().attributes.filterValues.needsUpdate()||t.filterEnabled!==r.filterEnabled||t.filterRange!==r.filterRange||t.filterSoftRange!==r.filterSoftRange;n&&this.setState({filterNeedsUpdate:n})}}draw(t,r){let{filterFBO:i,filterModel:n,filterNeedsUpdate:s}=this.state,{onFilteredItemsChange:o}=this.props;if(s&&o&&n){let{attributes:{filterValues:c,filterIndices:d}}=this.getAttributeManager();n.setVertexCount(this.getNumInstances());let{gl:_}=this.context;Kf(_,{framebuffer:i,color:[0,0,0,0]}),n.updateModuleSettings(t.moduleParameters).setAttributes({...c.getShaderAttributes(),...d&&d.getShaderAttributes()}).draw({framebuffer:i,parameters:{...eH,viewport:[0,0,i.width,i.height]}});let w=Ch(i),I=0;for(let R=0;R 1000\n }\n\n if (collision_enabled) {\n vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));\n vec2 collision_texCoords = collision_getCoords(collision_common_position);\n collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);\n if (collision_fade < 0.0001) {\n // Position outside clip space bounds to discard\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n `,\"vs:DECKGL_FILTER_COLOR\":`\n color.a *= collision_fade;\n `},Pft=(e,t)=>{if(!e||!(\"dummyCollisionMap\"in e))return{};let{collisionFBO:r,drawToCollisionMap:i,dummyCollisionMap:n}=e;return{collision_sort:!!i,collision_texture:!i&&r?r:n}},iH={name:\"collision\",dependencies:[Fh],vs:Mft,inject:Eft,getUniforms:Pft};var y2=class extends Jl{renderCollisionMap(t,r){let i=this.gl,n=1;return mn(i,{scissorTest:!0,scissor:[n,n,t.width-2*n,t.height-2*n],clearColor:[0,0,0,0],blend:!1,depthTest:!0,depthRange:[0,1]},()=>this.render({...r,target:t,pass:\"collision\"}))}getModuleParameters(){return{drawToCollisionMap:!0,pickingActive:1,pickingAttribute:!1,lightSources:{}}}};var v2=class extends Jl{constructor(t,r){super(t,r),G(this,\"maskMap\",void 0),G(this,\"fbo\",void 0);let{mapSize:i=2048}=r;this.maskMap=new ui(t,{width:i,height:i,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.fbo=new pi(t,{id:\"maskmap\",width:i,height:i,attachments:{36064:this.maskMap}})}render(t){let r=this.gl,i=[!1,!1,!1,!1];return i[t.channel]=!0,mn(r,{clearColor:[255,255,255,255],blend:!0,blendFunc:[0,1],blendEquation:32778,colorMask:i,depthTest:!1},()=>super.render({...t,target:this.fbo,pass:\"mask\"}))}shouldDrawLayer(t){return t.props.operation.includes(\"mask\")}delete(){this.fbo.delete(),this.maskMap.delete()}};function nH(e,t){let r=[1/0,1/0,-1/0,-1/0];for(let i of e){let n=i.getBounds();if(n){let s=i.projectPosition(n[0],{viewport:t,autoOffset:!1}),o=i.projectPosition(n[1],{viewport:t,autoOffset:!1});r[0]=Math.min(r[0],s[0]),r[1]=Math.min(r[1],s[1]),r[2]=Math.max(r[2],o[0]),r[3]=Math.max(r[3],o[1])}}return Number.isFinite(r[0])?r:null}var Ift=2048;function sH(e){let{bounds:t,viewport:r,border:i=0}=e,{isGeospatial:n}=r;if(t[2]<=t[0]||t[3]<=t[1])return null;let s=r.unprojectPosition([(t[0]+t[2])/2,(t[1]+t[3])/2,0]),{width:o,height:c,zoom:d}=e;if(d===void 0){o=o-i*2,c=c-i*2;let _=Math.min(o/(t[2]-t[0]),c/(t[3]-t[1]));d=Math.min(Math.log2(_),20)}else if(!o||!c){let _=2**d;o=Math.round(Math.abs(t[2]-t[0])*_),c=Math.round(Math.abs(t[3]-t[1])*_);let w=Ift-i*2;if(o>w||c>w){let I=w/Math.max(o,c);o=Math.round(o*I),c=Math.round(c*I),d+=Math.log2(I)}}return n?new ec({id:r.id,x:i,y:i,width:o,height:c,longitude:s[0],latitude:s[1],zoom:d,orthographic:!0}):new Wy({id:r.id,x:i,y:i,width:o,height:c,target:s,zoom:d,flipY:!1})}function Cft(e,t){let r;if(t&&t.length===2){let[s,o]=t,c=e.getBounds({z:s}),d=e.getBounds({z:o});r=[Math.min(c[0],d[0]),Math.min(c[1],d[1]),Math.max(c[2],d[2]),Math.max(c[3],d[3])]}else r=e.getBounds();let i=e.projectPosition(r.slice(0,2)),n=e.projectPosition(r.slice(2,4));return[i[0],i[1],n[0],n[1]]}function oH(e,t,r){if(!e)return[0,0,1,1];let i=Cft(t,r),n=Lft(i);return e[2]-e[0]<=n[2]-n[0]&&e[3]-e[1]<=n[3]-n[1]?e:[Math.max(e[0],n[0]),Math.max(e[1],n[1]),Math.min(e[2],n[2]),Math.min(e[3],n[3])]}function Lft(e){let t=e[2]-e[0],r=e[3]-e[1],i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return[i-t,n-r,i+t,n+r]}var x2=class{constructor(){G(this,\"id\",\"mask-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",0),G(this,\"dummyMaskMap\",void 0),G(this,\"channels\",[]),G(this,\"masks\",null),G(this,\"maskPass\",void 0),G(this,\"maskMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{layers:r,layerFilter:i,viewports:n,onViewportActive:s,views:o,isPicking:c}){let d=!1;if(this.dummyMaskMap||(this.dummyMaskMap=new ui(t,{width:1,height:1})),c)return{didRender:d};let _=r.filter(N=>N.props.visible&&N.props.operation.includes(\"mask\"));if(_.length===0)return this.masks=null,this.channels.length=0,{didRender:d};this.masks={},this.maskPass||(this.maskPass=new v2(t,{id:\"default-mask\"}),this.maskMap=this.maskPass.maskMap);let w=this._sortMaskChannels(_),I=n[0],R=!this.lastViewport||!this.lastViewport.equals(I);if(I.resolution!==void 0)return rr.warn(\"MaskExtension is not supported in GlobeView\")(),{didRender:d};for(let N in w){let j=this._renderChannel(w[N],{layerFilter:i,onViewportActive:s,views:o,viewport:I,viewportChanged:R});d||(d=j)}return{didRender:d}}_renderChannel(t,{layerFilter:r,onViewportActive:i,views:n,viewport:s,viewportChanged:o}){let c=!1,d=this.channels[t.index];if(!d)return c;let _=t===d||t.layers.length!==d.layers.length||t.layers.some((w,I)=>w!==d.layers[I]||w.props.transitions)||t.layerBounds.some((w,I)=>w!==d.layerBounds[I]);if(t.bounds=d.bounds,t.maskBounds=d.maskBounds,this.channels[t.index]=t,_||o){this.lastViewport=s;let w=nH(t.layers,s);if(t.bounds=w&&oH(w,s),_||!Lo(t.bounds,d.bounds)){let{maskPass:I,maskMap:R}=this,N=w&&sH({bounds:t.bounds,viewport:s,width:R.width,height:R.height,border:1});t.maskBounds=N?N.getBounds():[0,0,1,1],I.render({pass:\"mask\",channel:t.index,layers:t.layers,layerFilter:r,viewports:N?[N]:[],onViewportActive:i,views:n,moduleParameters:{devicePixelRatio:1}}),c=!0}}return this.masks[t.id]={index:t.index,bounds:t.maskBounds,coordinateOrigin:t.coordinateOrigin,coordinateSystem:t.coordinateSystem},c}_sortMaskChannels(t){let r={},i=0;for(let n of t){let{id:s}=n.root,o=r[s];if(!o){if(++i>4){rr.warn(\"Too many mask layers. The max supported is 4\")();continue}o={id:s,index:this.channels.findIndex(c=>c?.id===s),layers:[],layerBounds:[],coordinateOrigin:n.root.props.coordinateOrigin,coordinateSystem:n.root.props.coordinateSystem},r[s]=o}o.layers.push(n),o.layerBounds.push(n.getBounds())}for(let n=0;n<4;n++){let s=this.channels[n];(!s||!(s.id in r))&&(this.channels[n]=null)}for(let n in r){let s=r[n];s.index<0&&(s.index=this.channels.findIndex(o=>!o),this.channels[s.index]=s)}return r}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var BO=2,b2=class{constructor(){G(this,\"id\",\"collision-filter-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",1),G(this,\"channels\",{}),G(this,\"collisionFilterPass\",void 0),G(this,\"collisionFBOs\",{}),G(this,\"dummyCollisionMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{effects:r,layers:i,layerFilter:n,viewports:s,onViewportActive:o,views:c,isPicking:d,preRenderStats:_={}}){var w;if(this.dummyCollisionMap||(this.dummyCollisionMap=new ui(t,{width:1,height:1})),d)return;let I=i.filter(({props:{visible:Z,collisionEnabled:K}})=>Z&&K);if(I.length===0){this.channels={};return}this.collisionFilterPass||(this.collisionFilterPass=new y2(t,{id:\"default-collision-filter\"}));let R=r?.filter(Z=>Z.constructor===x2),N=(w=_[\"mask-effect\"])===null||w===void 0?void 0:w.didRender,j=this._groupByCollisionGroup(t,I),Y=s[0],it=!this.lastViewport||!this.lastViewport.equals(Y)||N;for(let Z in j){let K=this.collisionFBOs[Z],J=j[Z];K.resize({width:t.canvas.width/BO,height:t.canvas.height/BO}),this._render(J,{effects:R,layerFilter:n,onViewportActive:o,views:c,viewport:Y,viewportChanged:it})}}_render(t,{effects:r,layerFilter:i,onViewportActive:n,views:s,viewport:o,viewportChanged:c}){let{collisionGroup:d}=t,_=this.channels[d];if(!_)return;let w=c||t===_||!fo(_.layers,t.layers,1)||t.layerBounds.some((I,R)=>!Lo(I,_.layerBounds[R]))||t.allLayersLoaded!==_.allLayersLoaded||t.layers.some(I=>I.props.transitions);if(this.channels[d]=t,w){this.lastViewport=o;let I=this.collisionFBOs[d];this.collisionFilterPass.renderCollisionMap(I,{pass:\"collision-filter\",isPicking:!0,layers:t.layers,effects:r,layerFilter:i,viewports:o?[o]:[],onViewportActive:n,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:Sl(I.gl)/BO}})}}_groupByCollisionGroup(t,r){let i={};for(let n of r){let{collisionGroup:s}=n.props,o=i[s];o||(o={collisionGroup:s,layers:[],layerBounds:[],allLayersLoaded:!0},i[s]=o),o.layers.push(n),o.layerBounds.push(n.getBounds()),n.isLoaded||(o.allLayersLoaded=!1)}for(let n of Object.keys(i))this.collisionFBOs[n]||this.createFBO(t,n),this.channels[n]||(this.channels[n]=i[n]);for(let n of Object.keys(this.collisionFBOs))i[n]||this.destroyFBO(n);return i}getModuleParameters(t){let{collisionGroup:r}=t.props,{collisionFBOs:i,dummyCollisionMap:n}=this;return{collisionFBO:i[r],dummyCollisionMap:n}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let t of Object.keys(this.collisionFBOs))this.destroyFBO(t);this.collisionFBOs={},this.lastViewport=void 0}createFBO(t,r){let{width:i,height:n}=t.canvas,s=new ui(t,{width:i,height:n,parameters:{10241:9728,10240:9728,10242:33071,10243:33071}}),o=new el(t,{format:33189,width:i,height:n});this.collisionFBOs[r]=new pi(t,{id:\"Collision-\".concat(r),width:i,height:n,attachments:{36064:s,36096:o}})}destroyFBO(t){let r=this.collisionFBOs[t];for(let i of Object.values(r.attachments))i.delete();r.delete(),delete this.collisionFBOs[t]}};var kft={getCollisionPriority:{type:\"accessor\",value:0},collisionEnabled:!0,collisionGroup:{type:\"string\",value:\"default\"},collisionTestProps:{}},xm=class extends Gu{getShaders(){return{modules:[iH]}}draw({uniforms:t,context:r,moduleParameters:i}){let{collisionEnabled:n}=this.props,{collisionFBO:s,drawToCollisionMap:o}=i,c=n&&!!s;t.collision_enabled=c,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(t,r){var i;if(this.getAttributeManager()===null)return;(i=this.context.deck)===null||i===void 0||i._addDefaultEffect(new b2),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:\"getCollisionPriority\",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};G(xm,\"defaultProps\",kft);G(xm,\"extensionName\",\"CollisionFilterExtension\");var Fv=class extends Ig{static extensionType;constructor(t,r){super(t,r)}},w2=class extends Fv{static extensionType=\"brushing\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new ym,r.initRegularAttribute(\"brushing_enabled\",\"brushingEnabled\"),r.initRegularAttribute(\"brushing_target\",\"brushingTarget\"),r.initRegularAttribute(\"brushing_radius\",\"brushingRadius\"),r.initVectorizedAccessor(\"get_brushing_target\",\"getBrushingTarget\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"brushingEnabled\",\"brushingTarget\",\"brushingRadius\",\"getBrushingTarget\"]}},S2=class extends Fv{static extensionType=\"collision-filter\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new xm,r.initRegularAttribute(\"collision_enabled\",\"collisionEnabled\"),r.initRegularAttribute(\"collision_group\",\"collisionGroup\"),r.initRegularAttribute(\"collision_test_props\",\"collisionTestProps\"),r.initVectorizedAccessor(\"get_collision_priority\",\"getCollisionPriority\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"collisionEnabled\",\"collisionGroup\",\"collisionTestProps\",\"getCollisionPriority\"]}},f3=class extends Fv{static extensionType=\"data-filter\";extensionInstance;constructor(t,r,i){super(t,i);let n=this.model.get(\"filter_size\");this.extensionInstance=new vm({filterSize:n}),r.initRegularAttribute(\"filter_enabled\",\"filterEnabled\"),r.initRegularAttribute(\"filter_range\",\"filterRange\"),r.initRegularAttribute(\"filter_soft_range\",\"filterSoftRange\"),r.initRegularAttribute(\"filter_transform_size\",\"filterTransformSize\"),r.initRegularAttribute(\"filter_transform_color\",\"filterTransformColor\"),r.initVectorizedAccessor(\"get_filter_value\",\"getFilterValue\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"filterEnabled\",\"filterRange\",\"filterSoftRange\",\"filterTransformSize\",\"filterTransformColor\",\"getFilterValue\"]}};async function FO(e,t,r){let i=e.get(\"_extension_type\"),n;switch(i){case w2.extensionType:n=new w2(e,t,r);break;case S2.extensionType:n=new S2(e,t,r);break;case f3.extensionType:n=new f3(e,t,r);break;default:throw new Error(`no known model for extension type ${i}`)}return await n.loadSubModels(),n}var Cg=class extends Ig{pickable;visible;opacity;autoHighlight;extensions;extensionLayerPropertyNames=[];constructor(t,r){super(t,r),this.initRegularAttribute(\"pickable\",\"pickable\"),this.initRegularAttribute(\"visible\",\"visible\"),this.initRegularAttribute(\"opacity\",\"opacity\"),this.initRegularAttribute(\"auto_highlight\",\"autoHighlight\"),this.extensions=[]}async loadSubModels(){await this.initLayerExtensions()}extensionInstances(){return this.extensions.map(t=>t.extensionInstance)}extensionProps(){let t={};for(let r of this.extensionLayerPropertyNames)this[r]!==void 0&&this[r]!==null&&(t[r]=this[r]);return t}onClick(t){t.index&&(this.model.set(\"selected_index\",t.index),this.model.save_changes())}baseLayerProps(){return{extensions:this.extensionInstances(),...this.extensionProps(),id:this.model.model_id,pickable:this.pickable,visible:this.visible,opacity:this.opacity,autoHighlight:this.autoHighlight,onClick:this.onClick.bind(this)}}async initLayerExtensions(){let t=async()=>{let r=this.model.get(\"extensions\");if(!r){this.extensions=[];return}let i=await h3(this.model.widget_manager,r),n=[];for(let s of i){let o=await FO(s,this,this.updateStateCallback);n.push(o)}this.extensions=n};await t(),this.model.off(\"change:extensions\"),this.model.on(\"change:extensions\",t),this.callbacks.set(\"change:extensions\",t)}};var aH=`#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instanceHeights;\nattribute float instanceTilts;\n\nuniform bool greatCircle;\nuniform bool useShortestPath;\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n\n float deltaZ = targetZ - sourceZ;\n float dh = distance * instanceHeights;\n if (dh == 0.0) {\n return sourceZ + deltaZ * ratio;\n }\n float unitZ = deltaZ / dh;\n float p2 = unitZ * unitZ + 1.0;\n float dir = step(deltaZ, 0.0);\n float z0 = mix(sourceZ, targetZ, dir);\n float r = mix(ratio, 1.0 - ratio, dir);\n return sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n float distance = length(source.xy - target.xy);\n float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n float tiltAngle = radians(instanceTilts);\n vec2 tiltDirection = normalize(target.xy - source.xy);\n vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n return vec3(\n mix(source.xy, target.xy, segmentRatio) + tilt,\n z * cos(tiltAngle)\n );\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 sourceRadians = radians(source);\n vec2 targetRadians = radians(target);\n vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n vec2 lngLat;\n if(abs(angularDist - PI) < 0.001) {\n lngLat = (1.0 - t) * source.xy + t * target.xy;\n } else {\n float a = sin((1.0 - t) * angularDist);\n float b = sin(t * angularDist);\n vec3 p = source3D.yxz * a + target3D.yxz * b;\n lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n }\n\n float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n return vec3(lngLat, z);\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n float segmentIndex = positions.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n isValid = 1.0;\n\n uv = vec2(segmentRatio, positions.y);\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n vec4 curr;\n vec4 next;\n vec3 source;\n vec3 target;\n\n if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n if (abs(currPos.x - prevPos.x) > 180.0) {\n indexDir = -1.0;\n isValid = 0.0;\n } else if (abs(currPos.x - nextPos.x) > 180.0) {\n indexDir = 1.0;\n isValid = 0.0;\n }\n nextPos = indexDir < 0.0 ? prevPos : nextPos;\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n if (isValid == 0.0) {\n nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n currPos = mix(currPos, nextPos, t);\n segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n }\n\n vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n \n curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n \n } else {\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n if (useShortestPath) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n float deltaLng = target_world.x - source_world.x;\n if (deltaLng > 180.) target_world.x -= 360.;\n if (deltaLng < -180.) source_world.x -= 360.;\n }\n source = project_position(source_world, instanceSourcePositions64Low);\n target = project_position(target_world, instanceTargetPositions64Low);\n float antiMeridianX = 0.0;\n\n if (useShortestPath) {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n }\n float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n isValid = 0.0;\n indexDir = sign(segmentRatio - thresholdRatio);\n segmentRatio = thresholdRatio;\n }\n }\n\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n vec3 currPos = interpolateFlat(source, target, segmentRatio);\n vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n if (useShortestPath) {\n if (nextPos.x < antiMeridianX) {\n currPos.x += TILE_SIZE;\n nextPos.x += TILE_SIZE;\n }\n }\n\n curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n geometry.position = vec4(currPos, 1.0);\n }\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels\n );\n vec3 offset = vec3(\n getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(curr, geometry);\n gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n vColor = vec4(color.rgb, color.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var lH=`#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nvoid main(void) {\n if (isValid == 0.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n geometry.uv = uv;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var d3=[0,0,0,255],Rft={getSourcePosition:{type:\"accessor\",value:e=>e.sourcePosition},getTargetPosition:{type:\"accessor\",value:e=>e.targetPosition},getSourceColor:{type:\"accessor\",value:d3},getTargetColor:{type:\"accessor\",value:d3},getWidth:{type:\"accessor\",value:1},getHeight:{type:\"accessor\",value:1},getTilt:{type:\"accessor\",value:0},greatCircle:!1,numSegments:{type:\"number\",value:50,min:1},widthUnits:\"pixels\",widthScale:{type:\"number\",value:1,min:0},widthMinPixels:{type:\"number\",value:0,min:0},widthMaxPixels:{type:\"number\",value:Number.MAX_SAFE_INTEGER,min:0}},bp=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"instanceSourcePositions\",\"instanceTargetPositions\"])}getShaders(){return super.getShaders({vs:aH,fs:lH,modules:[ho,ia]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getSourcePosition\"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getTargetPosition\"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getSourceColor\",defaultValue:d3},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getTargetColor\",defaultValue:d3},instanceWidths:{size:1,transition:!0,accessor:\"getWidth\",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:\"getHeight\",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:\"getTilt\",defaultValue:0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t;if(n.extensionsChanged||n.propsChanged&&r.numSegments!==i.numSegments){var s;let{gl:o}=this.context;(s=this.state.model)===null||s===void 0||s.delete(),this.state.model=this._getModel(o),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:s,greatCircle:o,wrapLongitude:c}=this.props;this.state.model.setUniforms(t).setUniforms({greatCircle:o,widthUnits:ea[r],widthScale:i,widthMinPixels:n,widthMaxPixels:s,useShortestPath:c}).draw()}_getModel(t){let{id:r,numSegments:i}=this.props,n=[];for(let o=0;o0&&j>0&&(c[I++]=w-s,c[I++]=w-s-1,c[I++]=w-1,c[I++]=w-s,c[I++]=w-1,c[I++]=w),w++}}return{vertexCount:o,positions:_,indices:c,texCoords:d}}function Bft(e){let t=new Float64Array(12);for(let r=0;r 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;var zft=`\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n`,uH=`\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n if (transparentColor.a == 0.0) {\n return vec4(color, alpha);\n }\n float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);\n float highLightRatio = alpha / blendedAlpha;\n vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n`.concat(zft,`\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n`);var Nft={image:{type:\"image\",value:null,async:!0},bounds:{type:\"array\",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Hr.DEFAULT,desaturate:{type:\"number\",min:0,max:1,value:0},transparentColor:{type:\"color\",value:[0,0,0,0]},tintColor:{type:\"color\",value:[255,255,255]},textureParameters:{type:\"object\",ignore:!0}},wp=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:cH,fs:uH,modules:[ho,ia]})}initializeState(){let t=this.getAttributeManager();t.remove([\"instancePickingColors\"]);let r=!0;t.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:5130,fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:t,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged){var s;let{gl:o}=this.context;(s=this.state.model)===null||s===void 0||s.delete(),this.state.model=this._getModel(o),n.invalidateAll()}if(t.bounds!==r.bounds){let o=this.state.mesh,c=this._createMesh();this.state.model.setVertexCount(c.vertexCount);for(let d in c)o&&o[d]!==c[d]&&n.invalidate(d);this.setState({mesh:c,...this._getCoordinateUniforms()})}else t._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(t){let{image:r}=this.props,i=t.info;if(!i.color||!r)return i.bitmap=null,i;let{width:n,height:s}=r;i.index=0;let o=Uft(i.color),c=[Math.floor(o[0]*n),Math.floor(o[1]*s)];return i.bitmap={size:{width:n,height:s},uv:o,pixel:c},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(t){super._updateAutoHighlight({...t,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:t}=this.props,r=t;return hH(t)&&(r=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]]]),zO(r,this.context.viewport.resolution)}_getModel(t){return t?new _n(t,{...this.getShaders(),id:this.props.id,geometry:new ms({drawMode:4,vertexCount:6}),isInstanced:!1}):null}draw(t){let{uniforms:r,moduleParameters:i}=t,{model:n,coordinateConversion:s,bounds:o,disablePicking:c}=this.state,{image:d,desaturate:_,transparentColor:w,tintColor:I}=this.props;i.pickingActive&&c||d&&n&&n.setUniforms(r).setUniforms({bitmapTexture:d,desaturate:_,transparentColor:w.map(R=>R/255),tintColor:I.slice(0,3).map(R=>R/255),coordinateConversion:s,bounds:o}).draw()}_getCoordinateUniforms(){let{LNGLAT:t,CARTESIAN:r,DEFAULT:i}=Hr,{_imageCoordinateSystem:n}=this.props;if(n!==i){let{bounds:s}=this.props;if(!hH(s))throw new Error(\"_imageCoordinateSystem only supports rectangular bounds\");let o=this.context.viewport.resolution?t:r;if(n=n===t?t:r,n===t&&o===r)return{coordinateConversion:-1,bounds:s};if(n===r&&o===t){let c=El([s[0],s[1]]),d=El([s[2],s[3]]);return{coordinateConversion:1,bounds:[c[0],c[1],d[0],d[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}};G(wp,\"layerName\",\"BitmapLayer\");G(wp,\"defaultProps\",Nft);function Uft(e){let[t,r,i]=e,n=(i&240)/256,s=(i&15)/16;return[(t+s)/256,(r+n)/256]}function hH(e){return Number.isFinite(e[0])}var fH=`#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n\n vec2 iconSize = instanceIconFrames.zw;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), \n sizeMinPixels, sizeMaxPixels\n );\n float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n pixelOffset += instancePixelOffset;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vColor = instanceColors;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n vColorMode = instanceColorModes;\n}\n`;var dH=`#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n float a = texColor.a * opacity * vColor.a;\n\n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color, a);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Vft=1024,jft=4,pH=()=>{},AH={10241:9987,10240:9729,10242:33071,10243:33071};function Gft(e){return Math.pow(2,Math.ceil(Math.log2(e)))}function Wft(e,t,r,i){let n=Math.min(r/t.width,i/t.height),s=Math.floor(t.width*n),o=Math.floor(t.height*n);return n===1?{data:t,width:s,height:o}:(e.canvas.height=o,e.canvas.width=s,e.clearRect(0,0,s,o),e.drawImage(t,0,0,t.width,t.height,0,0,s,o),{data:e.canvas,width:s,height:o})}function T2(e){return e&&(e.id||e.url)}function Hft(e,t,r,i){let n=e.width,s=e.height,o=new ui(e.gl,{width:t,height:r,parameters:i});return tE(e,o,{targetY:0,width:n,height:s}),e.delete(),o}function mH(e,t,r){for(let i=0;io&&(mH(r,c,n),i=0,n=s+n+t,s=0,c=[]),c.push({icon:_,xOffset:i}),i=i+R+t,s=Math.max(s,I)}}return c.length>0&&mH(r,c,n),{mapping:r,rowHeight:s,xOffset:i,yOffset:n,canvasWidth:o,canvasHeight:Gft(s+n+t)}}function Zft(e,t,r){if(!e||!t)return null;r=r||{};let i={},{iterable:n,objectInfo:s}=Jc(e);for(let o of n){s.index++;let c=t(o,s),d=T2(c);if(!c)throw new Error(\"Icon is missing.\");if(!c.url)throw new Error(\"Icon url is missing.\");!i[d]&&(!r[d]||c.url!==r[d].url)&&(i[d]={...c,source:o,sourceIndex:s.index})}return i}var M2=class{constructor(t,{onUpdate:r=pH,onError:i=pH}){G(this,\"gl\",void 0),G(this,\"onUpdate\",void 0),G(this,\"onError\",void 0),G(this,\"_loadOptions\",null),G(this,\"_texture\",null),G(this,\"_externalTexture\",null),G(this,\"_mapping\",{}),G(this,\"_textureParameters\",null),G(this,\"_pendingCount\",0),G(this,\"_autoPacking\",!1),G(this,\"_xOffset\",0),G(this,\"_yOffset\",0),G(this,\"_rowHeight\",0),G(this,\"_buffer\",jft),G(this,\"_canvasWidth\",Vft),G(this,\"_canvasHeight\",0),G(this,\"_canvas\",null),this.gl=t,this.onUpdate=r,this.onError=i}finalize(){var t;(t=this._texture)===null||t===void 0||t.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(t){let r=this._autoPacking?T2(t):t;return this._mapping[r]||{}}setProps({loadOptions:t,autoPacking:r,iconAtlas:i,iconMapping:n,textureParameters:s}){if(t&&(this._loadOptions=t),r!==void 0&&(this._autoPacking=r),n&&(this._mapping=n),i){var o;(o=this._texture)===null||o===void 0||o.delete(),this._texture=null,this._externalTexture=i}s&&(this._textureParameters=s)}get isLoaded(){return this._pendingCount===0}packIcons(t,r){if(!this._autoPacking||typeof document>\"u\")return;let i=Object.values(Zft(t,r,this._mapping)||{});if(i.length>0){let{mapping:n,xOffset:s,yOffset:o,rowHeight:c,canvasHeight:d}=qft({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=c,this._mapping=n,this._xOffset=s,this._yOffset=o,this._canvasHeight=d,this._texture||(this._texture=new ui(this.gl,{width:this._canvasWidth,height:this._canvasHeight,parameters:this._textureParameters||AH})),this._texture.height!==this._canvasHeight&&(this._texture=Hft(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||AH)),this.onUpdate(),this._canvas=this._canvas||document.createElement(\"canvas\"),this._loadIcons(i)}}_loadIcons(t){let r=this._canvas.getContext(\"2d\",{willReadFrequently:!0});for(let i of t)this._pendingCount++,jA(i.url,this._loadOptions).then(n=>{let s=T2(i),o=this._mapping[s],{x:c,y:d,width:_,height:w}=o,{data:I,width:R,height:N}=Wft(r,n,_,w);this._texture.setSubImageData({data:I,x:c+(_-R)/2,y:d+(w-N)/2,width:R,height:N}),o.width=R,o.height=N,this._texture.generateMipmap(),this.onUpdate()}).catch(n=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:n})}).finally(()=>{this._pendingCount--})}};var gH=[0,0,0,255],Yft={iconAtlas:{type:\"image\",value:null,async:!0},iconMapping:{type:\"object\",value:{},async:!0},sizeScale:{type:\"number\",value:1,min:0},billboard:!0,sizeUnits:\"pixels\",sizeMinPixels:{type:\"number\",min:0,value:0},sizeMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:\"number\",value:.05,min:0,max:1},getPosition:{type:\"accessor\",value:e=>e.position},getIcon:{type:\"accessor\",value:e=>e.icon},getColor:{type:\"accessor\",value:gH},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},onIconError:{type:\"function\",value:null,optional:!0},textureParameters:{type:\"object\",ignore:!0}},Sp=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:fH,fs:dH,modules:[ho,ia]})}initializeState(){this.state={iconManager:new M2(this.context.gl,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceOffsets:{size:2,accessor:\"getIcon\",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:\"getIcon\",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:5121,accessor:\"getIcon\",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getColor\",defaultValue:gH},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instancePixelOffset:{size:2,transition:!0,accessor:\"getPixelOffset\"}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t,s=this.getAttributeManager(),{iconAtlas:o,iconMapping:c,data:d,getIcon:_,textureParameters:w}=r,{iconManager:I}=this.state,R=o||this.internalState.isAsyncPropLoading(\"iconAtlas\");if(I.setProps({loadOptions:r.loadOptions,autoPacking:!R,iconAtlas:o,iconMapping:R?c:null,textureParameters:w}),R?i.iconMapping!==r.iconMapping&&s.invalidate(\"getIcon\"):(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getIcon))&&I.packIcons(d,_),n.extensionsChanged){var N;let{gl:j}=this.context;(N=this.state.model)===null||N===void 0||N.delete(),this.state.model=this._getModel(j),s.invalidateAll()}}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw({uniforms:t}){let{sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,sizeUnits:s,billboard:o,alphaCutoff:c}=this.props,{iconManager:d}=this.state,_=d.getTexture();_&&this.state.model.setUniforms(t).setUniforms({iconsTexture:_,iconsTextureDim:[_.width,_.height],sizeUnits:ea[s],sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,billboard:o,alphaCutoff:c}).draw()}_getModel(t){let r=[-1,-1,-1,1,1,1,1,-1];return new _n(t,{...this.getShaders(),id:this.props.id,geometry:new ms({drawMode:6,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(t){var r;let i=(r=this.getCurrentLayer())===null||r===void 0?void 0:r.props.onIconError;i?i(t):rr.error(t.error.message)()}getInstanceOffset(t){let{width:r,height:i,anchorX:n=r/2,anchorY:s=i/2}=this.state.iconManager.getIconMapping(t);return[r/2-n,i/2-s]}getInstanceColorMode(t){return this.state.iconManager.getIconMapping(t).mask?1:0}getInstanceIconFrame(t){let{x:r,y:i,width:n,height:s}=this.state.iconManager.getIconMapping(t);return[r,i,n,s]}};G(Sp,\"defaultProps\",Yft);G(Sp,\"layerName\",\"IconLayer\");var _H=`#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool antialiasing;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n outerRadiusPixels = clamp(\n project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\n radiusMinPixels, radiusMaxPixels\n );\n float lineWidthPixels = clamp(\n project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\n lineWidthMinPixels, lineWidthMaxPixels\n );\n outerRadiusPixels += stroked * lineWidthPixels / 2.0;\n float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\n \n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = edgePadding * positions * outerRadiusPixels;\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var yH=`#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = antialiasing ? \n smoothedge(distToCenter, outerRadiusPixels) : \n step(distToCenter, outerRadiusPixels);\n\n if (inCircle == 0.0) {\n discard;\n }\n\n if (stroked > 0.5) {\n float isLine = antialiasing ? \n smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n if (filled) {\n gl_FragColor = mix(vFillColor, vLineColor, isLine);\n } else {\n if (isLine == 0.0) {\n discard;\n }\n gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n }\n } else if (!filled) {\n discard;\n } else {\n gl_FragColor = vFillColor;\n }\n\n gl_FragColor.a *= inCircle;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var vH=[0,0,0,255],$ft={radiusUnits:\"meters\",radiusScale:{type:\"number\",min:0,value:1},radiusMinPixels:{type:\"number\",min:0,value:0},radiusMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:\"meters\",lineWidthScale:{type:\"number\",min:0,value:1},lineWidthMinPixels:{type:\"number\",min:0,value:0},lineWidthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:\"accessor\",value:e=>e.position},getRadius:{type:\"accessor\",value:1},getFillColor:{type:\"accessor\",value:vH},getLineColor:{type:\"accessor\",value:vH},getLineWidth:{type:\"accessor\",value:1},strokeWidth:{deprecatedFor:\"getLineWidth\"},outline:{deprecatedFor:\"stroked\"},getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},nh=class extends yn{getShaders(){return super.getShaders({vs:_H,fs:yH,modules:[ho,ia]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceRadius:{size:1,transition:!0,accessor:\"getRadius\",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var r;let{gl:i}=this.context;(r=this.state.model)===null||r===void 0||r.delete(),this.state.model=this._getModel(i),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:n,radiusMaxPixels:s,stroked:o,filled:c,billboard:d,antialiasing:_,lineWidthUnits:w,lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}=this.props;this.state.model.setUniforms(t).setUniforms({stroked:o?1:0,filled:c,billboard:d,antialiasing:_,radiusUnits:ea[r],radiusScale:i,radiusMinPixels:n,radiusMaxPixels:s,lineWidthUnits:ea[w],lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}).draw()}_getModel(t){let r=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];return new _n(t,{...this.getShaders(),id:this.props.id,geometry:new ms({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array(r)}}}),isInstanced:!0})}};G(nh,\"defaultProps\",$ft);G(nh,\"layerName\",\"ScatterplotLayer\");var zv={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Lg(e,t,r={}){return xH(e,r)!==t?(Qft(e,r),!0):!1}function xH(e,t={}){return Math.sign(p3(e,t))}function p3(e,t={}){let{start:r=0,end:i=e.length}=t,n=t.size||2,s=0;for(let o=r,c=i-n;o0){let n=!0;for(let s=0;st[2]&&(r|=2),e[1]t[3]&&(r|=8),r}function I2(e,t){let{size:r=2,broken:i=!1,gridResolution:n=10,gridOffset:s=[0,0],startIndex:o=0,endIndex:c=e.length}=t||{},d=(c-o)/r,_=[],w=[_],I=bm(e,0,r,o),R,N,j=SH(I,n,s,[]),Y=[];dc(_,I);for(let it=1;itr&&(_=[],w.push(_),dc(_,I)),N=P2(R,j)}dc(_,R),E2(I,R)}return i?w:w[0]}var bH=0,Kft=1;function m3(e,t){for(let r=0;r=0?(dc(_,N)&&I.push(Y),ht+=j):I.length&&(I[I.length-1]=bH),E2(it,N),Z=j,K=Y;return[J?{pos:d,types:t&&w}:null,ht?{pos:_,types:t&&I}:null]}function SH(e,t,r,i){let n=Math.floor((e[0]-r[0])/t)*t+r[0],s=Math.floor((e[1]-r[1])/t)*t+r[1];return i[0]=n,i[1]=s,i[2]=n+t,i[3]=s+t,i}function Jft(e,t,r){r&8?(e[1]+=t,e[3]+=t):r&4?(e[1]-=t,e[3]-=t):r&2?(e[0]+=t,e[2]+=t):r&1&&(e[0]-=t,e[2]-=t)}function tdt(e,t,r,i){let n=1/0,s=-1/0,o=1/0,c=-1/0;for(let d=0;ds?_:s,o=wc?w:c}return i[0][0]=n,i[0][1]=o,i[1][0]=s,i[1][1]=c,i}var edt=85.051129;function NO(e,t){let{size:r=2,startIndex:i=0,endIndex:n=e.length,normalize:s=!0}=t||{},o=e.slice(i,n);TH(o,r,0,n-i);let c=I2(o,{size:r,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(let d of c)MH(d,r);return c}function UO(e,t=null,r){let{size:i=2,normalize:n=!0,edgeTypes:s=!1}=r||{};t=t||[];let o=[],c=[],d=0,_=0;for(let I=0;I<=t.length;I++){let R=t[I]||e.length,N=_,j=rdt(e,i,d,R);for(let Y=j;Yn&&(n=c,s=o-1)}return s}function idt(e,t,r,i,n=edt){let s=e[r],o=e[i-t];if(Math.abs(s-o)>180){let c=bm(e,0,t,r);c[0]+=Math.round((o-s)/360)*360,dc(e,c),c[1]=Math.sign(c[1])*n,dc(e,c),c[0]=s,dc(e,c)}}function TH(e,t,r,i){let n=e[0],s;for(let o=r;o180||c<-180)&&(s-=Math.round(c/360)*360),e[o]=n=s}}function MH(e,t){let r,i=e.length/t;for(let s=0;s=i),n=n.flatMap(N=>[N[0],N[1]]),Lg(n,zv.COUNTER_CLOCKWISE));let s=r>0,o=i+1,c=s?o*3+1:i,d=Math.PI*2/i,_=new Uint16Array(s?i*3*2:0),w=new Float32Array(c*3),I=new Float32Array(c*3),R=0;if(s){for(let N=0;N 0.0 && instanceElevations >= 0.0);\n float dotRadius = radius * coverage * shouldRender;\n\n geometry.pickingColor = instancePickingColors;\n vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n vec3 centroidPosition64Low = instancePositions64Low;\n vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\n if (radiusUnits == UNIT_METERS) {\n offset = project_size(offset);\n }\n vec3 pos = vec3(offset, 0.);\n DECKGL_FILTER_SIZE(pos, geometry);\n\n gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n if (extruded && !isStroke) {\n#ifdef FLAT_SHADING\n position_commonspace = geometry.position;\n vColor = vec4(color.rgb, color.a * opacity);\n#else\n vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, color.a * opacity);\n#endif\n } else {\n vColor = vec4(color.rgb, color.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var PH=`#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nuniform vec3 project_uCameraPosition;\nuniform bool extruded;\nuniform bool isStroke;\n\nout vec4 fragColor;\n\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n fragColor = vColor;\n#ifdef FLAT_SHADING\n if (extruded && !isStroke && !picking_uActive) {\n vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n fragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal);\n }\n#endif\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;var g3=[0,0,0,255],odt={diskResolution:{type:\"number\",min:4,value:20},vertices:null,radius:{type:\"number\",min:0,value:1e3},angle:{type:\"number\",value:0},offset:{type:\"array\",value:[0,0]},coverage:{type:\"number\",min:0,max:1,value:1},elevationScale:{type:\"number\",min:0,value:1},radiusUnits:\"meters\",lineWidthUnits:\"meters\",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,getPosition:{type:\"accessor\",value:e=>e.position},getFillColor:{type:\"accessor\",value:g3},getLineColor:{type:\"accessor\",value:g3},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0,getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},nf=class extends yn{getShaders(){let{gl:t}=this.context,r=!fr(t),i={},n=this.props.flatShading&&W0(t,_i.GLSL_DERIVATIVES);return n&&(i.FLAT_SHADING=1),super.getShaders({vs:EH,fs:PH,defines:i,transpileToGLSL100:r,modules:[ho,n?Ey:XA,ia]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceElevations:{size:1,transition:!0,accessor:\"getElevation\"},instanceFillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getFillColor\",defaultValue:g3},instanceLineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getLineColor\",defaultValue:g3},instanceStrokeWidths:{size:1,accessor:\"getLineWidth\",transition:!0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t,s=n.extensionsChanged||r.flatShading!==i.flatShading;if(s){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),this.getAttributeManager().invalidateAll()}(s||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(t,r,i){let n=new L2({radius:1,height:i?2:0,vertices:r,nradial:t}),s=0;if(r)for(let o=0;o=t.length&&(r+=1-t.length/n);let s=r*n;return i[0]=t[s],i[1]=t[s+1],i[2]=n===3&&t[s+2]||0,i}isClosed(t){if(!this.normalize)return!!this.opts.loop;let{positionSize:r}=this,i=t.length-r;return t[0]===t[i]&&t[1]===t[i+1]&&(r===2||t[2]===t[i+2])}};function CH(e){return Array.isArray(e[0])}var LH=`#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute float instanceTypes;\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftPositions;\nattribute vec3 instanceRightPositions;\nattribute vec3 instanceLeftPositions64Low;\nattribute vec3 instanceStartPositions64Low;\nattribute vec3 instanceEndPositions64Low;\nattribute vec3 instanceRightPositions64Low;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;\nuniform bool billboard;\nuniform int widthUnits;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\nvec3 getLineJoinOffset(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n vec2 width\n) {\n bool isEnd = positions.x > 0.0;\n float sideOfPath = positions.y;\n float isJoint = float(sideOfPath == 0.0);\n\n vec3 deltaA3 = (currPoint - prevPoint);\n vec3 deltaB3 = (nextPoint - currPoint);\n\n mat3 rotationMatrix;\n bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\n if (needsRotation) {\n deltaA3 = deltaA3 * rotationMatrix;\n deltaB3 = deltaB3 * rotationMatrix;\n }\n vec2 deltaA = deltaA3.xy / width;\n vec2 deltaB = deltaB3.xy / width;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n vec2 tangent = dirA + dirB;\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n vec2 dir = isEnd ? dirA : dirB;\n vec2 perp = isEnd ? perpA : perpB;\n float L = isEnd ? lenA : lenB;\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n float cornerPosition = sideOfPath * turnDirection;\n\n float miterSize = 1.0 / max(sinHalfA, EPSILON);\n miterSize = mix(\n min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n miterSize,\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n * (sideOfPath + isJoint * turnDirection);\n bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n bool isCap = isStartCap || isEndCap;\n if (isCap) {\n offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n vJointType = capType;\n } else {\n vJointType = jointType;\n }\n vPathLength = L;\n vCornerOffset = offsetVec;\n vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n vMiterLength = isCap ? isJoint : vMiterLength;\n\n vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n vPathPosition = vec2(\n dot(offsetFromStartOfPath, perp),\n dot(offsetFromStartOfPath, dir)\n );\n geometry.uv = vPathPosition;\n\n float isValid = step(instanceTypes, 3.5);\n vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n if (needsRotation) {\n offset = rotationMatrix * offset;\n }\n return offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n if (position.w < EPSILON) {\n float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n position = refPosition + (position - refPosition) * r;\n }\n}\n\nvoid main() {\n geometry.pickingColor = instancePickingColors;\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n geometry.worldPosition = currPosition;\n vec2 widthPixels = vec2(clamp(\n project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels) / 2.0);\n vec3 width;\n\n if (billboard) {\n vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n clipLine(prevPositionScreen, currPositionScreen);\n clipLine(nextPositionScreen, currPositionScreen);\n clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n width = vec3(widthPixels, 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(\n prevPositionScreen.xyz / prevPositionScreen.w,\n currPositionScreen.xyz / currPositionScreen.w,\n nextPositionScreen.xyz / nextPositionScreen.w,\n project_pixel_size_to_clipspace(width.xy)\n );\n\n DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\n gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n } else {\n prevPosition = project_position(prevPosition, prevPosition64Low);\n currPosition = project_position(currPosition, currPosition64Low);\n nextPosition = project_position(nextPosition, nextPosition64Low);\n\n width = vec3(project_pixel_size(widthPixels), 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\n geometry.position = vec4(currPosition + offset, 1.0);\n gl_Position = project_common_position_to_clipspace(geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var kH=`#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float miterLimit;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nvoid main(void) {\n geometry.uv = vPathPosition;\n\n if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n discard;\n }\n if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\n discard;\n }\n }\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var RH=[0,0,0,255],cdt={widthUnits:\"meters\",widthScale:{type:\"number\",min:0,value:1},widthMinPixels:{type:\"number\",min:0,value:0},widthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:\"number\",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:\"accessor\",value:e=>e.path},getColor:{type:\"accessor\",value:RH},getWidth:{type:\"accessor\",value:1},rounded:{deprecatedFor:[\"jointRounded\",\"capRounded\"]}},jO={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},pc=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:LH,fs:kH,modules:[ho,ia]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({positions:{size:3,vertexOffset:1,type:5130,fp64:this.use64bitPositions(),transition:jO,accessor:\"getPath\",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:5121,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:\"getWidth\",transition:jO,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,accessor:\"getColor\",transition:jO,defaultValue:RH},instancePickingColors:{size:3,type:5121,accessor:(i,{index:n,target:s})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,s)}}),this.setState({pathTesselator:new k2({fp64:this.use64bitPositions()})})}updateState(t){super.updateState(t);let{props:r,changeFlags:i}=t,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:c}=this.state,d=r.data.attributes||{};c.updateGeometry({data:r.data,geometryBuffer:d.getPath,buffers:d,normalize:!r._pathType,loop:r._pathType===\"loop\",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:c.instanceCount,startIndices:c.vertexStarts}),i.dataChanged||n.invalidateAll()}if(i.extensionsChanged){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),n.invalidateAll()}}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:n}=this.props;return n[0]&&n[0].__source&&(r.object=n.find(s=>s.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;i=1&&e[0].length>=2&&Number.isFinite(e[0][0])}function Pdt(e){let t=e[0],r=e[e.length-1];return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]}function Idt(e,t,r,i){for(let n=0;nc/t));let s=Uv(e),o=i&&t===3;if(r){let c=s.length;s=s.slice();let d=[];for(let _=0;_d&&c>_||(d>_?(r||(s=s.slice()),jH(s,0,2,1)):(r||(s=s.slice()),jH(s,2,0,1)))}return(0,GH.default)(s,n,t)}var F2=class extends rm{constructor(t){let{fp64:r,IndexType:i=Uint32Array}=t;super({...t,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint8ClampedArray,size:1},indices:{type:i,size:1}}})}get(t){let{attributes:r}=this;return t===\"indices\"?r.indices&&r.indices.subarray(0,this.vertexCount):r[t]}updateGeometry(t){super.updateGeometry(t);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw new Error(\"missing indices buffer\")}normalizeGeometry(t){if(this.normalize){let r=w3(t,this.positionSize);return this.opts.resolution?C2(Uv(r),B2(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?UO(Uv(r),B2(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return t}getGeometrySize(t){if(qH(t)){let r=0;for(let i of t)r+=this.getGeometrySize(i);return r}return Uv(t).length/this.positionSize}getGeometryFromBuffer(t){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(t):null}updateGeometryAttributes(t,r){if(t&&qH(t))for(let i of t){let n=this.getGeometrySize(i);r.geometrySize=n,this.updateGeometryAttributes(i,r),r.vertexStart+=n,r.indexStart=this.indexStarts[r.geometryIndex+1]}else this._updateIndices(t,r),this._updatePositions(t,r),this._updateVertexValid(t,r)}_updateIndices(t,{geometryIndex:r,vertexStart:i,indexStart:n}){let{attributes:s,indexStarts:o,typedArrayManager:c}=this,d=s.indices;if(!d||!t)return;let _=n,w=WH(t,this.positionSize,this.opts.preproject,this.opts.full3d);d=c.allocate(d,n+w.length,{copy:!0});for(let I=0;I2?o[d*s+2]:0;n[c*3]=_,n[c*3+1]=w,n[c*3+2]=I}}_updateVertexValid(t,{vertexStart:r,geometrySize:i}){let{positionSize:n}=this,s=this.attributes.vertexValid,o=t&&B2(t);if(t&&t.edgeTypes?s.set(t.edgeTypes,r):s.fill(1,r,r+i),o)for(let c=0;c0&&!Number.isFinite(e[0])}var S3=`\nattribute vec2 vertexPositions;\nattribute float vertexValid;\n\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nstruct PolygonProps {\n vec4 fillColors;\n vec4 lineColors;\n vec3 positions;\n vec3 nextPositions;\n vec3 pickingColors;\n vec3 positions64Low;\n vec3 nextPositions64Low;\n float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return normalize(vector * project_uCommonUnitsPerWorldUnit);\n }\n return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n#ifdef IS_SIDE_VERTEX\n if(vertexValid < 0.5){\n gl_Position = vec4(0.);\n return;\n }\n#endif\n\n vec3 pos;\n vec3 pos64Low;\n vec3 normal;\n vec4 colors = isWireframe ? props.lineColors : props.fillColors;\n\n geometry.worldPosition = props.positions;\n geometry.worldPositionAlt = props.nextPositions;\n geometry.pickingColor = props.pickingColors;\n\n#ifdef IS_SIDE_VERTEX\n pos = mix(props.positions, props.nextPositions, vertexPositions.x);\n pos64Low = mix(props.positions64Low, props.nextPositions64Low, vertexPositions.x);\n#else\n pos = props.positions;\n pos64Low = props.positions64Low;\n#endif\n\n if (extruded) {\n pos.z += props.elevations * vertexPositions.y * elevationScale;\n }\n gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n if (extruded) {\n #ifdef IS_SIDE_VERTEX\n normal = vec3(\n props.positions.y - props.nextPositions.y + (props.positions64Low.y - props.nextPositions64Low.y),\n props.nextPositions.x - props.positions.x + (props.nextPositions64Low.x - props.positions64Low.x),\n 0.0);\n normal = project_offset_normal(normal);\n #else\n normal = project_normal(vec3(0.0, 0.0, 1.0));\n #endif\n geometry.normal = normal;\n vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, normal);\n vColor = vec4(lightColor, colors.a * opacity);\n } else {\n vColor = vec4(colors.rgb, colors.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var ZH=`#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\n`.concat(S3,`\n\nvoid main(void) {\n PolygonProps props;\n\n props.positions = positions;\n props.positions64Low = positions64Low;\n props.elevations = elevations;\n props.fillColors = fillColors;\n props.lineColors = lineColors;\n props.pickingColors = pickingColors;\n\n calculatePosition(props);\n}\n`);var YH=`#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\n\nattribute vec3 instancePositions;\nattribute vec3 nextPositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 nextPositions64Low;\nattribute float instanceElevations;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\n`.concat(S3,`\n\nvoid main(void) {\n PolygonProps props;\n\n #if RING_WINDING_ORDER_CW == 1\n props.positions = instancePositions;\n props.positions64Low = instancePositions64Low;\n props.nextPositions = nextPositions;\n props.nextPositions64Low = nextPositions64Low;\n #else\n props.positions = nextPositions;\n props.positions64Low = nextPositions64Low;\n props.nextPositions = instancePositions;\n props.nextPositions64Low = instancePositions64Low;\n #endif\n props.elevations = instanceElevations;\n props.fillColors = instanceFillColors;\n props.lineColors = instanceLineColors;\n props.pickingColors = instancePickingColors;\n\n calculatePosition(props);\n}\n`);var $H=`#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var M3=[0,0,0,255],Cdt={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:\"CW\",_full3d:!1,elevationScale:{type:\"number\",min:0,value:1},getPolygon:{type:\"accessor\",value:e=>e.polygon},getElevation:{type:\"accessor\",value:1e3},getFillColor:{type:\"accessor\",value:M3},getLineColor:{type:\"accessor\",value:M3},material:!0},T3={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},Ac=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(t){return super.getShaders({vs:t===\"top\"?ZH:YH,fs:$H,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder===\"CCW\"?0:1},modules:[ho,XA,ia]})}get wrapLongitude(){return!1}initializeState(){let{gl:t,viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:n}=this.props;r.isGeospatial&&i===Hr.DEFAULT&&(i=Hr.LNGLAT);let s;i===Hr.LNGLAT&&(n?s=r.projectPosition.bind(r):s=r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new F2({preproject:s,fp64:this.use64bitPositions(),IndexType:!t||Lh(t,_i.ELEMENT_INDEX_UINT32)?Uint32Array:Uint16Array})});let o=this.getAttributeManager(),c=!0;o.remove([\"instancePickingColors\"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:c},positions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:T3,accessor:\"getPolygon\",update:this.calculatePositions,noAlloc:c,shaderAttributes:{positions:{vertexOffset:0,divisor:0},instancePositions:{vertexOffset:0,divisor:1},nextPositions:{vertexOffset:1,divisor:1}}},vertexValid:{size:1,divisor:1,type:5121,update:this.calculateVertexValid,noAlloc:c},elevations:{size:1,transition:T3,accessor:\"getElevation\",shaderAttributes:{elevations:{divisor:0},instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:T3,accessor:\"getFillColor\",defaultValue:M3,shaderAttributes:{fillColors:{divisor:0},instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:T3,accessor:\"getLineColor\",defaultValue:M3,shaderAttributes:{lineColors:{divisor:0},instanceLineColors:{divisor:1}}},pickingColors:{size:3,type:5121,accessor:(d,{index:_,target:w})=>this.encodePickingColor(d&&d.__source?d.__source.index:_,w),shaderAttributes:{pickingColors:{divisor:0},instancePickingColors:{divisor:1}}}})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:n}=this.props;return n[0]&&n[0].__source&&(r.object=n.find(s=>s.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;id.delete()),this.setState(this._getModels(this.context.gl)),s.invalidateAll()}}updateGeometry({props:t,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:s}=this.state,o=t.data.attributes||{};s.updateGeometry({data:t.data,normalize:t._normalize,geometryBuffer:o.getPolygon,buffers:o,getGeometry:t.getPolygon,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:t._full3d}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(t){let{id:r,filled:i,extruded:n}=this.props,s,o;if(i){let c=this.getShaders(\"top\");c.defines.NON_INSTANCED_MODEL=1,s=new _n(t,{...c,id:\"\".concat(r,\"-top\"),drawMode:4,attributes:{vertexPositions:new Float32Array([0,1])},uniforms:{isWireframe:!1,isSideVertex:!1},vertexCount:0,isIndexed:!0})}return n&&(o=new _n(t,{...this.getShaders(\"side\"),id:\"\".concat(r,\"-side\"),geometry:new ms({drawMode:1,vertexCount:4,attributes:{vertexPositions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),instanceCount:0,isInstanced:1}),o.userData.excludeAttributes={indices:!0}),{models:[o,s].filter(Boolean),topModel:s,sideModel:o}}calculateIndices(t){let{polygonTesselator:r}=this.state;t.startIndices=r.indexStarts,t.value=r.get(\"indices\")}calculatePositions(t){let{polygonTesselator:r}=this.state;t.startIndices=r.vertexStarts,t.value=r.get(\"positions\")}calculateVertexValid(t){t.value=this.state.polygonTesselator.get(\"vertexValid\")}};G(Ac,\"defaultProps\",Cdt);G(Ac,\"layerName\",\"SolidPolygonLayer\");function E3({data:e,getIndex:t,dataRange:r,replace:i}){let{startRow:n=0,endRow:s=1/0}=r,o=e.length,c=o,d=o;for(let R=0;RR&&N>=n&&(c=R),N>=s){d=R;break}}let _=c,I=d-c!==i.length?e.slice(d):void 0;for(let R=0;Re.polygon},getFillColor:{type:\"accessor\",value:Ldt},getLineColor:{type:\"accessor\",value:QH},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0},sf=class extends $i{initializeState(){this.state={paths:[]},this.props.getLineDashArray&&rr.removed(\"getLineDashArray\",\"PathStyleExtension\")()}updateState({changeFlags:t}){let r=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getPolygon);if(r&&Array.isArray(t.dataChanged)){let i=this.state.paths.slice(),n=t.dataChanged.map(s=>E3({data:i,getIndex:o=>o.__source.index,dataRange:s,replace:this._getPaths(s)}));this.setState({paths:i,pathsDiff:n})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(t={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:s}=this.props,o=[],c=n===\"XY\"?2:3,{startRow:d,endRow:_}=t,{iterable:w,objectInfo:I}=Jc(r,d,_);for(let R of w){I.index++;let N=i(R,I);s&&(N=w3(N,c));let{holeIndices:j}=N,Y=N.positions||N;if(j)for(let it=0;it<=j.length;it++){let Z=Y.slice(j[it-1]||0,j[it]||Y.length);o.push(this.getSubLayerRow({path:Z},R,I.index))}else o.push(this.getSubLayerRow({path:Y},R,I.index))}return o}renderLayers(){let{data:t,_dataDiff:r,stroked:i,filled:n,extruded:s,wireframe:o,_normalize:c,_windingOrder:d,elevationScale:_,transitions:w,positionFormat:I}=this.props,{lineWidthUnits:R,lineWidthScale:N,lineWidthMinPixels:j,lineWidthMaxPixels:Y,lineJointRounded:it,lineMiterLimit:Z,lineDashJustified:K}=this.props,{getFillColor:J,getLineColor:ht,getLineWidth:Tt,getLineDashArray:Ot,getElevation:Yt,getPolygon:te,updateTriggers:oe,material:ae}=this.props,{paths:ke,pathsDiff:or}=this.state,cr=this.getSubLayerClass(\"fill\",Ac),Lr=this.getSubLayerClass(\"stroke\",pc),hn=this.shouldRenderSubLayer(\"fill\",ke)&&new cr({_dataDiff:r,extruded:s,elevationScale:_,filled:n,wireframe:o,_normalize:c,_windingOrder:d,getElevation:Yt,getFillColor:J,getLineColor:s&&o?ht:QH,material:ae,transitions:w},this.getSubLayerProps({id:\"fill\",updateTriggers:oe&&{getPolygon:oe.getPolygon,getElevation:oe.getElevation,getFillColor:oe.getFillColor,lineColors:s&&o,getLineColor:oe.getLineColor}}),{data:t,positionFormat:I,getPolygon:te}),zs=!s&&i&&this.shouldRenderSubLayer(\"stroke\",ke)&&new Lr({_dataDiff:or&&(()=>or),widthUnits:R,widthScale:N,widthMinPixels:j,widthMaxPixels:Y,jointRounded:it,miterLimit:Z,dashJustified:K,_pathType:\"loop\",transitions:w&&{getWidth:w.getLineWidth,getColor:w.getLineColor,getPath:w.getPolygon},getColor:this.getSubLayerAccessor(ht),getWidth:this.getSubLayerAccessor(Tt),getDashArray:this.getSubLayerAccessor(Ot)},this.getSubLayerProps({id:\"stroke\",updateTriggers:oe&&{getWidth:oe.getLineWidth,getColor:oe.getLineColor,getDashArray:oe.getLineDashArray}}),{data:ke,positionFormat:I,getPath:Tc=>Tc.path});return[!s&&hn,zs,s&&hn]}};G(sf,\"layerName\",\"PolygonLayer\");G(sf,\"defaultProps\",kdt);function XH(e,t){if(!e)return null;let r=\"startIndices\"in e?e.startIndices[t]:t,i=e.featureIds.value[r];return r!==-1?Rdt(e,i,r):null}function Rdt(e,t,r){let i={properties:{...e.properties[t]}};for(let n in e.numericProps)i.properties[n]=e.numericProps[n].value[r];return i}function KH(e,t){let r={points:null,lines:null,polygons:null};for(let i in r){let n=e[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let s=[];for(let o=0;o 0.0) {\n float inFill = alpha;\n float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\n color = mix(outlineColor, vColor, inFill);\n alpha = inBorder;\n }\n }\n float a = alpha * color.a;\n \n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color.rgb, a * opacity);\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var YO=192/256,tq=[],Ddt={getIconOffsets:{type:\"accessor\",value:e=>e.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:\"color\",value:[0,0,0,255]}},Rg=class extends Sp{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return{...super.getShaders(),fs:JH}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:\"getIconOffsets\"},instancePickingColors:{type:5121,size:3,accessor:(r,{index:i,target:n})=>this.encodePickingColor(i,n)}})}updateState(t){super.updateState(t);let{props:r,oldProps:i}=t,{outlineColor:n}=r;n!==i.outlineColor&&(n=n.map(s=>s/255),n[3]=Number.isFinite(n[3])?n[3]:1,this.setState({outlineColor:n})),!r.sdf&&r.outlineWidth&&rr.warn(\"\".concat(this.id,\": fontSettings.sdf is required to render outline\"))()}draw(t){let{sdf:r,smoothing:i,outlineWidth:n}=this.props,{outlineColor:s}=this.state,o=n?Math.max(i,YO*(1-n)):-1;if(t.uniforms={...t.uniforms,sdfBuffer:YO,outlineBuffer:o,gamma:i,sdf:!!r,outlineColor:s},super.draw(t),r&&n){let{iconManager:c}=this.state;c.getTexture()&&this.state.model.draw({uniforms:{outlineBuffer:YO}})}}getInstanceOffset(t){return t?Array.from(t).flatMap(r=>super.getInstanceOffset(r)):tq}getInstanceColorMode(t){return 1}getInstanceIconFrame(t){return t?Array.from(t).flatMap(r=>super.getInstanceIconFrame(r)):tq}};G(Rg,\"defaultProps\",Ddt);G(Rg,\"layerName\",\"MultiIconLayer\");var z2=class{constructor({fontSize:t=24,buffer:r=3,radius:i=8,cutoff:n=.25,fontFamily:s=\"sans-serif\",fontWeight:o=\"normal\",fontStyle:c=\"normal\"}={}){this.buffer=r,this.cutoff=n,this.radius=i;let d=this.size=t+r*4,_=this._createCanvas(d),w=this.ctx=_.getContext(\"2d\",{willReadFrequently:!0});w.font=`${c} ${o} ${t}px ${s}`,w.textBaseline=\"alphabetic\",w.textAlign=\"left\",w.fillStyle=\"black\",this.gridOuter=new Float64Array(d*d),this.gridInner=new Float64Array(d*d),this.f=new Float64Array(d),this.z=new Float64Array(d+1),this.v=new Uint16Array(d)}_createCanvas(t){let r=document.createElement(\"canvas\");return r.width=r.height=t,r}draw(t){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:o}=this.ctx.measureText(t),c=Math.ceil(i),d=0,_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-s))),w=Math.min(this.size-this.buffer,c+Math.ceil(n)),I=_+2*this.buffer,R=w+2*this.buffer,N=Math.max(I*R,0),j=new Uint8ClampedArray(N),Y={data:j,width:I,height:R,glyphWidth:_,glyphHeight:w,glyphTop:c,glyphLeft:d,glyphAdvance:r};if(_===0||w===0)return Y;let{ctx:it,buffer:Z,gridInner:K,gridOuter:J}=this;it.clearRect(Z,Z,_,w),it.fillText(t,Z,Z+c);let ht=it.getImageData(Z,Z,_,w);J.fill(1e20,0,N),K.fill(0,0,N);for(let Tt=0;Tt0?oe*oe:0,K[te]=oe<0?oe*oe:0}}eq(J,0,0,I,R,I,this.f,this.v,this.z),eq(K,Z,Z,_,w,I,this.f,this.v,this.z);for(let Tt=0;Tt-1);d++,s[d]=c,o[d]=_,o[d+1]=1e20}for(let c=0,d=0;cn&&(_=0,d++),s[I]={x:_+i,y:c+d*w+i,width:R,height:w,layoutWidth:R,layoutHeight:r},_+=R+i*2}return{mapping:s,xOffset:_,yOffset:c+d*w,canvasHeight:Fdt(c+(d+1)*w)}}function nq(e,t,r,i){let n=0;for(let o=t;oi&&(oc){let I=nq(e,c,d,n);_+I>i&&(oi&&(I=sq(e,c,d,i,n,s),o=s[s.length-1])),c=d,_+=I}return _}function Ndt(e,t,r,i,n=0,s){s===void 0&&(s=e.length);let o=[];return t===\"break-all\"?sq(e,n,s,r,i,o):zdt(e,n,s,r,i,o),o}function Udt(e,t,r,i,n,s){let o=0,c=0;for(let d=t;d0,I=[0,0],R=[0,0],N=0,j=0,Y=0;for(let Z=0;Z<=o;Z++){let K=s[Z];if((K===`\n`||Z===o)&&(Y=Z),Y>j){let J=w?Ndt(s,r,i,n,j,Y):Bdt;for(let ht=0;ht<=J.length;ht++){let Tt=ht===0?j:J[ht-1],Ot=ht1||d>0){let N=e.constructor;R=new N(_);for(let j=0;j<_;j++)R[j]=e[j*c+d]}for(let N=0;N=0&&this._order.splice(r,1)}_appendOrder(t){this._order.push(t)}};function Vdt(){let e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}var Dg={fontFamily:\"Monaco, monospace\",fontWeight:\"normal\",characterSet:Vdt(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},lq=1024,cq=.9,uq=1.2,fq=3,P3=new Vv(fq);function jdt(e,t){let r;typeof t==\"string\"?r=new Set(Array.from(t)):r=new Set(t);let i=P3.get(e);if(!i)return r;for(let n in i.mapping)r.has(n)&&r.delete(n);return r}function Gdt(e,t){for(let r=0;r=fq,\"Invalid cache limit\"),P3=new Vv(e)}var N2=class{constructor(){G(this,\"props\",{...Dg}),G(this,\"_key\",void 0),G(this,\"_atlas\",void 0)}get texture(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:t,buffer:r}=this.props;return(t*uq+r*2)/t}setProps(t={}){Object.assign(this.props,t),this._key=this._getKey();let r=jdt(this._key,this.props.characterSet),i=P3.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let n=this._generateFontAtlas(r,i);this._atlas=n,P3.set(this._key,n)}_generateFontAtlas(t,r){let{fontFamily:i,fontWeight:n,fontSize:s,buffer:o,sdf:c,radius:d,cutoff:_}=this.props,w=r&&r.data;w||(w=document.createElement(\"canvas\"),w.width=lq);let I=w.getContext(\"2d\",{willReadFrequently:!0});hq(I,i,s,n);let{mapping:R,canvasHeight:N,xOffset:j,yOffset:Y}=iq({getFontWidth:it=>I.measureText(it).width,fontHeight:s*uq,buffer:o,characterSet:t,maxCanvasWidth:lq,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(w.height!==N){let it=I.getImageData(0,0,w.width,w.height);w.height=N,I.putImageData(it,0,0)}if(hq(I,i,s,n),c){let it=new z2({fontSize:s,buffer:o,radius:d,cutoff:_,fontFamily:i,fontWeight:\"\".concat(n)});for(let Z of t){let{data:K,width:J,height:ht,glyphTop:Tt}=it.draw(Z);R[Z].width=J,R[Z].layoutOffsetY=s*cq-Tt;let Ot=I.createImageData(J,ht);Gdt(K,Ot),I.putImageData(Ot,R[Z].x,R[Z].y)}}else for(let it of t)I.fillText(it,R[it].x,R[it].y+o+s*cq);return{xOffset:j,yOffset:Y,mapping:R,data:w,width:w.width,height:w.height}}_getKey(){let{fontFamily:t,fontWeight:r,fontSize:i,buffer:n,sdf:s,radius:o,cutoff:c}=this.props;return s?\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(n,\" \").concat(o,\" \").concat(c):\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(n)}};var pq=`#define SHADER_NAME text-background-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceRects;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec2 instancePixelOffsets;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = radians(angle);\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n vLineWidth = instanceLineWidths;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\n sizeMinPixels, sizeMaxPixels\n );\n\n dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\n\n vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n pixelOffset += instancePixelOffsets;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var Aq=`#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool stroked;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec2 pixelPosition = uv * dimensions;\n if (stroked) {\n float distToEdge = min(\n min(pixelPosition.x, dimensions.x - pixelPosition.x),\n min(pixelPosition.y, dimensions.y - pixelPosition.y)\n );\n float isBorder = smoothedge(distToEdge, vLineWidth);\n gl_FragColor = mix(vFillColor, vLineColor, isBorder);\n } else {\n gl_FragColor = vFillColor;\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Wdt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:\"array\",value:[0,0,0,0]},getPosition:{type:\"accessor\",value:e=>e.position},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},getBoundingRect:{type:\"accessor\",value:[0,0,0,0]},getFillColor:{type:\"accessor\",value:[0,0,0,255]},getLineColor:{type:\"accessor\",value:[0,0,0,255]},getLineWidth:{type:\"accessor\",value:1}},Og=class extends yn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:pq,fs:Aq,modules:[ho,ia]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instanceRects:{size:4,accessor:\"getBoundingRect\"},instancePixelOffsets:{size:2,transition:!0,accessor:\"getPixelOffset\"},instanceFillColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){super.updateState(t);let{changeFlags:r}=t;if(r.extensionsChanged){var i;let{gl:n}=this.context;(i=this.state.model)===null||i===void 0||i.delete(),this.state.model=this._getModel(n),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{billboard:r,sizeScale:i,sizeUnits:n,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:c}=this.props,{padding:d}=this.props;d.length<4&&(d=[d[0],d[1],d[0],d[1]]),this.state.model.setUniforms(t).setUniforms({billboard:r,stroked:!!c,padding:d,sizeUnits:ea[n],sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o}).draw()}_getModel(t){let r=[0,0,1,0,1,1,0,1];return new _n(t,{...this.getShaders(),id:this.props.id,geometry:new ms({drawMode:6,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}};G(Og,\"defaultProps\",Wdt);G(Og,\"layerName\",\"TextBackgroundLayer\");var mq={start:1,middle:0,end:-1},gq={top:1,center:0,bottom:-1},$O=[0,0,0,255],Hdt=1,qdt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:\"accessor\",value:[255,255,255,255]},getBorderColor:{type:\"accessor\",value:$O},getBorderWidth:{type:\"accessor\",value:0},backgroundPadding:{type:\"array\",value:[0,0,0,0]},characterSet:{type:\"object\",value:Dg.characterSet},fontFamily:Dg.fontFamily,fontWeight:Dg.fontWeight,lineHeight:Hdt,outlineWidth:{type:\"number\",value:0,min:0},outlineColor:{type:\"color\",value:$O},fontSettings:{type:\"object\",value:{},compare:1},wordBreak:\"break-word\",maxWidth:{type:\"number\",value:-1},getText:{type:\"accessor\",value:e=>e.text},getPosition:{type:\"accessor\",value:e=>e.position},getColor:{type:\"accessor\",value:$O},getSize:{type:\"accessor\",value:32},getAngle:{type:\"accessor\",value:0},getTextAnchor:{type:\"accessor\",value:\"middle\"},getAlignmentBaseline:{type:\"accessor\",value:\"center\"},getPixelOffset:{type:\"accessor\",value:[0,0]},backgroundColor:{deprecatedFor:[\"background\",\"getBackgroundColor\"]}},of=class extends $i{constructor(...t){super(...t),G(this,\"state\",void 0),G(this,\"getBoundingRect\",(r,i)=>{let{size:[n,s]}=this.transformParagraph(r,i),{fontSize:o}=this.state.fontAtlasManager.props;n/=o,s/=o;let{getTextAnchor:c,getAlignmentBaseline:d}=this.props,_=mq[typeof c==\"function\"?c(r,i):c],w=gq[typeof d==\"function\"?d(r,i):d];return[(_-1)*n/2,(w-1)*s/2,n,s]}),G(this,\"getIconOffsets\",(r,i)=>{let{getTextAnchor:n,getAlignmentBaseline:s}=this.props,{x:o,y:c,rowWidth:d,size:[_,w]}=this.transformParagraph(r,i),I=mq[typeof n==\"function\"?n(r,i):n],R=gq[typeof s==\"function\"?s(r,i):s],N=o.length,j=new Array(N*2),Y=0;for(let it=0;it0&&rr.warn(\"v8.9 breaking change: TextLayer maxWidth is now relative to text size\")()}updateState(t){let{props:r,oldProps:i,changeFlags:n}=t;(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==i.lineHeight||r.wordBreak!==i.wordBreak||r.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:t}){return t.object=t.index>=0?this.props.data[t.index]:null,t}_updateFontAtlas(){let{fontSettings:t,fontFamily:r,fontWeight:i}=this.props,{fontAtlasManager:n,characterSet:s}=this.state,o={...t,characterSet:s,fontFamily:r,fontWeight:i};if(!n.mapping)return n.setProps(o),!0;for(let c in o)if(o[c]!==n.props[c])return n.setProps(o),!0;return!1}_updateText(){var t;let{data:r,characterSet:i}=this.props,n=(t=r.attributes)===null||t===void 0?void 0:t.getText,{getText:s}=this.props,o=r.startIndices,c,d=i===\"auto\"&&new Set;if(n&&o){let{texts:_,characterCount:w}=aq({...ArrayBuffer.isView(n)?{value:n}:n,length:r.length,startIndices:o,characterSet:d});c=w,s=(I,{index:R})=>_[R]}else{let{iterable:_,objectInfo:w}=Jc(r);o=[0],c=0;for(let I of _){w.index++;let R=Array.from(s(I,w)||\"\");d&&R.forEach(d.add,d),c+=R.length,o.push(c)}}this.setState({getText:s,startIndices:o,numInstances:c,characterSet:d||i})}transformParagraph(t,r){let{fontAtlasManager:i}=this.state,n=i.mapping,s=this.state.getText,{wordBreak:o,lineHeight:c,maxWidth:d}=this.props,_=s(t,r)||\"\";return oq(_,c,o,d*i.props.fontSize,n)}renderLayers(){let{startIndices:t,numInstances:r,getText:i,fontAtlasManager:{scale:n,texture:s,mapping:o},styleVersion:c}=this.state,{data:d,_dataDiff:_,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,getBackgroundColor:Y,getBorderColor:it,getBorderWidth:Z,backgroundPadding:K,background:J,billboard:ht,fontSettings:Tt,outlineWidth:Ot,outlineColor:Yt,sizeScale:te,sizeUnits:oe,sizeMinPixels:ae,sizeMaxPixels:ke,transitions:or,updateTriggers:cr}=this.props,Lr=this.getSubLayerClass(\"characters\",Rg),hn=this.getSubLayerClass(\"background\",Og);return[J&&new hn({getFillColor:Y,getLineColor:it,getLineWidth:Z,padding:K,getPosition:w,getSize:R,getAngle:N,getPixelOffset:j,billboard:ht,sizeScale:te,sizeUnits:oe,sizeMinPixels:ae,sizeMaxPixels:ke,transitions:or&&{getPosition:or.getPosition,getAngle:or.getAngle,getSize:or.getSize,getFillColor:or.getBackgroundColor,getLineColor:or.getBorderColor,getLineWidth:or.getBorderWidth,getPixelOffset:or.getPixelOffset}},this.getSubLayerProps({id:\"background\",updateTriggers:{getPosition:cr.getPosition,getAngle:cr.getAngle,getSize:cr.getSize,getFillColor:cr.getBackgroundColor,getLineColor:cr.getBorderColor,getLineWidth:cr.getBorderWidth,getPixelOffset:cr.getPixelOffset,getBoundingRect:{getText:cr.getText,getTextAnchor:cr.getTextAnchor,getAlignmentBaseline:cr.getAlignmentBaseline,styleVersion:c}}}),{data:d.attributes&&d.attributes.background?{length:d.length,attributes:d.attributes.background}:d,_dataDiff:_,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new Lr({sdf:Tt.sdf,smoothing:Number.isFinite(Tt.smoothing)?Tt.smoothing:Dg.smoothing,outlineWidth:Ot/(Tt.radius||Dg.radius),outlineColor:Yt,iconAtlas:s,iconMapping:o,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,billboard:ht,sizeScale:te*n,sizeUnits:oe,sizeMinPixels:ae*n,sizeMaxPixels:ke*n,transitions:or&&{getPosition:or.getPosition,getAngle:or.getAngle,getColor:or.getColor,getSize:or.getSize,getPixelOffset:or.getPixelOffset}},this.getSubLayerProps({id:\"characters\",updateTriggers:{all:cr.getText,getPosition:cr.getPosition,getAngle:cr.getAngle,getColor:cr.getColor,getSize:cr.getSize,getPixelOffset:cr.getPixelOffset,getIconOffsets:{getTextAnchor:cr.getTextAnchor,getAlignmentBaseline:cr.getAlignmentBaseline,styleVersion:c}}}),{data:d,_dataDiff:_,startIndices:t,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(t){dq(t)}};G(of,\"defaultProps\",qdt);G(of,\"layerName\",\"TextLayer\");var U2={circle:{type:nh,props:{filled:\"filled\",stroked:\"stroked\",lineWidthMaxPixels:\"lineWidthMaxPixels\",lineWidthMinPixels:\"lineWidthMinPixels\",lineWidthScale:\"lineWidthScale\",lineWidthUnits:\"lineWidthUnits\",pointRadiusMaxPixels:\"radiusMaxPixels\",pointRadiusMinPixels:\"radiusMinPixels\",pointRadiusScale:\"radiusScale\",pointRadiusUnits:\"radiusUnits\",pointAntialiasing:\"antialiasing\",pointBillboard:\"billboard\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\",getLineWidth:\"getLineWidth\",getPointRadius:\"getRadius\"}},icon:{type:Sp,props:{iconAtlas:\"iconAtlas\",iconMapping:\"iconMapping\",iconSizeMaxPixels:\"sizeMaxPixels\",iconSizeMinPixels:\"sizeMinPixels\",iconSizeScale:\"sizeScale\",iconSizeUnits:\"sizeUnits\",iconAlphaCutoff:\"alphaCutoff\",iconBillboard:\"billboard\",getIcon:\"getIcon\",getIconAngle:\"getAngle\",getIconColor:\"getColor\",getIconPixelOffset:\"getPixelOffset\",getIconSize:\"getSize\"}},text:{type:of,props:{textSizeMaxPixels:\"sizeMaxPixels\",textSizeMinPixels:\"sizeMinPixels\",textSizeScale:\"sizeScale\",textSizeUnits:\"sizeUnits\",textBackground:\"background\",textBackgroundPadding:\"backgroundPadding\",textFontFamily:\"fontFamily\",textFontWeight:\"fontWeight\",textLineHeight:\"lineHeight\",textMaxWidth:\"maxWidth\",textOutlineColor:\"outlineColor\",textOutlineWidth:\"outlineWidth\",textWordBreak:\"wordBreak\",textCharacterSet:\"characterSet\",textBillboard:\"billboard\",textFontSettings:\"fontSettings\",getText:\"getText\",getTextAngle:\"getAngle\",getTextColor:\"getColor\",getTextPixelOffset:\"getPixelOffset\",getTextSize:\"getSize\",getTextAnchor:\"getTextAnchor\",getTextAlignmentBaseline:\"getAlignmentBaseline\",getTextBackgroundColor:\"getBackgroundColor\",getTextBorderColor:\"getBorderColor\",getTextBorderWidth:\"getBorderWidth\"}}},V2={type:pc,props:{lineWidthUnits:\"widthUnits\",lineWidthScale:\"widthScale\",lineWidthMinPixels:\"widthMinPixels\",lineWidthMaxPixels:\"widthMaxPixels\",lineJointRounded:\"jointRounded\",lineCapRounded:\"capRounded\",lineMiterLimit:\"miterLimit\",lineBillboard:\"billboard\",getLineColor:\"getColor\",getLineWidth:\"getWidth\"}},I3={type:Ac,props:{extruded:\"extruded\",filled:\"filled\",wireframe:\"wireframe\",elevationScale:\"elevationScale\",material:\"material\",_full3d:\"_full3d\",getElevation:\"getElevation\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\"}};function jv({type:e,props:t}){let r={};for(let i in t)r[i]=e.defaultProps[t[i]];return r}function C3(e,t){let{transitions:r,updateTriggers:i}=e.props,n={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let s in t){let o=t[s],c=e.props[s];s.startsWith(\"get\")&&(c=e.getSubLayerAccessor(c),n.updateTriggers[o]=i[s],r&&(n.transitions[o]=r[s])),n[o]=c}return n}function yq(e){if(Array.isArray(e))return e;switch(rr.assert(e.type,\"GeoJSON does not have type\"),e.type){case\"Feature\":return[e];case\"FeatureCollection\":return rr.assert(Array.isArray(e.features),\"GeoJSON does not have features array\"),e.features;default:return[{geometry:e}]}}function QO(e,t,r={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:n=0,endRow:s=e.length}=r;for(let o=n;o{c.push(r({geometry:{type:\"Point\",coordinates:I}},i,n))});break;case\"LineString\":d.push(r({geometry:e},i,n));break;case\"MultiLineString\":o.forEach(I=>{d.push(r({geometry:{type:\"LineString\",coordinates:I}},i,n))});break;case\"Polygon\":_.push(r({geometry:e},i,n)),o.forEach(I=>{w.push(r({geometry:{type:\"LineString\",coordinates:I}},i,n))});break;case\"MultiPolygon\":o.forEach(I=>{_.push(r({geometry:{type:\"Polygon\",coordinates:I}},i,n)),I.forEach(R=>{w.push(r({geometry:{type:\"LineString\",coordinates:R}},i,n))})});break;default:}}var Zdt={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Ydt(e,t){let r=Zdt[e];for(rr.assert(r,\"Unknown GeoJSON type \".concat(e));t&&--r>0;)t=t[0];return t&&Number.isFinite(t[0])}function vq(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function L3(e){return e.geometry.coordinates}function xq(e,t){let r=vq(),{pointFeatures:i,lineFeatures:n,polygonFeatures:s,polygonOutlineFeatures:o}=e;return r.points.data=i,r.points._dataDiff=t.pointFeatures&&(()=>t.pointFeatures),r.points.getPosition=L3,r.lines.data=n,r.lines._dataDiff=t.lineFeatures&&(()=>t.lineFeatures),r.lines.getPath=L3,r.polygons.data=s,r.polygons._dataDiff=t.polygonFeatures&&(()=>t.polygonFeatures),r.polygons.getPolygon=L3,r.polygonsOutline.data=o,r.polygonsOutline._dataDiff=t.polygonOutlineFeatures&&(()=>t.polygonOutlineFeatures),r.polygonsOutline.getPath=L3,r}function bq(e,t){let r=vq(),{points:i,lines:n,polygons:s}=e,o=KH(e,t);return r.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,instancePickingColors:{size:3,value:o.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines.data={length:n.pathIndices.value.length-1,startIndices:n.pathIndices.value,attributes:{...n.attributes,getPath:n.positions,instancePickingColors:{size:3,value:o.lines}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines._pathType=\"open\",r.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:{...s.attributes,getPolygon:s.positions,pickingColors:{size:3,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},r.polygons._normalize=!1,s.triangles&&(r.polygons.data.attributes.indices=s.triangles.value),r.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:3,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},r.polygonsOutline._pathType=\"open\",r}var $dt=[\"points\",\"linestrings\",\"polygons\"],Qdt={...jv(U2.circle),...jv(U2.icon),...jv(U2.text),...jv(V2),...jv(I3),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:\"object\",value:null},iconMapping:{type:\"object\",value:{}},getIcon:{type:\"accessor\",value:e=>e.properties.icon},getText:{type:\"accessor\",value:e=>e.properties.text},pointType:\"circle\",getRadius:{deprecatedFor:\"getPointRadius\"}},Sm=class extends $i{initializeState(){this.state={layerProps:{},features:{}}}updateState({props:t,changeFlags:r}){if(!r.dataChanged)return;let{data:i}=this.props,n=i&&\"points\"in i&&\"polygons\"in i&&\"lines\"in i;this.setState({binary:n}),n?this._updateStateBinary({props:t,changeFlags:r}):this._updateStateJSON({props:t,changeFlags:r})}_updateStateBinary({props:t,changeFlags:r}){let i=bq(t.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:t,changeFlags:r}){let i=yq(t.data),n=this.getSubLayerRow.bind(this),s={},o={};if(Array.isArray(r.dataChanged)){let d=this.state.features;for(let _ in d)s[_]=d[_].slice(),o[_]=[];for(let _ of r.dataChanged){let w=QO(i,n,_);for(let I in d)o[I].push(E3({data:s[I],getIndex:R=>R.__source.index,dataRange:_,replace:w[I]}))}}else s=QO(i,n);let c=xq(s,o);this.setState({features:s,featuresDiff:o,layerProps:c})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i,sourceLayer:n}=r;return r.featureType=$dt.find(s=>n.id.startsWith(\"\".concat(this.id,\"-\").concat(s,\"-\"))),i>=0&&n.id.startsWith(\"\".concat(this.id,\"-points-text\"))&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(t){let r=\"\".concat(this.id,\"-points-\"),i=t.featureType===\"points\";for(let n of this.getSubLayers())n.id.startsWith(r)===i&&n.updateAutoHighlight(t)}_renderPolygonLayer(){let{extruded:t,wireframe:r}=this.props,{layerProps:i}=this.state,n=\"polygons-fill\",s=this.shouldRenderSubLayer(n,i.polygons.data)&&this.getSubLayerClass(n,I3.type);if(s){let o=C3(this,I3.props),c=t&&r;return c||delete o.getLineColor,o.updateTriggers.lineColors=c,new s(o,this.getSubLayerProps({id:n,updateTriggers:o.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:t,stroked:r}=this.props,{layerProps:i}=this.state,n=\"polygons-stroke\",s=\"linestrings\",o=!t&&r&&this.shouldRenderSubLayer(n,i.polygonsOutline.data)&&this.getSubLayerClass(n,V2.type),c=this.shouldRenderSubLayer(s,i.lines.data)&&this.getSubLayerClass(s,V2.type);if(o||c){let d=C3(this,V2.props);return[o&&new o(d,this.getSubLayerProps({id:n,updateTriggers:d.updateTriggers}),i.polygonsOutline),c&&new c(d,this.getSubLayerProps({id:s,updateTriggers:d.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:t}=this.props,{layerProps:r,binary:i}=this.state,{highlightedObjectIndex:n}=this.props;!i&&Number.isFinite(n)&&(n=r.points.data.findIndex(c=>c.__source.index===n));let s=new Set(t.split(\"+\")),o=[];for(let c of s){let d=\"points-\".concat(c),_=U2[c],w=_&&this.shouldRenderSubLayer(d,r.points.data)&&this.getSubLayerClass(d,_.type);if(w){let I=C3(this,_.props),R=r.points;if(c===\"text\"&&i){let{instancePickingColors:N,...j}=R.data.attributes;R={...R,data:{...R.data,attributes:j}}}o.push(new w(I,this.getSubLayerProps({id:d,updateTriggers:I.updateTriggers,highlightedObjectIndex:n}),R))}}return o}renderLayers(){let{extruded:t}=this.props,r=this._renderPolygonLayer(),i=this._renderLineLayers(),n=this._renderPointLayers();return[!t&&r,i,n,t&&r]}getSubLayerAccessor(t){let{binary:r}=this.state;return!r||typeof t!=\"function\"?super.getSubLayerAccessor(t):(i,n)=>{let{data:s,index:o}=n,c=XH(s,o);return t(c,n)}}};G(Sm,\"layerName\",\"GeoJsonLayer\");G(Sm,\"defaultProps\",Qdt);var iQt=1/Math.PI*180,nQt=1/180*Math.PI,Xdt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xdt}};var j2=globalThis.mathgl.config;function G2(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gv(e,t,r){let i=j2.EPSILON;r&&(j2.EPSILON=r);try{if(e===t)return!0;if(G2(e)&&G2(t)){if(e.length!==t.length)return!1;for(let n=0;n{t([r,i],[n,s],o,c)},this.options):Tq(this.points,t,this.options)}modifyWindingDirection(t){return this.isFlatArray?XO(this.points,t,this.options):Sq(this.points,t,this.options)}};function eB(e,t,r=2,i,n=\"xy\"){let s=t&&t.length,o=s?t[0]*r:e.length,c=Eq(e,0,o,r,!0,i&&i[0],n),d=[];if(!c||c.next===c.prev)return d;let _,w,I,R,N,j,Y;if(s&&(c=npt(e,t,c,r,i,n)),e.length>80*r){R=w=e[0],N=I=e[1];for(let it=r;itw&&(w=j),Y>I&&(I=Y);_=Math.max(w-R,I-N),_=_!==0?32767/_:0}return W2(c,d,r,R,N,_,0),d}function Eq(e,t,r,i,n,s,o){let c,d;s===void 0&&(s=Wv(e,{start:t,end:r,size:i,plane:o}));let _=Bg[o[0]],w=Bg[o[1]];if(n===s<0)for(c=t;c=t;c-=i)d=Mq(c,e[c+_],e[c+w],d);return d&&O3(d,d.next)&&(q2(d),d=d.next),d}function Fg(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(O3(r,r.next)||vs(r.prev,r,r.next)===0)){if(q2(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function W2(e,t,r,i,n,s,o){if(!e)return;!o&&s&&cpt(e,i,n,s);let c=e,d,_;for(;e.prev!==e.next;){if(d=e.prev,_=e.next,s?ept(e,i,n,s):tpt(e)){t.push(d.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),q2(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=rpt(Fg(e),t,r),W2(e,t,r,i,n,s,2)):o===2&&ipt(e,t,r,i,n,s):W2(Fg(e),t,r,i,n,s,1);break}}}function tpt(e){let t=e.prev,r=e,i=e.next;if(vs(t,r,i)>=0)return!1;let n=t.x,s=r.x,o=i.x,c=t.y,d=r.y,_=i.y,w=ns?n>o?n:o:s>o?s:o,N=c>d?c>_?c:_:d>_?d:_,j=i.next;for(;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&qv(n,c,s,d,o,_,j.x,j.y)&&vs(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function ept(e,t,r,i){let n=e.prev,s=e,o=e.next;if(vs(n,s,o)>=0)return!1;let c=n.x,d=s.x,_=o.x,w=n.y,I=s.y,R=o.y,N=cd?c>_?c:_:d>_?d:_,it=w>I?w>R?w:R:I>R?I:R,Z=tB(N,j,t,r,i),K=tB(Y,it,t,r,i),J=e.prevZ,ht=e.nextZ;for(;J&&J.z>=Z&&ht&&ht.z<=K;){if(J.x>=N&&J.x<=Y&&J.y>=j&&J.y<=it&&J!==n&&J!==o&&qv(c,w,d,I,_,R,J.x,J.y)&&vs(J.prev,J,J.next)>=0||(J=J.prevZ,ht.x>=N&&ht.x<=Y&&ht.y>=j&&ht.y<=it&&ht!==n&&ht!==o&&qv(c,w,d,I,_,R,ht.x,ht.y)&&vs(ht.prev,ht,ht.next)>=0))return!1;ht=ht.nextZ}for(;J&&J.z>=Z;){if(J.x>=N&&J.x<=Y&&J.y>=j&&J.y<=it&&J!==n&&J!==o&&qv(c,w,d,I,_,R,J.x,J.y)&&vs(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ht&&ht.z<=K;){if(ht.x>=N&&ht.x<=Y&&ht.y>=j&&ht.y<=it&&ht!==n&&ht!==o&&qv(c,w,d,I,_,R,ht.x,ht.y)&&vs(ht.prev,ht,ht.next)>=0)return!1;ht=ht.nextZ}return!0}function rpt(e,t,r){let i=e;do{let n=i.prev,s=i.next.next;!O3(n,s)&&Pq(n,i,i.next,s)&&H2(n,s)&&H2(s,n)&&(t.push(n.i/r|0),t.push(i.i/r|0),t.push(s.i/r|0),q2(i),q2(i.next),i=e=s),i=i.next}while(i!==e);return Fg(i)}function ipt(e,t,r,i,n,s){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&fpt(o,c)){let d=Iq(o,c);o=Fg(o,o.next),d=Fg(d,d.next),W2(o,t,r,i,n,s,0),W2(d,t,r,i,n,s,0);return}c=c.next}o=o.next}while(o!==e)}function npt(e,t,r,i,n,s){let o=[],c,d,_,w,I;for(c=0,d=t.length;c=r.next.y&&r.next.y!==r.y){let R=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(R<=i&&R>s&&(s=R,o=r.x=r.x&&r.x>=d&&i!==r.x&&qv(n<_?i:s,n,d,_,n<_?s:i,n,r.x,r.y)&&(I=Math.abs(n-r.y)/(i-r.x),H2(r,e)&&(Io.x||r.x===o.x&&lpt(o,r)))&&(o=r,w=I)),r=r.next;while(r!==c);return o}function lpt(e,t){return vs(e.prev,e,t.prev)<0&&vs(t.next,e,e.next)<0}function cpt(e,t,r,i){let n=e;do n.z===0&&(n.z=tB(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,upt(n)}function upt(e){let t,r,i=1,n,s,o,c,d,_;do{for(s=e,e=null,_=null,n=0;s;){for(n++,c=s,o=0,r=0;r0||d>0&&c;)o!==0&&(d===0||!c||s.z<=c.z)?(t=s,s=s.nextZ,o--):(t=c,c=c.nextZ,d--),_?_.nextZ=t:e=t,t.prevZ=_,_=t;s=c}_.nextZ=null,i*=2}while(n>1);return e}function tB(e,t,r,i,n){return e=(e-r)*n|0,t=(t-i)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function hpt(e){let t=e,r=e;do(t.x=(e-o)*(s-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(s-c)>=(n-o)*(i-c)}function fpt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!dpt(e,t)&&(H2(e,t)&&H2(t,e)&&ppt(e,t)&&(vs(e.prev,e,t.prev)||vs(e,t.prev,t))||O3(e,t)&&vs(e.prev,e,e.next)>0&&vs(t.prev,t,t.next)>0)}function vs(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function O3(e,t){return e.x===t.x&&e.y===t.y}function Pq(e,t,r,i){let n=D3(vs(e,t,r)),s=D3(vs(e,t,i)),o=D3(vs(r,i,e)),c=D3(vs(r,i,t));return!!(n!==s&&o!==c||n===0&&R3(e,r,t)||s===0&&R3(e,i,t)||o===0&&R3(r,e,i)||c===0&&R3(r,t,i))}function R3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function D3(e){return e>0?1:e<0?-1:0}function dpt(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Pq(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function H2(e,t){return vs(e.prev,e,e.next)<0?vs(e,t,e.next)>=0&&vs(e,e.prev,t)>=0:vs(e,t,e.prev)<0||vs(e,e.next,t)<0}function ppt(e,t){let r=e,i=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function Iq(e,t){let r=new Z2(e.i,e.x,e.y),i=new Z2(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Mq(e,t,r,i){let n=new Z2(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function q2(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)}var Z2=class{constructor(t,r,i){G(this,\"i\",void 0),G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"prev\",null),G(this,\"next\",null),G(this,\"z\",0),G(this,\"prevZ\",null),G(this,\"nextZ\",null),G(this,\"steiner\",!1),this.i=t,this.x=r,this.y=i}};function kq(e){e(\"EPSG:4326\",\"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\"),e(\"EPSG:4269\",\"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\"),e(\"EPSG:3857\",\"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\"),e.WGS84=e[\"EPSG:4326\"],e[\"EPSG:3785\"]=e[\"EPSG:3857\"],e.GOOGLE=e[\"EPSG:3857\"],e[\"EPSG:900913\"]=e[\"EPSG:3857\"],e[\"EPSG:102113\"]=e[\"EPSG:3857\"]}var af=1,lf=2,Tp=3,Rq=4,Y2=5,rB=6378137,Dq=6356752314e-3,iB=.0066943799901413165,zg=484813681109536e-20,pe=Math.PI/2,Oq=.16666666666666666,Bq=.04722222222222222,Fq=.022156084656084655,be=1e-10,xs=.017453292519943295,mc=57.29577951308232,Ii=Math.PI/4,Tm=Math.PI*2,bs=3.14159265359;var Ll={};Ll.greenwich=0;Ll.lisbon=-9.131906111111;Ll.paris=2.337229166667;Ll.bogota=-74.080916666667;Ll.madrid=-3.687938888889;Ll.rome=12.452333333333;Ll.bern=7.439583333333;Ll.jakarta=106.807719444444;Ll.ferro=-17.666666666667;Ll.brussels=4.367975;Ll.stockholm=18.058277777778;Ll.athens=23.7163375;Ll.oslo=10.722916666667;var zq={ft:{to_meter:.3048},\"us-ft\":{to_meter:1200/3937}};var Nq=/[\\s_\\-\\/\\(\\)]/g;function cu(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(Nq,\"\"),n=-1,s,o;++n=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Q2:return this.neutral(e);case Vq:return this.keyword(e);case B3:return this.quoted(e);case Gq:return this.afterquote(e);case jq:return this.number(e);case nB:return}};Mp.prototype.afterquote=function(e){if(e==='\"'){this.word+='\"',this.state=B3;return}if(F3.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in afterquote yet, index '+this.place)};Mp.prototype.afterItem=function(e){if(e===\",\"){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Q2;return}if(e===\"]\"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Q2,this.currentObject=this.stack.pop(),this.currentObject||(this.state=nB);return}};Mp.prototype.number=function(e){if(Wq.test(e)){this.word+=e;return}if(F3.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in number yet, index '+this.place)};Mp.prototype.quoted=function(e){if(e==='\"'){this.state=Gq;return}this.word+=e};Mp.prototype.keyword=function(e){if(vpt.test(e)){this.word+=e;return}if(e===\"[\"){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Q2;return}if(F3.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in keyword yet, index '+this.place)};Mp.prototype.neutral=function(e){if(ypt.test(e)){this.word=e,this.state=Vq;return}if(e==='\"'){this.word=\"\",this.state=B3;return}if(Wq.test(e)){this.word=e,this.state=jq;return}if(F3.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in neutral yet, index '+this.place)};Mp.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName===\"Polar_Stereographic\"&&(e.lat_ts=e.lat0,e.lat0=yd(e.lat0>0?90:-90))}function z3(e){var t=Uq(e),r=t.shift(),i=t.shift();t.unshift([\"name\",i]),t.unshift([\"type\",r]);var n={};return Ng(t,n),Spt(n),n}function sh(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r==\"string\"?r.charAt(0)===\"+\"?sh[e]=$2(arguments[1]):sh[e]=z3(arguments[1]):sh[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?sh.apply(t,i):sh(i)});if(typeof e==\"string\"){if(e in sh)return sh[e]}else\"EPSG\"in e?sh[\"EPSG:\"+e.EPSG]=e:\"ESRI\"in e?sh[\"ESRI:\"+e.ESRI]=e:\"IAU2000\"in e?sh[\"IAU2000:\"+e.IAU2000]=e:console.log(e);return}}kq(sh);var Zv=sh;function Tpt(e){return typeof e==\"string\"}function Mpt(e){return e in Zv}var Ept=[\"PROJECTEDCRS\",\"PROJCRS\",\"GEOGCS\",\"GEOCCS\",\"PROJCS\",\"LOCAL_CS\",\"GEODCRS\",\"GEODETICCRS\",\"GEODETICDATUM\",\"ENGCRS\",\"ENGINEERINGCRS\"];function Ppt(e){return Ept.some(function(t){return e.indexOf(t)>-1})}var Ipt=[\"3857\",\"900913\",\"3785\",\"102113\"];function Cpt(e){var t=cu(e,\"authority\");if(t){var r=cu(t,\"epsg\");return r&&Ipt.indexOf(r)>-1}}function Lpt(e){var t=cu(e,\"extension\");if(t)return cu(t,\"proj4\")}function kpt(e){return e[0]===\"+\"}function Rpt(e){if(Tpt(e)){if(Mpt(e))return Zv[e];if(Ppt(e)){var t=z3(e);if(Cpt(t))return Zv[\"EPSG:3857\"];var r=Lpt(t);return r?$2(r):t}if(kpt(e))return $2(e)}else return e}var qq=Rpt;function sB(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function nl(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function vd(e){return e<0?-1:1}function Ie(e){return Math.abs(e)<=bs?e:e-vd(e)*Tm}function kl(e,t,r){var i=e*r,n=.5*e;return i=Math.pow((1-i)/(1+i),n),Math.tan(.5*(pe-t))/i}function Ep(e,t){for(var r=.5*e,i,n,s=pe-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(s),n=pe-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-s,s+=n,Math.abs(n)<=1e-10)return s;return-9999}function Dpt(){var e=this.b/this.a;this.es=1-e*e,\"x0\"in this||(this.x0=0),\"y0\"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=nl(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Opt(e){var t=e.x,r=e.y;if(r*mc>90&&r*mc<-90&&t*mc>180&&t*mc<-180)return null;var i,n;if(Math.abs(Math.abs(r)-pe)<=be)return null;if(this.sphere)i=this.x0+this.a*this.k0*Ie(t-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(Ii+.5*r));else{var s=Math.sin(r),o=kl(this.e,r,s);i=this.x0+this.a*this.k0*Ie(t-this.long0),n=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=n,e}function Bpt(e){var t=e.x-this.x0,r=e.y-this.y0,i,n;if(this.sphere)n=pe-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(n=Ep(this.e,s),n===-9999)return null}return i=Ie(this.long0+t/(this.a*this.k0)),e.x=i,e.y=n,e}var Fpt=[\"Mercator\",\"Popular Visualisation Pseudo Mercator\",\"Mercator_1SP\",\"Mercator_Auxiliary_Sphere\",\"merc\"],Zq={init:Dpt,forward:Opt,inverse:Bpt,names:Fpt};function zpt(){}function Yq(e){return e}var Npt=[\"longlat\",\"identity\"],$q={init:zpt,forward:Yq,inverse:Yq,names:Npt};var Upt=[Zq,$q],N3={},U3=[];function Qq(e,t){var r=U3.length;return e.names?(U3[r]=e,e.names.forEach(function(i){N3[i.toLowerCase()]=r}),this):(console.log(t),!0)}function Vpt(e){if(!e)return!1;var t=e.toLowerCase();if(typeof N3[t]<\"u\"&&U3[N3[t]])return U3[N3[t]]}function jpt(){Upt.forEach(Qq)}var Xq={start:jpt,add:Qq,get:Vpt};var Kr={};Kr.MERIT={a:6378137,rf:298.257,ellipseName:\"MERIT 1983\"};Kr.SGS85={a:6378136,rf:298.257,ellipseName:\"Soviet Geodetic System 85\"};Kr.GRS80={a:6378137,rf:298.257222101,ellipseName:\"GRS 1980(IUGG, 1980)\"};Kr.IAU76={a:6378140,rf:298.257,ellipseName:\"IAU 1976\"};Kr.airy={a:6377563396e-3,b:635625691e-2,ellipseName:\"Airy 1830\"};Kr.APL4={a:6378137,rf:298.25,ellipseName:\"Appl. Physics. 1965\"};Kr.NWL9D={a:6378145,rf:298.25,ellipseName:\"Naval Weapons Lab., 1965\"};Kr.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:\"Modified Airy\"};Kr.andrae={a:637710443e-2,rf:300,ellipseName:\"Andrae 1876 (Den., Iclnd.)\"};Kr.aust_SA={a:6378160,rf:298.25,ellipseName:\"Australian Natl & S. Amer. 1969\"};Kr.GRS67={a:6378160,rf:298.247167427,ellipseName:\"GRS 67(IUGG 1967)\"};Kr.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:\"Bessel 1841\"};Kr.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:\"Bessel 1841 (Namibia)\"};Kr.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:\"Clarke 1866\"};Kr.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:\"Clarke 1880 mod.\"};Kr.clrk80ign={a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:\"Clarke 1880 (IGN)\"};Kr.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:\"Clarke 1858\"};Kr.CPM={a:63757387e-1,rf:334.29,ellipseName:\"Comm. des Poids et Mesures 1799\"};Kr.delmbr={a:6376428,rf:311.5,ellipseName:\"Delambre 1810 (Belgium)\"};Kr.engelis={a:637813605e-2,rf:298.2566,ellipseName:\"Engelis 1985\"};Kr.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:\"Everest 1830\"};Kr.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:\"Everest 1948\"};Kr.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:\"Everest 1956\"};Kr.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:\"Everest 1969\"};Kr.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:\"Everest (Sabah & Sarawak)\"};Kr.fschr60={a:6378166,rf:298.3,ellipseName:\"Fischer (Mercury Datum) 1960\"};Kr.fschr60m={a:6378155,rf:298.3,ellipseName:\"Fischer 1960\"};Kr.fschr68={a:6378150,rf:298.3,ellipseName:\"Fischer 1968\"};Kr.helmert={a:6378200,rf:298.3,ellipseName:\"Helmert 1906\"};Kr.hough={a:6378270,rf:297,ellipseName:\"Hough\"};Kr.intl={a:6378388,rf:297,ellipseName:\"International 1909 (Hayford)\"};Kr.kaula={a:6378163,rf:298.24,ellipseName:\"Kaula 1961\"};Kr.lerch={a:6378139,rf:298.257,ellipseName:\"Lerch 1979\"};Kr.mprts={a:6397300,rf:191,ellipseName:\"Maupertius 1738\"};Kr.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:\"New International 1967\"};Kr.plessis={a:6376523,rf:6355863,ellipseName:\"Plessis 1817 (France)\"};Kr.krass={a:6378245,rf:298.3,ellipseName:\"Krassovsky, 1942\"};Kr.SEasia={a:6378155,b:63567733205e-4,ellipseName:\"Southeast Asia\"};Kr.walbeck={a:6376896,b:63558348467e-4,ellipseName:\"Walbeck\"};Kr.WGS60={a:6378165,rf:298.3,ellipseName:\"WGS 60\"};Kr.WGS66={a:6378145,rf:298.25,ellipseName:\"WGS 66\"};Kr.WGS7={a:6378135,rf:298.26,ellipseName:\"WGS 72\"};var Kq=Kr.WGS84={a:6378137,rf:298.257223563,ellipseName:\"WGS 84\"};Kr.sphere={a:6370997,b:6370997,ellipseName:\"Normal Sphere (r=6370997)\"};function Jq(e,t,r,i){var n=e*e,s=t*t,o=(n-s)/n,c=0;i?(e*=1-o*(Oq+o*(Bq+o*Fq)),n=e*e,o=0):c=Math.sqrt(o);var d=(n-s)/s;return{es:o,e:c,ep2:d}}function tZ(e,t,r,i,n){if(!e){var s=cu(Kr,i);s||(s=Kq),e=s.a,t=s.b,r=s.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)3&&(c.datum_params[3]!==0||c.datum_params[4]!==0||c.datum_params[5]!==0||c.datum_params[6]!==0)&&(c.datum_type=lf,c.datum_params[3]*=zg,c.datum_params[4]*=zg,c.datum_params[5]*=zg,c.datum_params[6]=c.datum_params[6]/1e6+1)),o&&(c.datum_type=Tp,c.grids=o),c.a=r,c.b=i,c.es=n,c.ep2=s,c}var eZ=Gpt;var rZ={};function aB(e,t){var r=new DataView(t),i=Hpt(r),n=qpt(r,i),s=Zpt(r,n,i),o={header:n,subgrids:s};return rZ[e]=o,o}function iZ(e){if(e===void 0)return null;var t=e.split(\",\");return t.map(Wpt)}function Wpt(e){if(e.length===0)return null;var t=e[0]===\"@\";return t&&(e=e.slice(1)),e===\"null\"?{name:\"null\",mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:rZ[e]||null,isNull:!1}}function Yv(e){return e/3600*Math.PI/180}function Hpt(e){var t=e.getInt32(8,!1);return t===11?!1:(t=e.getInt32(8,!0),t!==11&&console.warn(\"Failed to detect nadgrid endian-ness, defaulting to little-endian\"),!0)}function qpt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:oB(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function oB(e,t,r){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,r)))}function Zpt(e,t,r){for(var i=176,n=[],s=0;s5e-11?!1:e.datum_type===af?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===lf?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function V3(e,t,r){var i=e.x,n=e.y,s=e.z?e.z:0,o,c,d,_;if(n<-pe&&n>-1.001*pe)n=-pe;else if(n>pe&&n<1.001*pe)n=pe;else{if(n<-pe)return{x:-1/0,y:-1/0,z:e.z};if(n>pe)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),c=Math.sin(n),_=Math.cos(n),d=c*c,o=r/Math.sqrt(1-t*d),{x:(o+s)*_*Math.cos(i),y:(o+s)*_*Math.sin(i),z:(o*(1-t)+s)*c}}function j3(e,t,r,i){var n=1e-12,s=n*n,o=30,c,d,_,w,I,R,N,j,Y,it,Z,K,J,ht=e.x,Tt=e.y,Ot=e.z?e.z:0,Yt,te,oe;if(c=Math.sqrt(ht*ht+Tt*Tt),d=Math.sqrt(ht*ht+Tt*Tt+Ot*Ot),c/rs&&Ji.y||j>i.x||Zc&&Math.abs(d.y)>c);if(o<0)return console.log(\"Inverse grid shift iterator failed to converge.\"),i;i.x=Ie(s.x+r.ll[0]),i.y=s.y+r.ll[1]}else isNaN(s.x)||(i.x=e.x+s.x,i.y=e.y+s.y);return i}function lZ(e,t){var r={x:e.x/t.del[0],y:e.y/t.del[1]},i={x:Math.floor(r.x),y:Math.floor(r.y)},n={x:r.x-1*i.x,y:r.y-1*i.y},s={x:Number.NaN,y:Number.NaN},o;if(i.x<0||i.x>=t.lim[0]||i.y<0||i.y>=t.lim[1])return s;o=i.y*t.lim[0]+i.x;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var d={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var _={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var w={x:t.cvs[o][0],y:t.cvs[o][1]},I=n.x*n.y,R=n.x*(1-n.y),N=(1-n.x)*(1-n.y),j=(1-n.x)*n.y;return s.x=N*c.x+R*d.x+j*w.x+I*_.x,s.y=N*c.y+R*d.y+j*w.y+I*_.y,s}function lB(e,t,r){var i=r.x,n=r.y,s=r.z||0,o,c,d,_={};for(d=0;d<3;d++)if(!(t&&d===2&&r.z===void 0))switch(d===0?(o=i,\"ew\".indexOf(e.axis[d])!==-1?c=\"x\":c=\"y\"):d===1?(o=n,\"ns\".indexOf(e.axis[d])!==-1?c=\"y\":c=\"x\"):(o=s,c=\"z\"),e.axis[d]){case\"e\":_[c]=o;break;case\"w\":_[c]=-o;break;case\"n\":_[c]=o;break;case\"s\":_[c]=-o;break;case\"u\":r[c]!==void 0&&(_.z=o);break;case\"d\":r[c]!==void 0&&(_.z=-o);break;default:return null}return _}function W3(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function hZ(e){uZ(e.x),uZ(e.y)}function uZ(e){if(typeof Number.isFinite==\"function\"){if(Number.isFinite(e))return;throw new TypeError(\"coordinates must be finite numbers\")}if(typeof e!=\"number\"||e!==e||!isFinite(e))throw new TypeError(\"coordinates must be finite numbers\")}function Kpt(e,t){return(e.datum.datum_type===af||e.datum.datum_type===lf||e.datum.datum_type===Tp)&&t.datumCode!==\"WGS84\"||(t.datum.datum_type===af||t.datum.datum_type===lf||t.datum.datum_type===Tp)&&e.datumCode!==\"WGS84\"}function Ug(e,t,r,i){var n;Array.isArray(r)?r=W3(r):r={x:r.x,y:r.y,z:r.z,m:r.m};var s=r.z!==void 0;if(hZ(r),e.datum&&t.datum&&Kpt(e,t)&&(n=new Mm(\"WGS84\"),r=Ug(e,n,r,i),e=n),i&&e.axis!==\"enu\"&&(r=lB(e,!1,r)),e.projName===\"longlat\")r={x:r.x*xs,y:r.y*xs,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;if(e.from_greenwich&&(r.x+=e.from_greenwich),r=cZ(e.datum,t.datum,r),!!r)return t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName===\"longlat\"?r={x:r.x*mc,y:r.y*mc,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),i&&t.axis!==\"enu\"?lB(t,!0,r):(r&&!s&&delete r.z,r)}var fZ=Mm(\"WGS84\");function cB(e,t,r,i){var n,s,o;return Array.isArray(r)?(n=Ug(e,t,r,i)||{x:NaN,y:NaN},r.length>2?typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"?typeof n.z==\"number\"?[n.x,n.y,n.z].concat(r.splice(3)):[n.x,n.y,r[2]].concat(r.splice(3)):[n.x,n.y].concat(r.splice(2)):[n.x,n.y]):(s=Ug(e,t,r,i),o=Object.keys(r),o.length===2||o.forEach(function(c){if(typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"){if(c===\"x\"||c===\"y\"||c===\"z\")return}else if(c===\"x\"||c===\"y\")return;s[c]=r[c]}),s)}function dZ(e){return e instanceof Mm?e:e.oProj?e.oProj:Mm(e)}function Jpt(e,t,r){e=dZ(e);var i=!1,n;return typeof t>\"u\"?(t=e,e=fZ,i=!0):(typeof t.x<\"u\"||Array.isArray(t))&&(r=t,t=e,e=fZ,i=!0),t=dZ(t),r?cB(e,t,r):(n={forward:function(s,o){return cB(e,t,s,o)},inverse:function(s,o){return cB(t,e,s,o)}},i&&(n.oProj=t),n)}var gc=Jpt;var pZ=6,mZ=\"AJSAJS\",gZ=\"AFAFAF\",Qv=65,_c=73,oh=79,X2=86,K2=90,_Z={forward:hB,inverse:tAt,toPoint:fB};function hB(e,t){return t=t||5,iAt(eAt({lat:e[1],lon:e[0]}),t)}function tAt(e){var t=dB(vZ(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function fB(e){var t=dB(vZ(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function uB(e){return e*(Math.PI/180)}function AZ(e){return 180*(e/Math.PI)}function eAt(e){var t=e.lat,r=e.lon,i=6378137,n=.00669438,s=.9996,o,c,d,_,w,I,R,N=uB(t),j=uB(r),Y,it;it=Math.floor((r+180)/6)+1,r===180&&(it=60),t>=56&&t<64&&r>=3&&r<12&&(it=32),t>=72&&t<84&&(r>=0&&r<9?it=31:r>=9&&r<21?it=33:r>=21&&r<33?it=35:r>=33&&r<42&&(it=37)),o=(it-1)*6-180+3,Y=uB(o),c=n/(1-n),d=i/Math.sqrt(1-n*Math.sin(N)*Math.sin(N)),_=Math.tan(N)*Math.tan(N),w=c*Math.cos(N)*Math.cos(N),I=Math.cos(N)*(j-Y),R=i*((1-n/4-3*n*n/64-5*n*n*n/256)*N-(3*n/8+3*n*n/32+45*n*n*n/1024)*Math.sin(2*N)+(15*n*n/256+45*n*n*n/1024)*Math.sin(4*N)-35*n*n*n/3072*Math.sin(6*N));var Z=s*d*(I+(1-_+w)*I*I*I/6+(5-18*_+_*_+72*w-58*c)*I*I*I*I*I/120)+5e5,K=s*(R+d*Math.tan(N)*(I*I/2+(5-_+9*w+4*w*w)*I*I*I*I/24+(61-58*_+_*_+600*w-330*c)*I*I*I*I*I*I/720));return t<0&&(K+=1e7),{northing:Math.round(K),easting:Math.round(Z),zoneNumber:it,zoneLetter:rAt(t)}}function dB(e){var t=e.northing,r=e.easting,i=e.zoneLetter,n=e.zoneNumber;if(n<0||n>60)return null;var s=.9996,o=6378137,c=.00669438,d,_=(1-Math.sqrt(1-c))/(1+Math.sqrt(1-c)),w,I,R,N,j,Y,it,Z,K,J=r-5e5,ht=t;i<\"N\"&&(ht-=1e7),it=(n-1)*6-180+3,d=c/(1-c),Y=ht/s,Z=Y/(o*(1-c/4-3*c*c/64-5*c*c*c/256)),K=Z+(3*_/2-27*_*_*_/32)*Math.sin(2*Z)+(21*_*_/16-55*_*_*_*_/32)*Math.sin(4*Z)+151*_*_*_/96*Math.sin(6*Z),w=o/Math.sqrt(1-c*Math.sin(K)*Math.sin(K)),I=Math.tan(K)*Math.tan(K),R=d*Math.cos(K)*Math.cos(K),N=o*(1-c)/Math.pow(1-c*Math.sin(K)*Math.sin(K),1.5),j=J/(w*s);var Tt=K-w*Math.tan(K)/N*(j*j/2-(5+3*I+10*R-4*R*R-9*d)*j*j*j*j/24+(61+90*I+298*R+45*I*I-252*d-3*R*R)*j*j*j*j*j*j/720);Tt=AZ(Tt);var Ot=(j-(1+2*I+R)*j*j*j/6+(5-2*R+28*I-3*R*R+8*d+24*I*I)*j*j*j*j*j/120)/Math.cos(K);Ot=it+AZ(Ot);var Yt;if(e.accuracy){var te=dB({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Yt={top:te.lat,right:te.lon,bottom:Tt,left:Ot}}else Yt={lat:Tt,lon:Ot};return Yt}function rAt(e){var t=\"Z\";return 84>=e&&e>=72?t=\"X\":72>e&&e>=64?t=\"W\":64>e&&e>=56?t=\"V\":56>e&&e>=48?t=\"U\":48>e&&e>=40?t=\"T\":40>e&&e>=32?t=\"S\":32>e&&e>=24?t=\"R\":24>e&&e>=16?t=\"Q\":16>e&&e>=8?t=\"P\":8>e&&e>=0?t=\"N\":0>e&&e>=-8?t=\"M\":-8>e&&e>=-16?t=\"L\":-16>e&&e>=-24?t=\"K\":-24>e&&e>=-32?t=\"J\":-32>e&&e>=-40?t=\"H\":-40>e&&e>=-48?t=\"G\":-48>e&&e>=-56?t=\"F\":-56>e&&e>=-64?t=\"E\":-64>e&&e>=-72?t=\"D\":-72>e&&e>=-80&&(t=\"C\"),t}function iAt(e,t){var r=\"00000\"+e.easting,i=\"00000\"+e.northing;return e.zoneNumber+e.zoneLetter+nAt(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function nAt(e,t,r){var i=yZ(r),n=Math.floor(e/1e5),s=Math.floor(t/1e5)%20;return sAt(n,s,i)}function yZ(e){var t=e%pZ;return t===0&&(t=pZ),t}function sAt(e,t,r){var i=r-1,n=mZ.charCodeAt(i),s=gZ.charCodeAt(i),o=n+e-1,c=s+t,d=!1;o>K2&&(o=o-K2+Qv-1,d=!0),(o===_c||n<_c&&o>_c||(o>_c||n<_c)&&d)&&o++,(o===oh||noh||(o>oh||nK2&&(o=o-K2+Qv-1),c>X2?(c=c-X2+Qv-1,d=!0):d=!1,(c===_c||s<_c&&c>_c||(c>_c||s<_c)&&d)&&c++,(c===oh||soh||(c>oh||sX2&&(c=c-X2+Qv-1);var _=String.fromCharCode(o)+String.fromCharCode(c);return _}function vZ(e){if(e&&e.length===0)throw\"MGRSPoint coverting from nothing\";for(var t=e.length,r=null,i=\"\",n,s=0;!/[A-Z]/.test(n=e.charAt(s));){if(s>=2)throw\"MGRSPoint bad conversion from: \"+e;i+=n,s++}var o=parseInt(i,10);if(s===0||s+3>t)throw\"MGRSPoint bad conversion from: \"+e;var c=e.charAt(s++);if(c<=\"A\"||c===\"B\"||c===\"Y\"||c>=\"Z\"||c===\"I\"||c===\"O\")throw\"MGRSPoint zone letter \"+c+\" not handled: \"+e;r=e.substring(s,s+=2);for(var d=yZ(o),_=oAt(r.charAt(0),d),w=aAt(r.charAt(1),d);w0&&(Y=1e5/Math.pow(10,R),it=e.substring(s,s+R),N=parseFloat(it)*Y,Z=e.substring(s+R),j=parseFloat(Z)*Y),K=N+_,J=j+w,{easting:K,northing:J,zoneLetter:c,zoneNumber:o,accuracy:Y}}function oAt(e,t){for(var r=mZ.charCodeAt(t-1),i=1e5,n=!1;r!==e.charCodeAt(0);){if(r++,r===_c&&r++,r===oh&&r++,r>K2){if(n)throw\"Bad character: \"+e;r=Qv,n=!0}i+=1e5}return i}function aAt(e,t){if(e>\"V\")throw\"MGRSPoint given invalid Northing \"+e;for(var r=gZ.charCodeAt(t-1),i=0,n=!1;r!==e.charCodeAt(0);){if(r++,r===_c&&r++,r===oh&&r++,r>X2){if(n)throw\"Bad character: \"+e;r=Qv,n=!0}i+=1e5}return i}function lAt(e){var t;switch(e){case\"C\":t=11e5;break;case\"D\":t=2e6;break;case\"E\":t=28e5;break;case\"F\":t=37e5;break;case\"G\":t=46e5;break;case\"H\":t=55e5;break;case\"J\":t=64e5;break;case\"K\":t=73e5;break;case\"L\":t=82e5;break;case\"M\":t=91e5;break;case\"N\":t=0;break;case\"P\":t=8e5;break;case\"Q\":t=17e5;break;case\"R\":t=26e5;break;case\"S\":t=35e5;break;case\"T\":t=44e5;break;case\"U\":t=53e5;break;case\"V\":t=62e5;break;case\"W\":t=7e6;break;case\"X\":t=79e5;break;default:t=-1}if(t>=0)return t;throw\"Invalid zone letter: \"+e}function Xv(e,t,r){if(!(this instanceof Xv))return new Xv(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==\"object\")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==\"string\"&&typeof t>\"u\"){var i=e.split(\",\");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn(\"proj4.Point will be removed in version 3, use proj4.toPoint\")}Xv.fromMGRS=function(e){return new Xv(fB(e))};Xv.prototype.toMGRS=function(e){return hB([this.x,this.y],e)};var xZ=Xv;var cAt=1,uAt=.25,bZ=.046875,wZ=.01953125,SZ=.01068115234375,hAt=.75,fAt=.46875,dAt=.013020833333333334,pAt=.007120768229166667,AAt=.3645833333333333,mAt=.005696614583333333,gAt=.3076171875;function H3(e){var t=[];t[0]=cAt-e*(uAt+e*(bZ+e*(wZ+e*SZ))),t[1]=e*(hAt-e*(bZ+e*(wZ+e*SZ)));var r=e*e;return t[2]=r*(fAt-e*(dAt+e*pAt)),r*=e,t[3]=r*(AAt-e*mAt),t[4]=r*e*gAt,t}function Vg(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var _At=20;function q3(e,t,r){for(var i=1/(1-t),n=e,s=_At;s;--s){var o=Math.sin(n),c=1-t*o*o;if(c=(Vg(n,o,Math.cos(n),r)-e)*(c*Math.sqrt(c))*i,n-=c,Math.abs(c)be?Math.tan(r):0,Y=Math.pow(j,2),it=Math.pow(Y,2);n=1-this.es*Math.pow(c,2),w=w/Math.sqrt(n);var Z=Vg(r,c,d,this.en);s=this.a*(this.k0*w*(1+I/6*(1-Y+R+I/20*(5-18*Y+it+14*R-58*Y*R+I/42*(61+179*it-it*Y-479*Y)))))+this.x0,o=this.a*(this.k0*(Z-this.ml0+c*i*w/2*(1+I/12*(5-Y+9*R+4*N+I/30*(61+it-58*Y+270*R-330*Y*R+I/56*(1385+543*it-it*Y-3111*Y))))))+this.y0}else{var _=d*Math.sin(i);if(Math.abs(Math.abs(_)-1)=1){if(_-1>be)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=s,e.y=o,e}function xAt(e){var t,r,i,n,s=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=q3(t,this.es,this.en),Math.abs(r)be?Math.tan(r):0,j=this.ep2*Math.pow(R,2),Y=Math.pow(j,2),it=Math.pow(N,2),Z=Math.pow(it,2);t=1-this.es*Math.pow(I,2);var K=s*Math.sqrt(t)/this.k0,J=Math.pow(K,2);t=t*N,i=r-t*J/(1-this.es)*.5*(1-J/12*(5+3*it-9*j*it+j-4*Y-J/30*(61+90*it-252*j*it+45*Z+46*j-J/56*(1385+3633*it+4095*Z+1574*Z*it)))),n=Ie(this.long0+K*(1-J/6*(1+2*it+j-J/20*(5+28*it+24*Z+8*j*it+6*j-J/42*(61+662*it+1320*Z+720*Z*it))))/R)}else i=pe*vd(o),n=0;else{var c=Math.exp(s/this.k0),d=.5*(c-1/c),_=this.lat0+o/this.k0,w=Math.cos(_);t=Math.sqrt((1-Math.pow(w,2))/(1+Math.pow(d,2))),i=Math.asin(t),o<0&&(i=-i),d===0&&w===0?n=0:n=Ie(Math.atan2(d,w)+this.long0)}return e.x=n,e.y=i,e}var bAt=[\"Fast_Transverse_Mercator\",\"Fast Transverse Mercator\"],Kv={init:yAt,forward:vAt,inverse:xAt,names:bAt};function Z3(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Ea(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function TZ(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function MZ(e){var t=Math.abs(e);return t=TZ(t*(1+t/(Ea(1,t)+1))),e<0?-t:t}function Y3(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,n=e[i],s=0,o;--i>=0;)o=-s+r*n+e[i],s=n,n=o;return t+o*Math.sin(2*t)}function EZ(e,t){for(var r=2*Math.cos(t),i=e.length-1,n=e[i],s=0,o;--i>=0;)o=-s+r*n+e[i],s=n,n=o;return Math.sin(t)*o}function PZ(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function pB(e,t,r){for(var i=Math.sin(t),n=Math.cos(t),s=Z3(r),o=PZ(r),c=2*n*o,d=-2*i*s,_=e.length-1,w=e[_],I=0,R=0,N=0,j,Y;--_>=0;)j=R,Y=I,R=w,I=N,w=-j+c*R-d*I+e[_],N=-Y+d*R+c*I;return c=i*o,d=n*s,[c*w-d*N,c*N+d*w]}function wAt(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');this.approx&&(Kv.init.apply(this),this.forward=Kv.forward,this.inverse=Kv.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=Y3(this.cbg,this.lat0);this.Zb=-this.Qn*(i+EZ(this.gtu,2*i))}function SAt(e){var t=Ie(e.x-this.long0),r=e.y;r=Y3(this.cbg,r);var i=Math.sin(r),n=Math.cos(r),s=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*n),t=Math.atan2(s*n,Ea(i,n*o)),t=MZ(Math.tan(t));var c=pB(this.gtu,2*r,2*t);r=r+c[0],t=t+c[1];var d,_;return Math.abs(t)<=2.623395162778?(d=this.a*(this.Qn*t)+this.x0,_=this.a*(this.Qn*r+this.Zb)+this.y0):(d=1/0,_=1/0),e.x=d,e.y=_,e}function TAt(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,n;if(Math.abs(t)<=2.623395162778){var s=pB(this.utg,2*r,2*t);r=r+s[0],t=t+s[1],t=Math.atan(Z3(t));var o=Math.sin(r),c=Math.cos(r),d=Math.sin(t),_=Math.cos(t);r=Math.atan2(o*_,Ea(d,_*c)),t=Math.atan2(d,_*c),i=Ie(t+this.long0),n=Y3(this.cgb,r)}else i=1/0,n=1/0;return e.x=i,e.y=n,e}var MAt=[\"Extended_Transverse_Mercator\",\"Extended Transverse Mercator\",\"etmerc\",\"Transverse_Mercator\",\"Transverse Mercator\",\"Gauss Kruger\",\"Gauss_Kruger\",\"tmerc\"],Jv={init:wAt,forward:SAt,inverse:TAt,names:MAt};function IZ(e,t){if(e===void 0){if(e=Math.floor((Ie(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var EAt=\"etmerc\";function PAt(){var e=IZ(this.zone,this.long0);if(e===void 0)throw new Error(\"unknown utm zone\");this.lat0=0,this.long0=(6*Math.abs(e)-183)*xs,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Jv.init.apply(this),this.forward=Jv.forward,this.inverse=Jv.inverse}var IAt=[\"Universal Transverse Mercator System\",\"utm\"],CZ={init:PAt,names:IAt,dependsOn:EAt};function $3(e,t){return Math.pow((1-e)/(1+e),t)}var CAt=20;function LAt(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ii)/(Math.pow(Math.tan(.5*this.lat0+Ii),this.C)*$3(this.e*e,this.ratexp))}function kAt(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+Ii),this.C)*$3(this.e*Math.sin(r),this.ratexp))-pe,e.x=this.C*t,e}function RAt(e){for(var t=1e-14,r=e.x/this.C,i=e.y,n=Math.pow(Math.tan(.5*i+Ii)/this.K,1/this.C),s=CAt;s>0&&(i=2*Math.atan(n*$3(this.e*Math.sin(e.y),-.5*this.e))-pe,!(Math.abs(i-e.y)0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=be&&Math.abs(Math.cos(this.lat_ts))>be&&(this.k0=.5*this.cons*nl(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/kl(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=nl(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-pe,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function VAt(e){var t=e.x,r=e.y,i=Math.sin(r),n=Math.cos(r),s,o,c,d,_,w,I=Ie(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=be&&Math.abs(r+this.lat0)<=be?(e.x=NaN,e.y=NaN,e):this.sphere?(s=2*this.k0/(1+this.sinlat0*i+this.coslat0*n*Math.cos(I)),e.x=this.a*s*n*Math.sin(I)+this.x0,e.y=this.a*s*(this.coslat0*i-this.sinlat0*n*Math.cos(I))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-pe,d=Math.cos(o),c=Math.sin(o),Math.abs(this.coslat0)<=be?(_=kl(this.e,r*this.con,this.con*i),w=2*this.a*this.k0*_/this.cons,e.x=this.x0+w*Math.sin(t-this.long0),e.y=this.y0-this.con*w*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)0?t=Ie(this.long0+Math.atan2(e.x,-1*e.y)):t=Ie(this.long0+Math.atan2(e.x,e.y)):t=Ie(this.long0+Math.atan2(e.x*Math.sin(c),o*this.coslat0*Math.cos(c)-e.y*this.sinlat0*Math.sin(c))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=be){if(o<=be)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Ep(this.e,i),t=this.con*Ie(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=be?s=this.X0:(s=Math.asin(Math.cos(n)*this.sinX0+e.y*Math.sin(n)*this.cosX0/o),t=Ie(this.long0+Math.atan2(e.x*Math.sin(n),o*this.cosX0*Math.cos(n)-e.y*this.sinX0*Math.sin(n)))),r=-1*Ep(this.e,Math.tan(.5*(pe+s)));return e.x=t,e.y=r,e}var GAt=[\"stere\",\"Stereographic_South_Pole\",\"Polar Stereographic (variant B)\",\"Polar_Stereographic\"],kZ={init:UAt,forward:VAt,inverse:jAt,names:GAt,ssfn_:NAt};function WAt(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,n=1/i,s=2*n-Math.pow(n,2),o=this.e=Math.sqrt(s);this.R=this.k0*r*Math.sqrt(1-s)/(1-s*Math.pow(t,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var c=Math.log(Math.tan(Math.PI/4+this.b0/2)),d=Math.log(Math.tan(Math.PI/4+e/2)),_=Math.log((1+o*t)/(1-o*t));this.K=c-this.alpha*d+this.alpha*o/2*_}function HAt(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,n=2*(Math.atan(Math.exp(i))-Math.PI/4),s=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(s))),c=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(s));return e.y=this.R/2*Math.log((1+Math.sin(c))/(1-Math.sin(c)))+this.y0,e.x=this.R*o+this.x0,e}function qAt(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,n=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(n))),c=this.lambda0+o/this.alpha,d=0,_=s,w=-1e3,I=0;Math.abs(_-w)>1e-7;){if(++I>20)return;d=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(_))/2)),w=_,_=2*Math.atan(Math.exp(d))-Math.PI/2}return e.x=c,e.y=_,e}var ZAt=[\"somerc\"],RZ={init:WAt,forward:HAt,inverse:qAt,names:ZAt};var tx=1e-7;function YAt(e){var t=[\"Hotine_Oblique_Mercator\",\"Hotine_Oblique_Mercator_Azimuth_Natural_Origin\"],r=typeof e.PROJECTION==\"object\"?Object.keys(e.PROJECTION)[0]:e.PROJECTION;return\"no_uoff\"in e||\"no_off\"in e||t.indexOf(r)!==-1}function $At(){var e,t,r,i,n,s,o,c,d,_,w=0,I,R=0,N=0,j=0,Y=0,it=0,Z=0,K;this.no_off=YAt(this),this.no_rot=\"no_rot\"in this;var J=!1;\"alpha\"in this&&(J=!0);var ht=!1;if(\"rectified_grid_angle\"in this&&(ht=!0),J&&(Z=this.alpha),ht&&(w=this.rectified_grid_angle*xs),J||ht)R=this.longc;else if(N=this.long1,Y=this.lat1,j=this.long2,it=this.lat2,Math.abs(Y-it)<=tx||(e=Math.abs(Y))<=tx||Math.abs(e-pe)<=tx||Math.abs(Math.abs(this.lat0)-pe)<=tx||Math.abs(Math.abs(it)-pe)<=tx)throw new Error;var Tt=1-this.es;t=Math.sqrt(Tt),Math.abs(this.lat0)>be?(c=Math.sin(this.lat0),r=Math.cos(this.lat0),e=1-this.es*c*c,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/Tt),this.A=this.B*this.k0*t/e,i=this.B*t/(r*Math.sqrt(e)),n=i*i-1,n<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=i,this.E*=Math.pow(kl(this.e,this.lat0,c),this.B)):(this.B=1/t,this.A=this.k0,this.E=i=n=1),J||ht?(J?(I=Math.asin(Math.sin(Z)/i),ht||(w=Z)):(I=w,Z=Math.asin(i*Math.sin(I))),this.lam0=R-Math.asin(.5*(n-1/n)*Math.tan(I))/this.B):(s=Math.pow(kl(this.e,Y,Math.sin(Y)),this.B),o=Math.pow(kl(this.e,it,Math.sin(it)),this.B),n=this.E/s,d=(o-s)/(o+s),_=this.E*this.E,_=(_-o*s)/(_+o*s),e=N-j,e<-Math.pi?j-=Tm:e>Math.pi&&(j+=Tm),this.lam0=Ie(.5*(N+j)-Math.atan(_*Math.tan(.5*this.B*(N-j))/d)/this.B),I=Math.atan(2*Math.sin(this.B*Ie(N-this.lam0))/(n-1/n)),w=Z=Math.asin(i*Math.sin(I))),this.singam=Math.sin(I),this.cosgam=Math.cos(I),this.sinrot=Math.sin(w),this.cosrot=Math.cos(w),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,K=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(Z))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*I,this.v_pole_n=this.ArB*Math.log(Math.tan(Ii-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ii+n))}function QAt(e){var t={},r,i,n,s,o,c,d,_;if(e.x=e.x-this.lam0,Math.abs(Math.abs(e.y)-pe)>be){if(o=this.E/Math.pow(kl(this.e,e.y,Math.sin(e.y)),this.B),c=1/o,r=.5*(o-c),i=.5*(o+c),s=Math.sin(this.B*e.x),n=(r*this.singam-s*this.cosgam)/i,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,d=this.ArB*e.y;return this.no_rot?(t.x=d,t.y=_):(d-=this.u_0,t.x=_*this.cosrot+d*this.sinrot,t.y=d*this.cosrot-_*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function XAt(e){var t,r,i,n,s,o,c,d={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(r=e.y,t=e.x):(r=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),i=Math.exp(-this.BrA*r),n=.5*(i-1/i),s=.5*(i+1/i),o=Math.sin(this.BrA*t),c=(o*this.cosgam+n*this.singam)/s,Math.abs(Math.abs(c)-1)be?this.ns=Math.log(i/c)/Math.log(n/d):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(_,this.ns),this.title||(this.title=\"Lambert Conformal Conic\")}}function tmt(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=be&&(r=vd(r)*(pe-2*be));var i=Math.abs(Math.abs(r)-pe),n,s;if(i>be)n=kl(this.e,r,Math.sin(r)),s=this.a*this.f0*Math.pow(n,this.ns);else{if(i=r*this.ns,i<=0)return null;s=0}var o=this.ns*Ie(t-this.long0);return e.x=this.k0*(s*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-s*Math.cos(o))+this.y0,e}function emt(e){var t,r,i,n,s,o=(e.x-this.x0)/this.k0,c=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+c*c),r=1):(t=-Math.sqrt(o*o+c*c),r=-1);var d=0;if(t!==0&&(d=Math.atan2(r*o,r*c)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),n=Ep(this.e,i),n===-9999)return null}else n=-pe;return s=Ie(d/this.ns+this.long0),e.x=s,e.y=n,e}var rmt=[\"Lambert Tangential Conformal Conic Projection\",\"Lambert_Conformal_Conic\",\"Lambert_Conformal_Conic_1SP\",\"Lambert_Conformal_Conic_2SP\",\"lcc\",\"Lambert Conic Conformal (1SP)\",\"Lambert Conic Conformal (2SP)\"],OZ={init:JAt,forward:tmt,inverse:emt,names:rmt};function imt(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function nmt(e){var t,r,i,n,s,o,c,d=e.x,_=e.y,w=Ie(d-this.long0);return t=Math.pow((1+this.e*Math.sin(_))/(1-this.e*Math.sin(_)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(_/2+this.s45),this.alfa)/t)-this.s45),i=-w*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),s=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(n)),o=this.n*s,c=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),e.y=c*Math.cos(o)/1,e.x=c*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function smt(e){var t,r,i,n,s,o,c,d,_=e.x;e.x=e.y,e.y=_,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),s=Math.atan2(e.y,e.x),n=s/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),r=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(t)),e.x=this.long0-r/this.alfa,c=t,d=0;var w=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.e/2))-this.s45),Math.abs(c-e.y)<1e-10&&(d=1),c=e.y,w+=1;while(d===0&&w<15);return w>=15?null:e}var omt=[\"Krovak\",\"krovak\"],BZ={init:imt,forward:nmt,inverse:smt,names:omt};function Fo(e,t,r,i,n){return e*n-t*Math.sin(2*n)+r*Math.sin(4*n)-i*Math.sin(6*n)}function Pp(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Ip(e){return .375*e*(1+.25*e*(1+.46875*e))}function Cp(e){return .05859375*e*e*(1+.75*e)}function Lp(e){return e*e*e*(35/3072)}function kp(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function cf(e){return Math.abs(e)1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var hmt=1,fmt=2,dmt=3,pmt=4;function Amt(){var e=Math.abs(this.lat0);if(Math.abs(e-pe)0){var t;switch(this.qp=uf(this.e,1),this.mmf=.5/(1-this.es),this.apa=Smt(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=uf(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function mmt(e){var t,r,i,n,s,o,c,d,_,w,I=e.x,R=e.y;if(I=Ie(I-this.long0),this.sphere){if(s=Math.sin(R),w=Math.cos(R),i=Math.cos(I),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+w*i:1+this.sinph0*s+this.cosph0*w*i,r<=be)return null;r=Math.sqrt(2/r),t=r*w*Math.sin(I),r*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*w*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(R+this.lat0)=0?(t=(_=Math.sqrt(o))*n,r=i*(this.mode===this.S_POLE?_:-_)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function gmt(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,n,s,o,c,d,_;if(this.sphere){var w=0,I,R=0;if(I=Math.sqrt(t*t+r*r),n=I*.5,n>1)return null;switch(n=2*Math.asin(n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(R=Math.sin(n),w=Math.cos(n)),this.mode){case this.EQUIT:n=Math.abs(I)<=be?0:Math.asin(r*R/I),t*=R,r=w*I;break;case this.OBLIQ:n=Math.abs(I)<=be?this.lat0:Math.asin(w*this.sinph0+r*R*this.cosph0/I),t*=R*this.cosph0,r=(w-Math.sin(n)*this.sinph0)*I;break;case this.N_POLE:r=-r,n=pe-n;break;case this.S_POLE:n-=pe;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(_=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,d=Math.sqrt(t*t+r*r),d1&&(e=e>1?1:-1),Math.asin(e)}function Emt(){Math.abs(this.lat1+this.lat2)be?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Pmt(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=uf(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,s=this.ns0*Ie(t-this.long0),o=n*Math.sin(s)+this.x0,c=this.rh-n*Math.cos(s)+this.y0;return e.x=o,e.y=c,e}function Imt(e){var t,r,i,n,s,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),n=0,t!==0&&(n=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),s=Ie(n/this.ns0+this.long0),e.x=s,e.y=o,e}function Cmt(e,t){var r,i,n,s,o,c=yc(.5*t);if(e0||Math.abs(o)<=be?(c=this.x0+this.a*s*r*Math.sin(i)/o,d=this.y0+this.a*s*(this.cos_p14*t-this.sin_p14*r*n)/o):(c=this.x0+this.infinity_dist*r*Math.sin(i),d=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*n)),e.x=c,e.y=d,e}function Dmt(e){var t,r,i,n,s,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(n=Math.atan2(t,this.rc),r=Math.sin(n),i=Math.cos(n),o=yc(i*this.sin_p14+e.y*r*this.cos_p14/t),s=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),s=Ie(this.long0+s)):(o=this.phic0,s=0),e.x=s,e.y=o,e}var Omt=[\"gnom\"],UZ={init:kmt,forward:Rmt,inverse:Dmt,names:Omt};function VZ(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*pe:pe;for(var i=Math.asin(.5*t),n,s,o,c,d=0;d<30;d++)if(s=Math.sin(i),o=Math.cos(i),c=e*s,n=Math.pow(1-c*c,2)/(2*o)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=n,Math.abs(n)<=1e-10)return i;return NaN}function Bmt(){this.sphere||(this.k0=nl(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Fmt(e){var t=e.x,r=e.y,i,n,s=Ie(t-this.long0);if(this.sphere)i=this.x0+this.a*s*Math.cos(this.lat_ts),n=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=uf(this.e,Math.sin(r));i=this.x0+this.a*this.k0*s,n=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=n,e}function zmt(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=Ie(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=VZ(this.e,2*e.y*this.k0/this.a),t=Ie(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var Nmt=[\"cea\"],jZ={init:Bmt,forward:Fmt,inverse:zmt,names:Nmt};function Umt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Equidistant Cylindrical (Plate Carre)\",this.rc=Math.cos(this.lat_ts)}function Vmt(e){var t=e.x,r=e.y,i=Ie(t-this.long0),n=cf(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*n,e}function jmt(e){var t=e.x,r=e.y;return e.x=Ie(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=cf(this.lat0+(r-this.y0)/this.a),e}var Gmt=[\"Equirectangular\",\"Equidistant_Cylindrical\",\"eqc\"],GZ={init:Umt,forward:Vmt,inverse:jmt,names:Gmt};var WZ=20;function Wmt(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Pp(this.es),this.e1=Ip(this.es),this.e2=Cp(this.es),this.e3=Lp(this.es),this.ml0=this.a*Fo(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Hmt(e){var t=e.x,r=e.y,i,n,s,o=Ie(t-this.long0);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=be?(i=this.a*o,n=-1*this.a*this.lat0):(i=this.a*Math.sin(s)/Math.tan(r),n=this.a*(cf(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=be)i=this.a*o,n=-1*this.ml0;else{var c=kp(this.a,this.e,Math.sin(r))/Math.tan(r);i=c*Math.sin(s),n=this.a*Fo(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+c*(1-Math.cos(s))}return e.x=i+this.x0,e.y=n+this.y0,e}function qmt(e){var t,r,i,n,s,o,c,d,_;if(i=e.x-this.x0,n=e.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=be)t=Ie(i/this.a+this.long0),r=0;else{o=this.lat0+n/this.a,c=i*i/this.a/this.a+o*o,d=o;var w;for(s=WZ;s;--s)if(w=Math.tan(d),_=-1*(o*(d*w+1)-d-.5*(d*d+c)*w)/((d-o)/w-1),d+=_,Math.abs(_)<=be){r=d;break}t=Ie(this.long0+Math.asin(i*Math.tan(d)/this.a)/Math.sin(r))}else if(Math.abs(n+this.ml0)<=be)r=0,t=Ie(this.long0+i/this.a);else{o=(this.ml0+n)/this.a,c=i*i/this.a/this.a+o*o,d=o;var I,R,N,j,Y;for(s=WZ;s;--s)if(Y=this.e*Math.sin(d),I=Math.sqrt(1-Y*Y)*Math.tan(d),R=this.a*Fo(this.e0,this.e1,this.e2,this.e3,d),N=this.e0-2*this.e1*Math.cos(2*d)+4*this.e2*Math.cos(4*d)-6*this.e3*Math.cos(6*d),j=R/this.a,_=(o*(I*j+1)-j-.5*I*(j*j+c))/(this.es*Math.sin(2*d)*(j*j+c-2*o*j)/(4*I)+(o-j)*(I*N-2/Math.sin(2*d))-N),d-=_,Math.abs(_)<=be){r=d;break}I=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=Ie(this.long0+Math.asin(i*I/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var Zmt=[\"Polyconic\",\"poly\"],HZ={init:Wmt,forward:Hmt,inverse:qmt,names:Zmt};function Ymt(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function $mt(e){var t,r=e.x,i=e.y,n=i-this.lat0,s=r-this.long0,o=n/zg*1e-5,c=s,d=1,_=0;for(t=1;t<=10;t++)d=d*o,_=_+this.A[t]*d;var w=_,I=c,R=1,N=0,j,Y,it=0,Z=0;for(t=1;t<=6;t++)j=R*w-N*I,Y=N*w+R*I,R=j,N=Y,it=it+this.B_re[t]*R-this.B_im[t]*N,Z=Z+this.B_im[t]*R+this.B_re[t]*N;return e.x=Z*this.a+this.x0,e.y=it*this.a+this.y0,e}function Qmt(e){var t,r=e.x,i=e.y,n=r-this.x0,s=i-this.y0,o=s/this.a,c=n/this.a,d=1,_=0,w,I,R=0,N=0;for(t=1;t<=6;t++)w=d*o-_*c,I=_*o+d*c,d=w,_=I,R=R+this.C_re[t]*d-this.C_im[t]*_,N=N+this.C_im[t]*d+this.C_re[t]*_;for(var j=0;j.999999999999&&(r=.999999999999),t=Math.asin(r);var i=Ie(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var n=Math.asin(r);return e.x=i,e.y=n,e}var u0t=[\"Mollweide\",\"moll\"],$Z={init:a0t,forward:l0t,inverse:c0t,names:u0t};function h0t(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var s=0;if(r!==0&&(s=Math.atan2(t*e.x,t*e.y)),this.sphere)return n=Ie(this.long0+s/this.ns),i=cf(this.g-r/this.a),e.x=n,e.y=i,e;var o=this.g-r/this.a;return i=jg(o,this.e0,this.e1,this.e2,this.e3),n=Ie(this.long0+s/this.ns),e.x=n,e.y=i,e}var p0t=[\"Equidistant_Conic\",\"eqdc\"],QZ={init:h0t,forward:f0t,inverse:d0t,names:p0t};function A0t(){this.R=this.a}function m0t(e){var t=e.x,r=e.y,i=Ie(t-this.long0),n,s;Math.abs(r)<=be&&(n=this.x0+this.R*i,s=this.y0);var o=yc(2*Math.abs(r/Math.PI));(Math.abs(i)<=be||Math.abs(Math.abs(r)-pe)<=be)&&(n=this.x0,r>=0?s=this.y0+Math.PI*this.R*Math.tan(.5*o):s=this.y0+Math.PI*this.R*-Math.tan(.5*o));var c=.5*Math.abs(Math.PI/i-i/Math.PI),d=c*c,_=Math.sin(o),w=Math.cos(o),I=w/(_+w-1),R=I*I,N=I*(2/_-1),j=N*N,Y=Math.PI*this.R*(c*(I-j)+Math.sqrt(d*(I-j)*(I-j)-(j+d)*(R-j)))/(j+d);i<0&&(Y=-Y),n=this.x0+Y;var it=d+I;return Y=Math.PI*this.R*(N*it-c*Math.sqrt((j+d)*(d+1)-it*it))/(j+d),r>=0?s=this.y0+Y:s=this.y0-Y,e.x=n,e.y=s,e}function g0t(e){var t,r,i,n,s,o,c,d,_,w,I,R,N;return e.x-=this.x0,e.y-=this.y0,I=Math.PI*this.R,i=e.x/I,n=e.y/I,s=i*i+n*n,o=-Math.abs(n)*(1+s),c=o-2*n*n+i*i,d=-2*o+1+2*n*n+s*s,N=n*n/d+(2*c*c*c/d/d/d-9*o*c/d/d)/27,_=(o-c*c/3/d)/d,w=2*Math.sqrt(-_/3),I=3*N/_/w,Math.abs(I)>1&&(I>=0?I=1:I=-1),R=Math.acos(I)/3,e.y>=0?r=(-w*Math.cos(R+Math.PI/3)-c/3/d)*Math.PI:r=-(-w*Math.cos(R+Math.PI/3)-c/3/d)*Math.PI,Math.abs(i)2*pe*this.a?void 0:(r=t/this.a,i=Math.sin(r),n=Math.cos(r),s=this.long0,Math.abs(t)<=be?o=this.lat0:(o=yc(n*this.sin_p12+e.y*i*this.cos_p12/t),c=Math.abs(this.lat0)-pe,Math.abs(c)<=be?this.lat0>=0?s=Ie(this.long0+Math.atan2(e.x,-e.y)):s=Ie(this.long0-Math.atan2(-e.x,e.y)):s=Ie(this.long0+Math.atan2(e.x*i,t*this.cos_p12*n-e.y*this.sin_p12*i))),e.x=s,e.y=o,e)):(d=Pp(this.es),_=Ip(this.es),w=Cp(this.es),I=Lp(this.es),Math.abs(this.sin_p12-1)<=be?(R=this.a*Fo(d,_,w,I,pe),t=Math.sqrt(e.x*e.x+e.y*e.y),N=R-t,o=jg(N/this.a,d,_,w,I),s=Ie(this.long0+Math.atan2(e.x,-1*e.y)),e.x=s,e.y=o,e):Math.abs(this.sin_p12+1)<=be?(R=this.a*Fo(d,_,w,I,pe),t=Math.sqrt(e.x*e.x+e.y*e.y),N=t-R,o=jg(N/this.a,d,_,w,I),s=Ie(this.long0+Math.atan2(e.x,e.y)),e.x=s,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),it=Math.atan2(e.x,e.y),j=kp(this.a,this.e,this.sin_p12),Z=Math.cos(it),K=this.e*this.cos_p12*Z,J=-K*K/(1-this.es),ht=3*this.es*(1-J)*this.sin_p12*this.cos_p12*Z/(1-this.es),Tt=t/j,Ot=Tt-J*(1+J)*Math.pow(Tt,3)/6-ht*(1+3*J)*Math.pow(Tt,4)/24,Yt=1-J*Ot*Ot/2-Tt*Ot*Ot*Ot/6,Y=Math.asin(this.sin_p12*Math.cos(Ot)+this.cos_p12*Math.sin(Ot)*Z),s=Ie(this.long0+Math.asin(Math.sin(it)*Math.sin(Ot)/Math.cos(Y))),te=Math.sin(Y),o=Math.atan2((te-this.es*Yt*this.sin_p12)*Math.tan(Y),te*(1-this.es)),e.x=s,e.y=o,e))}var b0t=[\"Azimuthal_Equidistant\",\"aeqd\"],KZ={init:y0t,forward:v0t,inverse:x0t,names:b0t};function w0t(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function S0t(e){var t,r,i,n,s,o,c,d,_=e.x,w=e.y;return i=Ie(_-this.long0),t=Math.sin(w),r=Math.cos(w),n=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*n,s=1,(o>0||Math.abs(o)<=be)&&(c=this.a*s*r*Math.sin(i),d=this.y0+this.a*s*(this.cos_p14*t-this.sin_p14*r*n)),e.x=c,e.y=d,e}function T0t(e){var t,r,i,n,s,o,c;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=yc(t/this.a),i=Math.sin(r),n=Math.cos(r),o=this.long0,Math.abs(t)<=be?(c=this.lat0,e.x=o,e.y=c,e):(c=yc(n*this.sin_p14+e.y*i*this.cos_p14/t),s=Math.abs(this.lat0)-pe,Math.abs(s)<=be?(this.lat0>=0?o=Ie(this.long0+Math.atan2(e.x,-e.y)):o=Ie(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=c,e):(o=Ie(this.long0+Math.atan2(e.x*i,t*this.cos_p14*n-e.y*this.sin_p14*i)),e.x=o,e.y=c,e))}var M0t=[\"ortho\"],JZ={init:w0t,forward:S0t,inverse:T0t,names:M0t};var ws={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},an={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function E0t(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Quadrilateralized Spherical Cube\",this.lat0>=pe-Ii/2?this.face=ws.TOP:this.lat0<=-(pe-Ii/2)?this.face=ws.BOTTOM:Math.abs(this.long0)<=Ii?this.face=ws.FRONT:Math.abs(this.long0)<=pe+Ii?this.face=this.long0>0?ws.RIGHT:ws.LEFT:this.face=ws.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function P0t(e){var t={x:0,y:0},r,i,n,s,o,c,d={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===ws.TOP)s=pe-r,i>=Ii&&i<=pe+Ii?(d.value=an.AREA_0,n=i-pe):i>pe+Ii||i<=-(pe+Ii)?(d.value=an.AREA_1,n=i>0?i-bs:i+bs):i>-(pe+Ii)&&i<=-Ii?(d.value=an.AREA_2,n=i+pe):(d.value=an.AREA_3,n=i);else if(this.face===ws.BOTTOM)s=pe+r,i>=Ii&&i<=pe+Ii?(d.value=an.AREA_0,n=-i+pe):i=-Ii?(d.value=an.AREA_1,n=-i):i<-Ii&&i>=-(pe+Ii)?(d.value=an.AREA_2,n=-i-pe):(d.value=an.AREA_3,n=i>0?-i+bs:-i-bs);else{var _,w,I,R,N,j,Y;this.face===ws.RIGHT?i=ex(i,+pe):this.face===ws.BACK?i=ex(i,+bs):this.face===ws.LEFT&&(i=ex(i,-pe)),R=Math.sin(r),N=Math.cos(r),j=Math.sin(i),Y=Math.cos(i),_=N*Y,w=N*j,I=R,this.face===ws.FRONT?(s=Math.acos(_),n=X3(s,I,w,d)):this.face===ws.RIGHT?(s=Math.acos(w),n=X3(s,I,-_,d)):this.face===ws.BACK?(s=Math.acos(-_),n=X3(s,I,-w,d)):this.face===ws.LEFT?(s=Math.acos(-w),n=X3(s,I,_,d)):(s=n=0,d.value=an.AREA_0)}return c=Math.atan(12/bs*(n+Math.acos(Math.sin(n)*Math.cos(Ii))-pe)),o=Math.sqrt((1-Math.cos(s))/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(n))))),d.value===an.AREA_1?c+=pe:d.value===an.AREA_2?c+=bs:d.value===an.AREA_3&&(c+=1.5*bs),t.x=o*Math.cos(c),t.y=o*Math.sin(c),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function I0t(e){var t={lam:0,phi:0},r,i,n,s,o,c,d,_,w,I={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?I.value=an.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(I.value=an.AREA_1,r-=pe):e.x<0&&-e.x>=Math.abs(e.y)?(I.value=an.AREA_2,r=r<0?r+bs:r-bs):(I.value=an.AREA_3,r+=pe),w=bs/12*Math.tan(r),o=Math.sin(w)/(Math.cos(w)-1/Math.sqrt(2)),c=Math.atan(o),n=Math.cos(r),s=Math.tan(i),d=1-n*n*s*s*(1-Math.cos(Math.atan(1/Math.cos(c)))),d<-1?d=-1:d>1&&(d=1),this.face===ws.TOP)_=Math.acos(d),t.phi=pe-_,I.value===an.AREA_0?t.lam=c+pe:I.value===an.AREA_1?t.lam=c<0?c+bs:c-bs:I.value===an.AREA_2?t.lam=c-pe:t.lam=c;else if(this.face===ws.BOTTOM)_=Math.acos(d),t.phi=_-pe,I.value===an.AREA_0?t.lam=-c+pe:I.value===an.AREA_1?t.lam=-c:I.value===an.AREA_2?t.lam=-c-pe:t.lam=c<0?-c-bs:-c+bs;else{var R,N,j;R=d,w=R*R,w>=1?j=0:j=Math.sqrt(1-w)*Math.sin(c),w+=j*j,w>=1?N=0:N=Math.sqrt(1-w),I.value===an.AREA_1?(w=N,N=-j,j=w):I.value===an.AREA_2?(N=-N,j=-j):I.value===an.AREA_3&&(w=N,N=j,j=-w),this.face===ws.RIGHT?(w=R,R=-N,N=w):this.face===ws.BACK?(R=-R,N=-N):this.face===ws.LEFT&&(w=R,R=N,N=-w),t.phi=Math.acos(-j)-pe,t.lam=Math.atan2(N,R),this.face===ws.RIGHT?t.lam=ex(t.lam,-pe):this.face===ws.BACK?t.lam=ex(t.lam,-bs):this.face===ws.LEFT&&(t.lam=ex(t.lam,+pe))}if(this.es!==0){var Y,it,Z;Y=t.phi<0?1:0,it=Math.tan(t.phi),Z=this.b/Math.sqrt(it*it+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-Z*Z)/(this.one_minus_f*Z)),Y&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function X3(e,t,r,i){var n;return eIi&&n<=pe+Ii?(i.value=an.AREA_1,n-=pe):n>pe+Ii||n<=-(pe+Ii)?(i.value=an.AREA_2,n=n>=0?n-bs:n+bs):(i.value=an.AREA_3,n+=pe)),n}function ex(e,t){var r=e+t;return r<-bs?r+=Tm:r>+bs&&(r-=Tm),r}var C0t=[\"Quadrilateralized Spherical Cube\",\"Quadrilateralized_Spherical_Cube\",\"qsc\"],tY={init:E0t,forward:P0t,inverse:I0t,names:C0t};var AB=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],J2=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],eY=.8487,rY=1.3523,iY=mc/5,L0t=1/iY,rx=18,K3=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},k0t=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function R0t(e,t,r,i){for(var n=t;i;--i){var s=e(n);if(n-=s,Math.abs(s)=rx&&(i=rx-1),r=mc*(r-L0t*i);var n={x:K3(AB[i],r)*t,y:K3(J2[i],r)};return e.y<0&&(n.y=-n.y),n.x=n.x*this.a*eY+this.x0,n.y=n.y*this.a*rY+this.y0,n}function B0t(e){var t={x:(e.x-this.x0)/(this.a*eY),y:Math.abs(e.y-this.y0)/(this.a*rY)};if(t.y>=1)t.x/=AB[rx][0],t.y=e.y<0?-pe:pe;else{var r=Math.floor(t.y*rx);for(r<0?r=0:r>=rx&&(r=rx-1);;)if(J2[r][0]>t.y)--r;else if(J2[r+1][0]<=t.y)++r;else break;var i=J2[r],n=5*(t.y-i[0])/(J2[r+1][0]-i[0]);n=R0t(function(s){return(K3(i,s)-t.y)/k0t(i,s)},n,be,100),t.x/=K3(AB[r],n),t.y=(5*r+n)*xs,e.y<0&&(t.y=-t.y)}return t.x=Ie(t.x+this.long0),t}var F0t=[\"Robinson\",\"robin\"],nY={init:D0t,forward:O0t,inverse:B0t,names:F0t};function z0t(){this.name=\"geocent\"}function N0t(e){var t=V3(e,this.es,this.a);return t}function U0t(e){var t=j3(e,this.es,this.a,this.b);return t}var V0t=[\"Geocentric\",\"geocentric\",\"geocent\",\"Geocent\"],sY={init:z0t,forward:N0t,inverse:U0t,names:V0t};var sl={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},tS={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function j0t(){if(Object.keys(tS).forEach(function(r){if(typeof this[r]>\"u\")this[r]=tS[r].def;else{if(tS[r].num&&isNaN(this[r]))throw new Error(\"Invalid parameter value, must be numeric \"+r+\" = \"+this[r]);tS[r].num&&(this[r]=parseFloat(this[r]))}tS[r].degrees&&(this[r]=this[r]*xs)}.bind(this)),Math.abs(Math.abs(this.lat0)-pe)1e10)throw new Error(\"Invalid height\");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function G0t(e){e.x-=this.long0;var t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),n,s;switch(this.mode){case sl.OBLIQ:s=this.sinph0*t+this.cosph0*r*i;break;case sl.EQUIT:s=r*i;break;case sl.S_POLE:s=-t;break;case sl.N_POLE:s=t;break}switch(s=this.pn1/(this.p-s),n=s*r*Math.sin(e.x),this.mode){case sl.OBLIQ:s*=this.cosph0*t-this.sinph0*r*i;break;case sl.EQUIT:s*=t;break;case sl.N_POLE:s*=-(r*i);break;case sl.S_POLE:s*=r*i;break}var o,c;return o=s*this.cg+n*this.sg,c=1/(o*this.sw*this.h1+this.cw),n=(n*this.cg-s*this.sg)*this.cw*c,s=o*c,e.x=n*this.a,e.y=s*this.a,e}function W0t(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},r,i,n;n=1/(this.pn1-e.y*this.sw),r=this.pn1*e.x*n,i=this.pn1*e.y*this.cw*n,e.x=r*this.cg+i*this.sg,e.y=i*this.cg-r*this.sg;var s=Ea(e.x,e.y);if(Math.abs(s)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=\"ellipse\"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=\"sphere\";this.title||(this.title=\"Geostationary Satellite View\")}function Z0t(e){var t=e.x,r=e.y,i,n,s,o;if(t=t-this.long0,this.shape===\"ellipse\"){r=Math.atan(this.radius_p2*Math.tan(r));var c=this.radius_p/Ea(this.radius_p*Math.cos(r),Math.sin(r));if(n=c*Math.cos(t)*Math.cos(r),s=c*Math.sin(t)*Math.cos(r),o=c*Math.sin(r),(this.radius_g-n)*n-s*s-o*o*this.radius_p_inv2<0)return e.x=Number.NaN,e.y=Number.NaN,e;i=this.radius_g-n,this.flip_axis?(e.x=this.radius_g_1*Math.atan(s/Ea(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(s/i),e.y=this.radius_g_1*Math.atan(o/Ea(s,i)))}else this.shape===\"sphere\"&&(i=Math.cos(r),n=Math.cos(t)*i,s=Math.sin(t)*i,o=Math.sin(r),i=this.radius_g-n,this.flip_axis?(e.x=this.radius_g_1*Math.atan(s/Ea(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(s/i),e.y=this.radius_g_1*Math.atan(o/Ea(s,i))));return e.x=e.x*this.a,e.y=e.y*this.a,e}function Y0t(e){var t=-1,r=0,i=0,n,s,o,c;if(e.x=e.x/this.a,e.y=e.y/this.a,this.shape===\"ellipse\"){this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Ea(1,i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Ea(1,r));var d=i/this.radius_p;if(n=r*r+d*d+t*t,s=2*this.radius_g*t,o=s*s-4*n*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-s-Math.sqrt(o))/(2*n),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===\"sphere\"){if(this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+i*i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+r*r)),n=r*r+i*i+t*t,s=2*this.radius_g*t,o=s*s-4*n*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-s-Math.sqrt(o))/(2*n),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t)}return e.x=e.x+this.long0,e}var $0t=[\"Geostationary Satellite View\",\"Geostationary_Satellite\",\"geos\"],aY={init:q0t,forward:Z0t,inverse:Y0t,names:$0t};function lY(e){e.Proj.projections.add(Kv),e.Proj.projections.add(Jv),e.Proj.projections.add(CZ),e.Proj.projections.add(LZ),e.Proj.projections.add(kZ),e.Proj.projections.add(RZ),e.Proj.projections.add(DZ),e.Proj.projections.add(OZ),e.Proj.projections.add(BZ),e.Proj.projections.add(FZ),e.Proj.projections.add(zZ),e.Proj.projections.add(NZ),e.Proj.projections.add(UZ),e.Proj.projections.add(jZ),e.Proj.projections.add(GZ),e.Proj.projections.add(HZ),e.Proj.projections.add(qZ),e.Proj.projections.add(ZZ),e.Proj.projections.add(YZ),e.Proj.projections.add($Z),e.Proj.projections.add(QZ),e.Proj.projections.add(XZ),e.Proj.projections.add(KZ),e.Proj.projections.add(JZ),e.Proj.projections.add(tY),e.Proj.projections.add(nY),e.Proj.projections.add(sY),e.Proj.projections.add(oY),e.Proj.projections.add(aY)}gc.defaultDatum=\"WGS84\";gc.Proj=Mm;gc.WGS84=new gc.Proj(\"WGS84\");gc.Point=xZ;gc.toPoint=W3;gc.defs=Zv;gc.nadgrid=aB;gc.transform=Ug;gc.mgrs=_Z;gc.version=\"__VERSION__\";lY(gc);var cY=gc;function iS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function nS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function ix(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function Q0t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function X0t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function iI(e){return\"data\"in e?e.getChildAt(0):e.children[0]}var Ci=Object.freeze({__proto__:null,getLineStringChild:nS,getMultiLineStringChild:X0t,getMultiPointChild:Q0t,getMultiPolygonChild:iI,getPointChild:iS,getPolygonChild:ix});function nI(e,t){let r=e.valueOffsets,i=ix(e),n=i.valueOffsets,s=nS(i),o=s.type.listSize,c=iS(s),d=r[t],_=r[t+1],w=n[d],I=n[_],R=c.values.subarray(w*o,I*o);return new Hv(R,{size:o,isClosed:!0})}function hY(e){if(\"data\"in e)return new br(e.data.map(r=>hY(r)));let t=new Float64Array(e.length);for(let r=0;rfY(r)));let t=new Float64Array(e.length);for(let r=0;rdY(s));let t=[],r=0;for(let s=0;spY(t))):ix(e)}function AY(e){return\"data\"in e?new br(e.data.map(t=>AY(t))):iI(e)}function sI(e){return Ue.isFixedSizeList(e)?!(![2,3,4].includes(e.listSize)||!Ue.isFloat(e.children[0])):Ue.isStruct(e)?!(![2,3,4].includes(e.children.length)||!e.children.every(t=>[\"x\",\"y\",\"z\",\"m\"].includes(t.name))||!e.children.every(t=>Ue.isFloat(t))):!1}function oI(e){return!(!Ue.isList(e)||!sI(e.children[0].type))}function yB(e){return!(!Ue.isList(e)||!oI(e.children[0].type))}function mY(e){return!(!Ue.isList(e)||!sI(e.children[0].type))}function gY(e){return!(!Ue.isList(e)||!oI(e.children[0].type))}function _Y(e){return!(!Ue.isList(e)||!yB(e.children[0].type))}function J0t(e){return sI(e.type)}function tgt(e){return oI(e.type)}function egt(e){return yB(e.type)}function rgt(e){return mY(e.type)}function igt(e){return gY(e.type)}function ngt(e){return _Y(e.type)}function sgt(e,t){if(!e)throw new Error(`assertion failed ${t}`)}function ogt(){throw new Error(\"assertion failed\")}function yY(e,t){if(J0t(e))return vY(e,t);if(tgt(e))return mB(e,t);if(egt(e))return gB(e,t);if(rgt(e))return mB(e,t);if(igt(e))return gB(e,t);if(ngt(e))return agt(e,t);ogt()}function vY(e,t){sgt(e.type.listSize===2,\"expected 2D\");let r=iS(e),i=r.values,n=new Float64Array(i.length);for(let o=0;ouY(n,i))):uY(e,i)}function uY(e,t){let r=[0,0];return yY(e,(n,s)=>(r[0]=n,r[1]=s,t.forward(r)))}var Em;(function(e){e.POINT=\"geoarrow.point\",e.LINESTRING=\"geoarrow.linestring\",e.POLYGON=\"geoarrow.polygon\",e.MULTIPOINT=\"geoarrow.multipoint\",e.MULTILINESTRING=\"geoarrow.multilinestring\",e.MULTIPOLYGON=\"geoarrow.multipolygon\"})(Em||(Em={}));var rI=class{minX;minY;maxX;maxY;constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}updateBbox(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.maxY>this.maxY&&(this.maxY=t.maxY)}updateCoord(t,r){tthis.maxX&&(this.maxX=t),r>this.maxY&&(this.maxY=r)}};function cgt(e,t){switch(t.metadata.get(\"ARROW:extension:name\")){case Em.POINT:return xY(e);case Em.LINESTRING:case Em.MULTIPOINT:return bY(e);case Em.POLYGON:case Em.MULTILINESTRING:return wY(e);case Em.MULTIPOLYGON:return hgt(e);default:throw new Error(\"Unknown ext type name\")}}function ugt(e){let r=iS(e).values,i=new rI;for(let n=0;nSY(r)));let t=new Am({type:new ic,nullValues:[null]});t.set(e.length-1,null);for(let r=0;rTY(r,t));return}for(let r=0;rrS(s,t)));let r=[];for(let s of e.children)r.push(rS(s,t));let i;e.dictionary!==void 0&&(i=rS(e.dictionary,t));let n={[xi.OFFSET]:J3(e.buffers[xi.OFFSET],t),[xi.DATA]:J3(e.buffers[xi.DATA],t),[xi.VALIDITY]:J3(e.buffers[xi.VALIDITY],t),[xi.TYPE]:J3(e.buffers[xi.TYPE],t)};return new Si(e.type,e.offset,e.length,e._nullCount,n,r,i)}function tI(e){if(\"data\"in e)return e.data.some(r=>tI(r));for(let r of e.children)if(tI(r))return!0;if(e.dictionary!==void 0&&tI(e.dictionary))return!0;let t=[xi.OFFSET,xi.DATA,xi.VALIDITY,xi.TYPE];for(let r of t)if(e.buffers[r]!==void 0&&MY(e.buffers[r]))return!0;return!1}function MY(e){return!(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)}function J3(e,t){return e===void 0||!t&&!MY(e)?e:e.slice()}function eI(e,t=!1){if(\"data\"in e){let i=[],n=[];for(let o of e.data){let[c,d]=eI(o);i.push(c),n.push(...d)}return[new br(i),n]}e=rS(e,t);let r=[];for(let i=0;i1)throw new Error(\"expected 1 field\");return new sc(t[0])}case Lt.Struct:{let t=e.children.map(eS);return new on(t)}case Lt.Union:{let t=e.children.map(eS);return new oc(e.mode,e.typeIds,t)}case Lt.FixedSizeBinary:return new th(e.byteWidth);case Lt.FixedSizeList:{let t=e.children.map(eS);if(t.length>1)throw new Error(\"expected 1 field\");return new Il(e.listSize,t[0])}case Lt.Map:{let t=e.children.map(eS);if(t.length>1)throw new Error(\"expected 1 field\");let r=t[0];return new ac(r,e.keysSorted)}case Lt.Duration:return new Ju(e.unit);default:throw new Error(`unknown type ${e}`)}}function eS(e){let t=EY(e.type);return new li(e.name,t,e.nullable,e.metadata)}function vB(e){let t=e.children.map(n=>vB(n)),r=e.dictionary?PY(e.dictionary):void 0,i={[xi.OFFSET]:e.valueOffsets,[xi.DATA]:e.values,[xi.VALIDITY]:e.nullBitmap,[xi.TYPE]:e.typeIds};return new Si(EY(e.type),e.offset,e.length,e._nullCount,i,t,r)}function PY(e){return new br(e.data.map(t=>vB(t)))}var xB=Object.freeze({__proto__:null,hardClone:rS,isShared:tI,preparePostMessage:eI,rehydrateData:vB,rehydrateVector:PY});function _gt(e,t,r){let i=e.fields.findIndex(n=>n.name===r||n.metadata.get(\"ARROW:extension:name\")===t);return i!==-1?i:null}function ygt(e,t){let{index:r,data:i}=e,n=r;i.invertedGeomOffsets!==void 0&&(n=i.invertedGeomOffsets[r]);let s={data:i.data,length:i.length,attributes:i.attributes},o={index:n,data:s,target:e.target};return t(o)}function zo(e){let{props:t,propName:r,propInput:i,chunkIdx:n,geomCoordOffsets:s}=e;if(i!==void 0)if(i instanceof br){let o=i.data[n];if(Ue.isFixedSizeList(o)){xr(o.children.length===1);let c=o.children[0].values;s&&(c=lI(c,o.type.listSize,s)),t.data.attributes[r]={value:c,size:o.type.listSize,normalized:!0}}else if(Ue.isFloat(o)){let c=o.values;s&&(c=lI(c,1,s)),t.data.attributes[r]={value:c,size:1}}}else typeof i==\"function\"?t[r]=(o,c)=>r===\"getPolygonOffset\"?i(o,c):ygt(c,i):t[r]=i}function lI(e,t,r){let i=r[r.length-1],n=new e.constructor(i*t);for(let s=0;s(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function _o(e,t){let r=[],i=[];for(let[n,s]of Object.entries(e))n.startsWith(\"get\")&&s instanceof br&&(r.push(s),n.endsWith(\"Color\")&&i.push(s));vgt(t,r);for(let n of i)xgt(n)}function vgt(e,t){for(let r of t)xr(e.batches.length===r.data.length);for(let r of t)for(let i=0;ithis.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error(\"byteLength not defined in tile data\"),t}async _loadData({getData:t,requestScheduler:r,onLoad:i,onError:n}){let{index:s,id:o,bbox:c,userData:d,zoom:_}=this,w=this._loaderId;this._abortController=new AbortController;let{signal:I}=this._abortController,R=await r.scheduleRequest(this,Y=>Y.isSelected?1:-1);if(!R){this._isCancelled=!0;return}if(this._isCancelled){R.done();return}let N=null,j;try{N=await t({index:s,id:o,bbox:c,userData:d,zoom:_,signal:I})}catch(Y){j=Y||!0}finally{R.done()}if(w===this._loaderId){if(this._loader=void 0,this.content=N,this._isCancelled&&!N){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,j?n(j,this):i(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){var t;this.isLoaded||(this._isCancelled=!0,(t=this._abortController)===null||t===void 0||t.abort())}};var io={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var RY=new Ne,Mgt=new Ne,Gg=class e{constructor(t=[0,0,0],r=[0,0,0],i){G(this,\"center\",void 0),G(this,\"halfDiagonal\",void 0),G(this,\"minimum\",void 0),G(this,\"maximum\",void 0),i=i||RY.copy(t).add(r).scale(.5),this.center=new Ne(i),this.halfDiagonal=new Ne(r).subtract(this.center),this.minimum=new Ne(t),this.maximum=new Ne(r)}clone(){return new e(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,i=Mgt.from(t.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),s=this.center.dot(i)+t.distance;return s-n>0?io.INSIDE:s+n<0?io.OUTSIDE:io.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=RY.from(t).subtract(this.center),{halfDiagonal:i}=this,n=0,s;return s=Math.abs(r.x)-i.x,s>0&&(n+=s*s),s=Math.abs(r.y)-i.y,s>0&&(n+=s*s),s=Math.abs(r.z)-i.z,s>0&&(n+=s*s),n}};var aS=new Ne,DY=new Ne,Wg=class e{constructor(t=[0,0,0],r=0){G(this,\"center\",void 0),G(this,\"radius\",void 0),this.radius=-0,this.center=new Ne,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=aS.from(r),this.center=new Ne().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,i=this.radius,n=t.center,s=t.radius,o=aS.copy(n).subtract(r),c=o.magnitude();if(i>=c+s)return this.clone();if(s>=c+i)return t.clone();let d=(i+c+s)*.5;return DY.copy(o).scale((-i+d)/c).add(r),this.center.copy(DY),this.radius=d,this}expand(t){let i=aS.from(t).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(t){this.center.transform(t);let r=Dj(aS,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let i=aS.from(t).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(t){let r=this.center,i=this.radius,s=t.normal.dot(r)+t.distance;return s<-i?io.OUTSIDE:s=d?io.INSIDE:io.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=Pgt.from(t).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,uI),s=i.getColumn(1,hI),o=i.getColumn(2,fI),c=n.magnitude(),d=s.magnitude(),_=o.magnitude();n.normalize(),s.normalize(),o.normalize();let w=0,I;return I=Math.abs(r.dot(n))-c,I>0&&(w+=I*I),I=Math.abs(r.dot(s))-d,I>0&&(w+=I*I),I=Math.abs(r.dot(o))-_,I>0&&(w+=I*I),w}computePlaneDistances(t,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,d=c.getColumn(0,uI),_=c.getColumn(1,hI),w=c.getColumn(2,fI),I=Igt.copy(d).add(_).add(w).add(o),R=Cgt.copy(I).subtract(t),N=r.dot(R);return n=Math.min(N,n),s=Math.max(N,s),I.copy(o).add(d).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),I.copy(o).add(d).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),I.copy(o).add(d).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),o.copy(I).subtract(d).add(_).add(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),o.copy(I).subtract(d).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),o.copy(I).subtract(d).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),o.copy(I).subtract(d).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),n=Math.min(N,n),s=Math.max(N,s),i[0]=n,i[1]=s,i}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,uI);r.transformAsPoint(t);let i=this.halfAxes.getColumn(1,hI);i.transformAsPoint(t);let n=this.halfAxes.getColumn(2,fI);return n.transformAsPoint(t),this.halfAxes=new os([...r,...i,...n]),this}getTransform(){throw new Error(\"not implemented\")}};var OY=new Ne,BY=new Ne,hf=class e{constructor(t=[0,0,1],r=0){G(this,\"normal\",void 0),G(this,\"distance\",void 0),this.normal=new Ne,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return kh(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=OY.from(t),this.normal.from(r).normalize();let i=-this.normal.dot(t);return this.distance=i,this}fromCoefficients(t,r,i,n){return this.normal.set(t,r,i),kh(Lo(this.normal.len(),1)),this.distance=n,this}clone(){return new e(this.normal,this.distance)}equals(t){return Lo(this.distance,t.distance)&&Lo(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=BY.copy(this.normal).transformAsVector(t).normalize(),i=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(i,r)}projectPointOntoPlane(t,r=[0,0,0]){t=OY.from(t);let i=this.getPointDistance(t),n=BY.copy(this.normal).scale(i);return t.subtract(n).to(r)}};var FY=[new Ne([1,0,0]),new Ne([0,1,0]),new Ne([0,0,1])],zY=new Ne,Lgt=new Ne,Vie=new hf(new Ne(1,0,0),0),bd=class e{constructor(t=[]){G(this,\"planes\",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*FY.length;let r=t.center,i=t.radius,n=0;for(let s of FY){let o=this.planes[n],c=this.planes[n+1];o||(o=this.planes[n]=new hf),c||(c=this.planes[n+1]=new hf);let d=zY.copy(s).scale(-i).add(r),_=-s.dot(d);o.fromPointNormal(d,s);let w=zY.copy(s).scale(i).add(r),I=Lgt.copy(s).negate(),R=-I.dot(w);c.fromPointNormal(w,I),n+=2}return this}computeVisibility(t){let r=io.INSIDE;for(let i of this.planes)switch(t.intersectPlane(i)){case io.OUTSIDE:return io.OUTSIDE;case io.INTERSECTING:r=io.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(kh(Number.isFinite(r),\"parentPlaneMask is required.\"),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let i=e.MASK_INSIDE,n=this.planes;for(let s=0;sd;)Fgt(c,dI),NY.copy(dI).transpose(),c.multiplyRight(dI),c.multiplyLeft(NY),o.multiplyRight(dI),++n>2&&(++s,n=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function Ogt(e){let t=0;for(let r=0;r<9;++r){let i=e[r];t+=i*i}return Math.sqrt(t)}var wB=[1,0,0],SB=[2,2,1];function Bgt(e){let t=0;for(let r=0;r<3;++r){let i=e[wd.getElementIndex(SB[r],wB[r])];t+=2*i*i}return Math.sqrt(t)}function Fgt(e,t){let r=LE.EPSILON15,i=0,n=1;for(let _=0;_<3;++_){let w=Math.abs(e[wd.getElementIndex(SB[_],wB[_])]);w>i&&(n=_,i=w)}let s=wB[n],o=SB[n],c=1,d=0;if(Math.abs(e[wd.getElementIndex(o,s)])>r){let _=e[wd.getElementIndex(o,o)],w=e[wd.getElementIndex(s,s)],I=e[wd.getElementIndex(o,s)],R=(_-w)/2/I,N;R<0?N=-1/(-R+Math.sqrt(1+R*R)):N=1/(R+Math.sqrt(1+R*R)),c=1/Math.sqrt(1+N*N),d=N*c}return os.IDENTITY.to(t),t[wd.getElementIndex(s,s)]=t[wd.getElementIndex(o,o)]=c,t[wd.getElementIndex(o,s)]=d,t[wd.getElementIndex(s,o)]=-d,t}var Pm=new Ne,zgt=new Ne,Ngt=new Ne,Ugt=new Ne,Vgt=new Ne,jgt=new os,Ggt={diagonal:new os,unitary:new os};function TB(e,t=new sx){if(!e||e.length===0)return t.halfAxes=new os([0,0,0,0,0,0,0,0,0]),t.center=new Ne,t;let r=e.length,i=new Ne(0,0,0);for(let oe of e)i.add(oe);let n=1/r;i.multiplyByScalar(n);let s=0,o=0,c=0,d=0,_=0,w=0;for(let oe of e){let ae=Pm.copy(oe).subtract(i);s+=ae.x*ae.x,o+=ae.x*ae.y,c+=ae.x*ae.z,d+=ae.y*ae.y,_+=ae.y*ae.z,w+=ae.z*ae.z}s*=n,o*=n,c*=n,d*=n,_*=n,w*=n;let I=jgt;I[0]=s,I[1]=o,I[2]=c,I[3]=o,I[4]=d,I[5]=_,I[6]=c,I[7]=_,I[8]=w;let{unitary:R}=pI(I,Ggt),N=t.halfAxes.copy(R),j=N.getColumn(0,Ngt),Y=N.getColumn(1,Ugt),it=N.getColumn(2,Vgt),Z=-Number.MAX_VALUE,K=-Number.MAX_VALUE,J=-Number.MAX_VALUE,ht=Number.MAX_VALUE,Tt=Number.MAX_VALUE,Ot=Number.MAX_VALUE;for(let oe of e)Pm.copy(oe),Z=Math.max(Pm.dot(j),Z),K=Math.max(Pm.dot(Y),K),J=Math.max(Pm.dot(it),J),ht=Math.min(Pm.dot(j),ht),Tt=Math.min(Pm.dot(Y),Tt),Ot=Math.min(Pm.dot(it),Ot);j=j.multiplyByScalar(.5*(ht+Z)),Y=Y.multiplyByScalar(.5*(Tt+K)),it=it.multiplyByScalar(.5*(Ot+J)),t.center.copy(j).add(Y).add(it);let Yt=zgt.set(Z-ht,K-Tt,J-Ot).multiplyByScalar(.5),te=new os([Yt[0],0,0,0,Yt[1],0,0,0,Yt[2]]);return t.halfAxes.multiplyRight(te),t}var ox=512,UY=3,VY=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],jY=VY.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Wgt=jY.concat([[.25,.5],[.75,.5]]),MB=class e{constructor(t,r,i){G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"z\",void 0),G(this,\"childVisible\",void 0),G(this,\"selected\",void 0),G(this,\"_children\",void 0),this.x=t,this.y=r,this.z=i}get children(){if(!this._children){let t=this.x*2,r=this.y*2,i=this.z+1;this._children=[new e(t,r,i),new e(t,r+1,i),new e(t+1,r,i),new e(t+1,r+1,i)]}return this._children}update(t){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:s,maxZ:o,bounds:c,offset:d,project:_}=t,w=this.getBoundingVolume(n,d,_);if(c&&!this.insideBounds(c)||i.computeVisibility(w)<0)return!1;if(!this.childVisible){let{z:R}=this;if(R=s){let N=w.distanceTo(r.cameraPosition)*r.scale/r.height;R+=Math.floor(Math.log2(N))}if(R>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let R of this.children)R.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,i,n]){let s=Math.pow(2,this.z),o=ox/s;return this.x*ot&&(this.y+1)*o>r}getBoundingVolume(t,r,i){if(i){let d=this.z<1?Wgt:this.z<2?jY:VY,_=[];for(let w of d){let I=AI(this.x+w[0],this.y+w[1],this.z);I[2]=t[0],_.push(i(I)),t[0]!==t[1]&&(I[2]=t[1],_.push(i(I)))}return TB(_)}let n=Math.pow(2,this.z),s=ox/n,o=this.x*s+r*ox,c=ox-(this.y+1)*s;return new Gg([o,c,t[0]],[o+s,c+s,t[1]])}};function GY(e,t,r,i){let n=e instanceof Gy&&e.resolution?e.projectPosition:null,s=Object.values(e.getFrustumPlanes()).map(({normal:N,distance:j})=>new hf(N.clone().negate(),j)),o=new bd(s),c=e.distanceScales.unitsPerMeter[2],d=r&&r[0]*c||0,_=r&&r[1]*c||0,w=e instanceof ec&&e.pitch<=60?t:0;if(i){let[N,j,Y,it]=i,Z=El([N,it]),K=El([Y,j]);i=[Z[0],ox-Z[1],K[0],ox-K[1]]}let I=new MB(0,0,0),R={viewport:e,project:n,cullingVolume:o,elevationBounds:[d,_],minZ:w,maxZ:t,bounds:i,offset:0};if(I.update(R),e instanceof ec&&e.subViewports&&e.subViewports.length>1){for(R.offset=-1;I.update(R)&&!(--R.offset<-UY););for(R.offset=1;I.update(R)&&!(++R.offset>UY););}return I.getSelected()}var Dp=512,Hgt=[-1/0,-1/0,1/0,1/0],PB={type:\"object\",value:null,validate:(e,t)=>t.optional&&e===null||typeof e==\"string\"||Array.isArray(e)&&e.every(r=>typeof r==\"string\"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let i=0;in[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function qgt(e){return Math.abs(e.split(\"\").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function IB(e,t){if(!e||!e.length)return null;let{index:r,id:i}=t;if(Array.isArray(e)){let s=qgt(i)%e.length;e=e[s]}let n=e;for(let s of Object.keys(r)){let o=new RegExp(\"{\".concat(s,\"}\"),\"g\");n=n.replace(o,String(r[s]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\\{-y\\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function Zgt(e,t,r){let i;if(t&&t.length===2){let[n,s]=t,o=e.getBounds({z:n}),c=e.getBounds({z:s});i=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else i=e.getBounds();return e.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function qY({viewport:e,z:t=0,cullRect:r}){return(e.subViewports||[e]).map(n=>EB(n,t,r))}function EB(e,t,r){if(!Array.isArray(t)){let s=r.x-e.x,o=r.y-e.y,{width:c,height:d}=r,_={targetZ:t},w=e.unproject([s,o],_),I=e.unproject([s+c,o],_),R=e.unproject([s,o+d],_),N=e.unproject([s+c,o+d],_);return[Math.min(w[0],I[0],R[0],N[0]),Math.min(w[1],I[1],R[1],N[1]),Math.max(w[0],I[0],R[0],N[0]),Math.max(w[1],I[1],R[1],N[1])]}let i=EB(e,t[0],r),n=EB(e,t[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function Ygt(e,t,r){return r?HY(e,r).map(n=>n*t/Dp):e.map(i=>i*t/Dp)}function CB(e,t){return Math.pow(2,e)*Dp/t}function AI(e,t,r){let i=CB(r,Dp),n=e/i*360-180,s=Math.PI-2*Math.PI*t/i,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function WY(e,t,r,i){let n=CB(r,i);return[e/n*Dp,t/n*Dp]}function LB(e,t,r,i,n=Dp){if(e.isGeospatial){let[_,w]=AI(t,r,i),[I,R]=AI(t+1,r+1,i);return{west:_,north:w,east:I,south:R}}let[s,o]=WY(t,r,i,n),[c,d]=WY(t+1,r+1,i,n);return{left:s,top:o,right:c,bottom:d}}function $gt(e,t,r,i,n){let s=Zgt(e,null,i),o=CB(t,r),[c,d,_,w]=Ygt(s,o,n),I=[];for(let R=Math.floor(c);R<_;R++)for(let N=Math.floor(d);Nt&&(_=t);let w=n;return o&&c&&n&&!e.isGeospatial&&(w=HY(n,o)),e.isGeospatial?GY(e,_,i,n):$gt(e,_,s,w||Hgt,c)}function ZY(e){let t={},r;return i=>{for(let n in i)if(!Qgt(i[n],t[n])){r=e(i),t=i;break}return r}}function Qgt(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{}},e_t={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:\"best-available\",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},lS=class{constructor(t){G(this,\"opts\",void 0),G(this,\"_requestScheduler\",void 0),G(this,\"_cache\",void 0),G(this,\"_dirty\",void 0),G(this,\"_tiles\",void 0),G(this,\"_cacheByteSize\",void 0),G(this,\"_viewport\",void 0),G(this,\"_zRange\",void 0),G(this,\"_selectedTiles\",void 0),G(this,\"_frameNumber\",void 0),G(this,\"_modelMatrix\",void 0),G(this,\"_modelMatrixInverse\",void 0),G(this,\"_maxZoom\",void 0),G(this,\"_minZoom\",void 0),G(this,\"onTileLoad\",void 0),G(this,\"_getCullBounds\",ZY(qY)),this.opts={...e_t,...t},this.onTileLoad=r=>{var i,n;(i=(n=this.opts).onTileLoad)===null||i===void 0||i.call(n,r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new ty({maxRequests:t.maxRequests,throttleRequests:!!(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new gn,this._modelMatrixInverse=new gn,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:i}={}){let n=new gn(i),s=!n.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Lo(this._zRange,r)||s){s&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=t,this._zRange=r;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(d=>this._getTile(d,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,r){if(!t.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=t;for(let[s,o,c,d]of i){let _;if(\"west\"in n)_=n.wests&&n.southo;else{let w=Math.min(n.top,n.bottom),I=Math.max(n.top,n.bottom);_=n.lefts&&wo}if(_)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:i,zRange:n,modelMatrix:s,modelMatrixInverse:o}){let{tileSize:c,extent:d,zoomOffset:_}=this.opts;return kB({viewport:t,maxZoom:r,minZoom:i,zRange:n,tileSize:c,extent:d,modelMatrix:s,modelMatrixInverse:o,zoomOffset:_})}getTileId(t){return\"\".concat(t.x,\"-\").concat(t.y,\"-\").concat(t.z)}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:LB(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),i=Math.floor(t.y/2),n=t.z-1;return{x:r,y:i,z:n}}updateTileStates(){let t=this.opts.refinementStrategy||cS,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof t==\"function\"?t:t_t[t])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;t>0&&i>t&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let i=this._getNearestAncestor(r);r.parent=i,i!=null&&i.children&&i.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:Jgt*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(t.size>i||this._cacheByteSize>n){for(let[d,_]of t){if(!_.isVisible&&!_.isSelected){var o,c;this._cacheByteSize-=r.maxCacheByteSize?_.byteLength:0,t.delete(d),(o=(c=this.opts).onTileUnload)===null||o===void 0||o.call(c,_)}if(t.size<=i&&this._cacheByteSize<=n)break}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((d,_)=>d.zoom-_.zoom),this._dirty=!1)}_getTile(t,r){let i=this.getTileId(t),n=this._cache.get(i),s=!1;return!n&&r?(n=new cI(t),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),s=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(s=!0),n&&s&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(t){let{_minZoom:r=0}=this,i=t.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function r_t(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!$Y(t)&&RB(t);for(let t of e)t.isVisible=!!(t.state&mI)}function i_t(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&$Y(r);let t=Array.from(e).sort((r,i)=>r.zoom-i.zoom);for(let r of t)if(r.isVisible=!!(r.state&mI),r.children&&(r.isVisible||r.state&YY))for(let i of r.children)i.state=YY;else r.isSelected&&RB(r)}function $Y(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=mI,!0;t=t.parent}return!1}function RB(e){for(let t of e.children)t.isLoaded||t.content?t.state|=mI:RB(t)}var n_t={TilesetClass:lS,data:{type:\"data\",value:[]},dataComparator:PB.equal,renderSubLayers:{type:\"function\",value:e=>new Sm(e)},getTileData:{type:\"function\",optional:!0,value:null},onViewportLoad:{type:\"function\",optional:!0,value:null},onTileLoad:{type:\"function\",value:e=>{}},onTileUnload:{type:\"function\",value:e=>{}},onTileError:{type:\"function\",value:e=>console.error(e)},extent:{type:\"array\",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:cS,zRange:null,maxRequests:6,zoomOffset:0},Im=class extends $i{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){var t,r;(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||r.finalize()}get isLoaded(){var t,r,i;return(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||(i=r.selectedTiles)===null||i===void 0?void 0:i.every(n=>n.isLoaded&&n.layers&&n.layers.every(s=>s.isLoaded))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,i=t.propsOrDataChanged||t.updateTriggersChanged,n=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():this.state.tileset.tiles.forEach(s=>{s.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:s,maxZoom:o,minZoom:c,maxRequests:d,zoomOffset:_}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:n,extent:s,maxRequests:d,zoomOffset:_,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let{tileset:t}=this.state,{zRange:r,modelMatrix:i}=this.props,n=t.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:s}=t,o=this.state.isLoaded!==s,c=this.state.frameNumber!==n;s&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:n}),this.state.isLoaded=s}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:i,fetch:n}=this.props,{signal:s}=t;return t.url=typeof r==\"string\"||Array.isArray(r)?IB(r,t):null,i?i(t):n&&t.url?n(t.url,{propName:\"data\",layer:this,signal:s}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo({info:t,sourceLayer:r}){let i=r.props.tile;return t.picked&&(t.tile=i),t.sourceTile=i,t}_updateAutoHighlight(t){let r=t.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(i=>t.layers[0].props[i]!==r[i])&&(t.layers=t.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=np(i,Boolean).map(n=>n.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:i}=t.props;return this.state.tileset.isTileVisible(i,r)}};G(Im,\"defaultProps\",n_t);G(Im,\"layerName\",\"TileLayer\");var bc=function(e){e=e||{};var t=typeof e<\"u\"?e:{},r={},i;for(i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);var n=[],s=\"\";function o(qt){return t.locateFile?t.locateFile(qt,s):s+qt}var c;document.currentScript&&(s=document.currentScript.src),s.indexOf(\"blob:\")!==0?s=s.substr(0,s.lastIndexOf(\"/\")+1):s=\"\",c=function(de,Re,vr){var g=new XMLHttpRequest;g.open(\"GET\",de,!0),g.responseType=\"arraybuffer\",g.onload=function(){if(g.status==200||g.status==0&&g.response){Re(g.response);return}var vi=Rt(de);if(vi){Re(vi.buffer);return}vr()},g.onerror=vr,g.send(null)};var d=t.print||console.log.bind(console),_=t.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);r=null,t.arguments&&(n=t.arguments);var w=0,I=function(qt){w=qt},R=function(){return w},N=8;function j(qt,de,Re,vr){switch(Re=Re||\"i8\",Re.charAt(Re.length-1)===\"*\"&&(Re=\"i32\"),Re){case\"i1\":Lr[qt>>0]=de;break;case\"i8\":Lr[qt>>0]=de;break;case\"i16\":zs[qt>>1]=de;break;case\"i32\":Ss[qt>>2]=de;break;case\"i64\":ka=[de>>>0,(jn=de,+fu(jn)>=1?jn>0?(bn(+Cn(jn/4294967296),4294967295)|0)>>>0:~~+ei((jn-+(~~jn>>>0))/4294967296)>>>0:0)],Ss[qt>>2]=ka[0],Ss[qt+4>>2]=ka[1];break;case\"float\":Ts[qt>>2]=de;break;case\"double\":yo[qt>>3]=de;break;default:Fa(\"invalid type for setValue: \"+Re)}}function Y(qt,de,Re){switch(de=de||\"i8\",de.charAt(de.length-1)===\"*\"&&(de=\"i32\"),de){case\"i1\":return Lr[qt>>0];case\"i8\":return Lr[qt>>0];case\"i16\":return zs[qt>>1];case\"i32\":return Ss[qt>>2];case\"i64\":return Ss[qt>>2];case\"float\":return Ts[qt>>2];case\"double\":return yo[qt>>3];default:Fa(\"invalid type for getValue: \"+de)}return null}var it=!1;function Z(qt,de){qt||Fa(\"Assertion failed: \"+de)}function K(qt){var de=t[\"_\"+qt];return Z(de,\"Cannot call unknown function \"+qt+\", make sure it is exported\"),de}function J(qt,de,Re,vr,g){var Ni={string:function(Jr){var $r=0;if(Jr!=null&&Jr!==0){var Cc=(Jr.length<<2)+1;$r=Md(Cc),oe(Jr,$r,Cc)}return $r},array:function(Jr){var $r=Md(Jr.length);return ke(Jr,$r),$r}};function vi(Jr){return de===\"string\"?Yt(Jr):de===\"boolean\"?!!Jr:Jr}var bt=K(qt),Es=[],ao=0;if(vr)for(var Yr=0;Yr=vr);)++g;if(g-de>16&&qt.subarray&&Tt)return Tt.decode(qt.subarray(de,g));for(var Ni=\"\";de>10,56320|ao&1023)}}return Ni}function Yt(qt,de){return qt?Ot(hn,qt,de):\"\"}function te(qt,de,Re,vr){if(!(vr>0))return 0;for(var g=Re,Ni=Re+vr-1,vi=0;vi=55296&&bt<=57343){var Es=qt.charCodeAt(++vi);bt=65536+((bt&1023)<<10)|Es&1023}if(bt<=127){if(Re>=Ni)break;de[Re++]=bt}else if(bt<=2047){if(Re+1>=Ni)break;de[Re++]=192|bt>>6,de[Re++]=128|bt&63}else if(bt<=65535){if(Re+2>=Ni)break;de[Re++]=224|bt>>12,de[Re++]=128|bt>>6&63,de[Re++]=128|bt&63}else{if(Re+3>=Ni)break;de[Re++]=240|bt>>18,de[Re++]=128|bt>>12&63,de[Re++]=128|bt>>6&63,de[Re++]=128|bt&63}}return de[Re]=0,Re-g}function oe(qt,de,Re){return te(qt,hn,de,Re)}var ae=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-16le\"):void 0;function ke(qt,de){Lr.set(qt,de)}function or(qt,de){return qt%de>0&&(qt+=de-qt%de),qt}var cr,Lr,hn,zs,Tc,Ss,no,Ts,yo;function aa(qt){cr=qt,t.HEAP8=Lr=new Int8Array(qt),t.HEAP16=zs=new Int16Array(qt),t.HEAP32=Ss=new Int32Array(qt),t.HEAPU8=hn=new Uint8Array(qt),t.HEAPU16=Tc=new Uint16Array(qt),t.HEAPU32=no=new Uint32Array(qt),t.HEAPF32=Ts=new Float32Array(qt),t.HEAPF64=yo=new Float64Array(qt)}var ol=5266928,Ca=24016,Vo=t.TOTAL_MEMORY||33554432;t.buffer?cr=t.buffer:cr=new ArrayBuffer(Vo),Vo=cr.byteLength,aa(cr),Ss[Ca>>2]=ol;function Li(qt){for(;qt.length>0;){var de=qt.shift();if(typeof de==\"function\"){de();continue}var Re=de.func;typeof Re==\"number\"?de.arg===void 0?t.dynCall_v(Re):t.dynCall_vi(Re,de.arg):Re(de.arg===void 0?null:de.arg)}}var vo=[],Bi=[],cs=[],jo=[];function Go(){if(t.preRun)for(typeof t.preRun==\"function\"&&(t.preRun=[t.preRun]);t.preRun.length;)Jt(t.preRun.shift());Li(vo)}function Wo(){Li(Bi)}function ln(){Li(cs)}function la(){if(t.postRun)for(typeof t.postRun==\"function\"&&(t.postRun=[t.postRun]);t.postRun.length;)xo(t.postRun.shift());Li(jo)}function Jt(qt){vo.unshift(qt)}function xo(qt){jo.unshift(qt)}var fu=Math.abs,ei=Math.ceil,Cn=Math.floor,bn=Math.min,Ho=0,Ol=null,La=null;function Mc(qt){Ho++,t.monitorRunDependencies&&t.monitorRunDependencies(Ho)}function ff(qt){if(Ho--,t.monitorRunDependencies&&t.monitorRunDependencies(Ho),Ho==0&&(Ol!==null&&(clearInterval(Ol),Ol=null),La)){var de=La;La=null,de()}}t.preloadedImages={},t.preloadedAudios={};var Ms=null,me=\"data:application/octet-stream;base64,\";function qo(qt){return String.prototype.startsWith?qt.startsWith(me):qt.indexOf(me)===0}var jn,ka;Ms=\"data:application/octet-stream;base64,AAAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAABAAAAAMAAAAGAAAABQAAAAIAAAAAAAAAAgAAAAMAAAABAAAABAAAAAYAAAAAAAAABQAAAAMAAAAGAAAABAAAAAUAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAABAAAABQAAAAIAAAAAAAAAAQAAAAMAAAAGAAAABAAAAAYAAAAAAAAABQAAAAIAAAABAAAABAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAgAAAAMAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABgAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAAAAAAABgAAAAAAAAADAAAAAgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUAAAAEAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAEAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAACAAAABAAAAAMAAAAIAAAAAQAAAAcAAAAGAAAACQAAAAAAAAADAAAAAgAAAAIAAAAGAAAACgAAAAsAAAAAAAAAAQAAAAUAAAADAAAADQAAAAEAAAAHAAAABAAAAAwAAAAAAAAABAAAAH8AAAAPAAAACAAAAAMAAAAAAAAADAAAAAUAAAACAAAAEgAAAAoAAAAIAAAAAAAAABAAAAAGAAAADgAAAAsAAAARAAAAAQAAAAkAAAACAAAABwAAABUAAAAJAAAAEwAAAAMAAAANAAAAAQAAAAgAAAAFAAAAFgAAABAAAAAEAAAAAAAAAA8AAAAJAAAAEwAAAA4AAAAUAAAAAQAAAAcAAAAGAAAACgAAAAsAAAAYAAAAFwAAAAUAAAACAAAAEgAAAAsAAAARAAAAFwAAABkAAAACAAAABgAAAAoAAAAMAAAAHAAAAA0AAAAaAAAABAAAAA8AAAADAAAADQAAABoAAAAVAAAAHQAAAAMAAAAMAAAABwAAAA4AAAB/AAAAEQAAABsAAAAJAAAAFAAAAAYAAAAPAAAAFgAAABwAAAAfAAAABAAAAAgAAAAMAAAAEAAAABIAAAAhAAAAHgAAAAgAAAAFAAAAFgAAABEAAAALAAAADgAAAAYAAAAjAAAAGQAAABsAAAASAAAAGAAAAB4AAAAgAAAABQAAAAoAAAAQAAAAEwAAACIAAAAUAAAAJAAAAAcAAAAVAAAACQAAABQAAAAOAAAAEwAAAAkAAAAoAAAAGwAAACQAAAAVAAAAJgAAABMAAAAiAAAADQAAAB0AAAAHAAAAFgAAABAAAAApAAAAIQAAAA8AAAAIAAAAHwAAABcAAAAYAAAACwAAAAoAAAAnAAAAJQAAABkAAAAYAAAAfwAAACAAAAAlAAAACgAAABcAAAASAAAAGQAAABcAAAARAAAACwAAAC0AAAAnAAAAIwAAABoAAAAqAAAAHQAAACsAAAAMAAAAHAAAAA0AAAAbAAAAKAAAACMAAAAuAAAADgAAABQAAAARAAAAHAAAAB8AAAAqAAAALAAAAAwAAAAPAAAAGgAAAB0AAAArAAAAJgAAAC8AAAANAAAAGgAAABUAAAAeAAAAIAAAADAAAAAyAAAAEAAAABIAAAAhAAAAHwAAACkAAAAsAAAANQAAAA8AAAAWAAAAHAAAACAAAAAeAAAAGAAAABIAAAA0AAAAMgAAACUAAAAhAAAAHgAAADEAAAAwAAAAFgAAABAAAAApAAAAIgAAABMAAAAmAAAAFQAAADYAAAAkAAAAMwAAACMAAAAuAAAALQAAADgAAAARAAAAGwAAABkAAAAkAAAAFAAAACIAAAATAAAANwAAACgAAAA2AAAAJQAAACcAAAA0AAAAOQAAABgAAAAXAAAAIAAAACYAAAB/AAAAIgAAADMAAAAdAAAALwAAABUAAAAnAAAAJQAAABkAAAAXAAAAOwAAADkAAAAtAAAAKAAAABsAAAAkAAAAFAAAADwAAAAuAAAANwAAACkAAAAxAAAANQAAAD0AAAAWAAAAIQAAAB8AAAAqAAAAOgAAACsAAAA+AAAAHAAAACwAAAAaAAAAKwAAAD4AAAAvAAAAQAAAABoAAAAqAAAAHQAAACwAAAA1AAAAOgAAAEEAAAAcAAAAHwAAACoAAAAtAAAAJwAAACMAAAAZAAAAPwAAADsAAAA4AAAALgAAADwAAAA4AAAARAAAABsAAAAoAAAAIwAAAC8AAAAmAAAAKwAAAB0AAABFAAAAMwAAAEAAAAAwAAAAMQAAAB4AAAAhAAAAQwAAAEIAAAAyAAAAMQAAAH8AAAA9AAAAQgAAACEAAAAwAAAAKQAAADIAAAAwAAAAIAAAAB4AAABGAAAAQwAAADQAAAAzAAAARQAAADYAAABHAAAAJgAAAC8AAAAiAAAANAAAADkAAABGAAAASgAAACAAAAAlAAAAMgAAADUAAAA9AAAAQQAAAEsAAAAfAAAAKQAAACwAAAA2AAAARwAAADcAAABJAAAAIgAAADMAAAAkAAAANwAAACgAAAA2AAAAJAAAAEgAAAA8AAAASQAAADgAAABEAAAAPwAAAE0AAAAjAAAALgAAAC0AAAA5AAAAOwAAAEoAAABOAAAAJQAAACcAAAA0AAAAOgAAAH8AAAA+AAAATAAAACwAAABBAAAAKgAAADsAAAA/AAAATgAAAE8AAAAnAAAALQAAADkAAAA8AAAASAAAAEQAAABQAAAAKAAAADcAAAAuAAAAPQAAADUAAAAxAAAAKQAAAFEAAABLAAAAQgAAAD4AAAArAAAAOgAAACoAAABSAAAAQAAAAEwAAAA/AAAAfwAAADgAAAAtAAAATwAAADsAAABNAAAAQAAAAC8AAAA+AAAAKwAAAFQAAABFAAAAUgAAAEEAAAA6AAAANQAAACwAAABWAAAATAAAAEsAAABCAAAAQwAAAFEAAABVAAAAMQAAADAAAAA9AAAAQwAAAEIAAAAyAAAAMAAAAFcAAABVAAAARgAAAEQAAAA4AAAAPAAAAC4AAABaAAAATQAAAFAAAABFAAAAMwAAAEAAAAAvAAAAWQAAAEcAAABUAAAARgAAAEMAAAA0AAAAMgAAAFMAAABXAAAASgAAAEcAAABZAAAASQAAAFsAAAAzAAAARQAAADYAAABIAAAAfwAAAEkAAAA3AAAAUAAAADwAAABYAAAASQAAAFsAAABIAAAAWAAAADYAAABHAAAANwAAAEoAAABOAAAAUwAAAFwAAAA0AAAAOQAAAEYAAABLAAAAQQAAAD0AAAA1AAAAXgAAAFYAAABRAAAATAAAAFYAAABSAAAAYAAAADoAAABBAAAAPgAAAE0AAAA/AAAARAAAADgAAABdAAAATwAAAFoAAABOAAAASgAAADsAAAA5AAAAXwAAAFwAAABPAAAATwAAAE4AAAA/AAAAOwAAAF0AAABfAAAATQAAAFAAAABEAAAASAAAADwAAABjAAAAWgAAAFgAAABRAAAAVQAAAF4AAABlAAAAPQAAAEIAAABLAAAAUgAAAGAAAABUAAAAYgAAAD4AAABMAAAAQAAAAFMAAAB/AAAASgAAAEYAAABkAAAAVwAAAFwAAABUAAAARQAAAFIAAABAAAAAYQAAAFkAAABiAAAAVQAAAFcAAABlAAAAZgAAAEIAAABDAAAAUQAAAFYAAABMAAAASwAAAEEAAABoAAAAYAAAAF4AAABXAAAAUwAAAGYAAABkAAAAQwAAAEYAAABVAAAAWAAAAEgAAABbAAAASQAAAGMAAABQAAAAaQAAAFkAAABhAAAAWwAAAGcAAABFAAAAVAAAAEcAAABaAAAATQAAAFAAAABEAAAAagAAAF0AAABjAAAAWwAAAEkAAABZAAAARwAAAGkAAABYAAAAZwAAAFwAAABTAAAATgAAAEoAAABsAAAAZAAAAF8AAABdAAAATwAAAFoAAABNAAAAbQAAAF8AAABqAAAAXgAAAFYAAABRAAAASwAAAGsAAABoAAAAZQAAAF8AAABcAAAATwAAAE4AAABtAAAAbAAAAF0AAABgAAAAaAAAAGIAAABuAAAATAAAAFYAAABSAAAAYQAAAH8AAABiAAAAVAAAAGcAAABZAAAAbwAAAGIAAABuAAAAYQAAAG8AAABSAAAAYAAAAFQAAABjAAAAUAAAAGkAAABYAAAAagAAAFoAAABxAAAAZAAAAGYAAABTAAAAVwAAAGwAAAByAAAAXAAAAGUAAABmAAAAawAAAHAAAABRAAAAVQAAAF4AAABmAAAAZQAAAFcAAABVAAAAcgAAAHAAAABkAAAAZwAAAFsAAABhAAAAWQAAAHQAAABpAAAAbwAAAGgAAABrAAAAbgAAAHMAAABWAAAAXgAAAGAAAABpAAAAWAAAAGcAAABbAAAAcQAAAGMAAAB0AAAAagAAAF0AAABjAAAAWgAAAHUAAABtAAAAcQAAAGsAAAB/AAAAZQAAAF4AAABzAAAAaAAAAHAAAABsAAAAZAAAAF8AAABcAAAAdgAAAHIAAABtAAAAbQAAAGwAAABdAAAAXwAAAHUAAAB2AAAAagAAAG4AAABiAAAAaAAAAGAAAAB3AAAAbwAAAHMAAABvAAAAYQAAAG4AAABiAAAAdAAAAGcAAAB3AAAAcAAAAGsAAABmAAAAZQAAAHgAAABzAAAAcgAAAHEAAABjAAAAdAAAAGkAAAB1AAAAagAAAHkAAAByAAAAcAAAAGQAAABmAAAAdgAAAHgAAABsAAAAcwAAAG4AAABrAAAAaAAAAHgAAAB3AAAAcAAAAHQAAABnAAAAdwAAAG8AAABxAAAAaQAAAHkAAAB1AAAAfwAAAG0AAAB2AAAAcQAAAHkAAABqAAAAdgAAAHgAAABsAAAAcgAAAHUAAAB5AAAAbQAAAHcAAABvAAAAcwAAAG4AAAB5AAAAdAAAAHgAAAB4AAAAcwAAAHIAAABwAAAAeQAAAHcAAAB2AAAAeQAAAHQAAAB4AAAAdwAAAHUAAABxAAAAdgAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAQAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAADAAAABQAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAABQAAAAUAAAAAAAAAAAAAAP////8BAAAAAAAAAAMAAAAEAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAQAAAP//////////AQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAAAAAAAAAAAAAEAAAACAAAABgAAAAQAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAoAAAACAAAAAAAAAAAAAAABAAAAAQAAAAUAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAAAAAAAAAAAAAEAAAADAAAABwAAAAYAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAJAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAAAAAAAAAAAAQAAAAQAAAAIAAAACgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAAAAAAAAAAABAAAACwAAAA8AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAAAAAAABAAAADAAAABAAAAAMAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAEAAAAKAAAAEwAAAAgAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAgAAAAAAAAAAAAAAAQAAAA0AAAARAAAADQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAAAAAAAAAAAAAEAAAAOAAAAEgAAAA8AAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAAAAAABAAAA//////////8TAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABIAAAAAAAAAGAAAAAAAAAAhAAAAAAAAAB4AAAAAAAAAIAAAAAMAAAAxAAAAAQAAADAAAAADAAAAMgAAAAMAAAAIAAAAAAAAAAUAAAAFAAAACgAAAAUAAAAWAAAAAAAAABAAAAAAAAAAEgAAAAAAAAApAAAAAQAAACEAAAAAAAAAHgAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAgAAAAUAAAAPAAAAAQAAAAgAAAAAAAAABQAAAAUAAAAfAAAAAQAAABYAAAAAAAAAEAAAAAAAAAACAAAAAAAAAAYAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAsAAAAAAAAAEQAAAAMAAAAYAAAAAQAAABcAAAADAAAAGQAAAAMAAAAAAAAAAAAAAAEAAAAFAAAACQAAAAUAAAAFAAAAAAAAAAIAAAAAAAAABgAAAAAAAAASAAAAAQAAAAoAAAAAAAAACwAAAAAAAAAEAAAAAQAAAAMAAAAFAAAABwAAAAUAAAAIAAAAAQAAAAAAAAAAAAAAAQAAAAUAAAAQAAAAAQAAAAUAAAAAAAAAAgAAAAAAAAAHAAAAAAAAABUAAAAAAAAAJgAAAAAAAAAJAAAAAAAAABMAAAAAAAAAIgAAAAMAAAAOAAAAAQAAABQAAAADAAAAJAAAAAMAAAADAAAAAAAAAA0AAAAFAAAAHQAAAAUAAAABAAAAAAAAAAcAAAAAAAAAFQAAAAAAAAAGAAAAAQAAAAkAAAAAAAAAEwAAAAAAAAAEAAAAAgAAAAwAAAAFAAAAGgAAAAUAAAAAAAAAAQAAAAMAAAAAAAAADQAAAAUAAAACAAAAAQAAAAEAAAAAAAAABwAAAAAAAAAaAAAAAAAAACoAAAAAAAAAOgAAAAAAAAAdAAAAAAAAACsAAAAAAAAAPgAAAAMAAAAmAAAAAQAAAC8AAAADAAAAQAAAAAMAAAAMAAAAAAAAABwAAAAFAAAALAAAAAUAAAANAAAAAAAAABoAAAAAAAAAKgAAAAAAAAAVAAAAAQAAAB0AAAAAAAAAKwAAAAAAAAAEAAAAAwAAAA8AAAAFAAAAHwAAAAUAAAADAAAAAQAAAAwAAAAAAAAAHAAAAAUAAAAHAAAAAQAAAA0AAAAAAAAAGgAAAAAAAAAfAAAAAAAAACkAAAAAAAAAMQAAAAAAAAAsAAAAAAAAADUAAAAAAAAAPQAAAAMAAAA6AAAAAQAAAEEAAAADAAAASwAAAAMAAAAPAAAAAAAAABYAAAAFAAAAIQAAAAUAAAAcAAAAAAAAAB8AAAAAAAAAKQAAAAAAAAAqAAAAAQAAACwAAAAAAAAANQAAAAAAAAAEAAAABAAAAAgAAAAFAAAAEAAAAAUAAAAMAAAAAQAAAA8AAAAAAAAAFgAAAAUAAAAaAAAAAQAAABwAAAAAAAAAHwAAAAAAAAAyAAAAAAAAADAAAAAAAAAAMQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAIQAAAAMAAAAYAAAAAwAAABIAAAADAAAAEAAAAAMAAABGAAAAAAAAAEMAAAAAAAAAQgAAAAMAAAA0AAAAAwAAADIAAAAAAAAAMAAAAAAAAAAlAAAAAwAAACAAAAAAAAAAHgAAAAMAAABTAAAAAAAAAFcAAAADAAAAVQAAAAMAAABKAAAAAwAAAEYAAAAAAAAAQwAAAAAAAAA5AAAAAQAAADQAAAADAAAAMgAAAAAAAAAZAAAAAAAAABcAAAAAAAAAGAAAAAMAAAARAAAAAAAAAAsAAAADAAAACgAAAAMAAAAOAAAAAwAAAAYAAAADAAAAAgAAAAMAAAAtAAAAAAAAACcAAAAAAAAAJQAAAAMAAAAjAAAAAwAAABkAAAAAAAAAFwAAAAAAAAAbAAAAAwAAABEAAAAAAAAACwAAAAMAAAA/AAAAAAAAADsAAAADAAAAOQAAAAMAAAA4AAAAAwAAAC0AAAAAAAAAJwAAAAAAAAAuAAAAAwAAACMAAAADAAAAGQAAAAAAAAAkAAAAAAAAABQAAAAAAAAADgAAAAMAAAAiAAAAAAAAABMAAAADAAAACQAAAAMAAAAmAAAAAwAAABUAAAADAAAABwAAAAMAAAA3AAAAAAAAACgAAAAAAAAAGwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAFAAAAAAAAAAzAAAAAwAAACIAAAAAAAAAEwAAAAMAAABIAAAAAAAAADwAAAADAAAALgAAAAMAAABJAAAAAwAAADcAAAAAAAAAKAAAAAAAAABHAAAAAwAAADYAAAADAAAAJAAAAAAAAABAAAAAAAAAAC8AAAAAAAAAJgAAAAMAAAA+AAAAAAAAACsAAAADAAAAHQAAAAMAAAA6AAAAAwAAACoAAAADAAAAGgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAMwAAAAMAAABSAAAAAwAAAEAAAAAAAAAALwAAAAAAAABMAAAAAwAAAD4AAAAAAAAAKwAAAAMAAABhAAAAAAAAAFkAAAADAAAARwAAAAMAAABiAAAAAwAAAFQAAAAAAAAARQAAAAAAAABgAAAAAwAAAFIAAAADAAAAQAAAAAAAAABLAAAAAAAAAEEAAAAAAAAAOgAAAAMAAAA9AAAAAAAAADUAAAADAAAALAAAAAMAAAAxAAAAAwAAACkAAAADAAAAHwAAAAMAAABeAAAAAAAAAFYAAAAAAAAATAAAAAMAAABRAAAAAwAAAEsAAAAAAAAAQQAAAAAAAABCAAAAAwAAAD0AAAAAAAAANQAAAAMAAABrAAAAAAAAAGgAAAADAAAAYAAAAAMAAABlAAAAAwAAAF4AAAAAAAAAVgAAAAAAAABVAAAAAwAAAFEAAAADAAAASwAAAAAAAAA5AAAAAAAAADsAAAAAAAAAPwAAAAMAAABKAAAAAAAAAE4AAAADAAAATwAAAAMAAABTAAAAAwAAAFwAAAADAAAAXwAAAAMAAAAlAAAAAAAAACcAAAADAAAALQAAAAMAAAA0AAAAAAAAADkAAAAAAAAAOwAAAAAAAABGAAAAAwAAAEoAAAAAAAAATgAAAAMAAAAYAAAAAAAAABcAAAADAAAAGQAAAAMAAAAgAAAAAwAAACUAAAAAAAAAJwAAAAMAAAAyAAAAAwAAADQAAAAAAAAAOQAAAAAAAAAuAAAAAAAAADwAAAAAAAAASAAAAAMAAAA4AAAAAAAAAEQAAAADAAAAUAAAAAMAAAA/AAAAAwAAAE0AAAADAAAAWgAAAAMAAAAbAAAAAAAAACgAAAADAAAANwAAAAMAAAAjAAAAAAAAAC4AAAAAAAAAPAAAAAAAAAAtAAAAAwAAADgAAAAAAAAARAAAAAMAAAAOAAAAAAAAABQAAAADAAAAJAAAAAMAAAARAAAAAwAAABsAAAAAAAAAKAAAAAMAAAAZAAAAAwAAACMAAAAAAAAALgAAAAAAAABHAAAAAAAAAFkAAAAAAAAAYQAAAAMAAABJAAAAAAAAAFsAAAADAAAAZwAAAAMAAABIAAAAAwAAAFgAAAADAAAAaQAAAAMAAAAzAAAAAAAAAEUAAAADAAAAVAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAWQAAAAAAAAA3AAAAAwAAAEkAAAAAAAAAWwAAAAMAAAAmAAAAAAAAAC8AAAADAAAAQAAAAAMAAAAiAAAAAwAAADMAAAAAAAAARQAAAAMAAAAkAAAAAwAAADYAAAAAAAAARwAAAAAAAABgAAAAAAAAAGgAAAAAAAAAawAAAAMAAABiAAAAAAAAAG4AAAADAAAAcwAAAAMAAABhAAAAAwAAAG8AAAADAAAAdwAAAAMAAABMAAAAAAAAAFYAAAADAAAAXgAAAAMAAABSAAAAAAAAAGAAAAAAAAAAaAAAAAAAAABUAAAAAwAAAGIAAAAAAAAAbgAAAAMAAAA6AAAAAAAAAEEAAAADAAAASwAAAAMAAAA+AAAAAwAAAEwAAAAAAAAAVgAAAAMAAABAAAAAAwAAAFIAAAAAAAAAYAAAAAAAAABVAAAAAAAAAFcAAAAAAAAAUwAAAAMAAABlAAAAAAAAAGYAAAADAAAAZAAAAAMAAABrAAAAAwAAAHAAAAADAAAAcgAAAAMAAABCAAAAAAAAAEMAAAADAAAARgAAAAMAAABRAAAAAAAAAFUAAAAAAAAAVwAAAAAAAABeAAAAAwAAAGUAAAAAAAAAZgAAAAMAAAAxAAAAAAAAADAAAAADAAAAMgAAAAMAAAA9AAAAAwAAAEIAAAAAAAAAQwAAAAMAAABLAAAAAwAAAFEAAAAAAAAAVQAAAAAAAABfAAAAAAAAAFwAAAAAAAAAUwAAAAAAAABPAAAAAAAAAE4AAAAAAAAASgAAAAMAAAA/AAAAAQAAADsAAAADAAAAOQAAAAMAAABtAAAAAAAAAGwAAAAAAAAAZAAAAAUAAABdAAAAAQAAAF8AAAAAAAAAXAAAAAAAAABNAAAAAQAAAE8AAAAAAAAATgAAAAAAAAB1AAAABAAAAHYAAAAFAAAAcgAAAAUAAABqAAAAAQAAAG0AAAAAAAAAbAAAAAAAAABaAAAAAQAAAF0AAAABAAAAXwAAAAAAAABaAAAAAAAAAE0AAAAAAAAAPwAAAAAAAABQAAAAAAAAAEQAAAAAAAAAOAAAAAMAAABIAAAAAQAAADwAAAADAAAALgAAAAMAAABqAAAAAAAAAF0AAAAAAAAATwAAAAUAAABjAAAAAQAAAFoAAAAAAAAATQAAAAAAAABYAAAAAQAAAFAAAAAAAAAARAAAAAAAAAB1AAAAAwAAAG0AAAAFAAAAXwAAAAUAAABxAAAAAQAAAGoAAAAAAAAAXQAAAAAAAABpAAAAAQAAAGMAAAABAAAAWgAAAAAAAABpAAAAAAAAAFgAAAAAAAAASAAAAAAAAABnAAAAAAAAAFsAAAAAAAAASQAAAAMAAABhAAAAAQAAAFkAAAADAAAARwAAAAMAAABxAAAAAAAAAGMAAAAAAAAAUAAAAAUAAAB0AAAAAQAAAGkAAAAAAAAAWAAAAAAAAABvAAAAAQAAAGcAAAAAAAAAWwAAAAAAAAB1AAAAAgAAAGoAAAAFAAAAWgAAAAUAAAB5AAAAAQAAAHEAAAAAAAAAYwAAAAAAAAB3AAAAAQAAAHQAAAABAAAAaQAAAAAAAAB3AAAAAAAAAG8AAAAAAAAAYQAAAAAAAABzAAAAAAAAAG4AAAAAAAAAYgAAAAMAAABrAAAAAQAAAGgAAAADAAAAYAAAAAMAAAB5AAAAAAAAAHQAAAAAAAAAZwAAAAUAAAB4AAAAAQAAAHcAAAAAAAAAbwAAAAAAAABwAAAAAQAAAHMAAAAAAAAAbgAAAAAAAAB1AAAAAQAAAHEAAAAFAAAAaQAAAAUAAAB2AAAAAQAAAHkAAAAAAAAAdAAAAAAAAAByAAAAAQAAAHgAAAABAAAAdwAAAAAAAAByAAAAAAAAAHAAAAAAAAAAawAAAAAAAABkAAAAAAAAAGYAAAAAAAAAZQAAAAMAAABTAAAAAQAAAFcAAAADAAAAVQAAAAMAAAB2AAAAAAAAAHgAAAAAAAAAcwAAAAUAAABsAAAAAQAAAHIAAAAAAAAAcAAAAAAAAABcAAAAAQAAAGQAAAAAAAAAZgAAAAAAAAB1AAAAAAAAAHkAAAAFAAAAdwAAAAUAAABtAAAAAQAAAHYAAAAAAAAAeAAAAAAAAABfAAAAAQAAAGwAAAABAAAAcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAB+ogX28rbpPxqumpJv+fM/165tC4ns9D+XaEnTqUsEQFrOtNlC4PA/3U+0XG6P9b9TdUUBxTTjP4PUp8ex1ty/B1rD/EN43z+lcDi6LLrZP/a45NWEHMY/oJ5ijLDZ+j/xw3rjxWPjP2B8A46ioQdAotff3wla2z+FMSpA1jj+v6b5Y1mtPbS/cIu8K0F457/2esiyJpDNv98k5Ts2NeA/pvljWa09tD88ClUJ60MDQPZ6yLImkM0/4ONKxa0UBcD2uOTVhBzGv5G7JRxGave/8cN648Vj47+HCwtkjAXIv6LX398JWtu/qyheaCAL9D9TdUUBxTTjv4gyTxslhwVAB1rD/EN4378EH/28teoFwH6iBfbytum/F6ztFYdK/r/Xrm0Liez0vwcS6wNGWeO/Ws602ULg8L9TCtRLiLT8P8pi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAMuhRbbsNlBBYqHW9OmHIkF9XBuqnS31QAK37uYhNMhAOSo3UUupm0DC+6pc6JxvQHV9eseEEEJAzURsCyqlFEB8BQ4NMJjnPyy3tBoS97o/xawXQznRjj89J2K2CZxhP6vX43RIIDQ/S8isgygEBz+LvFHQkmzaPjFFFO7wMq4+AADMLkTtjkIAAOgkJqxhQgAAU7B0MjRCAADwpBcVB0IAAACYP2HaQQAAAIn/Ja5BzczM4Eg6gUHNzMxMU7BTQTMzMzNfgCZBAAAAAEi3+UAAAAAAwGPNQDMzMzMzy6BAmpmZmZkxc0AzMzMzM/NFQDMzMzMzMxlAzczMzMzM7D+ygXSx2U6RQKimJOvQKnpA23hmONTHY0A/AGcxyudNQNb3K647mzZA+S56rrwWIUAm4kUQ+9UJQKre9hGzh/M/BLvoy9WG3T+LmqMf8VHGP2m3nYNV37A/gbFHcyeCmT+cBPWBckiDP61tZACjKW0/q2RbYVUYVj8uDypVyLNAP6jGS5cA5zBBwcqhBdCNGUEGEhQ/JVEDQT6WPnRbNO1AB/AWSJgT1kDfUWNCNLDAQNk+5C33OqlAchWL34QSk0DKvtDIrNV8QNF0G3kFzGVASSeWhBl6UED+/0mNGuk4QGjA/dm/1CJALPLPMql6DEDSHoDrwpP1P2jouzWST+A/egAAAAAAAABKAwAAAAAAAPoWAAAAAAAAyqAAAAAAAAB6ZQQAAAAAAErGHgAAAAAA+mvXAAAAAADK8+MFAAAAAHqqOykAAAAASqmhIAEAAAD6oGvkBwAAAMpm8T43AAAAes+ZuIIBAABKrDQMkwoAAPq1cFUFSgAAyvkUViUGAgAAAAAAAwAAAAYAAAACAAAABQAAAAEAAAAEAAAAAAAAAAAAAAAFAAAAAwAAAAEAAAAGAAAABAAAAAIAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAA/////wAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAP////8AAAAAAAAAAAEAAAABAAAAAAAAAAAAAAD/////AAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAABAAEAAAEBAAAAAAABAAAAAQAAAAEAAQAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAAYWxnb3MuYwBfcG9seWZpbGxJbnRlcm5hbABhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0dlb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9HZW9Cb3VuZGFyeQBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGgzVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAcGVudGFnb25Sb3RhdGlvbnMgPj0gMABkaXJlY3Rpb25Sb3RhdGlvbnMgPj0gMABiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvSDMAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAd2l0aGluUGVudGFnb25Sb3RhdGlvbnMgPj0gMABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl\";var es=24032;function we(qt){return qt}function kr(qt){var de=/\\b__Z[\\w\\d_]+/g;return qt.replace(de,function(Re){var vr=Re;return Re===vr?Re:vr+\" [\"+Re+\"]\"})}function Sr(){var qt=new Error;if(!qt.stack){try{throw new Error(0)}catch(de){qt=de}if(!qt.stack)return\"(no stack trace available)\"}return qt.stack.toString()}function Ln(){var qt=Sr();return t.extraStackTrace&&(qt+=`\n`+t.extraStackTrace()),kr(qt)}function Ra(qt,de,Re,vr){Fa(\"Assertion failed: \"+Yt(qt)+\", at: \"+[de?Yt(de):\"unknown filename\",Re,vr?Yt(vr):\"unknown function\"])}function gr(){return Lr.length}function Ec(qt,de,Re){hn.set(hn.subarray(de,de+Re),qt)}function Gn(qt){return t.___errno_location&&(Ss[t.___errno_location()>>2]=qt),qt}function vt(qt){Fa(\"OOM\")}function tt(qt){try{var de=new ArrayBuffer(qt);return de.byteLength!=qt?void 0:(new Int8Array(de).set(Lr),wn(de),aa(de),1)}catch{}}function nt(qt){var de=gr(),Re=16777216,vr=2147483648-Re;if(qt>vr)return!1;for(var g=16777216,Ni=Math.max(de,g);Ni>4,g=(bt&15)<<4|Es>>2,Ni=(Es&3)<<6|ao,Re=Re+String.fromCharCode(vr),Es!==64&&(Re=Re+String.fromCharCode(g)),ao!==64&&(Re=Re+String.fromCharCode(Ni));while(Yr>2]=p,g[k+4>>2]=m,k=(C|0)!=0,k&&(g[C>>2]=0),Zn(p,m)|0)return Bt=1,wt=Gt,Bt|0;g[Bt>>2]=0;t:do if((y|0)>=1)if(k)for(et=0,st=1,Et=1,L=0,k=p;;){if(!(L|et)){if(k=Dn(k,m,4,Bt)|0,m=Pt()|0,(k|0)==0&(m|0)==0){k=2;break t}if(Zn(k,m)|0){k=1;break t}}if(k=Dn(k,m,g[16+(et<<2)>>2]|0,Bt)|0,m=Pt()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Et<<3)|0,g[p>>2]=k,g[p+4>>2]=m,g[C+(Et<<2)>>2]=st,L=L+1|0,p=(L|0)==(st|0),z=et+1|0,H=(z|0)==6,Zn(k,m)|0){k=1;break t}if(st=st+(H&p&1)|0,(st|0)>(y|0)){k=0;break}else et=p?H?0:z:et,Et=Et+1|0,L=p?0:L}else for(et=0,st=1,Et=1,L=0,k=p;;){if(!(L|et)){if(k=Dn(k,m,4,Bt)|0,m=Pt()|0,(k|0)==0&(m|0)==0){k=2;break t}if(Zn(k,m)|0){k=1;break t}}if(k=Dn(k,m,g[16+(et<<2)>>2]|0,Bt)|0,m=Pt()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Et<<3)|0,g[p>>2]=k,g[p+4>>2]=m,L=L+1|0,p=(L|0)==(st|0),z=et+1|0,H=(z|0)==6,Zn(k,m)|0){k=1;break t}if(st=st+(H&p&1)|0,(st|0)>(y|0)){k=0;break}else et=p?H?0:z:et,Et=Et+1|0,L=p?0:L}else k=0;while(!1);return Bt=k,wt=Gt,Bt|0}function ha(p,m,y,S,C,k,L){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0,L=L|0;var z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0;if(Et=wt,wt=wt+16|0,st=Et,(p|0)==0&(m|0)==0){wt=Et;return}if(z=Vl(p|0,m|0,k|0,((k|0)<0)<<31>>31|0)|0,Pt()|0,H=S+(z<<3)|0,Bt=H,Gt=g[Bt>>2]|0,Bt=g[Bt+4>>2]|0,et=(Gt|0)==(p|0)&(Bt|0)==(m|0),!((Gt|0)==0&(Bt|0)==0|et))do z=(z+1|0)%(k|0)|0,H=S+(z<<3)|0,Gt=H,Bt=g[Gt>>2]|0,Gt=g[Gt+4>>2]|0,et=(Bt|0)==(p|0)&(Gt|0)==(m|0);while(!((Bt|0)==0&(Gt|0)==0|et));if(z=C+(z<<2)|0,et&&(g[z>>2]|0)<=(L|0)){wt=Et;return}if(Gt=H,g[Gt>>2]=p,g[Gt+4>>2]=m,g[z>>2]=L,(L|0)>=(y|0)){wt=Et;return}Gt=L+1|0,g[st>>2]=0,Bt=Dn(p,m,2,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),g[st>>2]=0,Bt=Dn(p,m,3,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),g[st>>2]=0,Bt=Dn(p,m,1,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),g[st>>2]=0,Bt=Dn(p,m,5,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),g[st>>2]=0,Bt=Dn(p,m,4,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),g[st>>2]=0,Bt=Dn(p,m,6,st)|0,ha(Bt,Pt()|0,y,S,C,k,Gt),wt=Et}function Dn(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0;if((g[S>>2]|0)>0){C=0;do y=ll(y)|0,C=C+1|0;while((C|0)<(g[S>>2]|0))}z=xe(p|0,m|0,45)|0,Pt()|0,H=z&127,k=Vs(p,m)|0,C=xe(p|0,m|0,52)|0,Pt()|0,C=C&15;t:do if(!C)L=6;else for(;;){if(Et=(15-C|0)*3|0,Bt=xe(p|0,m|0,Et|0)|0,Pt()|0,Bt=Bt&7,Gt=(Is(C)|0)==0,C=C+-1|0,st=Oe(7,0,Et|0)|0,m=m&~(Pt()|0),Et=Oe(g[(Gt?464:48)+(Bt*28|0)+(y<<2)>>2]|0,0,Et|0)|0,et=Pt()|0,y=g[(Gt?672:256)+(Bt*28|0)+(y<<2)>>2]|0,p=Et|p&~st,m=et|m,!y){y=0;break t}if(!C){L=6;break}}while(!1);(L|0)==6&&(Gt=g[880+(H*28|0)+(y<<2)>>2]|0,Bt=Oe(Gt|0,0,45)|0,p=Bt|p,m=Pt()|0|m&-1040385,y=g[4304+(H*28|0)+(y<<2)>>2]|0,(Gt&127|0)==127&&(Gt=Oe(g[880+(H*28|0)+20>>2]|0,0,45)|0,m=Pt()|0|m&-1040385,y=g[4304+(H*28|0)+20>>2]|0,p=hl(Gt|p,m)|0,m=Pt()|0,g[S>>2]=(g[S>>2]|0)+1)),L=xe(p|0,m|0,45)|0,Pt()|0,L=L&127;t:do if(Ei(L)|0){e:do if((Vs(p,m)|0)==1){if((H|0)!=(L|0))if(Lc(L,g[7728+(H*28|0)>>2]|0)|0){p=Bd(p,m)|0,k=1,m=Pt()|0;break}else{p=hl(p,m)|0,k=1,m=Pt()|0;break}switch(k|0){case 5:{p=Bd(p,m)|0,m=Pt()|0,g[S>>2]=(g[S>>2]|0)+5,k=0;break e}case 3:{p=hl(p,m)|0,m=Pt()|0,g[S>>2]=(g[S>>2]|0)+1,k=0;break e}default:return Bt=0,Gt=0,Tr(Bt|0),Gt|0}}else k=0;while(!1);if((y|0)>0){C=0;do p=fh(p,m)|0,m=Pt()|0,C=C+1|0;while((C|0)!=(y|0))}if((H|0)!=(L|0)){if(!(Us(L)|0)){if((k|0)!=0|(Vs(p,m)|0)!=5)break;g[S>>2]=(g[S>>2]|0)+1;break}switch(z&127){case 8:case 118:break t;default:}(Vs(p,m)|0)!=3&&(g[S>>2]=(g[S>>2]|0)+1)}}else if((y|0)>0){C=0;do p=hl(p,m)|0,m=Pt()|0,C=C+1|0;while((C|0)!=(y|0))}while(!1);return g[S>>2]=((g[S>>2]|0)+y|0)%6|0,Bt=m,Gt=p,Tr(Bt|0),Gt|0}function t_(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0;if(Et=wt,wt=wt+16|0,st=Et,!y)return st=S,g[st>>2]=p,g[st+4>>2]=m,st=0,wt=Et,st|0;g[st>>2]=0;t:do if(Zn(p,m)|0)p=1;else{if(k=(y|0)>0,k){C=0,et=p;do{if(et=Dn(et,m,4,st)|0,m=Pt()|0,(et|0)==0&(m|0)==0){p=2;break t}if(C=C+1|0,Zn(et,m)|0){p=1;break t}}while((C|0)<(y|0));if(H=S,g[H>>2]=et,g[H+4>>2]=m,H=y+-1|0,k){k=0,L=1,C=et,p=m;do{if(C=Dn(C,p,2,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(L<<3)|0,g[z>>2]=C,g[z+4>>2]=p,L=L+1|0,Zn(C,p)|0){p=1;break t}k=k+1|0}while((k|0)<(y|0));z=0,k=L;do{if(C=Dn(C,p,3,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if(L=S+(k<<3)|0,g[L>>2]=C,g[L+4>>2]=p,k=k+1|0,Zn(C,p)|0){p=1;break t}z=z+1|0}while((z|0)<(y|0));L=0;do{if(C=Dn(C,p,1,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,Zn(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Dn(C,p,5,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,Zn(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Dn(C,p,4,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,Zn(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));for(L=0;;){if(C=Dn(C,p,6,st)|0,p=Pt()|0,(C|0)==0&(p|0)==0){p=2;break t}if((L|0)!=(H|0))if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,!(Zn(C,p)|0))k=k+1|0;else{p=1;break t}if(L=L+1|0,(L|0)>=(y|0)){L=et,k=m;break}}}else L=et,C=et,k=m,p=m}else L=S,g[L>>2]=p,g[L+4>>2]=m,L=p,C=p,k=m,p=m;p=((L|0)!=(C|0)|(k|0)!=(p|0))&1}while(!1);return st=p,wt=Et,st|0}function e_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(k=wt,wt=wt+48|0,C=k+8|0,S=k,z=p,L=g[z+4>>2]|0,y=S,g[y>>2]=g[z>>2],g[y+4>>2]=L,he(S,C),C=kc(C,m)|0,m=g[S>>2]|0,S=g[p+8>>2]|0,(S|0)<=0)return z=m,L=(C|0)<(z|0),z=L?z:C,z=z+12|0,wt=k,z|0;y=g[p+12>>2]|0,p=0;do m=(g[y+(p<<3)>>2]|0)+m|0,p=p+1|0;while((p|0)<(S|0));return z=(C|0)<(m|0),z=z?m:C,z=z+12|0,wt=k,z|0}function Kp(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;if(z=wt,wt=wt+48|0,S=z+8|0,C=z,!(Ym(p,m,y)|0)){wt=z;return}if(H=p,k=g[H+4>>2]|0,L=C,g[L>>2]=g[H>>2],g[L+4>>2]=k,he(C,S),L=kc(S,m)|0,m=g[C>>2]|0,k=g[p+8>>2]|0,(k|0)>0){C=g[p+12>>2]|0,S=0;do m=(g[C+(S<<3)>>2]|0)+m|0,S=S+1|0;while((S|0)!=(k|0))}if(m=(L|0)<(m|0)?m:L,(m|0)<=-12){wt=z;return}H=m+11|0,da(y|0,0,(((H|0)>0?H:0)<<3)+8|0)|0,wt=z}function Ym(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0,Xr=0,Di=0,Pi=0,ji=0,Ai=0,di=0,cn=0,Gr=0;if(Gr=wt,wt=wt+112|0,ji=Gr+80|0,H=Gr+72|0,Ai=Gr,di=Gr+56|0,et=p+8|0,cn=pn((g[et>>2]<<5)+32|0)|0,cn||ki(22848,22448,800,22456),ce(p,cn),k=p,S=g[k+4>>2]|0,z=H,g[z>>2]=g[k>>2],g[z+4>>2]=S,he(H,ji),z=kc(ji,m)|0,S=g[H>>2]|0,k=g[et>>2]|0,(k|0)>0){L=g[p+12>>2]|0,C=0;do S=(g[L+(C<<3)>>2]|0)+S|0,C=C+1|0;while((C|0)!=(k|0))}if(z=(z|0)<(S|0)?S:z,Pi=z+12|0,C=Fi(Pi,8)|0,st=Fi(Pi,8)|0,g[ji>>2]=0,Xr=p,Di=g[Xr+4>>2]|0,S=H,g[S>>2]=g[Xr>>2],g[S+4>>2]=Di,S=r_(H,Pi,m,ji,C,st)|0,S|0)return Ke(C),Ke(st),Ke(cn),cn=S,wt=Gr,cn|0;t:do if((g[et>>2]|0)>0){for(k=p+12|0,S=0;L=r_((g[k>>2]|0)+(S<<3)|0,Pi,m,ji,C,st)|0,S=S+1|0,!(L|0);)if((S|0)>=(g[et>>2]|0))break t;return Ke(C),Ke(st),Ke(cn),cn=L,wt=Gr,cn|0}while(!1);(z|0)>-12&&da(st|0,0,((Pi|0)>1?Pi:1)<<3|0)|0;t:do if((g[ji>>2]|0)>0){Di=((Pi|0)<0)<<31>>31,Ft=C,Ze=st,$e=C,Be=C,je=st,Xr=C,S=C,Te=C,We=st,Kt=st,ve=st,C=st;e:for(;;){for(se=g[ji>>2]|0,Gt=0,Qt=0,k=0;;){L=Ai,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));if(m=Ft+(Gt<<3)|0,H=g[m>>2]|0,m=g[m+4>>2]|0,xf(H,m,1,Ai,0)|0){L=Ai,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));L=Fi(7,4)|0,L|0&&(ha(H,m,1,Ai,L,7,0),Ke(L))}Bt=0;do{Et=Ai+(Bt<<3)|0,st=g[Et>>2]|0,Et=g[Et+4>>2]|0;r:do if(!((st|0)==0&(Et|0)==0)){if(H=Vl(st|0,Et|0,Pi|0,Di|0)|0,Pt()|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,!((m|0)==0&(z|0)==0))for(et=0;;){if((et|0)>(Pi|0))break e;if((m|0)==(st|0)&(z|0)==(Et|0))break r;if(H=(H+1|0)%(Pi|0)|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,(m|0)==0&(z|0)==0)break;et=et+1|0}(st|0)==0&(Et|0)==0||(Oc(st,Et,di),_e(p,cn,di)|0&&(et=L,g[et>>2]=st,g[et+4>>2]=Et,et=Ze+(k<<3)|0,g[et>>2]=st,g[et+4>>2]=Et,k=k+1|0))}while(!1);Bt=Bt+1|0}while(Bt>>>0<7);if(Qt=Qt+1|0,(Qt|0)>=(se|0))break;Gt=Gt+1|0}if((se|0)>0&&da($e|0,0,se<<3|0)|0,g[ji>>2]=k,(k|0)>0)st=C,Et=ve,Bt=Xr,Gt=Kt,Qt=We,se=Ze,C=Te,ve=S,Kt=Be,We=$e,Te=st,S=Et,Xr=je,je=Bt,Be=Gt,$e=Qt,Ze=Ft,Ft=se;else break t}return Ke(Be),Ke(je),Ke(cn),cn=-1,wt=Gr,cn|0}else S=st;while(!1);return Ke(cn),Ke(C),Ke(S),cn=0,wt=Gr,cn|0}function r_(p,m,y,S,C,k){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0;var L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0,Xr=0,Di=0,Pi=0,ji=0;if(Di=wt,wt=wt+48|0,$e=Di+32|0,Be=Di+16|0,je=Di,L=g[p>>2]|0,(L|0)<=0)return Xr=0,wt=Di,Xr|0;We=p+4|0,Kt=$e+8|0,ve=Be+8|0,Ft=je+8|0,Ze=((m|0)<0)<<31>>31,Te=0;t:for(;;){z=g[We>>2]|0,Qt=z+(Te<<4)|0,g[$e>>2]=g[Qt>>2],g[$e+4>>2]=g[Qt+4>>2],g[$e+8>>2]=g[Qt+8>>2],g[$e+12>>2]=g[Qt+12>>2],(Te|0)==(L+-1|0)?(g[Be>>2]=g[z>>2],g[Be+4>>2]=g[z+4>>2],g[Be+8>>2]=g[z+8>>2],g[Be+12>>2]=g[z+12>>2]):(Qt=z+(Te+1<<4)|0,g[Be>>2]=g[Qt>>2],g[Be+4>>2]=g[Qt+4>>2],g[Be+8>>2]=g[Qt+8>>2],g[Be+12>>2]=g[Qt+12>>2]),Qt=s_($e,Be,y)|0;e:do if((Qt|0)>0){se=+(Qt|0),Gt=0;r:for(;;){ji=+(Qt-Gt|0),Pi=+(Gt|0),bt[je>>3]=+bt[$e>>3]*ji/se+ +bt[Be>>3]*Pi/se,bt[Ft>>3]=+bt[Kt>>3]*ji/se+ +bt[ve>>3]*Pi/se,Et=aA(je,y)|0,Bt=Pt()|0,z=Vl(Et|0,Bt|0,m|0,Ze|0)|0,Pt()|0,L=k+(z<<3)|0,H=L,et=g[H>>2]|0,H=g[H+4>>2]|0;i:do if((et|0)==0&(H|0)==0)Xr=14;else for(st=0;;){if((st|0)>(m|0)){L=1;break i}if((et|0)==(Et|0)&(H|0)==(Bt|0)){L=7;break i}if(z=(z+1|0)%(m|0)|0,L=k+(z<<3)|0,H=L,et=g[H>>2]|0,H=g[H+4>>2]|0,(et|0)==0&(H|0)==0){Xr=14;break}else st=st+1|0}while(!1);switch((Xr|0)==14&&(Xr=0,(Et|0)==0&(Bt|0)==0?L=7:(g[L>>2]=Et,g[L+4>>2]=Bt,L=g[S>>2]|0,st=C+(L<<3)|0,g[st>>2]=Et,g[st+4>>2]=Bt,g[S>>2]=L+1,L=0)),L&7){case 7:case 0:break;default:break r}if(Gt=Gt+1|0,(Qt|0)<=(Gt|0)){Xr=8;break e}}if(L|0){L=-1,Xr=20;break t}}else Xr=8;while(!1);if((Xr|0)==8&&(Xr=0),Te=Te+1|0,L=g[p>>2]|0,(Te|0)>=(L|0)){L=0,Xr=20;break}}return(Xr|0)==20?(wt=Di,L|0):0}function i_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0;if(et=wt,wt=wt+176|0,H=et,(m|0)<1){js(y,0,0),wt=et;return}L=p,L=xe(g[L>>2]|0,g[L+4>>2]|0,52)|0,Pt()|0,js(y,(m|0)>6?m:6,L&15),L=0;do{if(S=p+(L<<3)|0,Bc(g[S>>2]|0,g[S+4>>2]|0,H),S=g[H>>2]|0,(S|0)>0){z=0;do k=H+8+(z<<4)|0,z=z+1|0,S=H+8+(((z|0)%(S|0)|0)<<4)|0,C=Rf(y,S,k)|0,C?Fc(y,C)|0:kf(y,k,S)|0,S=g[H>>2]|0;while((z|0)<(S|0))}L=L+1|0}while((L|0)!=(m|0));wt=et}function Tn(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=wt,wt=wt+32|0,S=k,C=k+16|0,i_(p,m,C),g[y>>2]=0,g[y+4>>2]=0,g[y+8>>2]=0,p=fa(C)|0,!p){gt(y)|0,Gs(C),wt=k;return}do{m=$(y)|0;do X(m,p)|0,L=p+16|0,g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],g[S+12>>2]=g[L+12>>2],Fc(C,p)|0,p=wu(C,S)|0;while(p|0);p=fa(C)|0}while(p|0);gt(y)|0,Gs(C),wt=k}function Ei(p){return p=p|0,g[7728+(p*28|0)+16>>2]|0}function Us(p){return p=p|0,(p|0)==4|(p|0)==117|0}function Jp(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)>>2]|0}function tA(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)+4>>2]|0}function n_(p,m){p=p|0,m=m|0,p=7728+(p*28|0)|0,g[m>>2]=g[p>>2],g[m+4>>2]=g[p+4>>2],g[m+8>>2]=g[p+8>>2],g[m+12>>2]=g[p+12>>2]}function Au(p,m){p=p|0,m=m|0;var y=0,S=0;if(m>>>0>20)return m=-1,m|0;do if((g[11152+(m*216|0)>>2]|0)!=(p|0))if((g[11152+(m*216|0)+8>>2]|0)!=(p|0))if((g[11152+(m*216|0)+16>>2]|0)!=(p|0))if((g[11152+(m*216|0)+24>>2]|0)!=(p|0))if((g[11152+(m*216|0)+32>>2]|0)!=(p|0))if((g[11152+(m*216|0)+40>>2]|0)!=(p|0))if((g[11152+(m*216|0)+48>>2]|0)!=(p|0))if((g[11152+(m*216|0)+56>>2]|0)!=(p|0))if((g[11152+(m*216|0)+64>>2]|0)!=(p|0))if((g[11152+(m*216|0)+72>>2]|0)!=(p|0))if((g[11152+(m*216|0)+80>>2]|0)!=(p|0))if((g[11152+(m*216|0)+88>>2]|0)!=(p|0))if((g[11152+(m*216|0)+96>>2]|0)!=(p|0))if((g[11152+(m*216|0)+104>>2]|0)!=(p|0))if((g[11152+(m*216|0)+112>>2]|0)!=(p|0))if((g[11152+(m*216|0)+120>>2]|0)!=(p|0))if((g[11152+(m*216|0)+128>>2]|0)!=(p|0))if((g[11152+(m*216|0)+136>>2]|0)==(p|0))p=2,y=1,S=2;else{if((g[11152+(m*216|0)+144>>2]|0)==(p|0)){p=0,y=2,S=0;break}if((g[11152+(m*216|0)+152>>2]|0)==(p|0)){p=0,y=2,S=1;break}if((g[11152+(m*216|0)+160>>2]|0)==(p|0)){p=0,y=2,S=2;break}if((g[11152+(m*216|0)+168>>2]|0)==(p|0)){p=1,y=2,S=0;break}if((g[11152+(m*216|0)+176>>2]|0)==(p|0)){p=1,y=2,S=1;break}if((g[11152+(m*216|0)+184>>2]|0)==(p|0)){p=1,y=2,S=2;break}if((g[11152+(m*216|0)+192>>2]|0)==(p|0)){p=2,y=2,S=0;break}if((g[11152+(m*216|0)+200>>2]|0)==(p|0)){p=2,y=2,S=1;break}if((g[11152+(m*216|0)+208>>2]|0)==(p|0)){p=2,y=2,S=2;break}else p=-1;return p|0}else p=2,y=1,S=1;else p=2,y=1,S=0;else p=1,y=1,S=2;else p=1,y=1,S=1;else p=1,y=1,S=0;else p=0,y=1,S=2;else p=0,y=1,S=1;else p=0,y=1,S=0;else p=2,y=0,S=2;else p=2,y=0,S=1;else p=2,y=0,S=0;else p=1,y=0,S=2;else p=1,y=0,S=1;else p=1,y=0,S=0;else p=0,y=0,S=2;else p=0,y=0,S=1;else p=0,y=0,S=0;while(!1);return m=g[11152+(m*216|0)+(y*72|0)+(p*24|0)+(S<<3)+4>>2]|0,m|0}function Lc(p,m){return p=p|0,m=m|0,(g[7728+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(g[7728+(p*28|0)+24>>2]|0)==(m|0),m|0)}function mu(p,m){return p=p|0,m=m|0,g[880+(p*28|0)+(m<<2)>>2]|0}function bf(p,m){return p=p|0,m=m|0,(g[880+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(g[880+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(g[880+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(g[880+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(g[880+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(g[880+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((g[880+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function $m(){return 122}function Qm(p){p=p|0;var m=0,y=0,S=0;m=0;do Oe(m|0,0,45)|0,S=Pt()|0|134225919,y=p+(m<<3)|0,g[y>>2]=-1,g[y+4>>2]=S,m=m+1|0;while((m|0)!=122)}function wf(p){return p=p|0,+bt[p+16>>3]<+bt[p+24>>3]|0}function Xm(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return y=+bt[m>>3],!(y>=+bt[p+8>>3])||!(y<=+bt[p>>3])?(m=0,m|0):(S=+bt[p+16>>3],y=+bt[p+24>>3],C=+bt[m+8>>3],m=C>=y,p=C<=S&1,S>2]=0,k=k+4|0;while((k|0)<(z|0));return l(m,C),k=C,z=g[k>>2]|0,k=g[k+4>>2]|0,Oc(z,k,y),Bc(z,k,S),H=+If(y,S+8|0),bt[y>>3]=+bt[p>>3],k=y+8|0,bt[k>>3]=+bt[p+16>>3],bt[S>>3]=+bt[p+8>>3],z=S+8|0,bt[z>>3]=+bt[p+24>>3],et=+If(y,S),z=~~+oi(+(et*et/+Su(+ +Yr(+((+bt[k>>3]-+bt[z>>3])/(+bt[y>>3]-+bt[S>>3]))),3)/(H*(H*2.59807621135)*.8))),wt=L,(z|0?z:1)|0}function s_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0;z=wt,wt=wt+288|0,S=z+264|0,C=z+96|0,k=z,L=k,H=L+96|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(H|0));return l(y,k),H=k,L=g[H>>2]|0,H=g[H+4>>2]|0,Oc(L,H,S),Bc(L,H,C),et=+If(S,C+8|0),H=~~+oi(+(+If(p,m)/(et*2))),wt=z,(H|0?H:1)|0}function o_(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0,g[p>>2]=m,g[p+4>>2]=y,g[p+8>>2]=S}function a_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0;Et=m+8|0,g[Et>>2]=0,H=+bt[p>>3],L=+Yr(+H),et=+bt[p+8>>3],z=+Yr(+et)/.8660254037844386,L=L+z*.5,y=~~L,p=~~z,L=L-+(y|0),z=z-+(p|0);do if(L<.5)if(L<.3333333333333333)if(g[m>>2]=y,z<(L+1)*.5){g[m+4>>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}else if(Bt=1-L,p=(!(z>2]=p,Bt<=z&z>2]=y;break}else{g[m>>2]=y;break}else{if(!(L<.6666666666666666))if(y=y+1|0,g[m>>2]=y,z>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}if(z<1-L){if(g[m+4>>2]=p,L*2+-1>2]=y;break}}else p=p+1|0,g[m+4>>2]=p;y=y+1|0,g[m>>2]=y}while(!1);do if(H<0)if(p&1){st=(p+1|0)/2|0,st=Pn(y|0,((y|0)<0)<<31>>31|0,st|0,((st|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-((+(st>>>0)+4294967296*+(Pt()|0))*2+1)),g[m>>2]=y;break}else{st=(p|0)/2|0,st=Pn(y|0,((y|0)<0)<<31>>31|0,st|0,((st|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-(+(st>>>0)+4294967296*+(Pt()|0))*2),g[m>>2]=y;break}while(!1);st=m+4|0,et<0&&(y=y-((p<<1|1|0)/2|0)|0,g[m>>2]=y,p=0-p|0,g[st>>2]=p),S=p-y|0,(y|0)<0?(C=0-y|0,g[st>>2]=S,g[Et>>2]=C,g[m>>2]=0,p=S,y=0):C=0,(p|0)<0&&(y=y-p|0,g[m>>2]=y,C=C-p|0,g[Et>>2]=C,g[st>>2]=0,p=0),k=y-C|0,S=p-C|0,(C|0)<0&&(g[m>>2]=k,g[st>>2]=S,g[Et>>2]=0,p=S,y=k,C=0),S=(p|0)<(y|0)?p:y,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[m>>2]=y-S,g[st>>2]=p-S,g[Et>>2]=C-S)}function ns(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,(m|0)<0&&(y=y-m|0,g[L>>2]=y,k=p+8|0,g[k>>2]=(g[k>>2]|0)-m,g[p>>2]=0,m=0),(y|0)<0?(m=m-y|0,g[p>>2]=m,k=p+8|0,C=(g[k>>2]|0)-y|0,g[k>>2]=C,g[L>>2]=0,y=0):(C=p+8|0,k=C,C=g[C>>2]|0),(C|0)<0&&(m=m-C|0,g[p>>2]=m,y=y-C|0,g[L>>2]=y,g[k>>2]=0,C=0),S=(y|0)<(m|0)?y:m,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[p>>2]=m-S,g[L>>2]=y-S,g[k>>2]=C-S)}function al(p,m){p=p|0,m=m|0;var y=0,S=0;S=g[p+8>>2]|0,y=+((g[p+4>>2]|0)-S|0),bt[m>>3]=+((g[p>>2]|0)-S|0)-y*.5,bt[m+8>>3]=y*.8660254037844386}function Vi(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[m>>2]|0)+(g[p>>2]|0),g[y+4>>2]=(g[m+4>>2]|0)+(g[p+4>>2]|0),g[y+8>>2]=(g[m+8>>2]|0)+(g[p+8>>2]|0)}function gu(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[p>>2]|0)-(g[m>>2]|0),g[y+4>>2]=(g[p+4>>2]|0)-(g[m+4>>2]|0),g[y+8>>2]=(g[p+8>>2]|0)-(g[m+8>>2]|0)}function _u(p,m){p=p|0,m=m|0;var y=0,S=0;y=za(g[p>>2]|0,m)|0,g[p>>2]=y,y=p+4|0,S=za(g[y>>2]|0,m)|0,g[y>>2]=S,p=p+8|0,m=za(g[p>>2]|0,m)|0,g[p>>2]=m}function Cd(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=g[p>>2]|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(k?0-S|0:0)+((g[p+8>>2]|0)-(z?L:0))|0,y=(C|0)<0,p=y?0:C,m=(k?0:S)-(y?C:0)|0,C=(z?0:L)-(k?S:0)-(y?C:0)|0,y=(m|0)<(C|0)?m:C,y=(p|0)<(y|0)?p:y,S=(y|0)>0,p=p-(S?y:0)|0,m=m-(S?y:0)|0;t:do switch(C-(S?y:0)|0){case 0:switch(m|0){case 0:return z=p|0?(p|0)==1?1:7:0,z|0;case 1:return z=p|0?(p|0)==1?3:7:2,z|0;default:break t}case 1:switch(m|0){case 0:return z=p|0?(p|0)==1?5:7:4,z|0;case 1:{if(!p)p=6;else break t;return p|0}default:break t}default:}while(!1);return z=7,z|0}function Na(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=sn(+((m*3|0)-y|0)/7)|0,g[p>>2]=S,m=sn(+((y<<1)+m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function lo(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=sn(+((m<<1)+y|0)/7)|0,g[p>>2]=S,m=sn(+((y*3|0)-m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function Sf(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m*3|0)|0,g[p>>2]=C,y=S+(y*3|0)|0,g[L>>2]=y,m=(S*3|0)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Ps(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m*3|0)+C|0,C=y+(C*3|0)|0,g[p>>2]=C,g[L>>2]=S,m=(y*3|0)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function Tf(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;(m+-1|0)>>>0>=6||(C=(g[15472+(m*12|0)>>2]|0)+(g[p>>2]|0)|0,g[p>>2]=C,z=p+4|0,S=(g[15472+(m*12|0)+4>>2]|0)+(g[z>>2]|0)|0,g[z>>2]=S,L=p+8|0,m=(g[15472+(m*12|0)+8>>2]|0)+(g[L>>2]|0)|0,g[L>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[z>>2]=y,g[L>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[L>>2]=m,g[z>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[z>>2]=C-y,g[L>>2]=m-y))}function eA(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=m+C|0,C=y+C|0,g[p>>2]=C,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function rA(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,S=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,C=S+m|0,g[p>>2]=C,S=y+S|0,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function ll(p){switch(p=p|0,p|0){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:}return p|0}function Rc(p){switch(p=p|0,p|0){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:}return p|0}function yu(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m<<1)|0,g[p>>2]=C,y=S+(y<<1)|0,g[L>>2]=y,m=(S<<1)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Nl(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m<<1)+C|0,C=y+(C<<1)|0,g[p>>2]=C,g[L>>2]=S,m=(y<<1)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function ze(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;return L=(g[p>>2]|0)-(g[m>>2]|0)|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(g[m+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(z?0-L|0:0)+(g[p+8>>2]|0)-(g[m+8>>2]|0)+(k?0-S|0:0)|0,p=(C|0)<0,m=p?0:C,y=(k?0:S)-(p?C:0)|0,C=(z?0:L)-(k?S:0)-(p?C:0)|0,p=(y|0)<(C|0)?y:C,p=(m|0)<(p|0)?m:p,S=(p|0)>0,m=m-(S?p:0)|0,y=y-(S?p:0)|0,p=C-(S?p:0)|0,p=(p|0)>-1?p:0-p|0,y=(y|0)>-1?y:0-y|0,m=(m|0)>-1?m:0-m|0,m=(y|0)>(m|0)?y:m,((p|0)>(m|0)?p:m)|0}function Km(p,m){p=p|0,m=m|0;var y=0;y=g[p+8>>2]|0,g[m>>2]=(g[p>>2]|0)-y,g[m+4>>2]=(g[p+4>>2]|0)-y}function Mf(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;S=g[p>>2]|0,g[m>>2]=S,p=g[p+4>>2]|0,L=m+4|0,g[L>>2]=p,z=m+8|0,g[z>>2]=0,y=p-S|0,(S|0)<0?(p=0-S|0,g[L>>2]=y,g[z>>2]=p,g[m>>2]=0,S=0):(y=p,p=0),(y|0)<0&&(S=S-y|0,g[m>>2]=S,p=p-y|0,g[z>>2]=p,g[L>>2]=0,y=0),k=S-p|0,C=y-p|0,(p|0)<0?(g[m>>2]=k,g[L>>2]=C,g[z>>2]=0,y=C,C=k,p=0):C=S,S=(y|0)<(C|0)?y:C,S=(p|0)<(S|0)?p:S,!((S|0)<=0)&&(g[m>>2]=C-S,g[L>>2]=y-S,g[z>>2]=p-S)}function Ef(p){p=p|0;var m=0,y=0,S=0,C=0;m=p+8|0,C=g[m>>2]|0,y=C-(g[p>>2]|0)|0,g[p>>2]=y,S=p+4|0,p=(g[S>>2]|0)-C|0,g[S>>2]=p,g[m>>2]=0-(p+y)}function iA(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;y=g[p>>2]|0,m=0-y|0,g[p>>2]=m,L=p+8|0,g[L>>2]=0,z=p+4|0,S=g[z>>2]|0,C=S+y|0,(y|0)>0?(g[z>>2]=C,g[L>>2]=y,g[p>>2]=0,m=0,S=C):y=0,(S|0)<0?(k=m-S|0,g[p>>2]=k,y=y-S|0,g[L>>2]=y,g[z>>2]=0,C=k-y|0,m=0-y|0,(y|0)<0?(g[p>>2]=C,g[z>>2]=m,g[L>>2]=0,S=m,y=0):(S=0,C=k)):C=m,m=(S|0)<(C|0)?S:C,m=(y|0)<(m|0)?y:m,!((m|0)<=0)&&(g[p>>2]=C-m,g[z>>2]=S-m,g[L>>2]=y-m)}function Le(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,nA(p,m,y,C),a_(C,y+4|0),wt=S}function nA(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0;if(H=wt,wt=wt+32|0,k=H,To(p,k),g[y>>2]=0,C=+Or(15888,k),L=+Or(15912,k),L>2]=1,C=L),L=+Or(15936,k),L>2]=2,C=L),L=+Or(15960,k),L>2]=3,C=L),L=+Or(15984,k),L>2]=4,C=L),L=+Or(16008,k),L>2]=5,C=L),L=+Or(16032,k),L>2]=6,C=L),L=+Or(16056,k),L>2]=7,C=L),L=+Or(16080,k),L>2]=8,C=L),L=+Or(16104,k),L>2]=9,C=L),L=+Or(16128,k),L>2]=10,C=L),L=+Or(16152,k),L>2]=11,C=L),L=+Or(16176,k),L>2]=12,C=L),L=+Or(16200,k),L>2]=13,C=L),L=+Or(16224,k),L>2]=14,C=L),L=+Or(16248,k),L>2]=15,C=L),L=+Or(16272,k),L>2]=16,C=L),L=+Or(16296,k),L>2]=17,C=L),L=+Or(16320,k),L>2]=18,C=L),L=+Or(16344,k),L>2]=19,C=L),L=+yf(+(1-C*.5)),L<1e-16){g[S>>2]=0,g[S+4>>2]=0,g[S+8>>2]=0,g[S+12>>2]=0,wt=H;return}if(y=g[y>>2]|0,C=+bt[16368+(y*24|0)>>3],C=+Ri(C-+Ri(+t0(15568+(y<<4)|0,p))),Is(m)|0?z=+Ri(C+-.3334731722518321):z=C,C=+Cc(+L)/.381966011250105,(m|0)>0){k=0;do C=C*2.6457513110645907,k=k+1|0;while((k|0)!=(m|0))}L=+Jr(+z)*C,bt[S>>3]=L,z=+$r(+z)*C,bt[S+8>>3]=z,wt=H}function Pf(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;if(k=+zr(p),k<1e-16){m=15568+(m<<4)|0,g[C>>2]=g[m>>2],g[C+4>>2]=g[m+4>>2],g[C+8>>2]=g[m+8>>2],g[C+12>>2]=g[m+12>>2];return}if(L=+$o(+ +bt[p+8>>3],+ +bt[p>>3]),(y|0)>0){p=0;do k=k/2.6457513110645907,p=p+1|0;while((p|0)!=(y|0))}S?(k=k/3,y=(Is(y)|0)==0,k=+Yp(+((y?k:k/2.6457513110645907)*.381966011250105))):(k=+Yp(+(k*.381966011250105)),Is(y)|0&&(L=+Ri(L+.3334731722518321))),u_(15568+(m<<4)|0,+Ri(+bt[16368+(m*24|0)>>3]-L),k,C)}function l_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,al(p+4|0,C),Pf(C,g[p>>2]|0,m,0,y),wt=S}function Ld(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0,Xr=0,Di=0,Pi=0,ji=0,Ai=0,di=0,cn=0,Gr=0;if(di=wt,wt=wt+272|0,k=di+256|0,Kt=di+240|0,Pi=di,ji=di+224|0,Ai=di+208|0,ve=di+176|0,Ft=di+160|0,Ze=di+192|0,$e=di+144|0,Be=di+128|0,je=di+112|0,Xr=di+96|0,Di=di+80|0,g[k>>2]=m,g[Kt>>2]=g[p>>2],g[Kt+4>>2]=g[p+4>>2],g[Kt+8>>2]=g[p+8>>2],g[Kt+12>>2]=g[p+12>>2],kd(Kt,k,Pi),g[C>>2]=0,Kt=S+y+((S|0)==5&1)|0,(Kt|0)<=(y|0)){wt=di;return}H=g[k>>2]|0,et=ji+4|0,st=ve+4|0,Et=y+5|0,Bt=16848+(H<<2)|0,Gt=16928+(H<<2)|0,Qt=Be+8|0,se=je+8|0,Te=Xr+8|0,We=Ai+4|0,z=y;t:for(;;){L=Pi+(((z|0)%5|0)<<4)|0,g[Ai>>2]=g[L>>2],g[Ai+4>>2]=g[L+4>>2],g[Ai+8>>2]=g[L+8>>2],g[Ai+12>>2]=g[L+12>>2];do;while((vu(Ai,H,0,1)|0)==2);if((z|0)>(y|0)&(Is(m)|0)!=0){if(g[ve>>2]=g[Ai>>2],g[ve+4>>2]=g[Ai+4>>2],g[ve+8>>2]=g[Ai+8>>2],g[ve+12>>2]=g[Ai+12>>2],al(et,Ft),S=g[ve>>2]|0,k=g[17008+(S*80|0)+(g[ji>>2]<<2)>>2]|0,g[ve>>2]=g[18608+(S*80|0)+(k*20|0)>>2],L=g[18608+(S*80|0)+(k*20|0)+16>>2]|0,(L|0)>0){p=0;do eA(st),p=p+1|0;while((p|0)<(L|0))}switch(L=18608+(S*80|0)+(k*20|0)+4|0,g[Ze>>2]=g[L>>2],g[Ze+4>>2]=g[L+4>>2],g[Ze+8>>2]=g[L+8>>2],_u(Ze,(g[Bt>>2]|0)*3|0),Vi(st,Ze,st),ns(st),al(st,$e),cn=+(g[Gt>>2]|0),bt[Be>>3]=cn*3,bt[Qt>>3]=0,Gr=cn*-1.5,bt[je>>3]=Gr,bt[se>>3]=cn*2.598076211353316,bt[Xr>>3]=Gr,bt[Te>>3]=cn*-2.598076211353316,g[17008+((g[ve>>2]|0)*80|0)+(g[Ai>>2]<<2)>>2]|0){case 1:{p=je,S=Be;break}case 3:{p=Xr,S=je;break}case 2:{p=Be,S=Xr;break}default:{p=12;break t}}Qr(Ft,$e,S,p,Di),Pf(Di,g[ve>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1}if((z|0)<(Et|0)&&(al(We,ve),Pf(ve,g[Ai>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),g[ji>>2]=g[Ai>>2],g[ji+4>>2]=g[Ai+4>>2],g[ji+8>>2]=g[Ai+8>>2],g[ji+12>>2]=g[Ai+12>>2],z=z+1|0,(z|0)>=(Kt|0)){p=3;break}}if((p|0)==3){wt=di;return}else(p|0)==12&&ki(22474,22521,581,22531)}function kd(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+128|0,S=H+64|0,C=H,k=S,L=20208,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20272,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Is(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,yu(C),Nl(C),Is(g[m>>2]|0)|0&&(Ps(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Vi(C,S,m),ns(m),g[y+16>>2]=g[p>>2],m=y+20|0,Vi(C,S+12|0,m),ns(m),g[y+32>>2]=g[p>>2],m=y+36|0,Vi(C,S+24|0,m),ns(m),g[y+48>>2]=g[p>>2],m=y+52|0,Vi(C,S+36|0,m),ns(m),g[y+64>>2]=g[p>>2],y=y+68|0,Vi(C,S+48|0,y),ns(y),wt=H}function vu(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0;if(Qt=wt,wt=wt+32|0,Bt=Qt+12|0,z=Qt,Gt=p+4|0,Et=g[16928+(m<<2)>>2]|0,st=(S|0)!=0,Et=st?Et*3|0:Et,C=g[Gt>>2]|0,et=p+8|0,L=g[et>>2]|0,st){if(k=p+12|0,S=g[k>>2]|0,C=L+C+S|0,(C|0)==(Et|0))return Gt=1,wt=Qt,Gt|0;H=k}else H=p+12|0,S=g[H>>2]|0,C=L+C+S|0;if((C|0)<=(Et|0))return Gt=0,wt=Qt,Gt|0;do if((S|0)>0){if(S=g[p>>2]|0,(L|0)>0){k=18608+(S*80|0)+60|0,S=p;break}S=18608+(S*80|0)+40|0,y?(o_(Bt,Et,0,0),gu(Gt,Bt,z),rA(z),Vi(z,Bt,Gt),k=S,S=p):(k=S,S=p)}else k=18608+((g[p>>2]|0)*80|0)+20|0,S=p;while(!1);if(g[S>>2]=g[k>>2],C=k+16|0,(g[C>>2]|0)>0){S=0;do eA(Gt),S=S+1|0;while((S|0)<(g[C>>2]|0))}return p=k+4|0,g[Bt>>2]=g[p>>2],g[Bt+4>>2]=g[p+4>>2],g[Bt+8>>2]=g[p+8>>2],m=g[16848+(m<<2)>>2]|0,_u(Bt,st?m*3|0:m),Vi(Gt,Bt,Gt),ns(Gt),st?S=((g[et>>2]|0)+(g[Gt>>2]|0)+(g[H>>2]|0)|0)==(Et|0)?1:2:S=2,Gt=S,wt=Qt,Gt|0}function Mx(p,m){p=p|0,m=m|0;var y=0;do y=vu(p,m,0,1)|0;while((y|0)==2);return y|0}function Jm(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0,Xr=0,Di=0,Pi=0;if(Xr=wt,wt=wt+240|0,k=Xr+224|0,Ze=Xr+208|0,$e=Xr,Be=Xr+192|0,je=Xr+176|0,Te=Xr+160|0,We=Xr+144|0,Kt=Xr+128|0,ve=Xr+112|0,Ft=Xr+96|0,g[k>>2]=m,g[Ze>>2]=g[p>>2],g[Ze+4>>2]=g[p+4>>2],g[Ze+8>>2]=g[p+8>>2],g[Ze+12>>2]=g[p+12>>2],xu(Ze,k,$e),g[C>>2]=0,se=S+y+((S|0)==6&1)|0,(se|0)<=(y|0)){wt=Xr;return}H=g[k>>2]|0,et=y+6|0,st=16928+(H<<2)|0,Et=We+8|0,Bt=Kt+8|0,Gt=ve+8|0,Qt=Be+4|0,L=0,z=y,S=-1;t:for(;;){if(k=(z|0)%6|0,p=$e+(k<<4)|0,g[Be>>2]=g[p>>2],g[Be+4>>2]=g[p+4>>2],g[Be+8>>2]=g[p+8>>2],g[Be+12>>2]=g[p+12>>2],p=L,L=vu(Be,H,0,1)|0,(z|0)>(y|0)&(Is(m)|0)!=0&&(p|0)!=1&&(g[Be>>2]|0)!=(S|0)){switch(al($e+(((k+5|0)%6|0)<<4)+4|0,je),al($e+(k<<4)+4|0,Te),Di=+(g[st>>2]|0),bt[We>>3]=Di*3,bt[Et>>3]=0,Pi=Di*-1.5,bt[Kt>>3]=Pi,bt[Bt>>3]=Di*2.598076211353316,bt[ve>>3]=Pi,bt[Gt>>3]=Di*-2.598076211353316,k=g[Ze>>2]|0,g[17008+(k*80|0)+(((S|0)==(k|0)?g[Be>>2]|0:S)<<2)>>2]|0){case 1:{p=Kt,S=We;break}case 3:{p=ve,S=Kt;break}case 2:{p=We,S=ve;break}default:{p=8;break t}}Qr(je,Te,S,p,Ft),!(Bn(je,Ft)|0)&&!(Bn(Te,Ft)|0)&&(Pf(Ft,g[Ze>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1)}if((z|0)<(et|0)&&(al(Qt,je),Pf(je,g[Be>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),z=z+1|0,(z|0)>=(se|0)){p=3;break}else S=g[Be>>2]|0}if((p|0)==3){wt=Xr;return}else(p|0)==8&&ki(22557,22521,746,22602)}function xu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+160|0,S=H+80|0,C=H,k=S,L=20336,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20416,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Is(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,yu(C),Nl(C),Is(g[m>>2]|0)|0&&(Ps(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Vi(C,S,m),ns(m),g[y+16>>2]=g[p>>2],m=y+20|0,Vi(C,S+12|0,m),ns(m),g[y+32>>2]=g[p>>2],m=y+36|0,Vi(C,S+24|0,m),ns(m),g[y+48>>2]=g[p>>2],m=y+52|0,Vi(C,S+36|0,m),ns(m),g[y+64>>2]=g[p>>2],m=y+68|0,Vi(C,S+48|0,m),ns(m),g[y+80>>2]=g[p>>2],y=y+84|0,Vi(C,S+60|0,y),ns(y),wt=H}function Ri(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function Ul(p,m){return p=p|0,m=m|0,+Yr(+(+bt[p>>3]-+bt[m>>3]))<17453292519943298e-27?(m=+Yr(+(+bt[p+8>>3]-+bt[m+8>>3]))<17453292519943298e-27,m|0):(m=0,m|0)}function sA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+bt[m>>3],S=+bt[p>>3],k=+$r(+((C-S)*.5)),y=+$r(+((+bt[m+8>>3]-+bt[p+8>>3])*.5)),y=k*k+y*(+Jr(+C)*+Jr(+S)*y),+(+$o(+ +dn(+y),+ +dn(+(1-y)))*2)}function If(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+bt[m>>3],S=+bt[p>>3],k=+$r(+((C-S)*.5)),y=+$r(+((+bt[m+8>>3]-+bt[p+8>>3])*.5)),y=k*k+y*(+Jr(+C)*+Jr(+S)*y),+(+$o(+ +dn(+y),+ +dn(+(1-y)))*2*6371.007180918475)}function c_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+bt[m>>3],S=+bt[p>>3],k=+$r(+((C-S)*.5)),y=+$r(+((+bt[m+8>>3]-+bt[p+8>>3])*.5)),y=k*k+y*(+Jr(+C)*+Jr(+S)*y),+(+$o(+ +dn(+y),+ +dn(+(1-y)))*2*6371.007180918475*1e3)}function t0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;return k=+bt[m>>3],S=+Jr(+k),C=+bt[m+8>>3]-+bt[p+8>>3],L=S*+$r(+C),y=+bt[p>>3],+ +$o(+L,+(+$r(+k)*+Jr(+y)-+Jr(+C)*(S*+$r(+y))))}function u_(p,m,y,S){p=p|0,m=+m,y=+y,S=S|0;var C=0,k=0,L=0,z=0;if(y<1e-16){g[S>>2]=g[p>>2],g[S+4>>2]=g[p+4>>2],g[S+8>>2]=g[p+8>>2],g[S+12>>2]=g[p+12>>2];return}k=m<0?m+6.283185307179586:m,k=m>=6.283185307179586?k+-6.283185307179586:k;do if(k<1e-16)m=+bt[p>>3]+y,bt[S>>3]=m,C=S;else{if(C=+Yr(+(k+-3.141592653589793))<1e-16,m=+bt[p>>3],C){m=m-y,bt[S>>3]=m,C=S;break}if(L=+Jr(+y),y=+$r(+y),m=L*+$r(+m)+ +Jr(+k)*(y*+Jr(+m)),m=m>1?1:m,m=+vf(+(m<-1?-1:m)),bt[S>>3]=m,+Yr(+(m+-1.5707963267948966))<1e-16){bt[S>>3]=1.5707963267948966,bt[S+8>>3]=0;return}if(+Yr(+(m+1.5707963267948966))<1e-16){bt[S>>3]=-1.5707963267948966,bt[S+8>>3]=0;return}if(z=+Jr(+m),k=y*+$r(+k)/z,y=+bt[p>>3],m=(L-+$r(+m)*+$r(+y))/+Jr(+y)/z,L=k>1?1:k,m=m>1?1:m,m=+bt[p+8>>3]+ +$o(+(L<-1?-1:L),+(m<-1?-1:m)),m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);bt[S+8>>3]=m;return}while(!1);if(+Yr(+(m+-1.5707963267948966))<1e-16){bt[C>>3]=1.5707963267948966,bt[S+8>>3]=0;return}if(+Yr(+(m+1.5707963267948966))<1e-16){bt[C>>3]=-1.5707963267948966,bt[S+8>>3]=0;return}if(m=+bt[p+8>>3],m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);bt[S+8>>3]=m}function cl(p){return p=p|0,+ +bt[20496+(p<<3)>>3]}function Rd(p){return p=p|0,+ +bt[20624+(p<<3)>>3]}function Xe(p){return p=p|0,+ +bt[20752+(p<<3)>>3]}function dr(p){return p=p|0,+ +bt[20880+(p<<3)>>3]}function Cf(p){p=p|0;var m=0;return m=21008+(p<<3)|0,p=g[m>>2]|0,Tr(g[m+4>>2]|0),p|0}function bu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0;return Bt=+bt[m>>3],st=+bt[p>>3],H=+$r(+((Bt-st)*.5)),k=+bt[m+8>>3],et=+bt[p+8>>3],L=+$r(+((k-et)*.5)),z=+Jr(+st),Et=+Jr(+Bt),L=H*H+L*(Et*z*L),L=+$o(+ +dn(+L),+ +dn(+(1-L)))*2,H=+bt[y>>3],Bt=+$r(+((H-Bt)*.5)),S=+bt[y+8>>3],k=+$r(+((S-k)*.5)),C=+Jr(+H),k=Bt*Bt+k*(Et*C*k),k=+$o(+ +dn(+k),+ +dn(+(1-k)))*2,H=+$r(+((st-H)*.5)),S=+$r(+((et-S)*.5)),S=H*H+S*(z*C*S),S=+$o(+ +dn(+S),+ +dn(+(1-S)))*2,C=(L+k+S)*.5,+(+Yp(+ +dn(+(+Cc(+(C*.5))*+Cc(+((C-L)*.5))*+Cc(+((C-k)*.5))*+Cc(+((C-S)*.5)))))*4)}function e0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,Oc(p,m,S),Bc(p,m,C),m=g[C>>2]|0,(m|0)<=0)return y=0,wt=k,+y;if(y=+bu(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)==1)return wt=k,+y;p=1;do L=p,p=p+1|0,y=y+ +bu(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0));return wt=k,+y}function So(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,Oc(p,m,S),Bc(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+bu(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +bu(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475)}function r0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,Oc(p,m,S),Bc(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+bu(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +bu(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475*1e3*1e3)}function ul(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0;if(L=wt,wt=wt+176|0,k=L,W(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+bt[k+8>>3],C=+bt[k+16>>3];do p=p+1|0,H=S,S=+bt[k+8+(p<<4)>>3],et=+$r(+((S-H)*.5)),z=C,C=+bt[k+8+(p<<4)+8>>3],z=+$r(+((C-z)*.5)),z=et*et+z*(+Jr(+S)*+Jr(+H)*z),y=y+ +$o(+ +dn(+z),+ +dn(+(1-z)))*2;while((p|0)<(m|0));return wt=L,+y}function Ex(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0;if(L=wt,wt=wt+176|0,k=L,W(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+bt[k+8>>3],C=+bt[k+16>>3];do p=p+1|0,H=S,S=+bt[k+8+(p<<4)>>3],et=+$r(+((S-H)*.5)),z=C,C=+bt[k+8+(p<<4)+8>>3],z=+$r(+((C-z)*.5)),z=et*et+z*(+Jr(+H)*+Jr(+S)*z),y=y+ +$o(+ +dn(+z),+ +dn(+(1-z)))*2;while((p|0)!=(m|0));return et=y*6371.007180918475,wt=L,+et}function Dd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0;if(L=wt,wt=wt+176|0,k=L,W(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+bt[k+8>>3],C=+bt[k+16>>3];do p=p+1|0,H=S,S=+bt[k+8+(p<<4)>>3],et=+$r(+((S-H)*.5)),z=C,C=+bt[k+8+(p<<4)+8>>3],z=+$r(+((C-z)*.5)),z=et*et+z*(+Jr(+H)*+Jr(+S)*z),y=y+ +$o(+ +dn(+z),+ +dn(+(1-z)))*2;while((p|0)!=(m|0));return et=y*6371.007180918475*1e3,wt=L,+et}function Mn(p,m){return p=p|0,m=m|0,m=xe(p|0,m|0,52)|0,Pt()|0,m&15|0}function On(p,m){return p=p|0,m=m|0,m=xe(p|0,m|0,45)|0,Pt()|0,m&127|0}function i0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(!(!0&(m&-16777216|0)==134217728)||(L=xe(p|0,m|0,45)|0,Pt()|0,L=L&127,L>>>0>121))return m=0,m|0;y=xe(p|0,m|0,52)|0,Pt()|0,y=y&15;do if(y|0){for(C=1,S=0;;){if(k=xe(p|0,m|0,(15-C|0)*3|0)|0,Pt()|0,k=k&7,(k|0)!=0&(S^1))if((k|0)==1&(Ei(L)|0)!=0){z=0,S=13;break}else S=1;if((k|0)==7){z=0,S=13;break}if(C>>>0>>0)C=C+1|0;else{S=9;break}}if((S|0)==9){if((y|0)==15)z=1;else break;return z|0}else if((S|0)==13)return z|0}while(!1);for(;;){if(z=xe(p|0,m|0,(14-y|0)*3|0)|0,Pt()|0,!((z&7|0)==7&!0)){z=0,S=13;break}if(y>>>0<14)y=y+1|0;else{z=1,S=13;break}}return(S|0)==13?z|0:0}function Ua(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,(S|0)>=(y|0)){if((S|0)!=(y|0))if(y>>>0<=15){if(C=Oe(y|0,0,52)|0,p=C|p,m=Pt()|0|m&-15728641,(S|0)>(y|0))do C=Oe(7,0,(14-y|0)*3|0)|0,y=y+1|0,p=C|p,m=Pt()|0|m;while((y|0)<(S|0))}else m=0,p=0}else m=0,p=0;return Tr(m|0),p|0}function oA(p,m,y){return p=p|0,m=m|0,y=y|0,p=xe(p|0,m|0,52)|0,Pt()|0,p=p&15,(y|0)<16&(p|0)<=(y|0)?(y=Ht(7,y-p|0)|0,y|0):(y=0,y|0)}function co(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0;if(L=xe(p|0,m|0,52)|0,Pt()|0,L=L&15,!!((y|0)<16&(L|0)<=(y|0))){if((L|0)==(y|0)){y=S,g[y>>2]=p,g[y+4>>2]=m;return}if(H=Ht(7,y-L|0)|0,et=(H|0)/7|0,z=xe(p|0,m|0,45)|0,Pt()|0,!(Ei(z&127)|0))k=0;else{t:do if(!L)C=0;else for(k=1;;){if(C=xe(p|0,m|0,(15-k|0)*3|0)|0,Pt()|0,C=C&7,C|0)break t;if(k>>>0>>0)k=k+1|0;else{C=0;break}}while(!1);k=(C|0)==0}if(st=Oe(L+1|0,0,52)|0,C=Pt()|0|m&-15728641,z=(14-L|0)*3|0,m=Oe(7,0,z|0)|0,m=(st|p)&~m,L=C&~(Pt()|0),co(m,L,y,S),C=S+(et<<3)|0,!k){st=Oe(1,0,z|0)|0,co(st|m,Pt()|0|L,y,C),st=C+(et<<3)|0,H=Oe(2,0,z|0)|0,co(H|m,Pt()|0|L,y,st),st=st+(et<<3)|0,H=Oe(3,0,z|0)|0,co(H|m,Pt()|0|L,y,st),st=st+(et<<3)|0,H=Oe(4,0,z|0)|0,co(H|m,Pt()|0|L,y,st),st=st+(et<<3)|0,H=Oe(5,0,z|0)|0,co(H|m,Pt()|0|L,y,st),H=Oe(6,0,z|0)|0,co(H|m,Pt()|0|L,y,st+(et<<3)|0);return}k=C+(et<<3)|0,(H|0)>6&&(H=C+8|0,st=(k>>>0>H>>>0?k:H)+-1+(0-C)|0,da(C|0,0,st+8&-8|0)|0,C=H+(st>>>3<<3)|0),st=Oe(2,0,z|0)|0,co(st|m,Pt()|0|L,y,C),st=C+(et<<3)|0,H=Oe(3,0,z|0)|0,co(H|m,Pt()|0|L,y,st),st=st+(et<<3)|0,H=Oe(4,0,z|0)|0,co(H|m,Pt()|0|L,y,st),st=st+(et<<3)|0,H=Oe(5,0,z|0)|0,co(H|m,Pt()|0|L,y,st),H=Oe(6,0,z|0)|0,co(H|m,Pt()|0|L,y,st+(et<<3)|0)}}function Zn(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=xe(p|0,m|0,45)|0,Pt()|0,!(Ei(C&127)|0))return C=0,C|0;C=xe(p|0,m|0,52)|0,Pt()|0,C=C&15;t:do if(!C)y=0;else for(S=1;;){if(y=xe(p|0,m|0,(15-S|0)*3|0)|0,Pt()|0,y=y&7,y|0)break t;if(S>>>0>>0)S=S+1|0;else{y=0;break}}while(!1);return C=(y|0)==0&1,C|0}function n0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,(y|0)<16&(S|0)<=(y|0)){if((S|0)!=(y|0)&&(C=Oe(y|0,0,52)|0,p=C|p,m=Pt()|0|m&-15728641,(S|0)<(y|0)))do C=Oe(7,0,(14-S|0)*3|0)|0,S=S+1|0,p=p&~C,m=m&~(Pt()|0);while((S|0)<(y|0))}else m=0,p=0;return Tr(m|0),p|0}function Lf(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0;if(!y)return Be=0,Be|0;if(C=p,S=g[C>>2]|0,C=g[C+4>>2]|0,!0&(C&15728640|0)==0){if((y|0)<=0||(Be=m,g[Be>>2]=S,g[Be+4>>2]=C,(y|0)==1))return Be=0,Be|0;S=1;do Ze=p+(S<<3)|0,$e=g[Ze+4>>2]|0,Be=m+(S<<3)|0,g[Be>>2]=g[Ze>>2],g[Be+4>>2]=$e,S=S+1|0;while((S|0)!=(y|0));return S=0,S|0}if(Ze=y<<3,$e=pn(Ze)|0,!$e)return Be=-3,Be|0;if(Ah($e|0,p|0,Ze|0)|0,Ft=Fi(y,8)|0,!Ft)return Ke($e),Be=-3,Be|0;S=y;t:for(;;){L=$e,st=g[L>>2]|0,L=g[L+4>>2]|0,Kt=xe(st|0,L|0,52)|0,Pt()|0,Kt=Kt&15,ve=Kt+-1|0,We=(S|0)>0;e:do if(We){if(Te=((S|0)<0)<<31>>31,Qt=Oe(ve|0,0,52)|0,se=Pt()|0,ve>>>0>15)for(C=0,p=st,y=L;;){if(!((p|0)==0&(y|0)==0)){if(k=xe(p|0,y|0,52)|0,Pt()|0,k=k&15,z=(k|0)<(ve|0),k=(k|0)==(ve|0),et=z?0:k?p:0,p=z?0:k?y:0,y=Vl(et|0,p|0,S|0,Te|0)|0,Pt()|0,k=Ft+(y<<3)|0,z=k,H=g[z>>2]|0,z=g[z+4>>2]|0,(H|0)==0&(z|0)==0)y=et;else for(Qt=0,Gt=y,Bt=z,y=et;;){if((Qt|0)>(S|0)){Be=41;break t}if((H|0)==(y|0)&(Bt&-117440513|0)==(p|0)){et=xe(H|0,Bt|0,56)|0,Pt()|0,et=et&7,Et=et+1|0,se=xe(H|0,Bt|0,45)|0,Pt()|0;r:do if(!(Ei(se&127)|0))z=7;else{if(H=xe(H|0,Bt|0,52)|0,Pt()|0,H=H&15,!H){z=6;break}for(z=1;;){if(se=Oe(7,0,(15-z|0)*3|0)|0,!((se&y|0)==0&((Pt()|0)&p|0)==0)){z=7;break r}if(z>>>0>>0)z=z+1|0;else{z=6;break}}}while(!1);if((et+2|0)>>>0>z>>>0){Be=51;break t}se=Oe(Et|0,0,56)|0,p=Pt()|0|p&-117440513,z=k,g[z>>2]=0,g[z+4>>2]=0,z=Gt,y=se|y}else z=(Gt+1|0)%(S|0)|0;if(k=Ft+(z<<3)|0,Bt=k,H=g[Bt>>2]|0,Bt=g[Bt+4>>2]|0,(H|0)==0&(Bt|0)==0)break;Qt=Qt+1|0,Gt=z}se=k,g[se>>2]=y,g[se+4>>2]=p}if(C=C+1|0,(C|0)>=(S|0))break e;y=$e+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}for(C=0,p=st,y=L;;){if(!((p|0)==0&(y|0)==0)){if(z=xe(p|0,y|0,52)|0,Pt()|0,z=z&15,(z|0)>=(ve|0)){if((z|0)!=(ve|0)&&(p=p|Qt,y=y&-15728641|se,z>>>0>=Kt>>>0)){k=ve;do Gt=Oe(7,0,(14-k|0)*3|0)|0,k=k+1|0,p=Gt|p,y=Pt()|0|y;while(k>>>0>>0)}}else p=0,y=0;if(z=Vl(p|0,y|0,S|0,Te|0)|0,Pt()|0,k=Ft+(z<<3)|0,H=k,et=g[H>>2]|0,H=g[H+4>>2]|0,!((et|0)==0&(H|0)==0))for(Gt=0;;){if((Gt|0)>(S|0)){Be=41;break t}if((et|0)==(p|0)&(H&-117440513|0)==(y|0)){Et=xe(et|0,H|0,56)|0,Pt()|0,Et=Et&7,Bt=Et+1|0,je=xe(et|0,H|0,45)|0,Pt()|0;r:do if(!(Ei(je&127)|0))H=7;else{if(et=xe(et|0,H|0,52)|0,Pt()|0,et=et&15,!et){H=6;break}for(H=1;;){if(je=Oe(7,0,(15-H|0)*3|0)|0,!((je&p|0)==0&((Pt()|0)&y|0)==0)){H=7;break r}if(H>>>0>>0)H=H+1|0;else{H=6;break}}}while(!1);if((Et+2|0)>>>0>H>>>0){Be=51;break t}je=Oe(Bt|0,0,56)|0,y=Pt()|0|y&-117440513,Bt=k,g[Bt>>2]=0,g[Bt+4>>2]=0,p=je|p}else z=(z+1|0)%(S|0)|0;if(k=Ft+(z<<3)|0,H=k,et=g[H>>2]|0,H=g[H+4>>2]|0,(et|0)==0&(H|0)==0)break;Gt=Gt+1|0}je=k,g[je>>2]=p,g[je+4>>2]=y}if(C=C+1|0,(C|0)>=(S|0))break e;y=$e+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}}while(!1);if((S+5|0)>>>0<11){Be=99;break}if(se=Fi((S|0)/6|0,8)|0,!se){Be=58;break}e:do if(We){Gt=0,Bt=0;do{if(z=Ft+(Gt<<3)|0,p=z,C=g[p>>2]|0,p=g[p+4>>2]|0,!((C|0)==0&(p|0)==0)){H=xe(C|0,p|0,56)|0,Pt()|0,H=H&7,y=H+1|0,et=p&-117440513,je=xe(C|0,p|0,45)|0,Pt()|0;r:do if(Ei(je&127)|0){if(Et=xe(C|0,p|0,52)|0,Pt()|0,Et=Et&15,Et|0)for(k=1;;){if(je=Oe(7,0,(15-k|0)*3|0)|0,!((C&je|0)==0&(et&(Pt()|0)|0)==0))break r;if(k>>>0>>0)k=k+1|0;else break}p=Oe(y|0,0,56)|0,C=p|C,p=Pt()|0|et,y=z,g[y>>2]=C,g[y+4>>2]=p,y=H+2|0}while(!1);(y|0)==7&&(je=se+(Bt<<3)|0,g[je>>2]=C,g[je+4>>2]=p&-117440513,Bt=Bt+1|0)}Gt=Gt+1|0}while((Gt|0)!=(S|0));if(We){if(Qt=((S|0)<0)<<31>>31,Et=Oe(ve|0,0,52)|0,Gt=Pt()|0,ve>>>0>15)for(p=0,C=0;;){do if(!((st|0)==0&(L|0)==0)){for(H=xe(st|0,L|0,52)|0,Pt()|0,H=H&15,k=(H|0)<(ve|0),H=(H|0)==(ve|0),z=k?0:H?st:0,H=k?0:H?L:0,k=Vl(z|0,H|0,S|0,Qt|0)|0,Pt()|0,y=0;;){if((y|0)>(S|0)){Be=98;break t}if(je=Ft+(k<<3)|0,et=g[je+4>>2]|0,(et&-117440513|0)==(H|0)&&(g[je>>2]|0)==(z|0)){Be=70;break}if(k=(k+1|0)%(S|0)|0,je=Ft+(k<<3)|0,(g[je>>2]|0)==(z|0)&&(g[je+4>>2]|0)==(H|0))break;y=y+1|0}if((Be|0)==70&&(Be=0,!0&(et&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=st,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Bt;break e}L=$e+(p<<3)|0,st=g[L>>2]|0,L=g[L+4>>2]|0}for(p=0,C=0;;){do if(!((st|0)==0&(L|0)==0)){if(H=xe(st|0,L|0,52)|0,Pt()|0,H=H&15,(H|0)>=(ve|0))if((H|0)!=(ve|0))if(y=st|Et,k=L&-15728641|Gt,H>>>0>>0)H=k;else{z=ve;do je=Oe(7,0,(14-z|0)*3|0)|0,z=z+1|0,y=je|y,k=Pt()|0|k;while(z>>>0>>0);H=k}else y=st,H=L;else y=0,H=0;for(z=Vl(y|0,H|0,S|0,Qt|0)|0,Pt()|0,k=0;;){if((k|0)>(S|0)){Be=98;break t}if(je=Ft+(z<<3)|0,et=g[je+4>>2]|0,(et&-117440513|0)==(H|0)&&(g[je>>2]|0)==(y|0)){Be=93;break}if(z=(z+1|0)%(S|0)|0,je=Ft+(z<<3)|0,(g[je>>2]|0)==(y|0)&&(g[je+4>>2]|0)==(H|0))break;k=k+1|0}if((Be|0)==93&&(Be=0,!0&(et&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=st,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Bt;break e}L=$e+(p<<3)|0,st=g[L>>2]|0,L=g[L+4>>2]|0}}else C=0,S=Bt}else C=0,S=0;while(!1);if(da(Ft|0,0,Ze|0)|0,Ah($e|0,se|0,S<<3|0)|0,Ke(se),S)m=m+(C<<3)|0;else break}return(Be|0)==41?(Ke($e),Ke(Ft),je=-1,je|0):(Be|0)==51?(Ke($e),Ke(Ft),je=-2,je|0):(Be|0)==58?(Ke($e),Ke(Ft),je=-3,je|0):(Be|0)==98?(Ke(se),Ke($e),Ke(Ft),je=-1,je|0):((Be|0)==99&&Ah(m|0,$e|0,S<<3|0)|0,Ke($e),Ke(Ft),je=0,je|0)}function s0(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0;if((m|0)<=0)return C=0,C|0;if((C|0)>=16){for(k=0;;){if(st=p+(k<<3)|0,!((g[st>>2]|0)==0&(g[st+4>>2]|0)==0)){k=14;break}if(k=k+1|0,(k|0)>=(m|0)){L=0,k=16;break}}if((k|0)==14)return((S|0)>0?-2:-1)|0;if((k|0)==16)return L|0}k=0,st=0;t:for(;;){et=p+(st<<3)|0,z=et,L=g[z>>2]|0,z=g[z+4>>2]|0;do if(!((L|0)==0&(z|0)==0)){if((k|0)>=(S|0)){L=-1,k=16;break t}if(H=xe(L|0,z|0,52)|0,Pt()|0,H=H&15,(H|0)>(C|0)){L=-2,k=16;break t}if((H|0)==(C|0)){et=y+(k<<3)|0,g[et>>2]=L,g[et+4>>2]=z,k=k+1|0;break}if(L=(Ht(7,C-H|0)|0)+k|0,(L|0)>(S|0)){L=-1,k=16;break t}co(g[et>>2]|0,g[et+4>>2]|0,C,y+(k<<3)|0),k=L}while(!1);if(st=st+1|0,(st|0)>=(m|0)){L=0,k=16;break}}return(k|0)==16?L|0:0}function o0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if((m|0)<=0)return y=0,y|0;if((y|0)>=16){for(S=0;;){if(L=p+(S<<3)|0,!((g[L>>2]|0)==0&(g[L+4>>2]|0)==0)){S=-1,C=13;break}if(S=S+1|0,(S|0)>=(m|0)){S=0,C=13;break}}if((C|0)==13)return S|0}S=0,L=0;t:for(;;){C=p+(L<<3)|0,k=g[C>>2]|0,C=g[C+4>>2]|0;do if(!((k|0)==0&(C|0)==0)){if(C=xe(k|0,C|0,52)|0,Pt()|0,C=C&15,(C|0)>(y|0)){S=-1,C=13;break t}if((C|0)==(y|0)){S=S+1|0;break}else{S=(Ht(7,y-C|0)|0)+S|0;break}}while(!1);if(L=L+1|0,(L|0)>=(m|0)){C=13;break}}return(C|0)==13?S|0:0}function Dc(p,m){return p=p|0,m=m|0,m=xe(p|0,m|0,52)|0,Pt()|0,m&1|0}function Vs(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=xe(p|0,m|0,52)|0,Pt()|0,C=C&15,!C)return C=0,C|0;for(S=1;;){if(y=xe(p|0,m|0,(15-S|0)*3|0)|0,Pt()|0,y=y&7,y|0){S=5;break}if(S>>>0>>0)S=S+1|0;else{y=0,S=5;break}}return(S|0)==5?y|0:0}function fh(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=xe(p|0,m|0,52)|0,Pt()|0,H=H&15,!H)return z=m,H=p,Tr(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=Oe(7,0,k|0)|0,C=Pt()|0,L=xe(p|0,m|0,k|0)|0,Pt()|0,k=Oe(ll(L&7)|0,0,k|0)|0,L=Pt()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=xe(p|0,m|0,(15-y|0)*3|0)|0,Pt()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(L=(15-y|0)*3|0,C=xe(p|0,m|0,L|0)|0,Pt()|0,k=Oe(7,0,L|0)|0,m=m&~(Pt()|0),L=Oe(ll(C&7)|0,0,L|0)|0,p=p&~k|L,m=m|(Pt()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Tr(m|0),p|0}function hl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,!S)return y=m,S=p,Tr(y|0),S|0;for(y=1;k=(15-y|0)*3|0,L=xe(p|0,m|0,k|0)|0,Pt()|0,C=Oe(7,0,k|0)|0,m=m&~(Pt()|0),k=Oe(ll(L&7)|0,0,k|0)|0,p=k|p&~C,m=Pt()|0|m,y>>>0>>0;)y=y+1|0;return Tr(m|0),p|0}function Od(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=xe(p|0,m|0,52)|0,Pt()|0,H=H&15,!H)return z=m,H=p,Tr(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=Oe(7,0,k|0)|0,C=Pt()|0,L=xe(p|0,m|0,k|0)|0,Pt()|0,k=Oe(Rc(L&7)|0,0,k|0)|0,L=Pt()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=xe(p|0,m|0,(15-y|0)*3|0)|0,Pt()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(C=(15-y|0)*3|0,k=Oe(7,0,C|0)|0,L=m&~(Pt()|0),m=xe(p|0,m|0,C|0)|0,Pt()|0,m=Oe(Rc(m&7)|0,0,C|0)|0,p=p&~k|m,m=L|(Pt()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Tr(m|0),p|0}function Bd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,!S)return y=m,S=p,Tr(y|0),S|0;for(y=1;L=(15-y|0)*3|0,k=Oe(7,0,L|0)|0,C=m&~(Pt()|0),m=xe(p|0,m|0,L|0)|0,Pt()|0,m=Oe(Rc(m&7)|0,0,L|0)|0,p=m|p&~k,m=Pt()|0|C,y>>>0>>0;)y=y+1|0;return Tr(m|0),p|0}function dh(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0;if(H=wt,wt=wt+64|0,z=H+40|0,S=H+24|0,C=H+12|0,k=H,Oe(m|0,0,52)|0,y=Pt()|0|134225919,!m)return(g[p+4>>2]|0)>2||(g[p+8>>2]|0)>2||(g[p+12>>2]|0)>2?(L=0,z=0,Tr(L|0),wt=H,z|0):(Oe(Jp(p)|0,0,45)|0,L=Pt()|0|y,z=-1,Tr(L|0),wt=H,z|0);if(g[z>>2]=g[p>>2],g[z+4>>2]=g[p+4>>2],g[z+8>>2]=g[p+8>>2],g[z+12>>2]=g[p+12>>2],L=z+4|0,(m|0)>0)for(p=-1;g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],m&1?(Na(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],Sf(C)):(lo(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],Ps(C)),gu(S,C,k),ns(k),st=(15-m|0)*3|0,et=Oe(7,0,st|0)|0,y=y&~(Pt()|0),st=Oe(Cd(k)|0,0,st|0)|0,p=st|p&~et,y=Pt()|0|y,(m|0)>1;)m=m+-1|0;else p=-1;t:do if((g[L>>2]|0)<=2&&(g[z+8>>2]|0)<=2&&(g[z+12>>2]|0)<=2){if(S=Jp(z)|0,m=Oe(S|0,0,45)|0,m=m|p,p=Pt()|0|y&-1040385,k=tA(z)|0,!(Ei(S)|0)){if((k|0)<=0)break;for(C=0;;){if(S=xe(m|0,p|0,52)|0,Pt()|0,S=S&15,S)for(y=1;st=(15-y|0)*3|0,z=xe(m|0,p|0,st|0)|0,Pt()|0,et=Oe(7,0,st|0)|0,p=p&~(Pt()|0),st=Oe(ll(z&7)|0,0,st|0)|0,m=m&~et|st,p=p|(Pt()|0),y>>>0>>0;)y=y+1|0;if(C=C+1|0,(C|0)==(k|0))break t}}C=xe(m|0,p|0,52)|0,Pt()|0,C=C&15;e:do if(C){y=1;r:for(;;){switch(st=xe(m|0,p|0,(15-y|0)*3|0)|0,Pt()|0,st&7){case 1:break r;case 0:break;default:break e}if(y>>>0>>0)y=y+1|0;else break e}if(Lc(S,g[z>>2]|0)|0)for(y=1;z=(15-y|0)*3|0,et=Oe(7,0,z|0)|0,st=p&~(Pt()|0),p=xe(m|0,p|0,z|0)|0,Pt()|0,p=Oe(Rc(p&7)|0,0,z|0)|0,m=m&~et|p,p=st|(Pt()|0),y>>>0>>0;)y=y+1|0;else for(y=1;st=(15-y|0)*3|0,z=xe(m|0,p|0,st|0)|0,Pt()|0,et=Oe(7,0,st|0)|0,p=p&~(Pt()|0),st=Oe(ll(z&7)|0,0,st|0)|0,m=m&~et|st,p=p|(Pt()|0),y>>>0>>0;)y=y+1|0}while(!1);if((k|0)>0){y=0;do m=fh(m,p)|0,p=Pt()|0,y=y+1|0;while((y|0)!=(k|0))}}else m=0,p=0;while(!1);return et=p,st=m,Tr(et|0),wt=H,st|0}function Is(p){return p=p|0,(p|0)%2|0|0}function aA(p,m){p=p|0,m=m|0;var y=0,S=0;return S=wt,wt=wt+16|0,y=S,m>>>0<=15&&(g[p+4>>2]&2146435072|0)!=2146435072&&(g[p+8+4>>2]&2146435072|0)!=2146435072?(Le(p,m,y),m=dh(y,m)|0,p=Pt()|0):(p=0,m=0),Tr(p|0),wt=S,m|0}function ph(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(C=y+4|0,k=xe(p|0,m|0,52)|0,Pt()|0,k=k&15,L=xe(p|0,m|0,45)|0,Pt()|0,S=(k|0)==0,Ei(L&127)|0){if(S)return L=1,L|0;S=1}else{if(S)return L=0,L|0;!(g[C>>2]|0)&&!(g[y+8>>2]|0)?S=(g[y+12>>2]|0)!=0&1:S=1}for(y=1;y&1?Sf(C):Ps(C),L=xe(p|0,m|0,(15-y|0)*3|0)|0,Pt()|0,Tf(C,L&7),y>>>0>>0;)y=y+1|0;return S|0}function fl(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0;st=wt,wt=wt+16|0,H=st,et=xe(p|0,m|0,45)|0,Pt()|0,et=et&127;t:do if(Ei(et)|0&&(k=xe(p|0,m|0,52)|0,Pt()|0,k=k&15,(k|0)!=0)){S=1;e:for(;;){switch(z=xe(p|0,m|0,(15-S|0)*3|0)|0,Pt()|0,z&7){case 5:break e;case 0:break;default:{S=m;break t}}if(S>>>0>>0)S=S+1|0;else{S=m;break t}}for(C=1,S=m;m=(15-C|0)*3|0,L=Oe(7,0,m|0)|0,z=S&~(Pt()|0),S=xe(p|0,S|0,m|0)|0,Pt()|0,S=Oe(Rc(S&7)|0,0,m|0)|0,p=p&~L|S,S=z|(Pt()|0),C>>>0>>0;)C=C+1|0}else S=m;while(!1);if(z=7728+(et*28|0)|0,g[y>>2]=g[z>>2],g[y+4>>2]=g[z+4>>2],g[y+8>>2]=g[z+8>>2],g[y+12>>2]=g[z+12>>2],!(ph(p,S,y)|0)){wt=st;return}if(L=y+4|0,g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],k=xe(p|0,S|0,52)|0,Pt()|0,z=k&15,k&1?(Ps(L),k=z+1|0):k=z,!(Ei(et)|0))S=0;else{t:do if(!z)S=0;else for(m=1;;){if(C=xe(p|0,S|0,(15-m|0)*3|0)|0,Pt()|0,C=C&7,C|0){S=C;break t}if(m>>>0>>0)m=m+1|0;else{S=0;break}}while(!1);S=(S|0)==4&1}if(!(vu(y,k,S,0)|0))(k|0)!=(z|0)&&(g[L>>2]=g[H>>2],g[L+4>>2]=g[H+4>>2],g[L+8>>2]=g[H+8>>2]);else{if(Ei(et)|0)do;while(vu(y,k,0,0)|0);(k|0)!=(z|0)&&lo(L)}wt=st}function Oc(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,fl(p,m,C),m=xe(p|0,m|0,52)|0,Pt()|0,l_(C,m&15,y),wt=S}function Bc(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;L=wt,wt=wt+16|0,k=L,fl(p,m,k),S=xe(p|0,m|0,45)|0,Pt()|0,S=(Ei(S&127)|0)==0,C=xe(p|0,m|0,52)|0,Pt()|0,C=C&15;t:do if(!S){if(C|0)for(S=1;;){if(z=Oe(7,0,(15-S|0)*3|0)|0,!((z&p|0)==0&((Pt()|0)&m|0)==0))break t;if(S>>>0>>0)S=S+1|0;else break}Ld(k,C,0,5,y),wt=L;return}while(!1);Jm(k,C,0,6,y),wt=L}function lA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(S=xe(p|0,m|0,45)|0,Pt()|0,!(Ei(S&127)|0))return S=2,S|0;if(S=xe(p|0,m|0,52)|0,Pt()|0,S=S&15,!S)return S=5,S|0;for(y=1;;){if(C=Oe(7,0,(15-y|0)*3|0)|0,!((C&p|0)==0&((Pt()|0)&m|0)==0)){y=2,p=6;break}if(y>>>0>>0)y=y+1|0;else{y=5,p=6;break}}return(p|0)==6?y|0:0}function cA(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0;Et=wt,wt=wt+128|0,et=Et+112|0,k=Et+96|0,st=Et,C=xe(p|0,m|0,52)|0,Pt()|0,z=C&15,g[et>>2]=z,L=xe(p|0,m|0,45)|0,Pt()|0,L=L&127;t:do if(Ei(L)|0){if(z|0)for(S=1;;){if(H=Oe(7,0,(15-S|0)*3|0)|0,!((H&p|0)==0&((Pt()|0)&m|0)==0)){C=0;break t}if(S>>>0>>0)S=S+1|0;else break}if(C&1)C=1;else{H=Oe(z+1|0,0,52)|0,st=Pt()|0|m&-15728641,et=Oe(7,0,(14-z|0)*3|0)|0,cA((H|p)&~et,st&~(Pt()|0),y),wt=Et;return}}else C=0;while(!1);fl(p,m,k),C?(kd(k,et,st),H=5):(xu(k,et,st),H=6);t:do if(Ei(L)|0)if(!z)S=20;else for(S=1;;){if(L=Oe(7,0,(15-S|0)*3|0)|0,!((L&p|0)==0&((Pt()|0)&m|0)==0)){S=8;break t}if(S>>>0>>0)S=S+1|0;else{S=20;break}}else S=8;while(!1);if(da(y|0,-1,S|0)|0,C){C=0;do{for(k=st+(C<<4)|0,Mx(k,g[et>>2]|0)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}else{C=0;do{for(k=st+(C<<4)|0,vu(k,g[et>>2]|0,0,1)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}wt=Et}function T(){return 12}function l(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(Oe(p|0,0,52)|0,z=Pt()|0|134225919,(p|0)<1){S=0,y=0;do Ei(S)|0&&(Oe(S|0,0,45)|0,L=z|(Pt()|0),p=m+(y<<3)|0,g[p>>2]=-1,g[p+4>>2]=L,y=y+1|0),S=S+1|0;while((S|0)!=122);return}L=0,y=0;do{if(Ei(L)|0){for(Oe(L|0,0,45)|0,S=1,C=-1,k=z|(Pt()|0);H=Oe(7,0,(15-S|0)*3|0)|0,C=C&~H,k=k&~(Pt()|0),(S|0)!=(p|0);)S=S+1|0;H=m+(y<<3)|0,g[H>>2]=C,g[H+4>>2]=k,y=y+1|0}L=L+1|0}while((L|0)!=122)}function f(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0;if(z=wt,wt=wt+64|0,L=z,(p|0)==(y|0)&(m|0)==(S|0)|(!1|(m&2013265920|0)!=134217728|(!1|(S&2013265920|0)!=134217728))||(C=xe(p|0,m|0,52)|0,Pt()|0,C=C&15,k=xe(y|0,S|0,52)|0,Pt()|0,(C|0)!=(k&15|0)))return L=0,wt=z,L|0;if(k=C+-1|0,C>>>0>1&&(et=Ua(p,m,k)|0,H=Pt()|0,k=Ua(y,S,k)|0,(et|0)==(k|0)&(H|0)==(Pt()|0))&&(k=(C^15)*3|0,C=xe(p|0,m|0,k|0)|0,Pt()|0,C=C&7,k=xe(y|0,S|0,k|0)|0,Pt()|0,k=k&7,(C|0)==0|(k|0)==0||(g[21136+(C<<2)>>2]|0)==(k|0)||(g[21168+(C<<2)>>2]|0)==(k|0)))return et=1,wt=z,et|0;C=L,k=C+56|0;do g[C>>2]=0,C=C+4|0;while((C|0)<(k|0));return Id(p,m,1,L),et=L,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0))&&(et=L+8|0,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0)))&&(et=L+16|0,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0)))&&(et=L+24|0,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0)))&&(et=L+32|0,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0)))&&(et=L+40|0,!((g[et>>2]|0)==(y|0)&&(g[et+4>>2]|0)==(S|0)))?(C=L+48|0,C=((g[C>>2]|0)==(y|0)?(g[C+4>>2]|0)==(S|0):0)&1):C=1,et=C,wt=z,et|0}function v(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0;if(et=wt,wt=wt+16|0,L=et,!(f(p,m,y,S)|0))return z=0,H=0,Tr(z|0),wt=et,H|0;for(z=m&-2130706433,C=(Zn(p,m)|0)==0,C=C?1:2;g[L>>2]=0,st=Dn(p,m,C,L)|0,k=C+1|0,!((st|0)==(y|0)&(Pt()|0)==(S|0));)if(k>>>0<7)C=k;else{C=0,p=0,H=6;break}return(H|0)==6?(Tr(C|0),wt=et,p|0):(st=Oe(C|0,0,56)|0,H=z|(Pt()|0)|268435456,st=p|st,Tr(H|0),wt=et,st|0)}function b(p,m){p=p|0,m=m|0;var y=0;return y=!0&(m&2013265920|0)==268435456,Tr((y?m&-2130706433|134217728:0)|0),(y?p:0)|0}function M(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return S=wt,wt=wt+16|0,y=S,!0&(m&2013265920|0)==268435456?(C=xe(p|0,m|0,56)|0,Pt()|0,g[y>>2]=0,y=Dn(p,m&-2130706433|134217728,C&7,y)|0,m=Pt()|0,Tr(m|0),wt=S,y|0):(m=0,y=0,Tr(m|0),wt=S,y|0)}function O(p,m){p=p|0,m=m|0;var y=0;if(!(!0&(m&2013265920|0)==268435456))return y=0,y|0;switch(y=xe(p|0,m|0,56)|0,Pt()|0,y&7){case 0:case 7:return y=0,y|0;default:}return y=m&-2130706433|134217728,!0&(m&117440512|0)==16777216&(Zn(p,y)|0)!=0?(y=0,y|0):(y=i0(p,y)|0,y|0)}function F(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;k=wt,wt=wt+16|0,S=k,L=!0&(m&2013265920|0)==268435456,C=m&-2130706433|134217728,z=y,g[z>>2]=L?p:0,g[z+4>>2]=L?C:0,L?(m=xe(p|0,m|0,56)|0,Pt()|0,g[S>>2]=0,p=Dn(p,C,m&7,S)|0,m=Pt()|0):(p=0,m=0),z=y+8|0,g[z>>2]=p,g[z+4>>2]=m,wt=k}function U(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;C=(Zn(p,m)|0)==0,m=m&-2130706433,S=y,g[S>>2]=C?p:0,g[S+4>>2]=C?m|285212672:0,S=y+8|0,g[S>>2]=p,g[S+4>>2]=m|301989888,S=y+16|0,g[S>>2]=p,g[S+4>>2]=m|318767104,S=y+24|0,g[S>>2]=p,g[S+4>>2]=m|335544320,S=y+32|0,g[S>>2]=p,g[S+4>>2]=m|352321536,y=y+40|0,g[y>>2]=p,g[y+4>>2]=m|369098752}function W(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;if(L=wt,wt=wt+16|0,k=L,S=xe(p|0,m|0,56)|0,Pt()|0,z=!0&(m&2013265920|0)==268435456,C=z?p:0,p=z?m&-2130706433|134217728:0,m=En(C,p,S&7)|0,(m|0)==-1){g[y>>2]=0,wt=L;return}fl(C,p,k),S=xe(C|0,p|0,52)|0,Pt()|0,S=S&15,Zn(C,p)|0?Ld(k,S,m,2,y):Jm(k,S,m,2,y),wt=L}function $(p){p=p|0;var m=0,y=0,S=0;return m=Fi(1,12)|0,m||ki(22691,22646,49,22704),y=p+4|0,S=g[y>>2]|0,S|0?(S=S+8|0,g[S>>2]=m,g[y>>2]=m,m|0):(g[p>>2]|0&&ki(22721,22646,61,22744),S=p,g[S>>2]=m,g[y>>2]=m,m|0)}function X(p,m){p=p|0,m=m|0;var y=0,S=0;return S=pn(24)|0,S||ki(22758,22646,78,22772),g[S>>2]=g[m>>2],g[S+4>>2]=g[m+4>>2],g[S+8>>2]=g[m+8>>2],g[S+12>>2]=g[m+12>>2],g[S+16>>2]=0,m=p+4|0,y=g[m>>2]|0,y|0?(g[y+16>>2]=S,g[m>>2]=S,S|0):(g[p>>2]|0&&ki(22787,22646,82,22772),g[p>>2]=S,g[m>>2]=S,S|0)}function at(p){p=p|0;var m=0,y=0,S=0,C=0;if(p)for(S=1;;){if(m=g[p>>2]|0,m|0)do{if(y=g[m>>2]|0,y|0)do C=y,y=g[y+16>>2]|0,Ke(C);while(y|0);C=m,m=g[m+8>>2]|0,Ke(C)}while(m|0);if(m=p,p=g[p+8>>2]|0,S||Ke(m),p)S=0;else break}}function gt(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0,je=0,Xr=0,Di=0,Pi=0,ji=0,Ai=0,di=0,cn=0,Gr=0;if(C=p+8|0,g[C>>2]|0)return Gr=1,Gr|0;if(S=g[p>>2]|0,!S)return Gr=0,Gr|0;m=S,y=0;do y=y+1|0,m=g[m+8>>2]|0;while(m|0);if(y>>>0<2)return Gr=0,Gr|0;di=pn(y<<2)|0,di||ki(22807,22646,317,22826),Ai=pn(y<<5)|0,Ai||ki(22848,22646,321,22826),g[p>>2]=0,$e=p+4|0,g[$e>>2]=0,g[C>>2]=0,y=0,ji=0,Ze=0,Et=0;t:for(;;){if(st=g[S>>2]|0,st){k=0,L=st;do{if(H=+bt[L+8>>3],m=L,L=g[L+16>>2]|0,et=(L|0)==0,C=et?st:L,z=+bt[C+8>>3],+Yr(+(H-z))>3.141592653589793){Gr=14;break}k=k+(z-H)*(+bt[m>>3]+ +bt[C>>3])}while(!et);if((Gr|0)==14){Gr=0,k=0,m=st;do Ft=+bt[m+8>>3],Pi=m+16|0,Di=g[Pi>>2]|0,Di=Di|0?Di:st,ve=+bt[Di+8>>3],k=k+(+bt[m>>3]+ +bt[Di>>3])*((ve<0?ve+6.283185307179586:ve)-(Ft<0?Ft+6.283185307179586:Ft)),m=g[(m|0?Pi:S)>>2]|0;while(m|0)}k>0?(g[di+(ji<<2)>>2]=S,ji=ji+1|0,C=Ze,m=Et):Gr=19}else Gr=19;if((Gr|0)==19){Gr=0;do if(y){if(m=y+8|0,g[m>>2]|0){Gr=21;break t}if(y=Fi(1,12)|0,!y){Gr=23;break t}g[m>>2]=y,C=y+4|0,L=y,m=Et}else if(Et){C=$e,L=Et+8|0,m=S,y=p;break}else if(g[p>>2]|0){Gr=27;break t}else{C=$e,L=p,m=S,y=p;break}while(!1);if(g[L>>2]=S,g[C>>2]=S,L=Ai+(Ze<<5)|0,et=g[S>>2]|0,et){for(st=Ai+(Ze<<5)+8|0,bt[st>>3]=17976931348623157e292,Et=Ai+(Ze<<5)+24|0,bt[Et>>3]=17976931348623157e292,bt[L>>3]=-17976931348623157e292,Bt=Ai+(Ze<<5)+16|0,bt[Bt>>3]=-17976931348623157e292,We=17976931348623157e292,Kt=-17976931348623157e292,C=0,Gt=et,H=17976931348623157e292,se=17976931348623157e292,Te=-17976931348623157e292,z=-17976931348623157e292;k=+bt[Gt>>3],Ft=+bt[Gt+8>>3],Gt=g[Gt+16>>2]|0,Qt=(Gt|0)==0,ve=+bt[(Qt?et:Gt)+8>>3],k>3]=k,H=k),Ft>3]=Ft,se=Ft),k>Te?bt[L>>3]=k:k=Te,Ft>z&&(bt[Bt>>3]=Ft,z=Ft),We=Ft>0&FtKt?Ft:Kt,C=C|+Yr(+(Ft-ve))>3.141592653589793,!Qt;)Te=k;C&&(bt[Bt>>3]=Kt,bt[Et>>3]=We)}else g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,g[L+12>>2]=0,g[L+16>>2]=0,g[L+20>>2]=0,g[L+24>>2]=0,g[L+28>>2]=0;C=Ze+1|0}if(Pi=S+8|0,S=g[Pi>>2]|0,g[Pi>>2]=0,S)Ze=C,Et=m;else{Gr=45;break}}if((Gr|0)==21)ki(22624,22646,35,22658);else if((Gr|0)==23)ki(22678,22646,37,22658);else if((Gr|0)==27)ki(22721,22646,61,22744);else if((Gr|0)==45){t:do if((ji|0)>0){for(Pi=(C|0)==0,Xr=C<<2,Di=(p|0)==0,je=0,m=0;;){if(Be=g[di+(je<<2)>>2]|0,Pi)Gr=73;else{if(Ze=pn(Xr)|0,!Ze){Gr=50;break}if($e=pn(Xr)|0,!$e){Gr=52;break}e:do if(Di)y=0;else{for(C=0,y=0,L=p;S=Ai+(C<<5)|0,_t(g[L>>2]|0,S,g[Be>>2]|0)|0?(g[Ze+(y<<2)>>2]=L,g[$e+(y<<2)>>2]=S,Qt=y+1|0):Qt=y,L=g[L+8>>2]|0,L;)C=C+1|0,y=Qt;if((Qt|0)>0)if(S=g[Ze>>2]|0,(Qt|0)==1)y=S;else for(Bt=0,Gt=-1,y=S,Et=S;;){for(et=g[Et>>2]|0,S=0,L=0;C=g[g[Ze+(L<<2)>>2]>>2]|0,(C|0)==(et|0)?st=S:st=S+((_t(C,g[$e+(L<<2)>>2]|0,g[et>>2]|0)|0)&1)|0,L=L+1|0,(L|0)!=(Qt|0);)S=st;if(C=(st|0)>(Gt|0),y=C?Et:y,S=Bt+1|0,(S|0)==(Qt|0))break e;Bt=S,Gt=C?st:Gt,Et=g[Ze+(S<<2)>>2]|0}else y=0}while(!1);if(Ke(Ze),Ke($e),y){if(C=y+4|0,S=g[C>>2]|0,S)y=S+8|0;else if(g[y>>2]|0){Gr=70;break}g[y>>2]=Be,g[C>>2]=Be}else Gr=73}if((Gr|0)==73){if(Gr=0,m=g[Be>>2]|0,m|0)do $e=m,m=g[m+16>>2]|0,Ke($e);while(m|0);Ke(Be),m=2}if(je=je+1|0,(je|0)>=(ji|0)){cn=m;break t}}(Gr|0)==50?ki(22863,22646,249,22882):(Gr|0)==52?ki(22901,22646,252,22882):(Gr|0)==70&&ki(22721,22646,61,22744)}else cn=0;while(!1);return Ke(di),Ke(Ai),Gr=cn,Gr|0}return 0}function _t(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0;if(!(Xm(m,y)|0)||(m=wf(m)|0,et=+bt[y>>3],S=+bt[y+8>>3],S=m&S<0?S+6.283185307179586:S,p=g[p>>2]|0,!p))return p=0,p|0;if(m){m=0,y=p;t:for(;;){for(;L=+bt[y>>3],H=+bt[y+8>>3],y=y+16|0,st=g[y>>2]|0,st=st|0?st:p,k=+bt[st>>3],C=+bt[st+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(etz);)if(y=g[y>>2]|0,!y){y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(et-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}else{m=0,y=p;t:for(;;){for(;L=+bt[y>>3],H=+bt[y+8>>3],y=y+16|0,st=g[y>>2]|0,st=st|0?st:p,k=+bt[st>>3],C=+bt[st+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(etz);)if(y=g[y>>2]|0,!y){y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(et-k)/(z-k)*(L-C)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}return 0}function yt(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0;if(Kt=wt,wt=wt+32|0,We=Kt+16|0,Te=Kt,k=xe(p|0,m|0,52)|0,Pt()|0,k=k&15,Gt=xe(y|0,S|0,52)|0,Pt()|0,(k|0)!=(Gt&15|0))return We=1,wt=Kt,We|0;if(et=xe(p|0,m|0,45)|0,Pt()|0,et=et&127,st=xe(y|0,S|0,45)|0,Pt()|0,st=st&127,Gt=(et|0)!=(st|0),Gt){if(z=bf(et,st)|0,(z|0)==7)return We=2,wt=Kt,We|0;H=bf(st,et)|0,(H|0)==7?ki(22925,22949,151,22959):(Qt=z,L=H)}else Qt=0,L=0;Et=Ei(et)|0,Bt=Ei(st)|0,g[We>>2]=0,g[We+4>>2]=0,g[We+8>>2]=0,g[We+12>>2]=0;do if(Qt){if(st=g[4304+(et*28|0)+(Qt<<2)>>2]|0,z=(st|0)>0,Bt)if(z){et=0,H=y,z=S;do H=Od(H,z)|0,z=Pt()|0,L=Rc(L)|0,(L|0)==1&&(L=Rc(1)|0),et=et+1|0;while((et|0)!=(st|0));st=L,et=H,H=z}else st=L,et=y,H=S;else if(z){et=0,H=y,z=S;do H=Bd(H,z)|0,z=Pt()|0,L=Rc(L)|0,et=et+1|0;while((et|0)!=(st|0));st=L,et=H,H=z}else st=L,et=y,H=S;if(ph(et,H,We)|0,Gt||ki(22972,22949,181,22959),z=(Et|0)!=0,L=(Bt|0)!=0,z&L&&ki(22999,22949,182,22959),z){if(L=Vs(p,m)|0,vr[22032+(L*7|0)+Qt>>0]|0){k=3;break}H=g[21200+(L*28|0)+(Qt<<2)>>2]|0,et=H,se=26}else if(L){if(L=Vs(et,H)|0,vr[22032+(L*7|0)+st>>0]|0){k=4;break}et=0,H=g[21200+(st*28|0)+(L<<2)>>2]|0,se=26}else L=0;if((se|0)==26)if((H|0)<=-1&&ki(23030,22949,212,22959),(et|0)<=-1&&ki(23053,22949,213,22959),(H|0)>0){z=We+4|0,L=0;do rA(z),L=L+1|0;while((L|0)!=(H|0));L=et}else L=et;if(g[Te>>2]=0,g[Te+4>>2]=0,g[Te+8>>2]=0,Tf(Te,Qt),k|0)for(;Is(k)|0?Sf(Te):Ps(Te),(k|0)>1;)k=k+-1|0;if((L|0)>0){k=0;do rA(Te),k=k+1|0;while((k|0)!=(L|0))}se=We+4|0,Vi(se,Te,se),ns(se),se=50}else if(ph(y,S,We)|0,(Et|0)!=0&(Bt|0)!=0)if((st|0)!=(et|0)&&ki(23077,22949,243,22959),L=Vs(p,m)|0,k=Vs(y,S)|0,vr[22032+(L*7|0)+k>>0]|0)k=5;else if(L=g[21200+(L*28|0)+(k<<2)>>2]|0,(L|0)>0){z=We+4|0,k=0;do rA(z),k=k+1|0;while((k|0)!=(L|0));se=50}else se=50;else se=50;while(!1);return(se|0)==50&&(k=We+4|0,g[C>>2]=g[k>>2],g[C+4>>2]=g[k+4>>2],g[C+8>>2]=g[k+8>>2],k=0),We=k,wt=Kt,We|0}function At(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0;if(Qt=wt,wt=wt+48|0,L=Qt+36|0,z=Qt+24|0,H=Qt+12|0,et=Qt,k=xe(p|0,m|0,52)|0,Pt()|0,k=k&15,Bt=xe(p|0,m|0,45)|0,Pt()|0,Bt=Bt&127,st=Ei(Bt)|0,Oe(k|0,0,52)|0,Te=Pt()|0|134225919,se=S,g[se>>2]=-1,g[se+4>>2]=Te,!k)return(g[y>>2]|0)>1||(g[y+4>>2]|0)>1||(g[y+8>>2]|0)>1||(C=mu(Bt,Cd(y)|0)|0,(C|0)==127)?(Te=1,wt=Qt,Te|0):(Gt=Oe(C|0,0,45)|0,se=Pt()|0,Bt=S,se=g[Bt+4>>2]&-1040385|se,Te=S,g[Te>>2]=g[Bt>>2]|Gt,g[Te+4>>2]=se,Te=0,wt=Qt,Te|0);for(g[L>>2]=g[y>>2],g[L+4>>2]=g[y+4>>2],g[L+8>>2]=g[y+8>>2];g[z>>2]=g[L>>2],g[z+4>>2]=g[L+4>>2],g[z+8>>2]=g[L+8>>2],Is(k)|0?(Na(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],Sf(H)):(lo(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],Ps(H)),gu(z,H,et),ns(et),se=S,We=g[se>>2]|0,se=g[se+4>>2]|0,Kt=(15-k|0)*3|0,y=Oe(7,0,Kt|0)|0,se=se&~(Pt()|0),Kt=Oe(Cd(et)|0,0,Kt|0)|0,se=Pt()|0|se,Te=S,g[Te>>2]=Kt|We&~y,g[Te+4>>2]=se,(k|0)>1;)k=k+-1|0;t:do if((g[L>>2]|0)<=1&&(g[L+4>>2]|0)<=1&&(g[L+8>>2]|0)<=1){k=Cd(L)|0,z=mu(Bt,k)|0,(z|0)==127?et=0:et=Ei(z)|0;e:do if(k){if(st){if(L=21408+((Vs(p,m)|0)*28|0)+(k<<2)|0,L=g[L>>2]|0,(L|0)>0){y=0;do k=ll(k)|0,y=y+1|0;while((y|0)!=(L|0))}if((k|0)==1){C=3;break t}y=mu(Bt,k)|0,(y|0)==127&&ki(23104,22949,376,23134),Ei(y)|0?ki(23147,22949,377,23134):(Gt=L,Et=k,C=y)}else Gt=0,Et=k,C=z;if(H=g[4304+(Bt*28|0)+(Et<<2)>>2]|0,(H|0)<=-1&&ki(23178,22949,384,23134),!et){if((Gt|0)<=-1&&ki(23030,22949,417,23134),Gt|0){L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=hl(y,L)|0,L=Pt()|0,Kt=S,g[Kt>>2]=y,g[Kt+4>>2]=L,k=k+1|0;while((k|0)<(Gt|0))}if((H|0)<=0){k=54;break}for(L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;;)if(y=hl(y,L)|0,L=Pt()|0,Kt=S,g[Kt>>2]=y,g[Kt+4>>2]=L,k=k+1|0,(k|0)==(H|0)){k=54;break e}}if(z=bf(C,Bt)|0,(z|0)==7&&ki(22925,22949,393,23134),k=S,y=g[k>>2]|0,k=g[k+4>>2]|0,(H|0)>0){L=0;do y=hl(y,k)|0,k=Pt()|0,Kt=S,g[Kt>>2]=y,g[Kt+4>>2]=k,L=L+1|0;while((L|0)!=(H|0))}if(y=Vs(y,k)|0,Kt=Us(C)|0,y=g[(Kt?21824:21616)+(z*28|0)+(y<<2)>>2]|0,(y|0)<=-1&&ki(23030,22949,412,23134),!y)k=54;else{z=S,k=0,L=g[z>>2]|0,z=g[z+4>>2]|0;do L=fh(L,z)|0,z=Pt()|0,Kt=S,g[Kt>>2]=L,g[Kt+4>>2]=z,k=k+1|0;while((k|0)<(y|0));k=54}}else if((st|0)!=0&(et|0)!=0)if(Kt=Vs(p,m)|0,k=S,k=21408+(Kt*28|0)+((Vs(g[k>>2]|0,g[k+4>>2]|0)|0)<<2)|0,k=g[k>>2]|0,(k|0)<=-1&&ki(23201,22949,433,23134),!k)C=z,k=55;else{L=S,C=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=hl(y,L)|0,L=Pt()|0,Kt=S,g[Kt>>2]=y,g[Kt+4>>2]=L,C=C+1|0;while((C|0)<(k|0));C=z,k=54}else C=z,k=54;while(!1);if((k|0)==54&&et&&(k=55),(k|0)==55&&(Kt=S,(Vs(g[Kt>>2]|0,g[Kt+4>>2]|0)|0)==1)){C=4;break}Kt=S,Te=g[Kt>>2]|0,Kt=g[Kt+4>>2]&-1040385,We=Oe(C|0,0,45)|0,Kt=Kt|(Pt()|0),C=S,g[C>>2]=Te|We,g[C+4>>2]=Kt,C=0}else C=2;while(!1);return Kt=C,wt=Qt,Kt|0}function kt(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;return L=wt,wt=wt+16|0,k=L,p=yt(p,m,y,S,k)|0,p||(Km(k,C),p=0),wt=L,p|0}function Wt(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return C=wt,wt=wt+16|0,k=C,Mf(y,k),S=At(p,m,k,S)|0,wt=C,S|0}function St(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(yt(p,m,p,m,C)|0)&&!(yt(p,m,y,S,k)|0)?p=ze(C,k)|0:p=-1,wt=L,p|0}function Nt(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(yt(p,m,p,m,C)|0)&&!(yt(p,m,y,S,k)|0)?p=ze(C,k)|0:p=-1,wt=L,(p>>>31^1)+p|0}function Zt(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0;if(Ze=wt,wt=wt+48|0,k=Ze+24|0,L=Ze+12|0,Ft=Ze,!(yt(p,m,p,m,k)|0)&&!(yt(p,m,y,S,L)|0)){if(ve=ze(k,L)|0,(ve|0)<0)return Ft=ve,wt=Ze,Ft|0;for(g[k>>2]=0,g[k+4>>2]=0,g[k+8>>2]=0,g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,yt(p,m,p,m,k)|0,yt(p,m,y,S,L)|0,Ef(k),Ef(L),ve?(st=g[k>>2]|0,Gt=+(ve|0),Te=k+4|0,Et=g[Te>>2]|0,We=k+8|0,Bt=g[We>>2]|0,Kt=k,y=st,S=Et,k=Bt,Qt=+((g[L>>2]|0)-st|0)/Gt,se=+((g[L+4>>2]|0)-Et|0)/Gt,Gt=+((g[L+8>>2]|0)-Bt|0)/Gt):(S=k+4|0,Bt=k+8|0,Te=S,We=Bt,Kt=k,y=g[k>>2]|0,S=g[S>>2]|0,k=g[Bt>>2]|0,Qt=0,se=0,Gt=0),g[Ft>>2]=y,Bt=Ft+4|0,g[Bt>>2]=S,Et=Ft+8|0,g[Et>>2]=k,st=0;;){H=+(st|0),$e=Qt*H+ +(y|0),z=se*H+ +(g[Te>>2]|0),H=Gt*H+ +(g[We>>2]|0),S=~~+Va(+$e),L=~~+Va(+z),y=~~+Va(+H),$e=+Yr(+(+(S|0)-$e)),z=+Yr(+(+(L|0)-z)),H=+Yr(+(+(y|0)-H));do if($e>z&$e>H)S=0-(L+y)|0,k=L;else if(et=0-S|0,z>H){k=et-y|0;break}else{k=L,y=et-L|0;break}while(!1);if(g[Ft>>2]=S,g[Bt>>2]=k,g[Et>>2]=y,iA(Ft),At(p,m,Ft,C+(st<<3)|0)|0,(st|0)==(ve|0))break;st=st+1|0,y=g[Kt>>2]|0}return Ft=0,wt=Ze,Ft|0}return Ft=-1,wt=Ze,Ft|0}function Ht(p,m){p=p|0,m=m|0;var y=0;if(!m)return y=1,y|0;y=p,p=1;do p=za(m&1|0?y:1,p)|0,m=m>>1,y=za(y,y)|0;while(m|0);return p|0}function ne(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0;if(!(Xm(m,y)|0)||(m=wf(m)|0,Bt=+bt[y>>3],S=+bt[y+8>>3],S=m&S<0?S+6.283185307179586:S,Et=g[p>>2]|0,(Et|0)<=0))return Et=0,Et|0;if(st=g[p+4>>2]|0,m){m=0,y=-1,p=0;t:for(;;){for(et=p;L=+bt[st+(et<<4)>>3],H=+bt[st+(et<<4)+8>>3],p=(y+2|0)%(Et|0)|0,k=+bt[st+(p<<4)>>3],C=+bt[st+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Btz);)if(y=et+1|0,(y|0)<(Et|0))p=et,et=y,y=p;else{y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(Bt-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),p=et+1|0,(p|0)>=(Et|0)){y=22;break}else y=et}if((y|0)==22)return m|0}else{m=0,y=-1,p=0;t:for(;;){for(et=p;L=+bt[st+(et<<4)>>3],H=+bt[st+(et<<4)+8>>3],p=(y+2|0)%(Et|0)|0,k=+bt[st+(p<<4)>>3],C=+bt[st+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Btz);)if(y=et+1|0,(y|0)<(Et|0))p=et,et=y,y=p;else{y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(Bt-k)/(z-k)*(L-C)>S&&(m=m^1),p=et+1|0,(p|0)>=(Et|0)){y=22;break}else y=et}if((y|0)==22)return m|0}return 0}function he(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0;if(Qt=g[p>>2]|0,!Qt){g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;return}if(se=m+8|0,bt[se>>3]=17976931348623157e292,Te=m+24|0,bt[Te>>3]=17976931348623157e292,bt[m>>3]=-17976931348623157e292,We=m+16|0,bt[We>>3]=-17976931348623157e292,!((Qt|0)<=0)){for(Bt=g[p+4>>2]|0,et=17976931348623157e292,st=-17976931348623157e292,Et=0,p=-1,k=17976931348623157e292,L=17976931348623157e292,H=-17976931348623157e292,S=-17976931348623157e292,Gt=0;y=+bt[Bt+(Gt<<4)>>3],z=+bt[Bt+(Gt<<4)+8>>3],p=p+2|0,C=+bt[Bt+(((p|0)==(Qt|0)?0:p)<<4)+8>>3],y>3]=y,k=y),z>3]=z,L=z),y>H?bt[m>>3]=y:y=H,z>S&&(bt[We>>3]=z,S=z),et=z>0&zst?z:st,Et=Et|+Yr(+(z-C))>3.141592653589793,p=Gt+1|0,(p|0)!=(Qt|0);)Kt=Gt,H=y,Gt=p,p=Kt;Et&&(bt[We>>3]=st,bt[Te>>3]=et)}}function ce(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0,$e=0,Be=0;if(Qt=g[p>>2]|0,Qt){if(se=m+8|0,bt[se>>3]=17976931348623157e292,Te=m+24|0,bt[Te>>3]=17976931348623157e292,bt[m>>3]=-17976931348623157e292,We=m+16|0,bt[We>>3]=-17976931348623157e292,(Qt|0)>0){for(C=g[p+4>>2]|0,Bt=17976931348623157e292,Gt=-17976931348623157e292,S=0,y=-1,H=17976931348623157e292,et=17976931348623157e292,Et=-17976931348623157e292,L=-17976931348623157e292,Kt=0;k=+bt[C+(Kt<<4)>>3],st=+bt[C+(Kt<<4)+8>>3],$e=y+2|0,z=+bt[C+((($e|0)==(Qt|0)?0:$e)<<4)+8>>3],k>3]=k,H=k),st>3]=st,et=st),k>Et?bt[m>>3]=k:k=Et,st>L&&(bt[We>>3]=st,L=st),Bt=st>0&stGt?st:Gt,S=S|+Yr(+(st-z))>3.141592653589793,y=Kt+1|0,(y|0)!=(Qt|0);)$e=Kt,Et=k,Kt=y,y=$e;S&&(bt[We>>3]=Gt,bt[Te>>3]=Bt)}}else g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;if($e=p+8|0,y=g[$e>>2]|0,!((y|0)<=0)){Ze=p+12|0,Ft=0;do if(C=g[Ze>>2]|0,S=Ft,Ft=Ft+1|0,Te=m+(Ft<<5)|0,We=g[C+(S<<3)>>2]|0,We){if(Kt=m+(Ft<<5)+8|0,bt[Kt>>3]=17976931348623157e292,p=m+(Ft<<5)+24|0,bt[p>>3]=17976931348623157e292,bt[Te>>3]=-17976931348623157e292,ve=m+(Ft<<5)+16|0,bt[ve>>3]=-17976931348623157e292,(We|0)>0){for(Qt=g[C+(S<<3)+4>>2]|0,Bt=17976931348623157e292,Gt=-17976931348623157e292,C=0,S=-1,se=0,H=17976931348623157e292,et=17976931348623157e292,st=-17976931348623157e292,L=-17976931348623157e292;k=+bt[Qt+(se<<4)>>3],Et=+bt[Qt+(se<<4)+8>>3],S=S+2|0,z=+bt[Qt+(((S|0)==(We|0)?0:S)<<4)+8>>3],k>3]=k,H=k),Et>3]=Et,et=Et),k>st?bt[Te>>3]=k:k=st,Et>L&&(bt[ve>>3]=Et,L=Et),Bt=Et>0&EtGt?Et:Gt,C=C|+Yr(+(Et-z))>3.141592653589793,S=se+1|0,(S|0)!=(We|0);)Be=se,se=S,st=k,S=Be;C&&(bt[ve>>3]=Gt,bt[p>>3]=Bt)}}else g[Te>>2]=0,g[Te+4>>2]=0,g[Te+8>>2]=0,g[Te+12>>2]=0,g[Te+16>>2]=0,g[Te+20>>2]=0,g[Te+24>>2]=0,g[Te+28>>2]=0,y=g[$e>>2]|0;while((Ft|0)<(y|0))}}function _e(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if(!(ne(p,m,y)|0))return C=0,C|0;if(C=p+8|0,(g[C>>2]|0)<=0)return C=1,C|0;for(S=p+12|0,p=0;;){if(k=p,p=p+1|0,ne((g[S>>2]|0)+(k<<3)|0,m+(p<<5)|0,y)|0){p=0,S=6;break}if((p|0)>=(g[C>>2]|0)){p=1,S=6;break}}return(S|0)==6?p|0:0}function Ve(){return 8}function hr(){return 16}function Ee(){return 168}function lr(){return 8}function qe(){return 16}function nn(){return 12}function ti(){return 8}function zr(p){p=p|0;var m=0,y=0;return y=+bt[p>>3],m=+bt[p+8>>3],+ +dn(+(y*y+m*m))}function Qr(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0;et=+bt[p>>3],H=+bt[m>>3]-et,z=+bt[p+8>>3],L=+bt[m+8>>3]-z,Et=+bt[y>>3],k=+bt[S>>3]-Et,Bt=+bt[y+8>>3],st=+bt[S+8>>3]-Bt,k=(k*(z-Bt)-(et-Et)*st)/(H*st-L*k),bt[C>>3]=et+H*k,bt[C+8>>3]=z+L*k}function Bn(p,m){return p=p|0,m=m|0,+bt[p>>3]!=+bt[m>>3]?(m=0,m|0):(m=+bt[p+8>>3]==+bt[m+8>>3],m|0)}function Or(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return C=+bt[p>>3]-+bt[m>>3],S=+bt[p+8>>3]-+bt[m+8>>3],y=+bt[p+16>>3]-+bt[m+16>>3],+(C*C+S*S+y*y)}function To(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;y=+bt[p>>3],S=+Jr(+y),y=+$r(+y),bt[m+16>>3]=y,y=+bt[p+8>>3],C=S*+Jr(+y),bt[m>>3]=C,y=S*+$r(+y),bt[m+8>>3]=y}function Cs(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0;if(et=wt,wt=wt+32|0,C=et+16|0,k=et,fl(p,m,C),L=On(p,m)|0,H=Vs(p,m)|0,n_(L,k),m=Au(L,g[C>>2]|0)|0,!(Ei(L)|0))return H=m,wt=et,H|0;do switch(L|0){case 4:{p=0,y=14;break}case 14:{p=1,y=14;break}case 24:{p=2,y=14;break}case 38:{p=3,y=14;break}case 49:{p=4,y=14;break}case 58:{p=5,y=14;break}case 63:{p=6,y=14;break}case 72:{p=7,y=14;break}case 83:{p=8,y=14;break}case 97:{p=9,y=14;break}case 107:{p=10,y=14;break}case 117:{p=11,y=14;break}default:z=0,S=0}while(!1);return(y|0)==14&&(z=g[22096+(p*24|0)+8>>2]|0,S=g[22096+(p*24|0)+16>>2]|0),p=g[C>>2]|0,(p|0)!=(g[k>>2]|0)&&(L=Us(L)|0,p=g[C>>2]|0,L|(p|0)==(S|0)&&(m=(m+1|0)%6|0)),(H|0)==3&(p|0)==(S|0)?(H=(m+5|0)%6|0,wt=et,H|0):(H|0)==5&(p|0)==(z|0)?(H=(m+1|0)%6|0,wt=et,H|0):(H=m,wt=et,H|0)}function En(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;return S=Zn(p,m)|0,(y+-1|0)>>>0>5||(C=(S|0)!=0,(y|0)==1&C)?(y=-1,y|0):(S=Cs(p,m)|0,C?(y=(5-S+(g[22384+(y<<2)>>2]|0)|0)%5|0,y|0):(y=(6-S+(g[22416+(y<<2)>>2]|0)|0)%6|0,y|0))}function js(p,m,y){p=p|0,m=m|0,y=y|0;var S=0;(m|0)>0?(S=Fi(m,4)|0,g[p>>2]=S,S||ki(23230,23253,40,23267)):g[p>>2]=0,g[p+4>>2]=m,g[p+8>>2]=0,g[p+12>>2]=y}function Gs(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=p+4|0,k=p+12|0,L=p+8|0;t:for(;;){for(y=g[C>>2]|0,m=0;;){if((m|0)>=(y|0))break t;if(S=g[p>>2]|0,z=g[S+(m<<2)>>2]|0,!z)m=m+1|0;else break}m=S+(~~(+Yr(+(+zl(10,+ +(15-(g[k>>2]|0)|0))*(+bt[z>>3]+ +bt[z+8>>3])))%+(y|0))>>>0<<2)|0,y=g[m>>2]|0;e:do if(y|0){if(S=z+32|0,(y|0)==(z|0))g[m>>2]=g[S>>2];else{if(y=y+32|0,m=g[y>>2]|0,!m)break;for(;(m|0)!=(z|0);)if(y=m+32|0,m=g[y>>2]|0,!m)break e;g[y>>2]=g[S>>2]}Ke(z),g[L>>2]=(g[L>>2]|0)+-1}while(!1)}Ke(g[p>>2]|0)}function fa(p){p=p|0;var m=0,y=0,S=0;for(S=g[p+4>>2]|0,y=0;;){if((y|0)>=(S|0)){m=0,y=4;break}if(m=g[(g[p>>2]|0)+(y<<2)>>2]|0,!m)y=y+1|0;else{y=4;break}}return(y|0)==4?m|0:0}function Fc(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;if(y=~~(+Yr(+(+zl(10,+ +(15-(g[p+12>>2]|0)|0))*(+bt[m>>3]+ +bt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,y=(g[p>>2]|0)+(y<<2)|0,S=g[y>>2]|0,!S)return k=1,k|0;k=m+32|0;do if((S|0)!=(m|0)){if(y=g[S+32>>2]|0,!y)return k=1,k|0;for(C=y;;){if((C|0)==(m|0)){C=8;break}if(y=g[C+32>>2]|0,y)S=C,C=y;else{y=1,C=10;break}}if((C|0)==8){g[S+32>>2]=g[k>>2];break}else if((C|0)==10)return y|0}else g[y>>2]=g[k>>2];while(!1);return Ke(m),k=p+8|0,g[k>>2]=(g[k>>2]|0)+-1,k=0,k|0}function kf(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;k=pn(40)|0,k||ki(23283,23253,98,23296),g[k>>2]=g[m>>2],g[k+4>>2]=g[m+4>>2],g[k+8>>2]=g[m+8>>2],g[k+12>>2]=g[m+12>>2],C=k+16|0,g[C>>2]=g[y>>2],g[C+4>>2]=g[y+4>>2],g[C+8>>2]=g[y+8>>2],g[C+12>>2]=g[y+12>>2],g[k+32>>2]=0,C=~~(+Yr(+(+zl(10,+ +(15-(g[p+12>>2]|0)|0))*(+bt[m>>3]+ +bt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=(g[p>>2]|0)+(C<<2)|0,S=g[C>>2]|0;do if(!S)g[C>>2]=k;else{for(;!(Ul(S,m)|0&&Ul(S+16|0,y)|0);)if(C=g[S+32>>2]|0,S=C|0?C:S,!(g[S+32>>2]|0)){L=10;break}if((L|0)==10){g[S+32>>2]=k;break}return Ke(k),L=S,L|0}while(!1);return L=p+8|0,g[L>>2]=(g[L>>2]|0)+1,L=k,L|0}function Rf(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(C=~~(+Yr(+(+zl(10,+ +(15-(g[p+12>>2]|0)|0))*(+bt[m>>3]+ +bt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=g[(g[p>>2]|0)+(C<<2)>>2]|0,!C)return y=0,y|0;if(!y){for(p=C;;){if(Ul(p,m)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}if((S|0)==10)return p|0}for(p=C;;){if(Ul(p,m)|0&&Ul(p+16|0,y)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}return(S|0)==10?p|0:0}function wu(p,m){p=p|0,m=m|0;var y=0;if(y=~~(+Yr(+(+zl(10,+ +(15-(g[p+12>>2]|0)|0))*(+bt[m>>3]+ +bt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,p=g[(g[p>>2]|0)+(y<<2)>>2]|0,!p)return y=0,y|0;for(;;){if(Ul(p,m)|0){m=5;break}if(p=g[p+32>>2]|0,!p){p=0,m=5;break}}return(m|0)==5?p|0:0}function hs(){return 23312}function Yn(p){return p=+p,+ +l0(+p)}function sn(p){return p=+p,~~+Yn(p)|0}function pn(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0,se=0,Te=0,We=0,Kt=0,ve=0,Ft=0,Ze=0;Ze=wt,wt=wt+16|0,Bt=Ze;do if(p>>>0<245){if(et=p>>>0<11?16:p+11&-8,p=et>>>3,Et=g[5829]|0,y=Et>>>p,y&3|0)return m=(y&1^1)+p|0,p=23356+(m<<1<<2)|0,y=p+8|0,S=g[y>>2]|0,C=S+8|0,k=g[C>>2]|0,(k|0)==(p|0)?g[5829]=Et&~(1<>2]=p,g[y>>2]=k),Ft=m<<3,g[S+4>>2]=Ft|3,Ft=S+Ft+4|0,g[Ft>>2]=g[Ft>>2]|1,Ft=C,wt=Ze,Ft|0;if(st=g[5831]|0,et>>>0>st>>>0){if(y|0)return m=2<>>12&16,m=m>>>z,y=m>>>5&8,m=m>>>y,k=m>>>2&4,m=m>>>k,p=m>>>1&2,m=m>>>p,S=m>>>1&1,S=(y|z|k|p|S)+(m>>>S)|0,m=23356+(S<<1<<2)|0,p=m+8|0,k=g[p>>2]|0,z=k+8|0,y=g[z>>2]|0,(y|0)==(m|0)?(p=Et&~(1<>2]=m,g[p>>2]=y,p=Et),Ft=S<<3,L=Ft-et|0,g[k+4>>2]=et|3,C=k+et|0,g[C+4>>2]=L|1,g[k+Ft>>2]=L,st|0&&(S=g[5834]|0,m=st>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=L,g[5834]=C,Ft=z,wt=Ze,Ft|0;if(k=g[5830]|0,k){for(y=(k&0-k)+-1|0,C=y>>>12&16,y=y>>>C,S=y>>>5&8,y=y>>>S,L=y>>>2&4,y=y>>>L,z=y>>>1&2,y=y>>>z,H=y>>>1&1,H=g[23620+((S|C|L|z|H)+(y>>>H)<<2)>>2]|0,y=H,z=H,H=(g[H+4>>2]&-8)-et|0;p=g[y+16>>2]|0,!(!p&&(p=g[y+20>>2]|0,!p));)L=(g[p+4>>2]&-8)-et|0,C=L>>>0>>0,y=p,z=C?p:z,H=C?L:H;if(L=z+et|0,L>>>0>z>>>0){C=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){y=0;break}for(;;)if(S=m+20|0,y=g[S>>2]|0,y)m=y,p=S;else if(S=m+16|0,y=g[S>>2]|0,y)m=y,p=S;else break;g[p>>2]=0,y=m}else y=g[z+8>>2]|0,g[y+12>>2]=m,g[m+8>>2]=y,y=m;while(!1);do if(C|0){if(m=g[z+28>>2]|0,p=23620+(m<<2)|0,(z|0)==(g[p>>2]|0)){if(g[p>>2]=y,!y){g[5830]=k&~(1<>2]|0)==(z|0)?Ft:C+20|0)>>2]=y,!y)break;g[y+24>>2]=C,m=g[z+16>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),m=g[z+20>>2]|0,m|0&&(g[y+20>>2]=m,g[m+24>>2]=y)}while(!1);return H>>>0<16?(Ft=H+et|0,g[z+4>>2]=Ft|3,Ft=z+Ft+4|0,g[Ft>>2]=g[Ft>>2]|1):(g[z+4>>2]=et|3,g[L+4>>2]=H|1,g[L+H>>2]=H,st|0&&(S=g[5834]|0,m=st>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=m|Et,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=H,g[5834]=L),Ft=z+8|0,wt=Ze,Ft|0}else Et=et}else Et=et}else Et=et}else if(p>>>0<=4294967231)if(p=p+11|0,et=p&-8,S=g[5830]|0,S){C=0-et|0,p=p>>>8,p?et>>>0>16777215?H=31:(Et=(p+1048320|0)>>>16&8,se=p<>>16&4,se=se<>>16&2,H=14-(z|Et|H)+(se<>>15)|0,H=et>>>(H+7|0)&1|H<<1):H=0,y=g[23620+(H<<2)>>2]|0;t:do if(!y)y=0,p=0,se=61;else for(p=0,z=et<<((H|0)==31?0:25-(H>>>1)|0),k=0;;){if(L=(g[y+4>>2]&-8)-et|0,L>>>0>>0)if(L)p=y,C=L;else{p=y,C=0,se=65;break t}if(se=g[y+20>>2]|0,y=g[y+16+(z>>>31<<2)>>2]|0,k=(se|0)==0|(se|0)==(y|0)?k:se,y)z=z<<1;else{y=k,se=61;break}}while(!1);if((se|0)==61){if((y|0)==0&(p|0)==0){if(p=2<>>12&16,Et=Et>>>L,k=Et>>>5&8,Et=Et>>>k,z=Et>>>2&4,Et=Et>>>z,H=Et>>>1&2,Et=Et>>>H,y=Et>>>1&1,p=0,y=g[23620+((k|L|z|H|y)+(Et>>>y)<<2)>>2]|0}y?se=65:(z=p,L=C)}if((se|0)==65)for(k=y;;)if(Et=(g[k+4>>2]&-8)-et|0,y=Et>>>0>>0,C=y?Et:C,p=y?k:p,y=g[k+16>>2]|0,y||(y=g[k+20>>2]|0),y)k=y;else{z=p,L=C;break}if(z|0&&L>>>0<((g[5831]|0)-et|0)>>>0&&(st=z+et|0,st>>>0>z>>>0)){k=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){m=0;break}for(;;)if(C=m+20|0,y=g[C>>2]|0,y)m=y,p=C;else if(C=m+16|0,y=g[C>>2]|0,y)m=y,p=C;else break;g[p>>2]=0}else Ft=g[z+8>>2]|0,g[Ft+12>>2]=m,g[m+8>>2]=Ft;while(!1);do if(k){if(p=g[z+28>>2]|0,y=23620+(p<<2)|0,(z|0)==(g[y>>2]|0)){if(g[y>>2]=m,!m){S=S&~(1<>2]|0)==(z|0)?Ft:k+20|0)>>2]=m,!m)break;g[m+24>>2]=k,p=g[z+16>>2]|0,p|0&&(g[m+16>>2]=p,g[p+24>>2]=m),p=g[z+20>>2]|0,p&&(g[m+20>>2]=p,g[p+24>>2]=m)}while(!1);t:do if(L>>>0<16)Ft=L+et|0,g[z+4>>2]=Ft|3,Ft=z+Ft+4|0,g[Ft>>2]=g[Ft>>2]|1;else{if(g[z+4>>2]=et|3,g[st+4>>2]=L|1,g[st+L>>2]=L,m=L>>>3,L>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=st,g[m+12>>2]=st,g[st+8>>2]=m,g[st+12>>2]=y;break}if(m=L>>>8,m?L>>>0>16777215?y=31:(ve=(m+1048320|0)>>>16&8,Ft=m<>>16&4,Ft=Ft<>>16&2,y=14-(Kt|ve|y)+(Ft<>>15)|0,y=L>>>(y+7|0)&1|y<<1):y=0,m=23620+(y<<2)|0,g[st+28>>2]=y,p=st+16|0,g[p+4>>2]=0,g[p>>2]=0,p=1<>2]=st,g[st+24>>2]=m,g[st+12>>2]=st,g[st+8>>2]=st;break}m=g[m>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(L|0)){for(S=L<<((y|0)==31?0:25-(y>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(L|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=st,g[st+24>>2]=m,g[st+12>>2]=st,g[st+8>>2]=st;break t}while(!1);ve=m+8|0,Ft=g[ve>>2]|0,g[Ft+12>>2]=st,g[ve>>2]=st,g[st+8>>2]=Ft,g[st+12>>2]=m,g[st+24>>2]=0}while(!1);return Ft=z+8|0,wt=Ze,Ft|0}else Et=et}else Et=et;else Et=-1;while(!1);if(y=g[5831]|0,y>>>0>=Et>>>0)return m=y-Et|0,p=g[5834]|0,m>>>0>15?(Ft=p+Et|0,g[5834]=Ft,g[5831]=m,g[Ft+4>>2]=m|1,g[p+y>>2]=m,g[p+4>>2]=Et|3):(g[5831]=0,g[5834]=0,g[p+4>>2]=y|3,Ft=p+y+4|0,g[Ft>>2]=g[Ft>>2]|1),Ft=p+8|0,wt=Ze,Ft|0;if(L=g[5832]|0,L>>>0>Et>>>0)return Kt=L-Et|0,g[5832]=Kt,Ft=g[5835]|0,ve=Ft+Et|0,g[5835]=ve,g[ve+4>>2]=Kt|1,g[Ft+4>>2]=Et|3,Ft=Ft+8|0,wt=Ze,Ft|0;if(g[5947]|0?p=g[5949]|0:(g[5949]=4096,g[5948]=4096,g[5950]=-1,g[5951]=-1,g[5952]=0,g[5940]=0,g[5947]=Bt&-16^1431655768,p=4096),z=Et+48|0,H=Et+47|0,k=p+H|0,C=0-p|0,et=k&C,et>>>0<=Et>>>0||(p=g[5939]|0,p|0&&(st=g[5937]|0,Bt=st+et|0,Bt>>>0<=st>>>0|Bt>>>0>p>>>0)))return Ft=0,wt=Ze,Ft|0;t:do if(g[5940]&4)m=0,se=143;else{y=g[5835]|0;e:do if(y){for(S=23764;Bt=g[S>>2]|0,!(Bt>>>0<=y>>>0&&(Bt+(g[S+4>>2]|0)|0)>>>0>y>>>0);)if(p=g[S+8>>2]|0,p)S=p;else{se=128;break e}if(m=k-L&C,m>>>0<2147483647)if(p=dl(m|0)|0,(p|0)==((g[S>>2]|0)+(g[S+4>>2]|0)|0)){if((p|0)!=-1){L=m,k=p,se=145;break t}}else S=p,se=136;else m=0}else se=128;while(!1);do if((se|0)==128)if(y=dl(0)|0,(y|0)!=-1&&(m=y,Gt=g[5948]|0,Qt=Gt+-1|0,m=(Qt&m|0?(Qt+m&0-Gt)-m|0:0)+et|0,Gt=g[5937]|0,Qt=m+Gt|0,m>>>0>Et>>>0&m>>>0<2147483647)){if(Bt=g[5939]|0,Bt|0&&Qt>>>0<=Gt>>>0|Qt>>>0>Bt>>>0){m=0;break}if(p=dl(m|0)|0,(p|0)==(y|0)){L=m,k=y,se=145;break t}else S=p,se=136}else m=0;while(!1);do if((se|0)==136){if(y=0-m|0,!(z>>>0>m>>>0&(m>>>0<2147483647&(S|0)!=-1)))if((S|0)==-1){m=0;break}else{L=m,k=S,se=145;break t}if(p=g[5949]|0,p=H-m+p&0-p,p>>>0>=2147483647){L=m,k=S,se=145;break t}if((dl(p|0)|0)==-1){dl(y|0)|0,m=0;break}else{L=p+m|0,k=S,se=145;break t}}while(!1);g[5940]=g[5940]|4,se=143}while(!1);if((se|0)==143&&et>>>0<2147483647&&(Kt=dl(et|0)|0,Qt=dl(0)|0,Te=Qt-Kt|0,We=Te>>>0>(Et+40|0)>>>0,!((Kt|0)==-1|We^1|Kt>>>0>>0&((Kt|0)!=-1&(Qt|0)!=-1)^1))&&(L=We?Te:m,k=Kt,se=145),(se|0)==145){m=(g[5937]|0)+L|0,g[5937]=m,m>>>0>(g[5938]|0)>>>0&&(g[5938]=m),H=g[5835]|0;t:do if(H){for(m=23764;;){if(p=g[m>>2]|0,y=g[m+4>>2]|0,(k|0)==(p+y|0)){se=154;break}if(S=g[m+8>>2]|0,S)m=S;else break}if((se|0)==154&&(ve=m+4|0,(g[m+12>>2]&8|0)==0)&&k>>>0>H>>>0&p>>>0<=H>>>0){g[ve>>2]=y+L,Ft=(g[5832]|0)+L|0,Kt=H+8|0,Kt=Kt&7|0?0-Kt&7:0,ve=H+Kt|0,Kt=Ft-Kt|0,g[5835]=ve,g[5832]=Kt,g[ve+4>>2]=Kt|1,g[H+Ft+4>>2]=40,g[5836]=g[5951];break}for(k>>>0<(g[5833]|0)>>>0&&(g[5833]=k),y=k+L|0,m=23764;;){if((g[m>>2]|0)==(y|0)){se=162;break}if(p=g[m+8>>2]|0,p)m=p;else break}if((se|0)==162&&!(g[m+12>>2]&8|0)){g[m>>2]=k,st=m+4|0,g[st>>2]=(g[st>>2]|0)+L,st=k+8|0,st=k+(st&7|0?0-st&7:0)|0,m=y+8|0,m=y+(m&7|0?0-m&7:0)|0,et=st+Et|0,z=m-st-Et|0,g[st+4>>2]=Et|3;e:do if((H|0)==(m|0))Ft=(g[5832]|0)+z|0,g[5832]=Ft,g[5835]=et,g[et+4>>2]=Ft|1;else{if((g[5834]|0)==(m|0)){Ft=(g[5831]|0)+z|0,g[5831]=Ft,g[5834]=et,g[et+4>>2]=Ft|1,g[et+Ft>>2]=Ft;break}if(p=g[m+4>>2]|0,(p&3|0)==1){L=p&-8,S=p>>>3;r:do if(p>>>0<256)if(p=g[m+8>>2]|0,y=g[m+12>>2]|0,(y|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=y,g[y+8>>2]=p;break}else{k=g[m+24>>2]|0,p=g[m+12>>2]|0;do if((p|0)==(m|0)){if(y=m+16|0,S=y+4|0,p=g[S>>2]|0,p)y=S;else if(p=g[y>>2]|0,!p){p=0;break}for(;;)if(C=p+20|0,S=g[C>>2]|0,S)p=S,y=C;else if(C=p+16|0,S=g[C>>2]|0,S)p=S,y=C;else break;g[y>>2]=0}else Ft=g[m+8>>2]|0,g[Ft+12>>2]=p,g[p+8>>2]=Ft;while(!1);if(!k)break;y=g[m+28>>2]|0,S=23620+(y<<2)|0;do if((g[S>>2]|0)!=(m|0)){if(Ft=k+16|0,g[((g[Ft>>2]|0)==(m|0)?Ft:k+20|0)>>2]=p,!p)break r}else{if(g[S>>2]=p,p|0)break;g[5830]=g[5830]&~(1<>2]=k,y=m+16|0,S=g[y>>2]|0,S|0&&(g[p+16>>2]=S,g[S+24>>2]=p),y=g[y+4>>2]|0,!y)break;g[p+20>>2]=y,g[y+24>>2]=p}while(!1);m=m+L|0,C=L+z|0}else C=z;if(m=m+4|0,g[m>>2]=g[m>>2]&-2,g[et+4>>2]=C|1,g[et+C>>2]=C,m=C>>>3,C>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=et,g[m+12>>2]=et,g[et+8>>2]=m,g[et+12>>2]=y;break}m=C>>>8;do if(!m)S=0;else{if(C>>>0>16777215){S=31;break}ve=(m+1048320|0)>>>16&8,Ft=m<>>16&4,Ft=Ft<>>16&2,S=14-(Kt|ve|S)+(Ft<>>15)|0,S=C>>>(S+7|0)&1|S<<1}while(!1);if(m=23620+(S<<2)|0,g[et+28>>2]=S,p=et+16|0,g[p+4>>2]=0,g[p>>2]=0,p=g[5830]|0,y=1<>2]=et,g[et+24>>2]=m,g[et+12>>2]=et,g[et+8>>2]=et;break}m=g[m>>2]|0;r:do if((g[m+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(C|0)){m=p;break r}else S=S<<1,m=p;g[y>>2]=et,g[et+24>>2]=m,g[et+12>>2]=et,g[et+8>>2]=et;break e}while(!1);ve=m+8|0,Ft=g[ve>>2]|0,g[Ft+12>>2]=et,g[ve>>2]=et,g[et+8>>2]=Ft,g[et+12>>2]=m,g[et+24>>2]=0}while(!1);return Ft=st+8|0,wt=Ze,Ft|0}for(m=23764;p=g[m>>2]|0,!(p>>>0<=H>>>0&&(Ft=p+(g[m+4>>2]|0)|0,Ft>>>0>H>>>0));)m=g[m+8>>2]|0;C=Ft+-47|0,p=C+8|0,p=C+(p&7|0?0-p&7:0)|0,C=H+16|0,p=p>>>0>>0?H:p,m=p+8|0,y=L+-40|0,Kt=k+8|0,Kt=Kt&7|0?0-Kt&7:0,ve=k+Kt|0,Kt=y-Kt|0,g[5835]=ve,g[5832]=Kt,g[ve+4>>2]=Kt|1,g[k+y+4>>2]=40,g[5836]=g[5951],y=p+4|0,g[y>>2]=27,g[m>>2]=g[5941],g[m+4>>2]=g[5942],g[m+8>>2]=g[5943],g[m+12>>2]=g[5944],g[5941]=k,g[5942]=L,g[5944]=0,g[5943]=m,m=p+24|0;do ve=m,m=m+4|0,g[m>>2]=7;while((ve+8|0)>>>0>>0);if((p|0)!=(H|0)){if(k=p-H|0,g[y>>2]=g[y>>2]&-2,g[H+4>>2]=k|1,g[p>>2]=k,m=k>>>3,k>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=H,g[m+12>>2]=H,g[H+8>>2]=m,g[H+12>>2]=y;break}if(m=k>>>8,m?k>>>0>16777215?S=31:(ve=(m+1048320|0)>>>16&8,Ft=m<>>16&4,Ft=Ft<>>16&2,S=14-(Kt|ve|S)+(Ft<>>15)|0,S=k>>>(S+7|0)&1|S<<1):S=0,y=23620+(S<<2)|0,g[H+28>>2]=S,g[H+20>>2]=0,g[C>>2]=0,m=g[5830]|0,p=1<>2]=H,g[H+24>>2]=y,g[H+12>>2]=H,g[H+8>>2]=H;break}m=g[y>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(k|0)){for(S=k<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(k|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=H,g[H+24>>2]=m,g[H+12>>2]=H,g[H+8>>2]=H;break t}while(!1);ve=m+8|0,Ft=g[ve>>2]|0,g[Ft+12>>2]=H,g[ve>>2]=H,g[H+8>>2]=Ft,g[H+12>>2]=m,g[H+24>>2]=0}}else Ft=g[5833]|0,(Ft|0)==0|k>>>0>>0&&(g[5833]=k),g[5941]=k,g[5942]=L,g[5944]=0,g[5838]=g[5947],g[5837]=-1,g[5842]=23356,g[5841]=23356,g[5844]=23364,g[5843]=23364,g[5846]=23372,g[5845]=23372,g[5848]=23380,g[5847]=23380,g[5850]=23388,g[5849]=23388,g[5852]=23396,g[5851]=23396,g[5854]=23404,g[5853]=23404,g[5856]=23412,g[5855]=23412,g[5858]=23420,g[5857]=23420,g[5860]=23428,g[5859]=23428,g[5862]=23436,g[5861]=23436,g[5864]=23444,g[5863]=23444,g[5866]=23452,g[5865]=23452,g[5868]=23460,g[5867]=23460,g[5870]=23468,g[5869]=23468,g[5872]=23476,g[5871]=23476,g[5874]=23484,g[5873]=23484,g[5876]=23492,g[5875]=23492,g[5878]=23500,g[5877]=23500,g[5880]=23508,g[5879]=23508,g[5882]=23516,g[5881]=23516,g[5884]=23524,g[5883]=23524,g[5886]=23532,g[5885]=23532,g[5888]=23540,g[5887]=23540,g[5890]=23548,g[5889]=23548,g[5892]=23556,g[5891]=23556,g[5894]=23564,g[5893]=23564,g[5896]=23572,g[5895]=23572,g[5898]=23580,g[5897]=23580,g[5900]=23588,g[5899]=23588,g[5902]=23596,g[5901]=23596,g[5904]=23604,g[5903]=23604,Ft=L+-40|0,Kt=k+8|0,Kt=Kt&7|0?0-Kt&7:0,ve=k+Kt|0,Kt=Ft-Kt|0,g[5835]=ve,g[5832]=Kt,g[ve+4>>2]=Kt|1,g[k+Ft+4>>2]=40,g[5836]=g[5951];while(!1);if(m=g[5832]|0,m>>>0>Et>>>0)return Kt=m-Et|0,g[5832]=Kt,Ft=g[5835]|0,ve=Ft+Et|0,g[5835]=ve,g[ve+4>>2]=Kt|1,g[Ft+4>>2]=Et|3,Ft=Ft+8|0,wt=Ze,Ft|0}return Ft=hs()|0,g[Ft>>2]=12,Ft=0,wt=Ze,Ft|0}function Ke(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(p){y=p+-8|0,C=g[5833]|0,p=g[p+-4>>2]|0,m=p&-8,H=y+m|0;do if(p&1)z=y,L=y;else{if(S=g[y>>2]|0,!(p&3)||(L=y+(0-S)|0,k=S+m|0,L>>>0>>0))return;if((g[5834]|0)==(L|0)){if(p=H+4|0,m=g[p>>2]|0,(m&3|0)!=3){z=L,m=k;break}g[5831]=k,g[p>>2]=m&-2,g[L+4>>2]=k|1,g[L+k>>2]=k;return}if(y=S>>>3,S>>>0<256)if(p=g[L+8>>2]|0,m=g[L+12>>2]|0,(m|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=m,g[m+8>>2]=p,z=L,m=k;break}C=g[L+24>>2]|0,p=g[L+12>>2]|0;do if((p|0)==(L|0)){if(m=L+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){p=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0}else z=g[L+8>>2]|0,g[z+12>>2]=p,g[p+8>>2]=z;while(!1);if(C){if(m=g[L+28>>2]|0,y=23620+(m<<2)|0,(g[y>>2]|0)==(L|0)){if(g[y>>2]=p,!p){g[5830]=g[5830]&~(1<>2]|0)==(L|0)?z:C+20|0)>>2]=p,!p){z=L,m=k;break}g[p+24>>2]=C,m=L+16|0,y=g[m>>2]|0,y|0&&(g[p+16>>2]=y,g[y+24>>2]=p),m=g[m+4>>2]|0,m?(g[p+20>>2]=m,g[m+24>>2]=p,z=L,m=k):(z=L,m=k)}else z=L,m=k}while(!1);if(!(L>>>0>=H>>>0)&&(p=H+4|0,S=g[p>>2]|0,!!(S&1))){if(S&2)g[p>>2]=S&-2,g[z+4>>2]=m|1,g[L+m>>2]=m,C=m;else{if((g[5835]|0)==(H|0)){if(H=(g[5832]|0)+m|0,g[5832]=H,g[5835]=z,g[z+4>>2]=H|1,(z|0)!=(g[5834]|0))return;g[5834]=0,g[5831]=0;return}if((g[5834]|0)==(H|0)){H=(g[5831]|0)+m|0,g[5831]=H,g[5834]=L,g[z+4>>2]=H|1,g[L+H>>2]=H;return}C=(S&-8)+m|0,y=S>>>3;do if(S>>>0<256)if(m=g[H+8>>2]|0,p=g[H+12>>2]|0,(p|0)==(m|0)){g[5829]=g[5829]&~(1<>2]=p,g[p+8>>2]=m;break}else{k=g[H+24>>2]|0,p=g[H+12>>2]|0;do if((p|0)==(H|0)){if(m=H+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){y=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0,y=p}else y=g[H+8>>2]|0,g[y+12>>2]=p,g[p+8>>2]=y,y=p;while(!1);if(k|0){if(p=g[H+28>>2]|0,m=23620+(p<<2)|0,(g[m>>2]|0)==(H|0)){if(g[m>>2]=y,!y){g[5830]=g[5830]&~(1<>2]|0)==(H|0)?S:k+20|0)>>2]=y,!y)break;g[y+24>>2]=k,p=H+16|0,m=g[p>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),p=g[p+4>>2]|0,p|0&&(g[y+20>>2]=p,g[p+24>>2]=y)}}while(!1);if(g[z+4>>2]=C|1,g[L+C>>2]=C,(z|0)==(g[5834]|0)){g[5831]=C;return}}if(p=C>>>3,C>>>0<256){y=23356+(p<<1<<2)|0,m=g[5829]|0,p=1<>2]|0):(g[5829]=m|p,p=y,m=y+8|0),g[m>>2]=z,g[p+12>>2]=z,g[z+8>>2]=p,g[z+12>>2]=y;return}p=C>>>8,p?C>>>0>16777215?S=31:(L=(p+1048320|0)>>>16&8,H=p<>>16&4,H=H<>>16&2,S=14-(k|L|S)+(H<>>15)|0,S=C>>>(S+7|0)&1|S<<1):S=0,p=23620+(S<<2)|0,g[z+28>>2]=S,g[z+20>>2]=0,g[z+16>>2]=0,m=g[5830]|0,y=1<>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;else{p=g[p>>2]|0;e:do if((g[p+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=p+16+(S>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(C|0)){p=m;break e}else S=S<<1,p=m;g[y>>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;break t}while(!1);L=p+8|0,H=g[L>>2]|0,g[H+12>>2]=z,g[L>>2]=z,g[z+8>>2]=H,g[z+12>>2]=p,g[z+24>>2]=0}while(!1);if(H=(g[5837]|0)+-1|0,g[5837]=H,!(H|0)){for(p=23772;p=g[p>>2]|0,p;)p=p+8|0;g[5837]=-1}}}}function Fi(p,m){p=p|0,m=m|0;var y=0;return p?(y=za(m,p)|0,(m|p)>>>0>65535&&(y=((y>>>0)/(p>>>0)|0|0)==(m|0)?y:-1)):y=0,p=pn(y)|0,!p||!(g[p+-4>>2]&3)||da(p|0,0,y|0)|0,p|0}function Ls(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,y=p+y>>>0,Tr(m+S+(y>>>0

>>0|0)>>>0|0),y|0|0}function Pn(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,S=m-S-(y>>>0>p>>>0|0)>>>0,Tr(S|0),p-y>>>0|0|0}function a0(p){return p=p|0,(p?31-(pu(p^p-1)|0)|0:32)|0}function Fn(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,et=0,st=0,Et=0,Bt=0,Gt=0,Qt=0;if(st=p,H=m,et=H,L=y,Bt=S,z=Bt,!et)return k=(C|0)!=0,z?k?(g[C>>2]=p|0,g[C+4>>2]=m&0,Bt=0,C=0,Tr(Bt|0),C|0):(Bt=0,C=0,Tr(Bt|0),C|0):(k&&(g[C>>2]=(st>>>0)%(L>>>0),g[C+4>>2]=0),Bt=0,C=(st>>>0)/(L>>>0)>>>0,Tr(Bt|0),C|0);k=(z|0)==0;do if(L){if(!k){if(k=(pu(z|0)|0)-(pu(et|0)|0)|0,k>>>0<=31){Et=k+1|0,z=31-k|0,m=k-31>>31,L=Et,p=st>>>(Et>>>0)&m|et<>>(Et>>>0)&m,k=0,z=st<>2]=p|0,g[C+4>>2]=H|m&0,Bt=0,C=0,Tr(Bt|0),C|0):(Bt=0,C=0,Tr(Bt|0),C|0)}if(k=L-1|0,k&L|0){z=(pu(L|0)|0)+33-(pu(et|0)|0)|0,Qt=64-z|0,Et=32-z|0,H=Et>>31,Gt=z-32|0,m=Gt>>31,L=z,p=Et-1>>31&et>>>(Gt>>>0)|(et<>>(z>>>0))&m,m=m&et>>>(z>>>0),k=st<>>(Gt>>>0))&H|st<>31;break}return C|0&&(g[C>>2]=k&st,g[C+4>>2]=0),(L|0)==1?(Gt=H|m&0,Qt=p|0|0,Tr(Gt|0),Qt|0):(Qt=a0(L|0)|0,Gt=et>>>(Qt>>>0)|0,Qt=et<<32-Qt|st>>>(Qt>>>0)|0,Tr(Gt|0),Qt|0)}else{if(k)return C|0&&(g[C>>2]=(et>>>0)%(L>>>0),g[C+4>>2]=0),Gt=0,Qt=(et>>>0)/(L>>>0)>>>0,Tr(Gt|0),Qt|0;if(!st)return C|0&&(g[C>>2]=0,g[C+4>>2]=(et>>>0)%(z>>>0)),Gt=0,Qt=(et>>>0)/(z>>>0)>>>0,Tr(Gt|0),Qt|0;if(k=z-1|0,!(k&z))return C|0&&(g[C>>2]=p|0,g[C+4>>2]=k&et|m&0),Gt=0,Qt=et>>>((a0(z|0)|0)>>>0),Tr(Gt|0),Qt|0;if(k=(pu(z|0)|0)-(pu(et|0)|0)|0,k>>>0<=30){m=k+1|0,z=31-k|0,L=m,p=et<>>(m>>>0),m=et>>>(m>>>0),k=0,z=st<>2]=p|0,g[C+4>>2]=H|m&0,Gt=0,Qt=0,Tr(Gt|0),Qt|0):(Gt=0,Qt=0,Tr(Gt|0),Qt|0)}while(!1);if(!L)et=z,H=0,z=0;else{Et=y|0|0,st=Bt|S&0,et=Ls(Et|0,st|0,-1,-1)|0,y=Pt()|0,H=z,z=0;do S=H,H=k>>>31|H<<1,k=z|k<<1,S=p<<1|S>>>31|0,Bt=p>>>31|m<<1|0,Pn(et|0,y|0,S|0,Bt|0)|0,Qt=Pt()|0,Gt=Qt>>31|((Qt|0)<0?-1:0)<<1,z=Gt&1,p=Pn(S|0,Bt|0,Gt&Et|0,(((Qt|0)<0?-1:0)>>31|((Qt|0)<0?-1:0)<<1)&st|0)|0,m=Pt()|0,L=L-1|0;while(L|0);et=H,H=0}return L=0,C|0&&(g[C>>2]=p,g[C+4>>2]=m),Gt=(k|0)>>>31|(et|L)<<1|(L<<1|k>>>31)&0|H,Qt=(k<<1|0)&-2|z,Tr(Gt|0),Qt|0}function Vl(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return k=wt,wt=wt+16|0,C=k|0,Fn(p,m,y,S,C)|0,wt=k,Tr(g[C+4>>2]|0),g[C>>2]|0|0}function xe(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Tr(m>>>y|0),p>>>y|(m&(1<>>y-32|0)}function Oe(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Tr(m<>>32-y|0),p<=0?+ao(p+.5):+oi(p-.5)}function Ah(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if((y|0)>=8192)return rn(p|0,m|0,y|0)|0,p|0;if(k=p|0,C=p+y|0,(p&3)==(m&3)){for(;p&3;){if(!y)return k|0;vr[p>>0]=vr[m>>0]|0,p=p+1|0,m=m+1|0,y=y-1|0}for(y=C&-4|0,S=y-64|0;(p|0)<=(S|0);)g[p>>2]=g[m>>2],g[p+4>>2]=g[m+4>>2],g[p+8>>2]=g[m+8>>2],g[p+12>>2]=g[m+12>>2],g[p+16>>2]=g[m+16>>2],g[p+20>>2]=g[m+20>>2],g[p+24>>2]=g[m+24>>2],g[p+28>>2]=g[m+28>>2],g[p+32>>2]=g[m+32>>2],g[p+36>>2]=g[m+36>>2],g[p+40>>2]=g[m+40>>2],g[p+44>>2]=g[m+44>>2],g[p+48>>2]=g[m+48>>2],g[p+52>>2]=g[m+52>>2],g[p+56>>2]=g[m+56>>2],g[p+60>>2]=g[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(y|0);)g[p>>2]=g[m>>2],p=p+4|0,m=m+4|0}else for(y=C-4|0;(p|0)<(y|0);)vr[p>>0]=vr[m>>0]|0,vr[p+1>>0]=vr[m+1>>0]|0,vr[p+2>>0]=vr[m+2>>0]|0,vr[p+3>>0]=vr[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(C|0);)vr[p>>0]=vr[m>>0]|0,p=p+1|0,m=m+1|0;return k|0}function da(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=p+y|0,m=m&255,(y|0)>=67){for(;p&3;)vr[p>>0]=m,p=p+1|0;for(S=k&-4|0,L=m|m<<8|m<<16|m<<24,C=S-64|0;(p|0)<=(C|0);)g[p>>2]=L,g[p+4>>2]=L,g[p+8>>2]=L,g[p+12>>2]=L,g[p+16>>2]=L,g[p+20>>2]=L,g[p+24>>2]=L,g[p+28>>2]=L,g[p+32>>2]=L,g[p+36>>2]=L,g[p+40>>2]=L,g[p+44>>2]=L,g[p+48>>2]=L,g[p+52>>2]=L,g[p+56>>2]=L,g[p+60>>2]=L,p=p+64|0;for(;(p|0)<(S|0);)g[p>>2]=L,p=p+4|0}for(;(p|0)<(k|0);)vr[p>>0]=m,p=p+1|0;return k-y|0}function l0(p){return p=+p,p>=0?+ao(p+.5):+oi(p-.5)}function dl(p){p=p|0;var m=0,y=0,S=0;return S=qm()|0,y=g[Es>>2]|0,m=y+p|0,(p|0)>0&(m|0)<(y|0)|(m|0)<0?(hh(m|0)|0,ai(12),-1):(m|0)>(S|0)&&!(Ui(m|0)|0)?(ai(12),-1):(g[Es>>2]=m,y|0)}return{___uremdi3:Vl,_bitshift64Lshr:xe,_bitshift64Shl:Oe,_calloc:Fi,_cellAreaKm2:So,_cellAreaM2:r0,_cellAreaRads2:e0,_compact:Lf,_destroyLinkedPolygon:at,_edgeLengthKm:Xe,_edgeLengthM:dr,_emscripten_replace_memory:Zm,_exactEdgeLengthKm:Ex,_exactEdgeLengthM:Dd,_exactEdgeLengthRads:ul,_experimentalH3ToLocalIj:kt,_experimentalLocalIjToH3:Wt,_free:Ke,_geoToH3:aA,_getDestinationH3IndexFromUnidirectionalEdge:M,_getH3IndexesFromUnidirectionalEdge:F,_getH3UnidirectionalEdge:v,_getH3UnidirectionalEdgeBoundary:W,_getH3UnidirectionalEdgesFromHexagon:U,_getOriginH3IndexFromUnidirectionalEdge:b,_getPentagonIndexes:l,_getRes0Indexes:Qm,_h3Distance:St,_h3GetBaseCell:On,_h3GetFaces:cA,_h3GetResolution:Mn,_h3IndexesAreNeighbors:f,_h3IsPentagon:Zn,_h3IsResClassIII:Dc,_h3IsValid:i0,_h3Line:Zt,_h3LineSize:Nt,_h3SetToLinkedGeo:Tn,_h3ToCenterChild:n0,_h3ToChildren:co,_h3ToGeo:Oc,_h3ToGeoBoundary:Bc,_h3ToParent:Ua,_h3UnidirectionalEdgeIsValid:O,_hexAreaKm2:cl,_hexAreaM2:Rd,_hexRing:t_,_i64Subtract:Pn,_kRing:Id,_kRingDistances:Jg,_llvm_minnum_f64:Su,_llvm_round_f64:Va,_malloc:pn,_maxFaceCount:lA,_maxH3ToChildrenSize:oA,_maxKringSize:Kg,_maxPolyfillSize:e_,_maxUncompactSize:o0,_memcpy:Ah,_memset:da,_numHexagons:Cf,_pentagonIndexCount:T,_pointDistKm:If,_pointDistM:c_,_pointDistRads:sA,_polyfill:Kp,_res0IndexCount:$m,_round:l0,_sbrk:dl,_sizeOfCoordIJ:ti,_sizeOfGeoBoundary:Ee,_sizeOfGeoCoord:hr,_sizeOfGeoPolygon:qe,_sizeOfGeofence:lr,_sizeOfH3Index:Ve,_sizeOfLinkedGeoPolygon:nn,_uncompact:s0,establishStackSpace:Xp,stackAlloc:Xg,stackRestore:Qp,stackSave:$p}}(Dt,Ut,cr),jt=t.___uremdi3=ft.___uremdi3,le=t._bitshift64Lshr=ft._bitshift64Lshr,ee=t._bitshift64Shl=ft._bitshift64Shl,re=t._calloc=ft._calloc,tr=t._cellAreaKm2=ft._cellAreaKm2,nr=t._cellAreaM2=ft._cellAreaM2,Rr=t._cellAreaRads2=ft._cellAreaRads2,yr=t._compact=ft._compact,ni=t._destroyLinkedPolygon=ft._destroyLinkedPolygon,Ti=t._edgeLengthKm=ft._edgeLengthKm,Hi=t._edgeLengthM=ft._edgeLengthM,wn=t._emscripten_replace_memory=ft._emscripten_replace_memory,Dr=t._exactEdgeLengthKm=ft._exactEdgeLengthKm,tn=t._exactEdgeLengthM=ft._exactEdgeLengthM,en=t._exactEdgeLengthRads=ft._exactEdgeLengthRads,rs=t._experimentalH3ToLocalIj=ft._experimentalH3ToLocalIj,us=t._experimentalLocalIjToH3=ft._experimentalLocalIjToH3,kn=t._free=ft._free,ca=t._geoToH3=ft._geoToH3,zm=t._getDestinationH3IndexFromUnidirectionalEdge=ft._getDestinationH3IndexFromUnidirectionalEdge,Qg=t._getH3IndexesFromUnidirectionalEdge=ft._getH3IndexesFromUnidirectionalEdge,gi=t._getH3UnidirectionalEdge=ft._getH3UnidirectionalEdge,bo=t._getH3UnidirectionalEdgeBoundary=ft._getH3UnidirectionalEdgeBoundary,Pc=t._getH3UnidirectionalEdgesFromHexagon=ft._getH3UnidirectionalEdgesFromHexagon,Wn=t._getOriginH3IndexFromUnidirectionalEdge=ft._getOriginH3IndexFromUnidirectionalEdge,Sn=t._getPentagonIndexes=ft._getPentagonIndexes,Bl=t._getRes0Indexes=ft._getRes0Indexes,Rn=t._h3Distance=ft._h3Distance,Hn=t._h3GetBaseCell=ft._h3GetBaseCell,du=t._h3GetFaces=ft._h3GetFaces,df=t._h3GetResolution=ft._h3GetResolution,fn=t._h3IndexesAreNeighbors=ft._h3IndexesAreNeighbors,so=t._h3IsPentagon=ft._h3IsPentagon,Da=t._h3IsResClassIII=ft._h3IsResClassIII,qi=t._h3IsValid=ft._h3IsValid,ch=t._h3Line=ft._h3Line,oo=t._h3LineSize=ft._h3LineSize,uh=t._h3SetToLinkedGeo=ft._h3SetToLinkedGeo,Zo=t._h3ToCenterChild=ft._h3ToCenterChild,ua=t._h3ToChildren=ft._h3ToChildren,Mi=t._h3ToGeo=ft._h3ToGeo,pf=t._h3ToGeoBoundary=ft._h3ToGeoBoundary,Ic=t._h3ToParent=ft._h3ToParent,Fl=t._h3UnidirectionalEdgeIsValid=ft._h3UnidirectionalEdgeIsValid,Td=t._hexAreaKm2=ft._hexAreaKm2,Af=t._hexAreaM2=ft._hexAreaM2,ut=t._hexRing=ft._hexRing,dt=t._i64Subtract=ft._i64Subtract,Ct=t._kRing=ft._kRing,$t=t._kRingDistances=ft._kRingDistances,ge=t._llvm_minnum_f64=ft._llvm_minnum_f64,Ye=t._llvm_round_f64=ft._llvm_round_f64,si=t._malloc=ft._malloc,is=t._maxFaceCount=ft._maxFaceCount,qn=t._maxH3ToChildrenSize=ft._maxH3ToChildrenSize,Ns=t._maxKringSize=ft._maxKringSize,Oa=t._maxPolyfillSize=ft._maxPolyfillSize,Nm=t._maxUncompactSize=ft._maxUncompactSize,wx=t._memcpy=ft._memcpy,mf=t._memset=ft._memset,Um=t._numHexagons=ft._numHexagons,Ba=t._pentagonIndexCount=ft._pentagonIndexCount,Up=t._pointDistKm=ft._pointDistKm,Vm=t._pointDistM=ft._pointDistM,Vp=t._pointDistRads=ft._pointDistRads,jp=t._polyfill=ft._polyfill,Gp=t._res0IndexCount=ft._res0IndexCount,Wp=t._round=ft._round,kS=t._sbrk=ft._sbrk,RS=t._sizeOfCoordIJ=ft._sizeOfCoordIJ,Sx=t._sizeOfGeoBoundary=ft._sizeOfGeoBoundary,DS=t._sizeOfGeoCoord=ft._sizeOfGeoCoord,gf=t._sizeOfGeoPolygon=ft._sizeOfGeoPolygon,jm=t._sizeOfGeofence=ft._sizeOfGeofence,Yo=t._sizeOfH3Index=ft._sizeOfH3Index,wo=t._sizeOfLinkedGeoPolygon=ft._sizeOfLinkedGeoPolygon,yi=t._uncompact=ft._uncompact,Gm=t.establishStackSpace=ft.establishStackSpace,Md=t.stackAlloc=ft.stackAlloc,Wm=t.stackRestore=ft.stackRestore,Hm=t.stackSave=ft.stackSave;if(t.asm=ft,t.cwrap=ht,t.setValue=j,t.getValue=Y,t.getTempRet0=R,Ms){qo(Ms)||(Ms=o(Ms));{Mc(\"memory initializer\");var _f=function(qt){qt.byteLength&&(qt=new Uint8Array(qt)),hn.set(qt,N),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,ff(\"memory initializer\")},Hp=function(){c(Ms,_f,function(){throw\"could not load memory initializer \"+Ms})},qp=Rt(Ms);if(qp)_f(qp.buffer);else if(t.memoryInitializerRequest){var Ed=function(){var qt=t.memoryInitializerRequest,de=qt.response;if(qt.status!==200&&qt.status!==0){var Re=Rt(t.memoryInitializerRequestURL);if(Re)de=Re.buffer;else{console.warn(\"a problem seems to have happened with Module.memoryInitializerRequest, status: \"+qt.status+\", retrying \"+Ms),Hp();return}}_f(de)};t.memoryInitializerRequest.response?setTimeout(Ed,0):t.memoryInitializerRequest.addEventListener(\"load\",Ed)}else Hp()}}var Pd;La=function qt(){Pd||Zp(),Pd||(La=qt)};function Zp(qt){if(qt=qt||n,Ho>0||(Go(),Ho>0))return;function de(){Pd||(Pd=!0,!it&&(Wo(),ln(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),la()))}t.setStatus?(t.setStatus(\"Running...\"),setTimeout(function(){setTimeout(function(){t.setStatus(\"\")},1),de()},1)):de()}t.run=Zp;function Fa(qt){throw t.onAbort&&t.onAbort(qt),qt+=\"\",d(qt),_(qt),it=!0,\"abort(\"+qt+\"). Build with -s ASSERTIONS=1 for more info.\"}if(t.abort=Fa,t.preInit)for(typeof t.preInit==\"function\"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Zp(),e}(typeof bc==\"object\"?bc:{}),wr=\"number\",uS=wr,Zr=wr,fi=wr,xc=wr,Oi=wr,s_t=[[\"sizeOfH3Index\",wr],[\"sizeOfGeoCoord\",wr],[\"sizeOfGeoBoundary\",wr],[\"sizeOfGeoPolygon\",wr],[\"sizeOfGeofence\",wr],[\"sizeOfLinkedGeoPolygon\",wr],[\"sizeOfCoordIJ\",wr],[\"h3IsValid\",uS,[Zr,fi]],[\"geoToH3\",Zr,[wr,wr,xc]],[\"h3ToGeo\",null,[Zr,fi,Oi]],[\"h3ToGeoBoundary\",null,[Zr,fi,Oi]],[\"maxKringSize\",wr,[wr]],[\"kRing\",null,[Zr,fi,wr,Oi]],[\"kRingDistances\",null,[Zr,fi,wr,Oi,Oi]],[\"hexRing\",null,[Zr,fi,wr,Oi]],[\"maxPolyfillSize\",wr,[Oi,xc]],[\"polyfill\",null,[Oi,xc,Oi]],[\"h3SetToLinkedGeo\",null,[Oi,wr,Oi]],[\"destroyLinkedPolygon\",null,[Oi]],[\"compact\",wr,[Oi,Oi,wr]],[\"uncompact\",wr,[Oi,wr,Oi,wr,xc]],[\"maxUncompactSize\",wr,[Oi,wr,xc]],[\"h3IsPentagon\",uS,[Zr,fi]],[\"h3IsResClassIII\",uS,[Zr,fi]],[\"h3GetBaseCell\",wr,[Zr,fi]],[\"h3GetResolution\",wr,[Zr,fi]],[\"maxFaceCount\",wr,[Zr,fi]],[\"h3GetFaces\",null,[Zr,fi,Oi]],[\"h3ToParent\",Zr,[Zr,fi,xc]],[\"h3ToChildren\",null,[Zr,fi,xc,Oi]],[\"h3ToCenterChild\",Zr,[Zr,fi,xc]],[\"maxH3ToChildrenSize\",wr,[Zr,fi,xc]],[\"h3IndexesAreNeighbors\",uS,[Zr,fi,Zr,fi]],[\"getH3UnidirectionalEdge\",Zr,[Zr,fi,Zr,fi]],[\"getOriginH3IndexFromUnidirectionalEdge\",Zr,[Zr,fi]],[\"getDestinationH3IndexFromUnidirectionalEdge\",Zr,[Zr,fi]],[\"h3UnidirectionalEdgeIsValid\",uS,[Zr,fi]],[\"getH3IndexesFromUnidirectionalEdge\",null,[Zr,fi,Oi]],[\"getH3UnidirectionalEdgesFromHexagon\",null,[Zr,fi,Oi]],[\"getH3UnidirectionalEdgeBoundary\",null,[Zr,fi,Oi]],[\"h3Distance\",wr,[Zr,fi,Zr,fi]],[\"h3Line\",wr,[Zr,fi,Zr,fi,Oi]],[\"h3LineSize\",wr,[Zr,fi,Zr,fi]],[\"experimentalH3ToLocalIj\",wr,[Zr,fi,Zr,fi,Oi]],[\"experimentalLocalIjToH3\",wr,[Zr,fi,Oi,Oi]],[\"hexAreaM2\",wr,[xc]],[\"hexAreaKm2\",wr,[xc]],[\"edgeLengthM\",wr,[xc]],[\"edgeLengthKm\",wr,[xc]],[\"pointDistM\",wr,[Oi,Oi]],[\"pointDistKm\",wr,[Oi,Oi]],[\"pointDistRads\",wr,[Oi,Oi]],[\"cellAreaM2\",wr,[Zr,fi]],[\"cellAreaKm2\",wr,[Zr,fi]],[\"cellAreaRads2\",wr,[Zr,fi]],[\"exactEdgeLengthM\",wr,[Zr,fi]],[\"exactEdgeLengthKm\",wr,[Zr,fi]],[\"exactEdgeLengthRads\",wr,[Zr,fi]],[\"numHexagons\",wr,[xc]],[\"getRes0Indexes\",null,[Oi]],[\"res0IndexCount\",wr],[\"getPentagonIndexes\",null,[wr,Oi]],[\"pentagonIndexCount\",wr]],Pa={};s_t.forEach(function(t){Pa[t[0]]=bc.cwrap.apply(bc,t)});var ax=16;var hS=8,dse=Pa.sizeOfH3Index(),KY=Pa.sizeOfGeoCoord(),o_t=Pa.sizeOfGeoBoundary(),pse=Pa.sizeOfGeoPolygon(),Ase=Pa.sizeOfGeofence(),mse=Pa.sizeOfLinkedGeoPolygon(),gse=Pa.sizeOfCoordIJ(),QY={m:\"m\",m2:\"m2\",km:\"km\",km2:\"km2\",rads:\"rads\",rads2:\"rads2\"};function a_t(e){if(typeof e!=\"number\"||e<0||e>15||Math.floor(e)!==e)throw new Error(\"Invalid resolution: \"+e)}var l_t=/[^0-9a-fA-F]/;function lx(e){if(Array.isArray(e)&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1]))return e;if(typeof e!=\"string\"||l_t.test(e))return[0,0];var t=parseInt(e.substring(0,e.length-8),ax),r=parseInt(e.substring(e.length-8),ax);return[r,t]}function XY(e){if(e>=0)return e.toString(ax);e=e&2147483647;var t=JY(8,e.toString(ax)),r=(parseInt(t[0],ax)+8).toString(ax);return t=r+t.substring(1),t}function c_t(e,t){return XY(t)+JY(8,XY(e))}function JY(e,t){for(var r=e-t.length,i=\"\",n=0;n180?r[0]-=360:i<-180&&(r[0]+=360)}}function g_t(e,t,r){let[i,n]=_I(e),s=t.length;l$(t,n);let o=t[0]===t[s-1]?s-1:s;for(let c=0;ce.hexagon},extruded:!0},Op=class e extends $i{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){e._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:r}){if(t.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let i=this._calculateH3DataProps();this.setState(i)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,r=!1,i=!1,{iterable:n,objectInfo:s}=Jc(this.props.data);for(let o of n){s.index++;let c=this.props.getHexagon(o,s),d=r$(c);if(t<0){if(t=d,!this.props.highPrecision)break}else if(t!==d){i=!0;break}if(e$(c)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?o$(t,\"km\"):0,hasMultipleRes:i,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision===\"auto\"){let{resolution:t,hasPentagon:r,hasMultipleRes:i}=this.state,{viewport:n}=this.context;return!!n?.resolution||i||r||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:i,centerHex:n}=this.state;if(r<0)return;let s=this.props.centerHexagon||i$(t.latitude,t.longitude,r);if(n===s)return;if(n){let R=s$(n,s);if(R>=0&&R*i{let N=t.projectFlat(R);return[(N[0]-w)/o[0],(N[1]-I)/o[1]]}),this.setState({centerHex:s,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:i,extruded:n,wireframe:s,stroked:o,filled:c,lineWidthUnits:d,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,getFillColor:R,getElevation:N,getLineColor:j,getLineWidth:Y,transitions:it,updateTriggers:Z}=this.props;return{elevationScale:t,extruded:n,coverage:i,wireframe:s,stroked:o,filled:c,lineWidthUnits:d,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,material:r,getElevation:N,getFillColor:R,getLineColor:j,getLineWidth:Y,transitions:it,updateTriggers:{getFillColor:Z.getFillColor,getElevation:Z.getElevation,getLineColor:Z.getLineColor,getLineWidth:Z.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:r,updateTriggers:i,coverage:n}=this.props,s=this.getSubLayerClass(\"hexagon-cell-hifi\",sf),o=this._getForwardProps();return o.updateTriggers.getPolygon=v_t(i.getHexagon,n),new s(o,this.getSubLayerProps({id:\"hexagon-cell-hifi\",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:\"CCW\",positionFormat:\"XY\",getPolygon:(c,d)=>{let _=r(c,d);return y_t(a$(_,n))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:i}=this.props,n=this.getSubLayerClass(\"hexagon-cell\",nf),s=this._getForwardProps();return s.updateTriggers.getPosition=i.getHexagon,new n(s,this.getSubLayerProps({id:\"hexagon-cell\",flatShading:!0,updateTriggers:s.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:__t.bind(null,r)})}};G(Op,\"defaultProps\",x_t);G(Op,\"layerName\",\"H3HexagonLayer\");G(Op,\"_checkH3Lib\",()=>{});var{data:kse,getHexagon:Rse,...b_t}=Op.defaultProps,w_t={_validate:!0},Dse={...b_t,...w_t};var c$=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function u$(e,t=!1,r=Float32Array){let i;if(Number.isFinite(e[0]))i=new r(e);else{i=new r(e.length*4);let n=0;for(let s=0;sc[0]),r=e.map(c=>c[1]),i=Math.min.apply(null,t),n=Math.max.apply(null,t),s=Math.min.apply(null,r),o=Math.max.apply(null,r);return[i,s,n,o]}function p$(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var f$=new Float32Array(12);function DB(e,t=2){let r=0;for(let i of e)for(let n=0;n 0.) {\n maxValue = colorDomain[1];\n minValue = colorDomain[0];\n }\n vIntensityMax = intensity / maxValue;\n vIntensityMin = intensity / minValue;\n}\n`;var y$=`#define SHADER_NAME triangle-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D texture;\nuniform sampler2D colorTexture;\nuniform float aggregationMode;\n\nvarying vec2 vTexCoords;\nvarying float vIntensityMin;\nvarying float vIntensityMax;\n\nvec4 getLinearColor(float value) {\n float factor = clamp(value * vIntensityMax, 0., 1.);\n vec4 color = texture2D(colorTexture, vec2(factor, 0.5));\n color.a *= min(value * vIntensityMin, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 weights = texture2D(texture, vTexCoords);\n float weight = weights.r;\n\n if (aggregationMode > 0.5) {\n weight /= max(1.0, weights.a);\n }\n if (weight <= 0.) {\n discard;\n }\n\n vec4 linearColor = getLinearColor(weight);\n linearColor.a *= opacity;\n gl_FragColor =linearColor;\n}\n`;var ux=class extends yn{getShaders(){return{vs:_$,fs:y$,modules:[ho]}}initializeState({gl:t}){this.getAttributeManager().add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:r}=this.props;return new _n(t,{...this.getShaders(),id:this.props.id,geometry:new ms({drawMode:6,vertexCount:r})})}draw({uniforms:t}){let{model:r}=this.state,{texture:i,maxTexture:n,colorTexture:s,intensity:o,threshold:c,aggregationMode:d,colorDomain:_}=this.props;r.setUniforms({...t,texture:i,maxTexture:n,colorTexture:s,intensity:o,threshold:c,aggregationMode:d,colorDomain:_}).draw()}};G(ux,\"layerName\",\"TriangleLayer\");var v$=`attribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float weights;\nvarying vec4 weightsTexture;\nuniform float radiusPixels;\nuniform float textureWidth;\nuniform vec4 commonBounds;\nuniform float weightsScale;\nvoid main()\n{\n weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);\n\n float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);\n gl_PointSize = radiusTexels * 2.;\n\n vec3 commonPosition = project_position(positions, positions64Low);\n gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;\n gl_Position.xy = (gl_Position.xy * 2.) - (1.);\n}\n`;var x$=`varying vec4 weightsTexture;\nfloat gaussianKDE(float u){\n return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);\n}\nvoid main()\n{\n float dist = length(gl_PointCoord - vec2(0.5, 0.5));\n if (dist > 0.5) {\n discard;\n }\n gl_FragColor = weightsTexture * gaussianKDE(2. * dist);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var b$=`attribute vec4 inTexture;\nvarying vec4 outTexture;\n\nvoid main()\n{\noutTexture = inTexture;\ngl_Position = vec4(0, 0, 0, 1.);\ngl_PointSize = 1.0;\n}\n`;var w$=`varying vec4 outTexture;\nvoid main() {\n gl_FragColor = outTexture;\n gl_FragColor.g = outTexture.r / max(1.0, outTexture.a);\n}\n`;var T_t=2,OB={mipmaps:!1,parameters:{10240:9729,10241:9729,10242:33071,10243:33071},dataFormat:6408},S$=[0,0],M_t={SUM:0,MEAN:1},E_t={getPosition:{type:\"accessor\",value:e=>e.position},getWeight:{type:\"accessor\",value:1},intensity:{type:\"number\",min:0,value:1},radiusPixels:{type:\"number\",min:1,max:100,value:50},colorRange:c$,threshold:{type:\"number\",min:0,max:1,value:.05},colorDomain:{type:\"array\",value:null,optional:!0},aggregation:\"SUM\",weightsTextureSize:{type:\"number\",min:128,max:2048,value:2048},debounceTimeout:{type:\"number\",min:0,max:1e3,value:500}},P_t=[_i.BLEND_EQUATION_MINMAX,_i.TEXTURE_FLOAT],I_t=[_i.COLOR_ATTACHMENT_RGBA32F,_i.FLOAT_BLEND],C_t={data:{props:[\"radiusPixels\"]}},Bp=class extends cx{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){let{gl:t}=this.context;if(!Lh(t,P_t)){this.setState({supported:!1}),rr.error(\"HeatmapLayer: \".concat(this.id,\" is not supported on this browser\"))();return}super.initializeAggregationLayer(C_t),this.setState({supported:!0,colorDomain:S$}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){this.state.supported&&(super.updateState(t),this._updateHeatmapState(t))}_updateHeatmapState(t){let{props:r,oldProps:i}=t,n=this._getChangeFlags(t);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){if(!this.state.supported)return[];let{weightsTexture:t,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:s,colorDomain:o}=this.state,{updateTriggers:c,intensity:d,threshold:_,aggregation:w}=this.props,I=this.getSubLayerClass(\"triangle\",ux);return new I(this.getSubLayerProps({id:\"triangle-layer\",updateTriggers:c}),{coordinateSystem:Hr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:s,aggregationMode:M_t[w]||0,texture:t,intensity:d,threshold:_,colorDomain:o})}finalizeState(t){super.finalizeState(t);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:s,triPositionBuffer:o,triTexCoordBuffer:c,colorTexture:d,updateTimer:_}=this.state;r?.delete(),i?.delete(),n?.delete(),s?.delete(),o?.delete(),c?.delete(),d?.delete(),_&&clearTimeout(_)}_getAttributeManager(){return new id(this.context.gl,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(t,{compareAll:!0,dimension:i.data}),r.viewportChanged=t.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{gl:t}=this.context,{textureSize:r,format:i,type:n}=this.state;this.setState({weightsTexture:new ui(t,{width:r,height:r,format:i,type:n,...OB}),maxWeightsTexture:new ui(t,{format:i,type:n,...OB})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:5130,accessor:\"getPosition\"},weights:{size:1,accessor:\"getWeight\"}}),this.setState({positionAttributeName:\"positions\"})}_setupTextureParams(){let{gl:t}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,cy(t,3379)),n=Lh(t,I_t),{format:s,type:o}=g$({gl:t,floatTargetSupport:n}),c=n?1:1/255;this.setState({textureSize:i,format:s,type:o,weightsScale:c}),n||rr.warn(\"HeatmapLayer: \".concat(this.id,\" rendering to float texture not supported, fallingback to low precession format\"))()}getShaders(t){return super.getShaders(t===\"max-weights-transform\"?{vs:b$,_fs:w$}:{vs:v$,_fs:x$})}_createWeightsTransform(t={}){var r;let{gl:i}=this.context,{weightsTransform:n}=this.state,{weightsTexture:s}=this.state;(r=n)===null||r===void 0||r.delete(),n=new Kl(i,{id:\"\".concat(this.id,\"-weights-transform\"),elementCount:1,_targetTexture:s,_targetTextureVarying:\"weightsTexture\",...t}),this.setState({weightsTransform:n})}_setupResources(){let{gl:t}=this.context;this._createTextures();let{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,s=this.getShaders(\"weights-transform\");this._createWeightsTransform(s);let o=this.getShaders(\"max-weights-transform\"),c=new Kl(t,{id:\"\".concat(this.id,\"-max-weights-transform\"),_sourceTextures:{inTexture:i},_targetTexture:n,_targetTextureVarying:\"outTexture\",...o,elementCount:r*r});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:c,zoom:null,triPositionBuffer:new Ur(t,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new Ur(t,{byteLength:48,accessor:{size:2}})})}updateShaders(t){this._createWeightsTransform(t)}_updateMaxWeightValue(){let{maxWeightTransform:t}=this.state;t.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}_updateBounds(t=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(c=>c.map(Math.fround)),n=d$(i),s={visibleWorldBounds:n,viewportCorners:i},o=!1;if(t||!this.state.worldBounds||!p$(this.state.worldBounds,n)){let c=this._worldToCommonBounds(n),d=this._commonToWorldBounds(c);this.props.coordinateSystem===Hr.LNGLAT&&(d[1]=Math.max(d[1],-85.051129),d[3]=Math.min(d[3],85.051129),d[0]=Math.max(d[0],-360),d[2]=Math.min(d[2],360));let _=this._worldToCommonBounds(d);s.worldBounds=d,s.normalizedCommonBounds=_,o=!0}return this.setState(s),o}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:s}=this.context;t.subData(DB(n,3));let o=n.map(c=>m$(s.projectPosition(c),i));r.subData(DB(o,2))}_updateColorTexture(t){let{colorRange:r}=t.props,{colorTexture:i}=this.state,n=u$(r,!1,Uint8Array);i?i.setImageData({data:n,width:r.length}):i=new ui(this.context.gl,{data:n,width:r.length,height:1,...OB}),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:t,colorDomain:r,aggregation:i}=this.props,{weightsTransform:n,worldBounds:s,textureSize:o,weightsTexture:c,weightsScale:d}=this.state;this.state.isWeightMapDirty=!1;let _=this._worldToCommonBounds(s,{useLayerCoordinateSystem:!0});if(r&&i===\"SUM\"){let{viewport:I}=this.context,R=I.distanceScales.metersPerUnit[2]*(_[2]-_[0])/o;this.state.colorDomain=r.map(N=>N*R*d)}else this.state.colorDomain=r||S$;let w={radiusPixels:t,commonBounds:_,textureWidth:o,weightsScale:d};n.update({elementCount:this.getNumInstances()}),mn(this.context.gl,{clearColor:[0,0,0,0]},()=>{n.run({uniforms:w,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:this.getAttributes(),moduleSettings:this.getModuleSettings()})}),this._updateMaxWeightValue(),c.setParameters({10240:9729,10241:9729})}_debouncedUpdateWeightmap(t=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;t?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(t,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,s,o,c]=t,{viewport:d}=this.context,{textureSize:_}=this.state,{coordinateSystem:w}=this.props,I=i&&(w===Hr.LNGLAT_OFFSETS||w===Hr.METER_OFFSETS),R=I?d.projectPosition(this.props.coordinateOrigin):[0,0],N=_*T_t/d.scale,j,Y;return i&&!I?(j=this.projectPosition([n,s,0]),Y=this.projectPosition([o,c,0])):(j=d.projectPosition([n,s,0]),Y=d.projectPosition([o,c,0])),A$([j[0]-R[0],j[1]-R[1],Y[0]-R[0],Y[1]-R[1]],N,N)}_commonToWorldBounds(t){let[r,i,n,s]=t,{viewport:o}=this.context,c=o.unprojectPosition([r,i]),d=o.unprojectPosition([n,s]);return c.slice(0,2).concat(d.slice(0,2))}};G(Bp,\"layerName\",\"HeatmapLayer\");G(Bp,\"defaultProps\",E_t);var{data:woe,getPosition:Soe,...L_t}=Bp.defaultProps,T$={_validate:!0},k_t={...L_t,...T$},fS=class extends $i{static defaultProps=k_t;static layerName=\"GeoArrowHeatmapLayer\";renderLayers(){let{data:t}=this.props,r=No(t,ro.POINT);if(r!==null)return this._renderLayersPoint(r);let i=this.props.getPosition;if(i!==void 0&&Ji.isPointVector(i))return this._renderLayersPoint(i);throw new Error(\"getPosition not GeoArrow point\")}_renderLayersPoint(t){let{data:r}=this.props;this.props._validate&&(xr(Ji.isPointVector(t)),_o(this.props,r));let[i,n]=Uo(this.props,[\"getPosition\"]),s=sa(r.data),o=[];for(let c=0;cr.text()),earcutWorkerPool:null}}async initEarcutPool(){if(this.state.earcutWorkerPool)return this.state.earcutWorkerPool;let t=await this.state.earcutWorkerRequest;if(!t)return null;let r=BQ(()=>DQ(OQ.fromText(t)),8);return this.state.earcutWorkerPool=r,this.state.earcutWorkerPool}async finalizeState(t){await this.state?.earcutWorkerPool?.terminate(),console.log(\"terminated\")}async updateData(){let{data:t}=this.props,r=await this._updateEarcut(t),i=sa(t.data);this.setState({table:this.props.data,triangles:r,tableOffsets:i})}async _updateEarcut(t){let r=No(t,ro.POLYGON);if(r!==null)return this._earcutPolygonVector(r);let i=No(t,ro.MULTIPOLYGON);if(i!==null)return this._earcutMultiPolygonVector(i);let n=this.props.getPolygon;if(n!==void 0&&Ji.isPolygonVector(n))return this._earcutPolygonVector(n);if(n!==void 0&&Ji.isMultiPolygonVector(n))return this._earcutMultiPolygonVector(n);throw new Error(\"geometryColumn not Polygon or MultiPolygon\")}async _earcutPolygonVector(t){let r=await this.initEarcutPool();if(!r)return this._earcutPolygonVectorMainThread(t);let i=new Array(t.data.length);console.time(\"earcut\");for(let n=0;n{let _=await d(h6(o,c));i[n]=_})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;i{let w=await _(h6(c,d));i[n]=w})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutMultiPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;i{this.table=_2(this.model.get(t))};this.model.on(`change:${t}`,r),this.callbacks.set(`change:${t}`,r)}},OI=class extends Np{static layerType=\"arc\";greatCircle;numSegments;widthUnits;widthScale;widthMinPixels;widthMaxPixels;getSourcePosition;getTargetPosition;getSourceColor;getTargetColor;getWidth;getHeight;getTilt;constructor(t,r){super(t,r),this.initRegularAttribute(\"great_circle\",\"greatCircle\"),this.initRegularAttribute(\"num_segments\",\"numSegments\"),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initVectorizedAccessor(\"get_source_position\",\"getSourcePosition\"),this.initVectorizedAccessor(\"get_target_position\",\"getTargetPosition\"),this.initVectorizedAccessor(\"get_source_color\",\"getSourceColor\"),this.initVectorizedAccessor(\"get_target_color\",\"getTargetColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\"),this.initVectorizedAccessor(\"get_height\",\"getHeight\"),this.initVectorizedAccessor(\"get_tilt\",\"getTilt\")}layerProps(){return{data:this.table,getSourcePosition:this.getSourcePosition,getTargetPosition:this.getTargetPosition,...fe(this.greatCircle)&&{greatCircle:this.greatCircle},...fe(this.numSegments)&&{numSegments:this.numSegments},...fe(this.widthUnits)&&{widthUnits:this.widthUnits},...fe(this.widthScale)&&{widthScale:this.widthScale},...fe(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...fe(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...fe(this.getSourceColor)&&{getSourceColor:this.getSourceColor},...fe(this.getTargetColor)&&{getTargetColor:this.getTargetColor},...fe(this.getWidth)&&{getWidth:this.getWidth},...fe(this.getHeight)&&{getHeight:this.getHeight},...fe(this.getTilt)&&{getTilt:this.getTilt}}}render(){return new sS({...this.baseLayerProps(),...this.layerProps()})}},BI=class extends Cg{static layerType=\"bitmap\";image;bounds;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"image\",\"image\"),this.initRegularAttribute(\"bounds\",\"bounds\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}layerProps(){return{...fe(this.image)&&{image:this.image},...fe(this.bounds)&&{bounds:this.bounds},...fe(this.desaturate)&&{desaturate:this.desaturate},...fe(this.transparentColor)&&{transparentColor:this.transparentColor},...fe(this.tintColor)&&{tintColor:this.tintColor}}}render(){return new wp({...this.baseLayerProps(),...this.layerProps(),data:void 0,pickable:!1})}},FI=class extends Cg{static layerType=\"bitmap-tile\";data;tileSize;zoomOffset;maxZoom;minZoom;extent;maxCacheSize;maxCacheByteSize;refinementStrategy;maxRequests;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"data\",\"data\"),this.initRegularAttribute(\"tile_size\",\"tileSize\"),this.initRegularAttribute(\"zoom_offset\",\"zoomOffset\"),this.initRegularAttribute(\"max_zoom\",\"maxZoom\"),this.initRegularAttribute(\"min_zoom\",\"minZoom\"),this.initRegularAttribute(\"extent\",\"extent\"),this.initRegularAttribute(\"max_cache_size\",\"maxCacheSize\"),this.initRegularAttribute(\"max_cache_byte_size\",\"maxCacheByteSize\"),this.initRegularAttribute(\"refinement_strategy\",\"refinementStrategy\"),this.initRegularAttribute(\"max_requests\",\"maxRequests\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}bitmapLayerProps(){return{...fe(this.desaturate)&&{desaturate:this.desaturate},...fe(this.transparentColor)&&{transparentColor:this.transparentColor},...fe(this.tintColor)&&{tintColor:this.tintColor}}}layerProps(){return{data:this.data,...fe(this.tileSize)&&{tileSize:this.tileSize},...fe(this.zoomOffset)&&{zoomOffset:this.zoomOffset},...fe(this.maxZoom)&&{maxZoom:this.maxZoom},...fe(this.minZoom)&&{minZoom:this.minZoom},...fe(this.extent)&&{extent:this.extent},...fe(this.maxCacheSize)&&{maxCacheSize:this.maxCacheSize},...fe(this.maxCacheByteSize)&&{maxCacheByteSize:this.maxCacheByteSize},...fe(this.refinementStrategy)&&{refinementStrategy:this.refinementStrategy},...fe(this.maxRequests)&&{maxRequests:this.maxRequests}}}render(){return new Im({...this.baseLayerProps(),...this.layerProps(),renderSubLayers:t=>{let[r,i]=t.tile.boundingBox;return new wp(t,{...this.bitmapLayerProps(),data:void 0,image:t.data,bounds:[r[0],r[1],i[0],i[1]]})}})}},zI=class extends Np{static layerType=\"column\";diskResolution;radius;angle;vertices;offset;coverage;elevationScale;filled;stroked;extruded;wireframe;flatShading;radiusUnits;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;material;getPosition;getFillColor;getLineColor;getElevation;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"disk_resolution\",\"diskResolution\"),this.initRegularAttribute(\"radius\",\"radius\"),this.initRegularAttribute(\"angle\",\"angle\"),this.initRegularAttribute(\"vertices\",\"vertices\"),this.initRegularAttribute(\"offset\",\"offset\"),this.initRegularAttribute(\"coverage\",\"coverage\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"flat_shading\",\"flatShading\"),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"material\",\"material\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...fe(this.diskResolution)&&{diskResolution:this.diskResolution},...fe(this.radius)&&{radius:this.radius},...fe(this.angle)&&{angle:this.angle},...fe(this.vertices)&&this.vertices!==void 0&&{vertices:this.vertices},...fe(this.offset)&&{offset:this.offset},...fe(this.coverage)&&{coverage:this.coverage},...fe(this.elevationScale)&&{elevationScale:this.elevationScale},...fe(this.filled)&&{filled:this.filled},...fe(this.stroked)&&{stroked:this.stroked},...fe(this.extruded)&&{extruded:this.extruded},...fe(this.wireframe)&&{wireframe:this.wireframe},...fe(this.flatShading)&&{flatShading:this.flatShading},...fe(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...fe(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...fe(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...fe(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...fe(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...fe(this.material)&&{material:this.material},...fe(this.getPosition)&&{getPosition:this.getPosition},...fe(this.getFillColor)&&{getFillColor:this.getFillColor},...fe(this.getLineColor)&&{getLineColor:this.getLineColor},...fe(this.getElevation)&&{getElevation:this.getElevation},...fe(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new oS({...this.baseLayerProps(),...this.layerProps()})}},NI=class extends Np{static layerType=\"heatmap\";radiusPixels;colorRange;intensity;threshold;colorDomain;aggregation;weightsTextureSize;debounceTimeout;getPosition;getWeight;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_pixels\",\"radiusPixels\"),this.initRegularAttribute(\"color_range\",\"colorRange\"),this.initRegularAttribute(\"intensity\",\"intensity\"),this.initRegularAttribute(\"threshold\",\"threshold\"),this.initRegularAttribute(\"color_domain\",\"colorDomain\"),this.initRegularAttribute(\"aggregation\",\"aggregation\"),this.initRegularAttribute(\"weights_texture_size\",\"weightsTextureSize\"),this.initRegularAttribute(\"debounce_timeout\",\"debounceTimeout\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_weight\",\"getWeight\")}layerProps(){return{data:this.table,...fe(this.radiusPixels)&&{radiusPixels:this.radiusPixels},...fe(this.colorRange)&&{colorRange:this.colorRange},...fe(this.intensity)&&{intensity:this.intensity},...fe(this.threshold)&&{threshold:this.threshold},...fe(this.colorDomain)&&{colorDomain:this.colorDomain},...fe(this.aggregation)&&{aggregation:this.aggregation},...fe(this.weightsTextureSize)&&{weightsTextureSize:this.weightsTextureSize},...fe(this.debounceTimeout)&&{debounceTimeout:this.debounceTimeout},...fe(this.getPosition)&&{getPosition:this.getPosition},...fe(this.getWeight)&&{getWeight:this.getWeight}}}render(){return new fS({...this.baseLayerProps(),...this.layerProps()})}},IS=class extends Np{static layerType=\"path\";widthUnits;widthScale;widthMinPixels;widthMaxPixels;jointRounded;capRounded;miterLimit;billboard;getColor;getWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initRegularAttribute(\"joint_rounded\",\"jointRounded\"),this.initRegularAttribute(\"cap_rounded\",\"capRounded\"),this.initRegularAttribute(\"miter_limit\",\"miterLimit\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\")}layerProps(){return{data:this.table,...fe(this.widthUnits)&&{widthUnits:this.widthUnits},...fe(this.widthScale)&&{widthScale:this.widthScale},...fe(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...fe(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...fe(this.jointRounded)&&{jointRounded:this.jointRounded},...fe(this.capRounded)&&{capRounded:this.capRounded},...fe(this.miterLimit)&&{miterLimit:this.miterLimit},...fe(this.billboard)&&{billboard:this.billboard},...fe(this.getColor)&&{getColor:this.getColor},...fe(this.getWidth)&&{getWidth:this.getWidth}}}render(){return new hx({...this.baseLayerProps(),...this.layerProps()})}},CS=class extends Np{static layerType=\"scatterplot\";radiusUnits;radiusScale;radiusMinPixels;radiusMaxPixels;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;stroked;filled;billboard;antialiasing;getRadius;getFillColor;getLineColor;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"radius_scale\",\"radiusScale\"),this.initRegularAttribute(\"radius_min_pixels\",\"radiusMinPixels\"),this.initRegularAttribute(\"radius_max_pixels\",\"radiusMaxPixels\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"antialiasing\",\"antialiasing\"),this.initVectorizedAccessor(\"get_radius\",\"getRadius\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...fe(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...fe(this.radiusScale)&&{radiusScale:this.radiusScale},...fe(this.radiusMinPixels)&&{radiusMinPixels:this.radiusMinPixels},...fe(this.radiusMaxPixels)&&{radiusMaxPixels:this.radiusMaxPixels},...fe(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...fe(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...fe(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...fe(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...fe(this.stroked)&&{stroked:this.stroked},...fe(this.filled)&&{filled:this.filled},...fe(this.billboard)&&{billboard:this.billboard},...fe(this.antialiasing)&&{antialiasing:this.antialiasing},...fe(this.getRadius)&&{getRadius:this.getRadius},...fe(this.getFillColor)&&{getFillColor:this.getFillColor},...fe(this.getLineColor)&&{getLineColor:this.getLineColor},...fe(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new ES({...this.baseLayerProps(),...this.layerProps()})}},LS=class extends Np{static layerType=\"solid-polygon\";filled;extruded;wireframe;elevationScale;getElevation;getFillColor;getLineColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\")}layerProps(){return{data:this.table,...fe(this.filled)&&{filled:this.filled},...fe(this.extruded)&&{extruded:this.extruded},...fe(this.wireframe)&&{wireframe:this.wireframe},...fe(this.elevationScale)&&{elevationScale:this.elevationScale},...fe(this.getElevation)&&{getElevation:this.getElevation},...fe(this.getFillColor)&&{getFillColor:this.getFillColor},...fe(this.getLineColor)&&{getLineColor:this.getLineColor}}}render(){return new bx({...this.baseLayerProps(),...this.layerProps()})}},UI=class extends Np{static layerType=\"text\";billboard;sizeScale;sizeUnits;sizeMinPixels;sizeMaxPixels;getBackgroundColor;getBorderColor;getBorderWidth;backgroundPadding;characterSet;fontFamily;fontWeight;lineHeight;outlineWidth;outlineColor;fontSettings;wordBreak;maxWidth;getText;getPosition;getColor;getSize;getAngle;getTextAnchor;getAlignmentBaseline;getPixelOffset;constructor(t,r){super(t,r),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"size_scale\",\"sizeScale\"),this.initRegularAttribute(\"size_units\",\"sizeUnits\"),this.initRegularAttribute(\"size_min_pixels\",\"sizeMinPixels\"),this.initRegularAttribute(\"size_max_pixels\",\"sizeMaxPixels\"),this.initRegularAttribute(\"background_padding\",\"backgroundPadding\"),this.initRegularAttribute(\"character_set\",\"characterSet\"),this.initRegularAttribute(\"font_family\",\"fontFamily\"),this.initRegularAttribute(\"font_weight\",\"fontWeight\"),this.initRegularAttribute(\"line_height\",\"lineHeight\"),this.initRegularAttribute(\"outline_width\",\"outlineWidth\"),this.initRegularAttribute(\"outline_color\",\"outlineColor\"),this.initRegularAttribute(\"font_settings\",\"fontSettings\"),this.initRegularAttribute(\"word_break\",\"wordBreak\"),this.initRegularAttribute(\"max_width\",\"maxWidth\"),this.initVectorizedAccessor(\"get_background_color\",\"getBackgroundColor\"),this.initVectorizedAccessor(\"get_border_color\",\"getBorderColor\"),this.initVectorizedAccessor(\"get_border_width\",\"getBorderWidth\"),this.initVectorizedAccessor(\"get_text\",\"getText\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_size\",\"getSize\"),this.initVectorizedAccessor(\"get_angle\",\"getAngle\"),this.initVectorizedAccessor(\"get_text_anchor\",\"getTextAnchor\"),this.initVectorizedAccessor(\"get_alignment_baseline\",\"getAlignmentBaseline\"),this.initVectorizedAccessor(\"get_pixel_offset\",\"getPixelOffset\")}layerProps(){return{data:this.table,getText:this.getText,...fe(this.billboard)&&{billboard:this.billboard},...fe(this.sizeScale)&&{sizeScale:this.sizeScale},...fe(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...fe(this.sizeMinPixels)&&{sizeMinPixels:this.sizeMinPixels},...fe(this.sizeMaxPixels)&&{sizeMaxPixels:this.sizeMaxPixels},...fe(this.backgroundPadding)&&{backgroundPadding:this.backgroundPadding},...fe(this.characterSet)&&{characterSet:this.characterSet},...fe(this.fontFamily)&&{fontFamily:this.fontFamily},...fe(this.fontWeight)&&{fontWeight:this.fontWeight},...fe(this.lineHeight)&&{lineHeight:this.lineHeight},...fe(this.outlineWidth)&&{outlineWidth:this.outlineWidth},...fe(this.outlineColor)&&{outlineColor:this.outlineColor},...fe(this.fontSettings)&&{fontSettings:this.fontSettings},...fe(this.wordBreak)&&{wordBreak:this.wordBreak},...fe(this.maxWidth)&&{maxWidth:this.maxWidth},...fe(this.getBackgroundColor)&&{getBackgroundColor:this.getBackgroundColor},...fe(this.getBorderColor)&&{getBorderColor:this.getBorderColor},...fe(this.getBorderWidth)&&{getBorderWidth:this.getBorderWidth},...fe(this.getPosition)&&{getPosition:this.getPosition},...fe(this.getColor)&&{getColor:this.getColor},...fe(this.getSize)&&{getSize:this.getSize},...fe(this.getAngle)&&{getAngle:this.getAngle},...fe(this.getTextAnchor)&&{getTextAnchor:this.getTextAnchor},...fe(this.getAlignmentBaseline)&&{getAlignmentBaseline:this.getAlignmentBaseline},...fe(this.getPixelOffset)&&{getPixelOffset:this.getPixelOffset}}}render(){return new PS({...this.baseLayerProps(),...this.layerProps()})}};async function p6(e,t){let r=e.get(\"_layer_type\"),i;switch(r){case OI.layerType:i=new OI(e,t);break;case BI.layerType:i=new BI(e,t);break;case FI.layerType:i=new FI(e,t);break;case zI.layerType:i=new zI(e,t);break;case NI.layerType:i=new NI(e,t);break;case IS.layerType:i=new IS(e,t);break;case CS.layerType:i=new CS(e,t);break;case LS.layerType:i=new LS(e,t);break;case UI.layerType:i=new UI(e,t);break;default:throw new Error(`no layer supported for ${r}`)}return await i.loadSubModels(),i}var VI=Symbol.for(\"rowIndex\");function Ext(e){return`\n \n ${Object.keys(e).map(t=>{let r=e[t];return`\n \n \n `}).join(\"\")}\n \n
${t}${r}
`}function zQ({object:e}){if(e){if(e[VI]===null||e[VI]===void 0||e[VI]&&e[VI]<0)return null;let t=e.toJSON();return!t||(delete t.geometry,Object.keys(t).length===0)?null:{className:\"lonboard-tooltip\",html:Ext(t),style:{backgroundColor:\"#fff\",boxShadow:\"0 0 15px rgba(0, 0, 0, 0.1)\",color:\"#000\",padding:\"6px\"}}}return null}var jI,Pxt=new Uint8Array(16);function A6(){if(!jI&&(jI=typeof crypto<\"u\"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jI))throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");return jI(Pxt)}var Ia=[];for(let e=0;e<256;++e)Ia.push((e+256).toString(16).slice(1));function NQ(e,t=0){return Ia[e[t+0]]+Ia[e[t+1]]+Ia[e[t+2]]+Ia[e[t+3]]+\"-\"+Ia[e[t+4]]+Ia[e[t+5]]+\"-\"+Ia[e[t+6]]+Ia[e[t+7]]+\"-\"+Ia[e[t+8]]+Ia[e[t+9]]+\"-\"+Ia[e[t+10]]+Ia[e[t+11]]+Ia[e[t+12]]+Ia[e[t+13]]+Ia[e[t+14]]+Ia[e[t+15]]}var Ixt=typeof crypto<\"u\"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),m6={randomUUID:Ixt};function Cxt(e,t,r){if(m6.randomUUID&&!t&&!e)return m6.randomUUID();e=e||{};let i=e.random||(e.rng||A6)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return NQ(i)}var g6=Cxt;await GW();var Lxt={latitude:10,longitude:0,zoom:.5,bearing:0,pitch:0},kxt=\"https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json\";async function Rxt(e,t,r,i){let n={},s=()=>i(new Date);for(let o=0;o{(async()=>{let j=await h3(d.widget_manager,_),Y=await Rxt(j,_,o,I);c(Y)})().catch(console.error)},[_]);let R=[];for(let N of Object.values(o))R.push(N.render());return(0,$g.useEffect)(()=>{if(r)return;let j=document.getElementById(`map-${s}`)?.parentElement;if(j){let Y=window.getComputedStyle(j);(!Y.height||Y.height===\"0px\")&&(j.style.height=\"100%\",j.style.minHeight=\"500px\")}},[]),GI.createElement(\"div\",{id:`map-${s}`,style:{height:r||\"100%\"}},GI.createElement(xD,{initialViewState:[\"longitude\",\"latitude\",\"zoom\"].every(N=>Object.keys(e).includes(N))?e:Lxt,controller:!0,layers:R,getTooltip:i&&zQ,pickingRadius:n},GI.createElement(D8,{mapStyle:t||kxt})))}var Oxt={render:y8(Dxt)},Pce=Oxt;export{Pce as default};\n/*! Bundled license information:\n\nreact/cjs/react.production.min.js:\n (**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nscheduler/cjs/scheduler.production.min.js:\n (**\n * @license React\n * scheduler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom.production.min.js:\n (**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nhammerjs/hammer.js:\n (*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license *)\n*/\n", - "_height": null, - "_initial_view_state": { - "latitude": 37.76675, - "longitude": -122.43700000000001, - "zoom": 11 - }, - "_model_module": "anywidget", - "_model_module_version": "0.9.0", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "0.9.0", - "_view_name": "AnyView", - "basemap_style": "https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json", - "layers": [ - "IPY_MODEL_106d00e6a1e2489d8c5fe2103ef444fb" - ], - "layout": "IPY_MODEL_de5ceed1d90642b0b1a75ae3c34ae910", - "picking_radius": 5, - "show_tooltip": true - } - }, - "de5ceed1d90642b0b1a75ae3c34ae910": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - } - }, - "version_major": 2, - "version_minor": 0 - } - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/mkdocs.yml b/mkdocs.yml index 9c4ca2fd..a804f660 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -56,6 +56,12 @@ nav: - api/layers/arc-layer.md - api/layers/text-layer.md - api/experimental/traits.md + - Ecosystem: + - ecosystem/index.md + - ecosystem/geoarrow.md + - ecosystem/geopandas.md + - ecosystem/panel.md + - ecosystem/shiny.md # - Caveats: caveats.md - Performance: performance.md @@ -63,11 +69,6 @@ nav: - Alternatives: alternatives.md - "How it works?": how-it-works.md - # - Ecosystem: - # - ecosystem/index.md - # - ecosystem/geopandas.md - # - ecosystem/geoarrow.md - watch: - lonboard - docs @@ -121,7 +122,7 @@ plugins: alias_type: "copy" canonical_version: "latest" - mkdocs-jupyter: - include_source: True + include_source: true ignore: ["**/.ipynb_checkpoints/*.ipynb"] - mkdocstrings: enable_inventory: true