diff --git a/lonboard/__init__.py b/lonboard/__init__.py index 39f4bf18..e1bdd106 100644 --- a/lonboard/__init__.py +++ b/lonboard/__init__.py @@ -19,3 +19,14 @@ from ._map import Map from ._version import __version__ from ._viz import viz +from ._deck_widget import ( + BaseDeckWidget, + FullscreenWidget, + ZoomWidget, + CompassWidget, + TitleWidget, + NorthArrowWidget, + LegendWidget, + ScaleWidget, + SaveImageWidget, +) diff --git a/lonboard/_deck_widget.py b/lonboard/_deck_widget.py new file mode 100644 index 00000000..03948266 --- /dev/null +++ b/lonboard/_deck_widget.py @@ -0,0 +1,96 @@ +import traitlets +from lonboard._base import BaseWidget + +class BaseDeckWidget(BaseWidget): + + # props = traitlets.Dict({}).tag(sync=True) # make me a class + placement = traitlets.Enum( + values=["top-left", "top-right", "bottom-left", "bottom-right", "fill"], + default_value=None, + allow_none=True + ).tag(sync=True) + class_name = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class FullscreenWidget(BaseDeckWidget): + _widget_type = traitlets.Unicode("fullscreen").tag(sync=True) + + enter_label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + exit_label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + class_name = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class ZoomWidget(BaseDeckWidget): + _widget_type = traitlets.Unicode("zoom").tag(sync=True) + + zoom_in_label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + zoom_out_label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + transition_duration = traitlets.Int(default_value=None, allow_none=True).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + class_name = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class CompassWidget(BaseDeckWidget): + _widget_type = traitlets.Unicode("compass").tag(sync=True) + + label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + transition_duration = traitlets.Int(default_value=None, allow_none=True).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + class_name = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class NorthArrowWidget(BaseDeckWidget): + _widget_type = traitlets.Unicode("north-arrow").tag(sync=True) + + label = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + transition_duration = traitlets.Int(default_value=None, allow_none=True).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + class_name = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class TitleWidget(BaseDeckWidget): + + _widget_type = traitlets.Unicode("title").tag(sync=True) + title = traitlets.Unicode(allow_none=False).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class LegendWidget(BaseDeckWidget): + + _widget_type = traitlets.Unicode("legend").tag(sync=True) + title = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True) + labels = traitlets.List(traitlets.Unicode()).tag(sync=True) + colors = traitlets.List(traitlets.Unicode()).tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class ScaleWidget(BaseDeckWidget): + + _widget_type = traitlets.Unicode("scale").tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + max_width = traitlets.Int(default_value=None, allow_none=True).tag(sync=True) + use_imperial = traitlets.Bool(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) + +class SaveImageWidget(BaseDeckWidget): + + _widget_type = traitlets.Unicode("save-image").tag(sync=True) + style = traitlets.Dict(default_value=None, allow_none=True).tag(sync=True) + + def __init__(self, **kwargs): + super().__init__(**kwargs) \ No newline at end of file diff --git a/lonboard/_map.py b/lonboard/_map.py index a18318cd..ad50153f 100644 --- a/lonboard/_map.py +++ b/lonboard/_map.py @@ -1,6 +1,7 @@ from __future__ import annotations import sys +from math import log2 from io import StringIO from pathlib import Path from typing import IO, TYPE_CHECKING, Optional, Sequence, TextIO, Union, overload @@ -12,6 +13,7 @@ from lonboard._base import BaseAnyWidget from lonboard._environment import DEFAULT_HEIGHT from lonboard._layer import BaseLayer +from lonboard._deck_widget import BaseDeckWidget from lonboard._viewport import compute_view from lonboard.basemap import CartoBasemap from lonboard.traits import DEFAULT_INITIAL_VIEW_STATE, BasemapUrl, ViewStateTrait @@ -123,11 +125,20 @@ def __init__( """ - _height = traitlets.Int(default_value=DEFAULT_HEIGHT, allow_none=True).tag( - sync=True - ) + height = traitlets.Union( + [traitlets.Int(),traitlets.Unicode()], + default_value=DEFAULT_HEIGHT, allow_none=True + ).tag(sync=True) """Height of the map in pixels. + This API is not yet stabilized and may change in the future. + """ + width = traitlets.Union( + [traitlets.Int(),traitlets.Unicode()], + default_value=DEFAULT_HEIGHT, allow_none=True + ).tag(sync=True) + """Width of the map in pixels. + This API is not yet stabilized and may change in the future. """ @@ -156,7 +167,17 @@ def __init__( - Default: `5` """ - basemap_style = BasemapUrl(CartoBasemap.PositronNoLabels) + deck_widgets = traitlets.List(trait=traitlets.Instance(BaseDeckWidget)).tag( + sync=True, **ipywidgets.widget_serialization + ) + """One or more `Widget` objects to display on this map. + """ + + controller = traitlets.Bool(default_value=True).tag(sync=True) + """Whether or not the map is interactive + """ + + basemap_style = traitlets.Unicode(CartoBasemap.PositronNoLabels).tag(sync=True) """ A URL to a MapLibre-compatible basemap style. diff --git a/lonboard/_viz.py b/lonboard/_viz.py index b4d45f27..ad3aa889 100644 --- a/lonboard/_viz.py +++ b/lonboard/_viz.py @@ -220,6 +220,48 @@ def viz( return Map(layers=layers, **map_kwargs) +def viz_layer( + data: Union[VizDataInput, List[VizDataInput], Tuple[VizDataInput, ...]], + *, + scatterplot_kwargs: Optional[ScatterplotLayerKwargs] = None, + path_kwargs: Optional[PathLayerKwargs] = None, + polygon_kwargs: Optional[PolygonLayerKwargs] = None, + map_kwargs: Optional[MapKwargs] = None, + con: Optional[duckdb.DuckDBPyConnection] = None, +) -> List[Union[ScatterplotLayer, PathLayer, PolygonLayer]]: + """Same as viz but returns only the created layers + """ + color_ordering = COLORS.copy() + shuffle(color_ordering) + + if isinstance(data, (list, tuple)): + layers: List[Union[ScatterplotLayer, PathLayer, PolygonLayer]] = [] + for i, item in enumerate(data): + ls = create_layers_from_data_input( + item, + _viz_color=color_ordering[i % len(color_ordering)], + scatterplot_kwargs=scatterplot_kwargs, + path_kwargs=path_kwargs, + polygon_kwargs=polygon_kwargs, + con=con, + ) + layers.extend(ls) + else: + layers = create_layers_from_data_input( + data, + _viz_color=color_ordering[0], + scatterplot_kwargs=scatterplot_kwargs, + path_kwargs=path_kwargs, + polygon_kwargs=polygon_kwargs, + con=con, + ) + + map_kwargs = {} if not map_kwargs else map_kwargs + + if "basemap_style" not in map_kwargs.keys(): + map_kwargs["basemap_style"] = CartoBasemap.DarkMatter + + return layers DUCKDB_PY_CONN_ERROR = dedent("""\ Must pass in DuckDBPyRelation object, not DuckDBPyConnection. diff --git a/lonboard/static/index.css b/lonboard/static/index.css new file mode 100644 index 00000000..e3b643ed --- /dev/null +++ b/lonboard/static/index.css @@ -0,0 +1 @@ +.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}.deck-widget{margin:var(--widget-margin, 12px)}.deck-widget-button,.deck-widget-button-group{background:var(--button-stroke, rgba(255, 255, 255, .3));border-radius:var(--button-corner-radius, 8px);box-shadow:var(--button-shadow, 0px 0px 8px 0px rgba(0, 0, 0, .25));display:flex;align-items:center;justify-content:center}.deck-widget-button{width:var(--button-size, 28px);height:var(--button-size, 28px)}.deck-widget-button-group{width:calc(var(--button-size, 28px) - 2);height:calc((var(--button-size, 28px) * 2) - 1);flex-direction:row;padding:1px;gap:1px}.deck-widget-button-group.vertical{display:inline-flex;flex-direction:column}.deck-widget-button-group button,.deck-widget-button button{width:calc(var(--button-size, 28px) - 2px);height:calc(var(--button-size, 28px) - 2px);box-sizing:border-box;background:var(--button-background, #fff);backdrop-filter:var(--button-backdrop-filter, unset);border:var(--button-inner-stroke, unset);border-radius:calc(var(--button-corner-radius, 8px) - 1px);pointer-events:auto;cursor:pointer;outline:none;padding:0}.deck-widget-button-group.vertical>*:not(:last-child),.deck-widget-button-group.vertical>*:not(:last-child)>button{border-bottom-left-radius:0;border-bottom-right-radius:0}.deck-widget-button-group.vertical>*:not(:first-child),.deck-widget-button-group.vertical>*:not(:first-child)>button{border-top-left-radius:0;border-top-right-radius:0}.deck-widget-button-group.horizontal>*:not(:last-child),.deck-widget-button-group.horizontal>*:not(:last-child)>button{border-top-right-radius:0;border-bottom-right-radius:0}.deck-widget-button-group.horizontal>*:not(:first-child),.deck-widget-button-group.horizontal>*:not(:first-child)>button{border-top-left-radius:0;border-bottom-left-radius:0}.deck-widget button .deck-widget-icon{background-color:var(--button-icon-idle, #616166);background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}.deck-widget button .deck-widget-icon:hover{background-color:var(--button-icon-hover, rgb(24, 24, 26))}.deck-widget.deck-widget-fullscreen button.deck-widget-fullscreen-enter .deck-widget-icon{mask-image:var( --icon-fullscreen-enter, url('data:image/svg+xml,') );-webkit-mask-image:var( --icon-fullscreen-enter, url('data:image/svg+xml,') )}.deck-widget.deck-widget-fullscreen button.deck-widget-fullscreen-exit .deck-widget-icon{mask-image:var( --icon-fullscreen-exit, url('data:image/svg+xml,') );-webkit-mask-image:var( --icon-fullscreen-exit, url('data:image/svg+xml,') )}.deck-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.deck-widget.deck-widget-zoom button.deck-widget-zoom-in .deck-widget-icon{mask-image:var( --icon-zoom-in, url('data:image/svg+xml,') );-webkit-mask-image:var( --icon-zoom-in, url('data:image/svg+xml,') )}.deck-widget.deck-widget-zoom button.deck-widget-zoom-out .deck-widget-icon{mask-image:var( --icon-zoom-out, url('data:image/svg+xml, wBox="0 0 26 26" fill="none">') );-webkit-mask-image:var( --icon-zoom-out, url('data:image/svg+xml, wBox="0 0 26 26" fill="none">') )}.deck-widget.deck-widget-title{font-size:26px;font-style:normal;font-family:Helvetica;color:#000;background-color:#fff;outline-width:0px;outline-style:solid;outline-color:#000;border-radius:5px;border-width:1px;border-style:solid;border-color:#000;padding:3px;text-align:center}.deck-widget.deck-widget-legend{background-color:#fff;border-color:#000;border-style:solid;border-radius:5px;border-width:1px;padding:10px;font-size:14px}.legend-title{text-align:left;margin-bottom:5px;font-weight:700;font-family:Helvetica;color:#000}.legend-scale ul{list-style:none;margin:0 0 5px;padding:0;color:#000}.deck-widget.deck-widget-legend.legend-scale ul{margin:0 0 5px;padding:0;float:left;list-style:none}.deck-widget.deck-widget-legend.legend-scale ul li{font-size:80%;list-style:none;margin-left:0;line-height:18px;margin-bottom:2px}.deck-widget.deck-widget-legend ul.legend-labels li span{display:block;float:left;height:16px;width:30px;margin-right:5px;margin-left:0;border:1px solid #999} diff --git a/lonboard/static/index.js b/lonboard/static/index.js new file mode 100644 index 00000000..a385c6dd --- /dev/null +++ b/lonboard/static/index.js @@ -0,0 +1,3030 @@ +var pie=Object.create;var ER=Object.defineProperty;var Aie=Object.getOwnPropertyDescriptor;var mie=Object.getOwnPropertyNames;var gie=Object.getPrototypeOf,_ie=Object.prototype.hasOwnProperty;var Hr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zc=(t,e)=>{for(var r in e)ER(t,r,{get:e[r],enumerable:!0})},yie=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mie(e))!_ie.call(t,n)&&n!==r&&ER(t,n,{get:()=>e[n],enumerable:!(i=Aie(e,n))||i.enumerable});return t};var Ei=(t,e,r)=>(r=t!=null?pie(gie(t)):{},yie(e||!t||!t.__esModule?ER(r,"default",{value:t,enumerable:!0}):r,t));var vz=Hr(Bi=>{"use strict";var mv=Symbol.for("react.element"),xie=Symbol.for("react.portal"),vie=Symbol.for("react.fragment"),bie=Symbol.for("react.strict_mode"),wie=Symbol.for("react.profiler"),Sie=Symbol.for("react.provider"),Tie=Symbol.for("react.context"),Eie=Symbol.for("react.forward_ref"),Mie=Symbol.for("react.suspense"),Pie=Symbol.for("react.memo"),Cie=Symbol.for("react.lazy"),uz=Symbol.iterator;function Iie(t){return t===null||typeof t!="object"?null:(t=uz&&t[uz]||t["@@iterator"],typeof t=="function"?t:null)}var dz={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},pz=Object.assign,Az={};function W_(t,e,r){this.props=t,this.context=e,this.refs=Az,this.updater=r||dz}W_.prototype.isReactComponent={};W_.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};W_.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function mz(){}mz.prototype=W_.prototype;function PR(t,e,r){this.props=t,this.context=e,this.refs=Az,this.updater=r||dz}var CR=PR.prototype=new mz;CR.constructor=PR;pz(CR,W_.prototype);CR.isPureReactComponent=!0;var hz=Array.isArray,gz=Object.prototype.hasOwnProperty,IR={current:null},_z={key:!0,ref:!0,__self:!0,__source:!0};function yz(t,e,r){var i,n={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)gz.call(e,i)&&!_z.hasOwnProperty(i)&&(n[i]=e[i]);var c=arguments.length-2;if(c===1)n.children=r;else if(1{"use strict";bz.exports=vz()});var kz=Hr(Hn=>{"use strict";function OR(t,e){var r=t.length;t.push(e);e:for(;0>>1,n=t[i];if(0>>1;ia3(c,r))fa3(y,c)?(t[i]=y,t[f]=r,i=f):(t[i]=c,t[o]=r,i=o);else if(fa3(y,r))t[i]=y,t[f]=r,i=f;else break e}}return e}function a3(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(wz=performance,Hn.unstable_now=function(){return wz.now()}):(kR=Date,Sz=kR.now(),Hn.unstable_now=function(){return kR.now()-Sz});var wz,kR,Sz,Bf=[],vA=[],Oie=1,Du=null,$a=3,u3=!1,wm=!1,_v=!1,Mz=typeof setTimeout=="function"?setTimeout:null,Pz=typeof clearTimeout=="function"?clearTimeout:null,Tz=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function BR(t){for(var e=Lh(vA);e!==null;){if(e.callback===null)c3(vA);else if(e.startTime<=t)c3(vA),e.sortIndex=e.expirationTime,OR(Bf,e);else break;e=Lh(vA)}}function FR(t){if(_v=!1,BR(t),!wm)if(Lh(Bf)!==null)wm=!0,zR(NR);else{var e=Lh(vA);e!==null&&UR(FR,e.startTime-t)}}function NR(t,e){wm=!1,_v&&(_v=!1,Pz(yv),yv=-1),u3=!0;var r=$a;try{for(BR(e),Du=Lh(Bf);Du!==null&&(!(Du.expirationTime>e)||t&&!Rz());){var i=Du.callback;if(typeof i=="function"){Du.callback=null,$a=Du.priorityLevel;var n=i(Du.expirationTime<=e);e=Hn.unstable_now(),typeof n=="function"?Du.callback=n:Du===Lh(Bf)&&c3(Bf),BR(e)}else c3(Bf);Du=Lh(Bf)}if(Du!==null)var s=!0;else{var o=Lh(vA);o!==null&&UR(FR,o.startTime-e),s=!1}return s}finally{Du=null,$a=r,u3=!1}}var h3=!1,l3=null,yv=-1,Cz=5,Iz=-1;function Rz(){return!(Hn.unstable_now()-Izt||125i?(t.sortIndex=r,OR(vA,t),Lh(Bf)===null&&t===Lh(vA)&&(_v?(Pz(yv),yv=-1):_v=!0,UR(FR,r-i))):(t.sortIndex=n,OR(Bf,t),wm||u3||(wm=!0,zR(NR))),t};Hn.unstable_shouldYield=Rz;Hn.unstable_wrapCallback=function(t){var e=$a;return function(){var r=$a;$a=e;try{return t.apply(this,arguments)}finally{$a=r}}}});var Dz=Hr((BEe,Lz)=>{"use strict";Lz.exports=kz()});var N9=Hr(eu=>{"use strict";var Bie=Zi(),Kc=Dz();function Dt(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c6=Object.prototype.hasOwnProperty,Fie=/^[: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]*$/,Oz={},Bz={};function Nie(t){return c6.call(Bz,t)?!0:c6.call(Oz,t)?!1:Fie.test(t)?Bz[t]=!0:(Oz[t]=!0,!1)}function zie(t,e,r,i){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Uie(t,e,r,i){if(e===null||typeof e>"u"||zie(t,e,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Sl(t,e,r,i,n,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var wa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){wa[t]=new Sl(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];wa[e]=new Sl(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){wa[t]=new Sl(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){wa[t]=new Sl(t,2,!1,t,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(t){wa[t]=new Sl(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){wa[t]=new Sl(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){wa[t]=new Sl(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){wa[t]=new Sl(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){wa[t]=new Sl(t,5,!1,t.toLowerCase(),null,!1,!1)});var tk=/[\-:]([a-z])/g;function rk(t){return t[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(t){var e=t.replace(tk,rk);wa[e]=new Sl(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(tk,rk);wa[e]=new Sl(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(tk,rk);wa[e]=new Sl(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){wa[t]=new Sl(t,1,!1,t.toLowerCase(),null,!1,!1)});wa.xlinkHref=new Sl("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){wa[t]=new Sl(t,1,!1,t.toLowerCase(),null,!0,!0)});function ik(t,e,r,i){var n=wa.hasOwnProperty(e)?wa[e]:null;(n!==null?n.type!==0:i||!(2c||n[o]!==s[c]){var f=` +`+n[o].replace(" at new "," at ");return t.displayName&&f.includes("")&&(f=f.replace("",t.displayName)),f}while(1<=o&&0<=c);break}}}finally{jR=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Pv(t):""}function Vie(t){switch(t.tag){case 5:return Pv(t.type);case 16:return Pv("Lazy");case 13:return Pv("Suspense");case 19:return Pv("SuspenseList");case 0:case 2:case 15:return t=WR(t.type,!1),t;case 11:return t=WR(t.type.render,!1),t;case 1:return t=WR(t.type,!0),t;default:return""}}function d6(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case G_:return"Fragment";case q_:return"Portal";case u6:return"Profiler";case nk:return"StrictMode";case h6:return"Suspense";case f6:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case WU:return(t.displayName||"Context")+".Consumer";case jU:return(t._context.displayName||"Context")+".Provider";case sk:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ok:return e=t.displayName||null,e!==null?e:d6(t.type)||"Memo";case wA:e=t._payload,t=t._init;try{return d6(t(e))}catch{}}return null}function jie(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return d6(e);case 8:return e===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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function FA(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $U(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Wie(t){var e=$U(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return n.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function d3(t){t._valueTracker||(t._valueTracker=Wie(t))}function qU(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),i="";return t&&(i=$U(t)?t.checked?"true":"false":t.value),t=i,t!==r?(e.setValue(t),!0):!1}function V3(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function p6(t,e){var r=e.checked;return xs({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Nz(t,e){var r=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;r=FA(e.value!=null?e.value:r),t._wrapperState={initialChecked:i,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function GU(t,e){e=e.checked,e!=null&&ik(t,"checked",e,!1)}function A6(t,e){GU(t,e);var r=FA(e.value),i=e.type;if(r!=null)i==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?m6(t,e.type,r):e.hasOwnProperty("defaultValue")&&m6(t,e.type,FA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function zz(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function m6(t,e,r){(e!=="number"||V3(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Cv=Array.isArray;function ny(t,e,r,i){if(t=t.options,e){e={};for(var n=0;n"+e.valueOf().toString()+"",e=p3.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function jv(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var kv={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},Hie=["Webkit","ms","Moz","O"];Object.keys(kv).forEach(function(t){Hie.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),kv[e]=kv[t]})});function QU(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||kv.hasOwnProperty(t)&&kv[t]?(""+e).trim():e+"px"}function KU(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var i=r.indexOf("--")===0,n=QU(r,e[r],i);r==="float"&&(r="cssFloat"),i?t.setProperty(r,n):t[r]=n}}var $ie=xs({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 y6(t,e){if(e){if($ie[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Dt(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Dt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Dt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Dt(62))}}function x6(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 v6=null;function ak(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var b6=null,sy=null,oy=null;function jz(t){if(t=ob(t)){if(typeof b6!="function")throw Error(Dt(280));var e=t.stateNode;e&&(e=AE(e),b6(t.stateNode,t.type,e))}}function JU(t){sy?oy?oy.push(t):oy=[t]:sy=t}function e7(){if(sy){var t=sy,e=oy;if(oy=sy=null,jz(t),e)for(t=0;t>>=0,t===0?32:31-(rne(t)/ine|0)|0}var A3=64,m3=4194304;function Iv(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function $3(t,e){var r=t.pendingLanes;if(r===0)return 0;var i=0,n=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var c=o&~n;c!==0?i=Iv(c):(s&=o,s!==0&&(i=Iv(s)))}else o=r&~n,o!==0?i=Iv(o):s!==0&&(i=Iv(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&n)&&(n=i&-i,s=e&-e,n>=s||n===16&&(s&4194240)!==0))return e;if(i&4&&(i|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0r;r++)e.push(t);return e}function nb(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Nh(e),t[e]=r}function ane(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0=Dv),Qz=" ",Kz=!1;function x7(t,e){switch(t){case"keyup":return One.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function v7(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Z_=!1;function Fne(t,e){switch(t){case"compositionend":return v7(e);case"keypress":return e.which!==32?null:(Kz=!0,Qz);case"textInput":return t=e.data,t===Qz&&Kz?null:t;default:return null}}function Nne(t,e){if(Z_)return t==="compositionend"||!Ak&&x7(t,e)?(t=_7(),k3=fk=MA=null,Z_=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=tU(r)}}function T7(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?T7(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function E7(){for(var t=window,e=V3();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=V3(t.document)}return e}function mk(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Gne(t){var e=E7(),r=t.focusedElem,i=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&T7(r.ownerDocument.documentElement,r)){if(i!==null&&mk(r)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var n=r.textContent.length,s=Math.min(i.start,n);i=i.end===void 0?s:Math.min(i.end,n),!t.extend&&s>i&&(n=i,i=s,s=n),n=rU(r,s);var o=rU(r,i);n&&o&&(t.rangeCount!==1||t.anchorNode!==n.node||t.anchorOffset!==n.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(n.node,n.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Y_=null,P6=null,Bv=null,C6=!1;function iU(t,e,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;C6||Y_==null||Y_!==V3(i)||(i=Y_,"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}),Bv&&Zv(Bv,i)||(Bv=i,i=Z3(P6,"onSelect"),0K_||(t.current=O6[K_],O6[K_]=null,K_--)}function $n(t,e){K_++,O6[K_]=t.current,t.current=e}var NA={},Ya=UA(NA),tc=UA(!1),Rm=NA;function hy(t,e){var r=t.type.contextTypes;if(!r)return NA;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var n={},s;for(s in r)n[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=n),n}function rc(t){return t=t.childContextTypes,t!=null}function X3(){Kn(tc),Kn(Ya)}function fU(t,e,r){if(Ya.current!==NA)throw Error(Dt(168));$n(Ya,e),$n(tc,r)}function O7(t,e,r){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return r;i=i.getChildContext();for(var n in i)if(!(n in e))throw Error(Dt(108,jie(t)||"Unknown",n));return xs({},r,i)}function Q3(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||NA,Rm=Ya.current,$n(Ya,t),$n(tc,tc.current),!0}function dU(t,e,r){var i=t.stateNode;if(!i)throw Error(Dt(169));r?(t=O7(t,e,Rm),i.__reactInternalMemoizedMergedChildContext=t,Kn(tc),Kn(Ya),$n(Ya,t)):Kn(tc),$n(tc,r)}var Yd=null,mE=!1,e6=!1;function B7(t){Yd===null?Yd=[t]:Yd.push(t)}function ise(t){mE=!0,B7(t)}function VA(){if(!e6&&Yd!==null){e6=!0;var t=0,e=Sn;try{var r=Yd;for(Sn=1;t>=o,n-=o,Xd=1<<32-Nh(e)+n|r<He?(ot=Ze,Ze=null):ot=Ze.sibling;var et=L(q,Ze,ee[He],oe);if(et===null){Ze===null&&(Ze=ot);break}t&&Ze&&et.alternate===null&&e(q,Ze),J=s(et,J,He),Re===null?ve=et:Re.sibling=et,Re=et,Ze=ot}if(He===ee.length)return r(q,Ze),cs&&Sm(q,He),ve;if(Ze===null){for(;HeHe?(ot=Ze,Ze=null):ot=Ze.sibling;var Lt=L(q,Ze,et.value,oe);if(Lt===null){Ze===null&&(Ze=ot);break}t&&Ze&&Lt.alternate===null&&e(q,Ze),J=s(Lt,J,He),Re===null?ve=Lt:Re.sibling=Lt,Re=Lt,Ze=ot}if(et.done)return r(q,Ze),cs&&Sm(q,He),ve;if(Ze===null){for(;!et.done;He++,et=ee.next())et=M(q,et.value,oe),et!==null&&(J=s(et,J,He),Re===null?ve=et:Re.sibling=et,Re=et);return cs&&Sm(q,He),ve}for(Ze=i(q,Ze);!et.done;He++,et=ee.next())et=N(Ze,q,He,et.value,oe),et!==null&&(t&&et.alternate!==null&&Ze.delete(et.key===null?He:et.key),J=s(et,J,He),Re===null?ve=et:Re.sibling=et,Re=et);return t&&Ze.forEach(function(Gt){return e(q,Gt)}),cs&&Sm(q,He),ve}function Q(q,J,ee,oe){if(typeof ee=="object"&&ee!==null&&ee.type===G_&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case f3:e:{for(var ve=ee.key,Re=J;Re!==null;){if(Re.key===ve){if(ve=ee.type,ve===G_){if(Re.tag===7){r(q,Re.sibling),J=n(Re,ee.props.children),J.return=q,q=J;break e}}else if(Re.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===wA&&mU(ve)===Re.type){r(q,Re.sibling),J=n(Re,ee.props),J.ref=Sv(q,Re,ee),J.return=q,q=J;break e}r(q,Re);break}else e(q,Re);Re=Re.sibling}ee.type===G_?(J=Im(ee.props.children,q.mode,oe,ee.key),J.return=q,q=J):(oe=U3(ee.type,ee.key,ee.props,null,q.mode,oe),oe.ref=Sv(q,J,ee),oe.return=q,q=oe)}return o(q);case q_:e:{for(Re=ee.key;J!==null;){if(J.key===Re)if(J.tag===4&&J.stateNode.containerInfo===ee.containerInfo&&J.stateNode.implementation===ee.implementation){r(q,J.sibling),J=n(J,ee.children||[]),J.return=q,q=J;break e}else{r(q,J);break}else e(q,J);J=J.sibling}J=l6(ee,q.mode,oe),J.return=q,q=J}return o(q);case wA:return Re=ee._init,Q(q,J,Re(ee._payload),oe)}if(Cv(ee))return V(q,J,ee,oe);if(xv(ee))return $(q,J,ee,oe);M3(q,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"?(ee=""+ee,J!==null&&J.tag===6?(r(q,J.sibling),J=n(J,ee),J.return=q,q=J):(r(q,J),J=a6(ee,q.mode,oe),J.return=q,q=J),o(q)):r(q,J)}return Q}var dy=U7(!0),V7=U7(!1),eE=UA(null),tE=null,ty=null,xk=null;function vk(){xk=ty=tE=null}function bk(t){var e=eE.current;Kn(eE),t._currentValue=e}function N6(t,e,r){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===r)break;t=t.return}}function ly(t,e){tE=t,xk=ty=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ec=!0),t.firstContext=null)}function zu(t){var e=t._currentValue;if(xk!==t)if(t={context:t,memoizedValue:e,next:null},ty===null){if(tE===null)throw Error(Dt(308));ty=t,tE.dependencies={lanes:0,firstContext:t}}else ty=ty.next=t;return e}var Mm=null;function wk(t){Mm===null?Mm=[t]:Mm.push(t)}function j7(t,e,r,i){var n=e.interleaved;return n===null?(r.next=r,wk(e)):(r.next=n.next,n.next=r),e.interleaved=r,tp(t,i)}function tp(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var SA=!1;function Sk(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W7(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Kd(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function LA(t,e,r){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,Ji&2){var n=i.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),i.pending=e,tp(t,r)}return n=i.interleaved,n===null?(e.next=e,wk(i)):(e.next=n.next,n.next=e),i.interleaved=e,tp(t,r)}function D3(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,r|=i,e.lanes=r,ck(t,r)}}function gU(t,e){var r=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var n=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?n=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?n=s=e:s=s.next=e}else n=s=e;r={baseState:i.baseState,firstBaseUpdate:n,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function rE(t,e,r,i){var n=t.updateQueue;SA=!1;var s=n.firstBaseUpdate,o=n.lastBaseUpdate,c=n.shared.pending;if(c!==null){n.shared.pending=null;var f=c,y=f.next;f.next=null,o===null?s=y:o.next=y,o=f;var b=t.alternate;b!==null&&(b=b.updateQueue,c=b.lastBaseUpdate,c!==o&&(c===null?b.firstBaseUpdate=y:c.next=y,b.lastBaseUpdate=f))}if(s!==null){var M=n.baseState;o=0,b=y=f=null,c=s;do{var L=c.lane,N=c.eventTime;if((i&L)===L){b!==null&&(b=b.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var V=t,$=c;switch(L=e,N=r,$.tag){case 1:if(V=$.payload,typeof V=="function"){M=V.call(N,M,L);break e}M=V;break e;case 3:V.flags=V.flags&-65537|128;case 0:if(V=$.payload,L=typeof V=="function"?V.call(N,M,L):V,L==null)break e;M=xs({},M,L);break e;case 2:SA=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,L=n.effects,L===null?n.effects=[c]:L.push(c))}else N={eventTime:N,lane:L,tag:c.tag,payload:c.payload,callback:c.callback,next:null},b===null?(y=b=N,f=M):b=b.next=N,o|=L;if(c=c.next,c===null){if(c=n.shared.pending,c===null)break;L=c,c=L.next,L.next=null,n.lastBaseUpdate=L,n.shared.pending=null}}while(!0);if(b===null&&(f=M),n.baseState=f,n.firstBaseUpdate=y,n.lastBaseUpdate=b,e=n.shared.interleaved,e!==null){n=e;do o|=n.lane,n=n.next;while(n!==e)}else s===null&&(n.shared.lanes=0);Dm|=o,t.lanes=o,t.memoizedState=M}}function _U(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;er?r:4,t(!0);var i=r6.transition;r6.transition={};try{t(!1),e()}finally{Sn=r,r6.transition=i}}function o9(){return Uu().memoizedState}function ase(t,e,r){var i=OA(t);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},a9(t))l9(e,r);else if(r=j7(t,e,r,i),r!==null){var n=wl();zh(r,t,i,n),c9(r,e,i)}}function lse(t,e,r){var i=OA(t),n={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(a9(t))l9(e,n);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,c=s(o,r);if(n.hasEagerState=!0,n.eagerState=c,Uh(c,o)){var f=e.interleaved;f===null?(n.next=n,wk(e)):(n.next=f.next,f.next=n),e.interleaved=n;return}}catch{}finally{}r=j7(t,e,n,i),r!==null&&(n=wl(),zh(r,t,i,n),c9(r,e,i))}}function a9(t){var e=t.alternate;return t===ys||e!==null&&e===ys}function l9(t,e){Fv=nE=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function c9(t,e,r){if(r&4194240){var i=e.lanes;i&=t.pendingLanes,r|=i,e.lanes=r,ck(t,r)}}var sE={readContext:zu,useCallback:qa,useContext:qa,useEffect:qa,useImperativeHandle:qa,useInsertionEffect:qa,useLayoutEffect:qa,useMemo:qa,useReducer:qa,useRef:qa,useState:qa,useDebugValue:qa,useDeferredValue:qa,useTransition:qa,useMutableSource:qa,useSyncExternalStore:qa,useId:qa,unstable_isNewReconciler:!1},cse={readContext:zu,useCallback:function(t,e){return Nf().memoizedState=[t,e===void 0?null:e],t},useContext:zu,useEffect:xU,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,B3(4194308,4,t9.bind(null,e,t),r)},useLayoutEffect:function(t,e){return B3(4194308,4,t,e)},useInsertionEffect:function(t,e){return B3(4,2,t,e)},useMemo:function(t,e){var r=Nf();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var i=Nf();return e=r!==void 0?r(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=ase.bind(null,ys,t),[i.memoizedState,t]},useRef:function(t){var e=Nf();return t={current:t},e.memoizedState=t},useState:yU,useDebugValue:kk,useDeferredValue:function(t){return Nf().memoizedState=t},useTransition:function(){var t=yU(!1),e=t[0];return t=ose.bind(null,t[1]),Nf().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var i=ys,n=Nf();if(cs){if(r===void 0)throw Error(Dt(407));r=r()}else{if(r=e(),ra===null)throw Error(Dt(349));Lm&30||G7(i,e,r)}n.memoizedState=r;var s={value:r,getSnapshot:e};return n.queue=s,xU(Y7.bind(null,i,s,t),[t]),i.flags|=2048,rb(9,Z7.bind(null,i,s,r,e),void 0,null),r},useId:function(){var t=Nf(),e=ra.identifierPrefix;if(cs){var r=Qd,i=Xd;r=(i&~(1<<32-Nh(i)-1)).toString(32)+r,e=":"+e+"R"+r,r=eb++,0<\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=o.createElement(r,{is:i.is}):(t=o.createElement(r),r==="select"&&(o=t,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):t=o.createElementNS(t,r),t[zf]=e,t[Qv]=i,y9(t,e,!1,!1),e.stateNode=t;e:{switch(o=x6(r,i),r){case"dialog":Qn("cancel",t),Qn("close",t),n=i;break;case"iframe":case"object":case"embed":Qn("load",t),n=i;break;case"video":case"audio":for(n=0;nmy&&(e.flags|=128,i=!0,Tv(s,!1),e.lanes=4194304)}else{if(!i)if(t=iE(o),t!==null){if(e.flags|=128,i=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Tv(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!cs)return Ga(e),null}else 2*no()-s.renderingStartTime>my&&r!==1073741824&&(e.flags|=128,i=!0,Tv(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=no(),e.sibling=null,r=_s.current,$n(_s,i?r&1|2:r&1),e):(Ga(e),null);case 22:case 23:return Nk(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Yc&1073741824&&(Ga(e),e.subtreeFlags&6&&(e.flags|=8192)):Ga(e),null;case 24:return null;case 25:return null}throw Error(Dt(156,e.tag))}function gse(t,e){switch(_k(e),e.tag){case 1:return rc(e.type)&&X3(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return py(),Kn(tc),Kn(Ya),Mk(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Ek(e),null;case 13:if(Kn(_s),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Dt(340));fy()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Kn(_s),null;case 4:return py(),null;case 10:return bk(e.type._context),null;case 22:case 23:return Nk(),null;case 24:return null;default:return null}}var C3=!1,Za=!1,_se=typeof WeakSet=="function"?WeakSet:Set,fr=null;function ry(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(i){Ds(t,e,i)}else r.current=null}function G6(t,e,r){try{r()}catch(i){Ds(t,e,i)}}var RU=!1;function yse(t,e){if(I6=q3,t=E7(),mk(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.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 e}var o=0,c=-1,f=-1,y=0,b=0,M=t,L=null;t:for(;;){for(var N;M!==r||n!==0&&M.nodeType!==3||(c=o+n),M!==s||i!==0&&M.nodeType!==3||(f=o+i),M.nodeType===3&&(o+=M.nodeValue.length),(N=M.firstChild)!==null;)L=M,M=N;for(;;){if(M===t)break t;if(L===r&&++y===n&&(c=o),L===s&&++b===i&&(f=o),(N=M.nextSibling)!==null)break;M=L,L=M.parentNode}M=N}r=c===-1||f===-1?null:{start:c,end:f}}else r=null}r=r||{start:0,end:0}}else r=null;for(R6={focusedElem:t,selectionRange:r},q3=!1,fr=e;fr!==null;)if(e=fr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,fr=t;else for(;fr!==null;){e=fr;try{var V=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(V!==null){var $=V.memoizedProps,Q=V.memoizedState,q=e.stateNode,J=q.getSnapshotBeforeUpdate(e.elementType===e.type?$:Oh(e.type,$),Q);q.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var ee=e.stateNode.containerInfo;ee.nodeType===1?ee.textContent="":ee.nodeType===9&&ee.documentElement&&ee.removeChild(ee.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Dt(163))}}catch(oe){Ds(e,e.return,oe)}if(t=e.sibling,t!==null){t.return=e.return,fr=t;break}fr=e.return}return V=RU,RU=!1,V}function Nv(t,e,r){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var n=i=i.next;do{if((n.tag&t)===t){var s=n.destroy;n.destroy=void 0,s!==void 0&&G6(e,r,s)}n=n.next}while(n!==i)}}function yE(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var i=r.create;r.destroy=i()}r=r.next}while(r!==e)}}function Z6(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function b9(t){var e=t.alternate;e!==null&&(t.alternate=null,b9(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[zf],delete e[Qv],delete e[D6],delete e[tse],delete e[rse])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function w9(t){return t.tag===5||t.tag===3||t.tag===4}function kU(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||w9(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Y6(t,e,r){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Y3));else if(i!==4&&(t=t.child,t!==null))for(Y6(t,e,r),t=t.sibling;t!==null;)Y6(t,e,r),t=t.sibling}function X6(t,e,r){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(X6(t,e,r),t=t.sibling;t!==null;)X6(t,e,r),t=t.sibling}var va=null,Bh=!1;function bA(t,e,r){for(r=r.child;r!==null;)S9(t,e,r),r=r.sibling}function S9(t,e,r){if(Uf&&typeof Uf.onCommitFiberUnmount=="function")try{Uf.onCommitFiberUnmount(hE,r)}catch{}switch(r.tag){case 5:Za||ry(r,e);case 6:var i=va,n=Bh;va=null,bA(t,e,r),va=i,Bh=n,va!==null&&(Bh?(t=va,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):va.removeChild(r.stateNode));break;case 18:va!==null&&(Bh?(t=va,r=r.stateNode,t.nodeType===8?JR(t.parentNode,r):t.nodeType===1&&JR(t,r),qv(t)):JR(va,r.stateNode));break;case 4:i=va,n=Bh,va=r.stateNode.containerInfo,Bh=!0,bA(t,e,r),va=i,Bh=n;break;case 0:case 11:case 14:case 15:if(!Za&&(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)&&G6(r,e,o),n=n.next}while(n!==i)}bA(t,e,r);break;case 1:if(!Za&&(ry(r,e),i=r.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(c){Ds(r,e,c)}bA(t,e,r);break;case 21:bA(t,e,r);break;case 22:r.mode&1?(Za=(i=Za)||r.memoizedState!==null,bA(t,e,r),Za=i):bA(t,e,r);break;default:bA(t,e,r)}}function LU(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new _se),e.forEach(function(i){var n=Pse.bind(null,t,i);r.has(i)||(r.add(i),i.then(n,n))})}}function Dh(t,e){var r=e.deletions;if(r!==null)for(var i=0;in&&(n=o),i&=~s}if(i=n,i=no()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*vse(i/1960))-i,10t?16:t,PA===null)var i=!1;else{if(t=PA,PA=null,lE=0,Ji&6)throw Error(Dt(331));var n=Ji;for(Ji|=4,fr=t.current;fr!==null;){var s=fr,o=s.child;if(fr.flags&16){var c=s.deletions;if(c!==null){for(var f=0;fno()-Bk?Cm(t,0):Ok|=r),ic(t,e)}function k9(t,e){e===0&&(t.mode&1?(e=m3,m3<<=1,!(m3&130023424)&&(m3=4194304)):e=1);var r=wl();t=tp(t,e),t!==null&&(nb(t,e,r),ic(t,r))}function Mse(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),k9(t,r)}function Pse(t,e){var r=0;switch(t.tag){case 13:var i=t.stateNode,n=t.memoizedState;n!==null&&(r=n.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(Dt(314))}i!==null&&i.delete(e),k9(t,r)}var L9;L9=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||tc.current)ec=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return ec=!1,Ase(t,e,r);ec=!!(t.flags&131072)}else ec=!1,cs&&e.flags&1048576&&F7(e,J3,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;F3(t,e),t=e.pendingProps;var n=hy(e,Ya.current);ly(e,r),n=Ck(null,e,i,t,n,r);var s=Ik();return e.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,rc(i)?(s=!0,Q3(e)):s=!1,e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,Sk(e),n.updater=_E,e.stateNode=n,n._reactInternals=e,U6(e,i,t,r),e=W6(null,e,i,!0,s,r)):(e.tag=0,cs&&s&&gk(e),bl(null,e,n,r),e=e.child),e;case 16:i=e.elementType;e:{switch(F3(t,e),t=e.pendingProps,n=i._init,i=n(i._payload),e.type=i,n=e.tag=Ise(i),t=Oh(i,t),n){case 0:e=j6(null,e,i,t,r);break e;case 1:e=PU(null,e,i,t,r);break e;case 11:e=EU(null,e,i,t,r);break e;case 14:e=MU(null,e,i,Oh(i.type,t),r);break e}throw Error(Dt(306,i,""))}return e;case 0:return i=e.type,n=e.pendingProps,n=e.elementType===i?n:Oh(i,n),j6(t,e,i,n,r);case 1:return i=e.type,n=e.pendingProps,n=e.elementType===i?n:Oh(i,n),PU(t,e,i,n,r);case 3:e:{if(m9(e),t===null)throw Error(Dt(387));i=e.pendingProps,s=e.memoizedState,n=s.element,W7(t,e),rE(e,i,null,r);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){n=Ay(Error(Dt(423)),e),e=CU(t,e,i,r,n);break e}else if(i!==n){n=Ay(Error(Dt(424)),e),e=CU(t,e,i,r,n);break e}else for(Xc=kA(e.stateNode.containerInfo.firstChild),Qc=e,cs=!0,Fh=null,r=V7(e,null,i,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(fy(),i===n){e=rp(t,e,r);break e}bl(t,e,i,r)}e=e.child}return e;case 5:return H7(e),t===null&&F6(e),i=e.type,n=e.pendingProps,s=t!==null?t.memoizedProps:null,o=n.children,k6(i,n)?o=null:s!==null&&k6(i,s)&&(e.flags|=32),A9(t,e),bl(t,e,o,r),e.child;case 6:return t===null&&F6(e),null;case 13:return g9(t,e,r);case 4:return Tk(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=dy(e,null,i,r):bl(t,e,i,r),e.child;case 11:return i=e.type,n=e.pendingProps,n=e.elementType===i?n:Oh(i,n),EU(t,e,i,n,r);case 7:return bl(t,e,e.pendingProps,r),e.child;case 8:return bl(t,e,e.pendingProps.children,r),e.child;case 12:return bl(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(i=e.type._context,n=e.pendingProps,s=e.memoizedProps,o=n.value,$n(eE,i._currentValue),i._currentValue=o,s!==null)if(Uh(s.value,o)){if(s.children===n.children&&!tc.current){e=rp(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var c=s.dependencies;if(c!==null){o=s.child;for(var f=c.firstContext;f!==null;){if(f.context===i){if(s.tag===1){f=Kd(-1,r&-r),f.tag=2;var y=s.updateQueue;if(y!==null){y=y.shared;var b=y.pending;b===null?f.next=f:(f.next=b.next,b.next=f),y.pending=f}}s.lanes|=r,f=s.alternate,f!==null&&(f.lanes|=r),N6(s.return,r,e),c.lanes|=r;break}f=f.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Dt(341));o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),N6(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}bl(t,e,n.children,r),e=e.child}return e;case 9:return n=e.type,i=e.pendingProps.children,ly(e,r),n=zu(n),i=i(n),e.flags|=1,bl(t,e,i,r),e.child;case 14:return i=e.type,n=Oh(i,e.pendingProps),n=Oh(i.type,n),MU(t,e,i,n,r);case 15:return d9(t,e,e.type,e.pendingProps,r);case 17:return i=e.type,n=e.pendingProps,n=e.elementType===i?n:Oh(i,n),F3(t,e),e.tag=1,rc(i)?(t=!0,Q3(e)):t=!1,ly(e,r),u9(e,i,n),U6(e,i,n,r),W6(null,e,i,!0,t,r);case 19:return _9(t,e,r);case 22:return p9(t,e,r)}throw Error(Dt(156,e.tag))};function D9(t,e){return a7(t,e)}function Cse(t,e,r,i){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 Fu(t,e,r,i){return new Cse(t,e,r,i)}function Uk(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ise(t){if(typeof t=="function")return Uk(t)?1:0;if(t!=null){if(t=t.$$typeof,t===sk)return 11;if(t===ok)return 14}return 2}function BA(t,e){var r=t.alternate;return r===null?(r=Fu(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function U3(t,e,r,i,n,s){var o=2;if(i=t,typeof t=="function")Uk(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case G_:return Im(r.children,n,s,e);case nk:o=8,n|=8;break;case u6:return t=Fu(12,r,e,n|2),t.elementType=u6,t.lanes=s,t;case h6:return t=Fu(13,r,e,n),t.elementType=h6,t.lanes=s,t;case f6:return t=Fu(19,r,e,n),t.elementType=f6,t.lanes=s,t;case HU:return vE(r,n,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case jU:o=10;break e;case WU:o=9;break e;case sk:o=11;break e;case ok:o=14;break e;case wA:o=16,i=null;break e}throw Error(Dt(130,t==null?t:typeof t,""))}return e=Fu(o,r,e,n),e.elementType=t,e.type=i,e.lanes=s,e}function Im(t,e,r,i){return t=Fu(7,t,i,e),t.lanes=r,t}function vE(t,e,r,i){return t=Fu(22,t,i,e),t.elementType=HU,t.lanes=r,t.stateNode={isHidden:!1},t}function a6(t,e,r){return t=Fu(6,t,null,e),t.lanes=r,t}function l6(t,e,r){return e=Fu(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Rse(t,e,r,i,n){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$R(0),this.expirationTimes=$R(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$R(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function Vk(t,e,r,i,n,s,o,c,f){return t=new Rse(t,e,r,c,f),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Fu(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sk(s),t}function kse(t,e,r){var i=3{"use strict";function z9(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(z9)}catch(t){console.error(t)}}z9(),U9.exports=N9()});var qk=Hr($k=>{"use strict";var V9=EE();$k.createRoot=V9.createRoot,$k.hydrateRoot=V9.hydrateRoot;var zEe});var iV=Hr((rL,iL)=>{(function(t,e){typeof rL=="object"&&typeof iL<"u"?iL.exports=e():(t=typeof globalThis<"u"?globalThis:t||self,t.maplibregl=e())})(rL,function(){"use strict";var t,e,r;function i(s,o){if(!t)t=o;else if(!e)e=o;else{var c="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",f={};t(f),r=o(f),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([c],{type:"text/javascript"})))}}i(["exports"],function(s){"use strict";function o(u,a,h,_){return new(h||(h=Promise))(function(w,I){function R(W){try{z(_.next(W))}catch(Z){I(Z)}}function O(W){try{z(_.throw(W))}catch(Z){I(Z)}}function z(W){var Z;W.done?w(W.value):(Z=W.value,Z instanceof h?Z:new h(function(K){K(Z)})).then(R,O)}z((_=_.apply(u,a||[])).next())})}function c(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}typeof SuppressedError=="function"&&SuppressedError;var f=y;function y(u,a){this.x=u,this.y=a}y.prototype={clone:function(){return new y(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),_=h*this.x+a*this.y;return this.x=a*this.x-h*this.y,this.y=_,this},_rotateAround:function(u,a){var h=Math.cos(u),_=Math.sin(u),w=a.y+_*(this.x-a.x)+h*(this.y-a.y);return this.x=a.x+h*(this.x-a.x)-_*(this.y-a.y),this.y=w,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},y.convert=function(u){return u instanceof y?u:Array.isArray(u)?new y(u[0],u[1]):u};var b=c(f),M=L;function L(u,a,h,_){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)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=a,this.p2x=h,this.p2y=_}L.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,_=0;_<8;_++){var w=this.sampleCurveX(h)-u;if(Math.abs(w)w?R=h:O=h,h=.5*(O-R)+R;return h},solve:function(u,a){return this.sampleCurveY(this.solveCurveX(u,a))}};var N=c(M);let V,$;function Q(){return V==null&&(V=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),V}function q(){if($==null&&($=!1,Q())){let a=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(a){for(let _=0;_<5*5;_++){let w=4*_;a.fillStyle=`rgb(${w},${w+1},${w+2})`,a.fillRect(_%5,Math.floor(_/5),1,1)}let h=a.getImageData(0,0,5,5).data;for(let _=0;_<5*5*4;_++)if(_%4!=3&&h[_]!==_){$=!0;break}}}return $||!1}function J(u,a,h,_){let w=new N(u,a,h,_);return function(I){return w.solve(I)}}let ee=J(.25,.1,.25,1);function oe(u,a,h){return Math.min(h,Math.max(a,u))}function ve(u,a,h){let _=h-a,w=((u-a)%_+_)%_+a;return w===a?h:w}function Re(u,...a){for(let h of a)for(let _ in h)u[_]=h[_];return u}let Ze=1;function He(u,a,h){let _={};for(let w in u)_[w]=a.call(h||this,u[w],w,u);return _}function ot(u,a,h){let _={};for(let w in u)a.call(h||this,u[w],w,u)&&(_[w]=u[w]);return _}function et(u){return Array.isArray(u)?u.map(et):typeof u=="object"&&u?He(u,et):u}let Lt={};function Gt(u){Lt[u]||(typeof console<"u"&&console.warn(u),Lt[u]=!0)}function qt(u,a,h){return(h.y-u.y)*(a.x-u.x)>(a.y-u.y)*(h.x-u.x)}function Ar(u){let a=0;for(let h,_,w=0,I=u.length,R=I-1;w"u")throw new Error("VideoFrame not supported");let I=new VideoFrame(u,{timestamp:0});try{let R=I?.format;if(!R||!R.startsWith("BGR")&&!R.startsWith("RGB"))throw new Error(`Unrecognized format ${R}`);let O=R.startsWith("BGR"),z=new Uint8ClampedArray(_*w*4);if(yield I.copyTo(z,function(W,Z,K,re,ae){let ce=4*Math.max(-Z,0),_e=(Math.max(0,K)-K)*re*4+ce,Pe=4*re,ke=Math.max(0,Z),We=Math.max(0,K);return{rect:{x:ke,y:We,width:Math.min(W.width,Z+re)-ke,height:Math.min(W.height,K+ae)-We},layout:[{offset:_e,stride:Pe}]}}(u,a,h,_,w)),O)for(let W=0;WcancelAnimationFrame(a)}},getImageData(u,a=0){return this.getImageCanvasContext(u).getImageData(-a,-a,u.width+2*a,u.height+2*a)},getImageCanvasContext(u){let a=window.document.createElement("canvas"),h=a.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return a.width=u.width,a.height=u.height,h.drawImage(u,0,0,u.width,u.height),h},resolveURL:u=>(qs||(qs=document.createElement("a")),qs.href=u,qs.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ll==null&&(ll=matchMedia("(prefers-reduced-motion: reduce)")),ll.matches)}},Lc={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class on extends Error{constructor(a,h,_,w){super(`AJAXError: ${h} (${a}): ${_}`),this.status=a,this.statusText=h,this.url=_,this.body=w}}let is=ri()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Di=u=>Lc.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf("://"))];function ns(u,a){let h=new AbortController,_=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:is(),signal:h.signal}),w=!1,I=!1;return u.type==="json"&&_.headers.set("Accept","application/json"),I||fetch(_).then(R=>R.ok?(O=>{(u.type==="arrayBuffer"||u.type==="image"?O.arrayBuffer():u.type==="json"?O.json():O.text()).then(z=>{I||(w=!0,a(null,z,O.headers.get("Cache-Control"),O.headers.get("Expires")))}).catch(z=>{I||a(new Error(z.message))})})(R):R.blob().then(O=>a(new on(R.status,R.statusText,u.url,O)))).catch(R=>{R.code!==20&&a(new Error(R.message))}),{cancel:()=>{I=!0,w||h.abort()}}}let Wo=function(u,a){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(ri()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,a);if(!ri())return(Di(u.url)||ns)(u,a)}if(!(/^file:/.test(h=u.url)||/^file:/.test(is())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return ns(u,a);if(ri()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",u,a,void 0,!0)}var h;return function(_,w){let I=new XMLHttpRequest;I.open(_.method||"GET",_.url,!0),_.type!=="arrayBuffer"&&_.type!=="image"||(I.responseType="arraybuffer");for(let R in _.headers)I.setRequestHeader(R,_.headers[R]);return _.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=_.credentials==="include",I.onerror=()=>{w(new Error(I.statusText))},I.onload=()=>{if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let R=I.response;if(_.type==="json")try{R=JSON.parse(I.response)}catch(O){return w(O)}w(null,R,I.getResponseHeader("Cache-Control"),I.getResponseHeader("Expires"))}else{let R=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});w(new on(I.status,I.statusText,_.url,R))}},I.send(_.body),{cancel:()=>I.abort()}}(u,a)},cl=function(u,a){return Wo(Re(u,{type:"arrayBuffer"}),a)};function Co(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 La(u,a,h){h[u]&&h[u].indexOf(a)!==-1||(h[u]=h[u]||[],h[u].push(a))}function la(u,a,h){if(h&&h[u]){let _=h[u].indexOf(a);_!==-1&&h[u].splice(_,1)}}class fs{constructor(a,h={}){Re(this,h),this.type=a}}class po extends fs{constructor(a,h={}){super("error",Re({error:a},h))}}class zl{on(a,h){return this._listeners=this._listeners||{},La(a,h,this._listeners),this}off(a,h){return la(a,h,this._listeners),la(a,h,this._oneTimeListeners),this}once(a,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},La(a,h,this._oneTimeListeners),this):new Promise(_=>this.once(a,_))}fire(a,h){typeof a=="string"&&(a=new fs(a,h||{}));let _=a.type;if(this.listens(_)){a.target=this;let w=this._listeners&&this._listeners[_]?this._listeners[_].slice():[];for(let O of w)O.call(this,a);let I=this._oneTimeListeners&&this._oneTimeListeners[_]?this._oneTimeListeners[_].slice():[];for(let O of I)la(_,O,this._oneTimeListeners),O.call(this,a);let R=this._eventedParent;R&&(Re(a,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),R.fire(a))}else a instanceof po&&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 ct={$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"},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}},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 ds=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function vn(u,a){let h={};for(let _ in u)_!=="ref"&&(h[_]=u[_]);return ds.forEach(_=>{_ in a&&(h[_]=a[_])}),h}function Si(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 xe=[Oa,Ct,Vr,br,Gs,be,Ba,Te(Rr),te,ne,fe];function Be(u,a){if(a.kind==="error")return null;if(u.kind==="array"){if(a.kind==="array"&&(a.N===0&&a.itemType.kind==="value"||!Be(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 xe)if(!Be(h,a))return null}}return`Expected ${Ee(u)} but found ${Ee(a)} instead.`}function Ce(u,a){return a.some(h=>h.kind===u.kind)}function je(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 ht(u,a){return u.kind==="array"&&a.kind==="array"?u.itemType.kind===a.itemType.kind&&typeof u.N=="number":u.kind===a.kind}let ft=.96422,pt=.82521,ur=4/29,Sr=6/29,er=3*Sr*Sr,hr=Sr*Sr*Sr,Cr=Math.PI/180,Ii=180/Math.PI;function ji(u){return(u%=360)<0&&(u+=360),u}function pi([u,a,h,_]){let w,I,R=Zn((.2225045*(u=Xr(u))+.7168786*(a=Xr(a))+.0606169*(h=Xr(h)))/1);u===a&&a===h?w=I=R:(w=Zn((.4360747*u+.3850649*a+.1430804*h)/ft),I=Zn((.0139322*u+.0971045*a+.7141733*h)/pt));let O=116*R-16;return[O<0?0:O,500*(w-R),200*(R-I),_]}function Xr(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function Zn(u){return u>hr?Math.pow(u,1/3):u/er+ur}function Ni([u,a,h,_]){let w=(u+16)/116,I=isNaN(a)?w:w+a/500,R=isNaN(h)?w:w-h/200;return w=1*ss(w),I=ft*ss(I),R=pt*ss(R),[Tn(3.1338561*I-1.6168667*w-.4906146*R),Tn(-.9787684*I+1.9161415*w+.033454*R),Tn(.0719453*I-.2289914*w+1.4052427*R),_]}function Tn(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function ss(u){return u>Sr?u*u*u:er*(u-ur)}function ua(u){return parseInt(u.padEnd(2,u),16)/255}function W0(u,a){return Vl(a?u/100:u,0,1)}function Vl(u,a,h){return Math.min(Math.max(a,u),h)}function Cs(u){return!u.some(Number.isNaN)}let _h={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 _i{constructor(a,h,_,w=1,I=!0){this.r=a,this.g=h,this.b=_,this.a=w,I||(this.r*=w,this.g*=w,this.b*=w,w||this.overwriteGetter("rgb",[a,h,_,w]))}static parse(a){if(a instanceof _i)return a;if(typeof a!="string")return;let h=function(_){if((_=_.toLowerCase().trim())==="transparent")return[0,0,0,0];let w=_h[_];if(w){let[R,O,z]=w;return[R/255,O/255,z/255,1]}if(_.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(_)){let R=_.length<6?1:2,O=1;return[ua(_.slice(O,O+=R)),ua(_.slice(O,O+=R)),ua(_.slice(O,O+=R)),ua(_.slice(O,O+R)||"ff")]}if(_.startsWith("rgb")){let R=_.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(R){let[O,z,W,Z,K,re,ae,ce,_e,Pe,ke,We]=R,Oe=[Z||" ",ae||" ",Pe].join("");if(Oe===" "||Oe===" /"||Oe===",,"||Oe===",,,"){let $e=[W,re,_e].join(""),Je=$e==="%%%"?100:$e===""?255:0;if(Je){let At=[Vl(+z/Je,0,1),Vl(+K/Je,0,1),Vl(+ce/Je,0,1),ke?W0(+ke,We):1];if(Cs(At))return At}}return}}let I=_.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(I){let[R,O,z,W,Z,K,re,ae,ce]=I,_e=[z||" ",Z||" ",re].join("");if(_e===" "||_e===" /"||_e===",,"||_e===",,,"){let Pe=[+O,Vl(+W,0,100),Vl(+K,0,100),ae?W0(+ae,ce):1];if(Cs(Pe))return function([ke,We,Oe,$e]){function Je(At){let Ht=(At+ke/30)%12,sr=We*Math.min(Oe,1-Oe);return Oe-sr*Math.max(-1,Math.min(Ht-3,9-Ht,1))}return ke=ji(ke),We/=100,Oe/=100,[Je(0),Je(8),Je(4),$e]}(Pe)}}}(a);return h?new _i(...h,!1):void 0}get rgb(){let{r:a,g:h,b:_,a:w}=this,I=w||1/0;return this.overwriteGetter("rgb",[a/I,h/I,_/I,w])}get hcl(){return this.overwriteGetter("hcl",function(a){let[h,_,w,I]=pi(a),R=Math.sqrt(_*_+w*w);return[Math.round(1e4*R)?ji(Math.atan2(w,_)*Ii):NaN,R,h,I]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pi(this.rgb))}overwriteGetter(a,h){return Object.defineProperty(this,a,{value:h}),h}toString(){let[a,h,_,w]=this.rgb;return`rgba(${[a,h,_].map(I=>Math.round(255*I)).join(",")},${w})`}}_i.black=new _i(0,0,0,1),_i.white=new _i(1,1,1,1),_i.transparent=new _i(0,0,0,0),_i.red=new _i(1,0,0,1);class Fa{constructor(a,h,_){this.sensitivity=a?h?"variant":"case":h?"accent":"base",this.locale=_,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 Dc{constructor(a,h,_,w,I){this.text=a,this.image=h,this.scale=_,this.fontStack=w,this.textColor=I}}class An{constructor(a){this.sections=a}static fromString(a){return new An([new Dc(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 An?a:An.fromString(a)}toString(){return this.sections.length===0?"":this.sections.map(a=>a.text).join("")}}class Fn{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Fn)return a;if(typeof a=="number")return new Fn([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 Fn(a)}}toString(){return JSON.stringify(this.values)}}let H0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $o{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof $o)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?_===void 0||typeof _=="number"&&_>=0&&_<=1?null:`Invalid rgba value [${[u,a,h,_].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof _=="number"?[u,a,h,_]:[u,a,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jl(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof _i||u instanceof Fa||u instanceof An||u instanceof Fn||u instanceof $o||u instanceof Yn)return!0;if(Array.isArray(u)){for(let a of u)if(!jl(a))return!1;return!0}if(typeof u=="object"){for(let a in u)if(!jl(u[a]))return!1;return!0}return!1}function an(u){if(u===null)return Oa;if(typeof u=="string")return Vr;if(typeof u=="boolean")return br;if(typeof u=="number")return Ct;if(u instanceof _i)return Gs;if(u instanceof Fa)return ca;if(u instanceof An)return be;if(u instanceof Fn)return te;if(u instanceof $o)return fe;if(u instanceof Yn)return ne;if(Array.isArray(u)){let a=u.length,h;for(let _ of u){let w=an(_);if(h){if(h===w)continue;h=Rr;break}h=w}return Te(h||Rr,a)}return Ba}function Ti(u){let a=typeof u;return u===null?"":a==="string"||a==="number"||a==="boolean"?String(u):u instanceof _i||u instanceof An||u instanceof Fn||u instanceof $o||u instanceof Yn?u.toString():JSON.stringify(u)}class Wl{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(!jl(a[1]))return h.error("invalid value");let _=a[1],w=an(_),I=h.expectedType;return w.kind!=="array"||w.N!==0||!I||I.kind!=="array"||typeof I.N=="number"&&I.N!==0||(w=I),new Wl(w,_)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class mn{constructor(a){this.name="ExpressionEvaluationError",this.message=a}toJSON(){return this.message}}let bu={string:Vr,number:Ct,boolean:br,object:Ba};class os{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 _,w=1,I=a[0];if(I==="array"){let O,z;if(a.length>2){let W=a[1];if(typeof W!="string"||!(W in bu)||W==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);O=bu[W],w++}else O=Rr;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);z=a[2],w++}_=Te(O,z)}else{if(!bu[I])throw new Error(`Types doesn't contain name = ${I}`);_=bu[I]}let R=[];for(;wa.outputDefined())}}let Zp={"to-boolean":br,"to-color":Gs,"to-number":Ct,"to-string":Vr};class Hl{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[0];if(!Zp[_])throw new Error(`Can't parse ${_} as it is not part of the known types`);if((_==="to-boolean"||_==="to-string")&&a.length!==2)return h.error("Expected one argument.");let w=Zp[_],I=[];for(let R=1;R4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:mo(h[0],h[1],h[2],h[3]),!_))return new _i(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new mn(_||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(let _ of this.args){h=_.evaluate(a);let w=Fn.parse(h);if(w)return w}throw new mn(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(let _ of this.args){h=_.evaluate(a);let w=$o.parse(h);if(w)return w}throw new mn(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(let _ of this.args){if(h=_.evaluate(a),h===null)return 0;let w=Number(h);if(!isNaN(w))return w}throw new mn(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return An.fromString(Ti(this.args[0].evaluate(a)));case"resolvedImage":return Yn.fromString(Ti(this.args[0].evaluate(a)));default:return Ti(this.args[0].evaluate(a))}}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}let Ed=["Unknown","Point","LineString","Polygon"];class Md{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"?Ed[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]=_i.parse(a)),h}}class Pd{constructor(a,h,_=[],w,I=new Ul,R=[]){this.registry=a,this.path=_,this.key=_.map(O=>`[${O}]`).join(""),this.scope=I,this.errors=R,this.expectedType=w,this._isConstant=h}parse(a,h,_,w,I={}){return h?this.concat(h,_,w)._parse(a,I):this._parse(a,I)}_parse(a,h){function _(w,I,R){return R==="assert"?new os(I,[w]):R==="coerce"?new Hl(I,[w]):w}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 w=a[0];if(typeof w!="string")return this.error(`Expression name must be a string, but found ${typeof w} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let I=this.registry[w];if(I){let R=I.parse(a,this);if(!R)return null;if(this.expectedType){let O=this.expectedType,z=R.type;if(O.kind!=="string"&&O.kind!=="number"&&O.kind!=="boolean"&&O.kind!=="object"&&O.kind!=="array"||z.kind!=="value")if(O.kind!=="color"&&O.kind!=="formatted"&&O.kind!=="resolvedImage"||z.kind!=="value"&&z.kind!=="string")if(O.kind!=="padding"||z.kind!=="value"&&z.kind!=="number"&&z.kind!=="array")if(O.kind!=="variableAnchorOffsetCollection"||z.kind!=="value"&&z.kind!=="array"){if(this.checkSubtype(O,z))return null}else R=_(R,O,h.typeAnnotation||"coerce");else R=_(R,O,h.typeAnnotation||"coerce");else R=_(R,O,h.typeAnnotation||"coerce");else R=_(R,O,h.typeAnnotation||"assert")}if(!(R instanceof Wl)&&R.type.kind!=="resolvedImage"&&this._isConstant(R)){let O=new Md;try{R=new Wl(R.type,R.evaluate(O))}catch(z){return this.error(z.message),null}}return R}return this.error(`Unknown expression "${w}". 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,_){let w=typeof a=="number"?this.path.concat(a):this.path,I=_?this.scope.concat(_):this.scope;return new Pd(this.registry,this._isConstant,w,h||null,I,this.errors)}error(a,...h){let _=`${this.key}${h.map(w=>`[${w}]`).join("")}`;this.errors.push(new bn(_,a))}checkSubtype(a,h){let _=Be(a,h);return _&&this.error(_),_}}class Cd{constructor(a,h,_){this.type=ca,this.locale=_,this.caseSensitive=a,this.diacriticSensitive=h}static parse(a,h){if(a.length!==2)return h.error("Expected one argument.");let _=a[1];if(typeof _!="object"||Array.isArray(_))return h.error("Collator options argument must be an object.");let w=h.parse(_["case-sensitive"]!==void 0&&_["case-sensitive"],1,br);if(!w)return null;let I=h.parse(_["diacritic-sensitive"]!==void 0&&_["diacritic-sensitive"],1,br);if(!I)return null;let R=null;return _.locale&&(R=h.parse(_.locale,1,Vr),!R)?null:new Cd(w,I,R)}evaluate(a){return new Fa(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 le=8192;function pe(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 De(u,a){return!(u[0]<=a[0]||u[2]>=a[2]||u[1]<=a[1]||u[3]>=a[3])}function st(u,a){let h=(180+u[0])/360,_=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,w=Math.pow(2,a.z);return[Math.round(h*w*le),Math.round(_*w*le)]}function St(u,a,h){let _=u[0]-a[0],w=u[1]-a[1],I=u[0]-h[0],R=u[1]-h[1];return _*R-I*w==0&&_*I<=0&&w*R<=0}function Jt(u,a){let h=!1;for(let R=0,O=a.length;R(_=u)[1]!=(I=z[W+1])[1]>_[1]&&_[0]<(I[0]-w[0])*(_[1]-w[1])/(I[1]-w[1])+w[0]&&(h=!h)}}var _,w,I;return h}function li(u,a){for(let h=0;h0&&O<0||R<0&&O>0}function Is(u,a,h){for(let W of h)for(let Z=0;Zh[2]){let w=.5*_,I=u[0]-h[0]>w?-_:h[0]-u[0]>w?_:0;I===0&&(I=u[0]-h[2]>w?-_:h[2]-u[0]>w?_:0),u[0]+=I}pe(a,u)}function u_(u,a,h,_){let w=Math.pow(2,_.z)*le,I=[_.x*le,_.y*le],R=[];for(let O of u)for(let z of O){let W=[z.x+I[0],z.y+I[1]];$x(W,a,h,w),R.push(W)}return R}function h_(u,a,h,_){let w=Math.pow(2,_.z)*le,I=[_.x*le,_.y*le],R=[];for(let z of u){let W=[];for(let Z of z){let K=[Z.x+I[0],Z.y+I[1]];pe(a,K),W.push(K)}R.push(W)}if(a[2]-a[0]<=w/2){(O=a)[0]=O[1]=1/0,O[2]=O[3]=-1/0;for(let z of R)for(let W of z)$x(W,a,h,w)}var O;return R}class yf{constructor(a,h){this.type=br,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(jl(a[1])){let _=a[1];if(_.type==="FeatureCollection")for(let w=0;w<_.features.length;++w){let I=_.features[w].geometry.type;if(I==="Polygon"||I==="MultiPolygon")return new yf(_,_.features[w].geometry)}else if(_.type==="Feature"){let w=_.geometry.type;if(w==="Polygon"||w==="MultiPolygon")return new yf(_,_.geometry)}else if(_.type==="Polygon"||_.type==="MultiPolygon")return new yf(_,_)}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,_){let w=[1/0,1/0,-1/0,-1/0],I=[1/0,1/0,-1/0,-1/0],R=h.canonicalID();if(_.type==="Polygon"){let O=$0(_.coordinates,I,R),z=u_(h.geometry(),w,I,R);if(!De(w,I))return!1;for(let W of z)if(!Jt(W,O))return!1}if(_.type==="MultiPolygon"){let O=Hx(_.coordinates,I,R),z=u_(h.geometry(),w,I,R);if(!De(w,I))return!1;for(let W of z)if(!li(W,O))return!1}return!0}(a,this.geometries);if(a.geometryType()==="LineString")return function(h,_){let w=[1/0,1/0,-1/0,-1/0],I=[1/0,1/0,-1/0,-1/0],R=h.canonicalID();if(_.type==="Polygon"){let O=$0(_.coordinates,I,R),z=h_(h.geometry(),w,I,R);if(!De(w,I))return!1;for(let W of z)if(!Zs(W,O))return!1}if(_.type==="MultiPolygon"){let O=Hx(_.coordinates,I,R),z=h_(h.geometry(),w,I,R);if(!De(w,I))return!1;for(let W of z)if(!Na(W,O))return!1}return!0}(a,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class q0{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[1];return h.scope.has(_)?new q0(_,h.scope.get(_)):h.error(`Unknown variable "${_}". Make sure "${_}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}}class fl{constructor(a,h,_,w){this.name=a,this.type=h,this._evaluate=_,this.args=w}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}static parse(a,h){let _=a[0],w=fl.definitions[_];if(!w)return h.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0);let I=Array.isArray(w)?w[0]:w.type,R=Array.isArray(w)?[[w[1],w[2]]]:w.overloads,O=R.filter(([W])=>!Array.isArray(W)||W.length===a.length-1),z=null;for(let[W,Z]of O){z=new Pd(h.registry,G0,h.path,null,h.scope);let K=[],re=!1;for(let ae=1;ae{return re=K,Array.isArray(re)?`(${re.map(Ee).join(", ")})`:`(${Ee(re.type)}...)`;var re}).join(" | "),Z=[];for(let K=1;K{h=a?h&&G0(_):h&&_ instanceof Wl}),!!h&&Z0(u)&&Y0(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Z0(u){if(u instanceof fl&&(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 yf)return!1;let a=!0;return u.eachChild(h=>{a&&!Z0(h)&&(a=!1)}),a}function Yp(u){if(u instanceof fl&&u.name==="feature-state")return!1;let a=!0;return u.eachChild(h=>{a&&!Yp(h)&&(a=!1)}),a}function Y0(u,a){if(u instanceof fl&&a.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(_=>{h&&!Y0(_,a)&&(h=!1)}),h}function Id(u,a){let h=u.length-1,_,w,I=0,R=h,O=0;for(;I<=R;)if(O=Math.floor((I+R)/2),_=u[O],w=u[O+1],_<=a){if(O===h||aa))throw new mn("Input is not a number.");R=O-1}return 0}class yh{constructor(a,h,_){this.type=a,this.input=h,this.labels=[],this.outputs=[];for(let[w,I]of _)this.labels.push(w),this.outputs.push(I)}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 _=h.parse(a[1],1,Ct);if(!_)return null;let w=[],I=null;h.expectedType&&h.expectedType.kind!=="value"&&(I=h.expectedType);for(let R=1;R=O)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',W);let K=h.parse(z,Z,I);if(!K)return null;I=I||K.type,w.push([O,K])}return new yh(I,_,w)}evaluate(a){let h=this.labels,_=this.outputs;if(h.length===1)return _[0].evaluate(a);let w=this.input.evaluate(a);if(w<=h[0])return _[0].evaluate(a);let I=h.length;return w>=h[I-1]?_[I-1].evaluate(a):_[Id(h,w)].evaluate(a)}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){return u+h*(a-u)}function X0(u,a,h){return u.map((_,w)=>yi(_,a[w],h))}let za={number:yi,color:function(u,a,h,_="rgb"){switch(_){case"rgb":{let[w,I,R,O]=X0(u.rgb,a.rgb,h);return new _i(w,I,R,O,!1)}case"hcl":{let[w,I,R,O]=u.hcl,[z,W,Z,K]=a.hcl,re,ae;if(isNaN(w)||isNaN(z))isNaN(w)?isNaN(z)?re=NaN:(re=z,R!==1&&R!==0||(ae=W)):(re=w,Z!==1&&Z!==0||(ae=I));else{let We=z-w;z>w&&We>180?We-=360:z180&&(We+=360),re=w+h*We}let[ce,_e,Pe,ke]=function([We,Oe,$e,Je]){return We=isNaN(We)?0:We*Cr,Ni([$e,Math.cos(We)*Oe,Math.sin(We)*Oe,Je])}([re,ae??yi(I,W,h),yi(R,Z,h),yi(O,K,h)]);return new _i(ce,_e,Pe,ke,!1)}case"lab":{let[w,I,R,O]=Ni(X0(u.lab,a.lab,h));return new _i(w,I,R,O,!1)}}},array:X0,padding:function(u,a,h){return new Fn(X0(u.values,a.values,h))},variableAnchorOffsetCollection:function(u,a,h){let _=u.values,w=a.values;if(_.length!==w.length)throw new mn(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${a.toString()}`);let I=[];for(let R=0;R<_.length;R+=2){if(_[R]!==w[R])throw new mn(`Cannot interpolate values containing mismatched anchors. from[${R}]: ${_[R]}, to[${R}]: ${w[R]}`);I.push(_[R]);let[O,z]=_[R+1],[W,Z]=w[R+1];I.push([yi(O,W,h),yi(z,Z,h)])}return new $o(I)}};class Ua{constructor(a,h,_,w,I){this.type=a,this.operator=h,this.interpolation=_,this.input=w,this.labels=[],this.outputs=[];for(let[R,O]of I)this.labels.push(R),this.outputs.push(O)}static interpolationFactor(a,h,_,w){let I=0;if(a.name==="exponential")I=f_(h,a.base,_,w);else if(a.name==="linear")I=f_(h,1,_,w);else if(a.name==="cubic-bezier"){let R=a.controlPoints;I=new N(R[0],R[1],R[2],R[3]).solve(f_(h,1,_,w))}return I}static parse(a,h){let[_,w,I,...R]=a;if(!Array.isArray(w)||w.length===0)return h.error("Expected an interpolation type expression.",1);if(w[0]==="linear")w={name:"linear"};else if(w[0]==="exponential"){let W=w[1];if(typeof W!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);w={name:"exponential",base:W}}else{if(w[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(w[0])}`,1,0);{let W=w.slice(1);if(W.length!==4||W.some(Z=>typeof Z!="number"||Z<0||Z>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);w={name:"cubic-bezier",controlPoints:W}}}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(I=h.parse(I,2,Ct),!I)return null;let O=[],z=null;_==="interpolate-hcl"||_==="interpolate-lab"?z=Gs:h.expectedType&&h.expectedType.kind!=="value"&&(z=h.expectedType);for(let W=0;W=Z)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',re);let ce=h.parse(K,ae,z);if(!ce)return null;z=z||ce.type,O.push([Z,ce])}return ht(z,Ct)||ht(z,Gs)||ht(z,te)||ht(z,fe)||ht(z,Te(Ct))?new Ua(z,_,w,I,O):h.error(`Type ${Ee(z)} is not interpolatable.`)}evaluate(a){let h=this.labels,_=this.outputs;if(h.length===1)return _[0].evaluate(a);let w=this.input.evaluate(a);if(w<=h[0])return _[0].evaluate(a);let I=h.length;if(w>=h[I-1])return _[I-1].evaluate(a);let R=Id(h,w),O=Ua.interpolationFactor(this.interpolation,w,h[R],h[R+1]),z=_[R].evaluate(a),W=_[R+1].evaluate(a);switch(this.operator){case"interpolate":return za[this.type.kind](z,W,O);case"interpolate-hcl":return za.color(z,W,O,"hcl");case"interpolate-lab":return za.color(z,W,O,"lab")}}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function f_(u,a,h,_){let w=_-h,I=u-h;return w===0?0:a===1?I/w:(Math.pow(a,I)-1)/(Math.pow(a,w)-1)}class Q0{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 _=null,w=h.expectedType;w&&w.kind!=="value"&&(_=w);let I=[];for(let O of a.slice(1)){let z=h.parse(O,1+I.length,_,void 0,{typeAnnotation:"omit"});if(!z)return null;_=_||z.type,I.push(z)}if(!_)throw new Error("No output type");let R=w&&I.some(O=>Be(w,O.type));return new Q0(R?Rr:_,I)}evaluate(a){let h,_=null,w=0;for(let I of this.args)if(w++,_=I.evaluate(a),_&&_ instanceof Yn&&!_.available&&(h||(h=_.name),_=null,w===this.args.length&&(_=h)),_!==null)break;return _}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}class K0{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 _=[];for(let I=1;I=_.length)throw new mn(`Array index out of bounds: ${h} > ${_.length-1}.`);if(h!==Math.floor(h))throw new mn(`Array index must be an integer, but found ${h} instead.`);return _[h]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}}class p_{constructor(a,h){this.type=br,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 _=h.parse(a[1],1,Rr),w=h.parse(a[2],2,Rr);return _&&w?Ce(_.type,[br,Vr,Ct,Oa,Rr])?new p_(_,w):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ee(_.type)} instead`):null}evaluate(a){let h=this.needle.evaluate(a),_=this.haystack.evaluate(a);if(!_)return!1;if(!je(h,["boolean","string","number","null"]))throw new mn(`Expected first argument to be of type boolean, string, number or null, but found ${Ee(an(h))} instead.`);if(!je(_,["string","array"]))throw new mn(`Expected second argument to be of type array or string, but found ${Ee(an(_))} instead.`);return _.indexOf(h)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}}class J0{constructor(a,h,_){this.type=Ct,this.needle=a,this.haystack=h,this.fromIndex=_}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 _=h.parse(a[1],1,Rr),w=h.parse(a[2],2,Rr);if(!_||!w)return null;if(!Ce(_.type,[br,Vr,Ct,Oa,Rr]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ee(_.type)} instead`);if(a.length===4){let I=h.parse(a[3],3,Ct);return I?new J0(_,w,I):null}return new J0(_,w)}evaluate(a){let h=this.needle.evaluate(a),_=this.haystack.evaluate(a);if(!je(h,["boolean","string","number","null"]))throw new mn(`Expected first argument to be of type boolean, string, number or null, but found ${Ee(an(h))} instead.`);if(!je(_,["string","array"]))throw new mn(`Expected second argument to be of type array or string, but found ${Ee(an(_))} instead.`);if(this.fromIndex){let w=this.fromIndex.evaluate(a);return _.indexOf(h,w)}return _.indexOf(h)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}}class A_{constructor(a,h,_,w,I,R){this.inputType=a,this.type=h,this.input=_,this.cases=w,this.outputs=I,this.otherwise=R}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 _,w;h.expectedType&&h.expectedType.kind!=="value"&&(w=h.expectedType);let I={},R=[];for(let W=2;WNumber.MAX_SAFE_INTEGER)return re.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ce=="number"&&Math.floor(ce)!==ce)return re.error("Numeric branch labels must be integer values.");if(_){if(re.checkSubtype(_,an(ce)))return null}else _=an(ce);if(I[String(ce)]!==void 0)return re.error("Branch labels must be unique.");I[String(ce)]=R.length}let ae=h.parse(K,W,w);if(!ae)return null;w=w||ae.type,R.push(ae)}let O=h.parse(a[1],1,Rr);if(!O)return null;let z=h.parse(a[a.length-1],a.length-1,w);return z?O.type.kind!=="value"&&h.concat(1).checkSubtype(_,O.type)?null:new A_(_,w,O,I,R,z):null}evaluate(a){let h=this.input.evaluate(a);return(an(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 m_{constructor(a,h,_){this.type=a,this.branches=h,this.otherwise=_}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 _;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);let w=[];for(let R=1;Rh.outputDefined())&&this.otherwise.outputDefined()}}class em{constructor(a,h,_,w){this.type=a,this.input=h,this.beginIndex=_,this.endIndex=w}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 _=h.parse(a[1],1,Rr),w=h.parse(a[2],2,Ct);if(!_||!w)return null;if(!Ce(_.type,[Te(Rr),Vr,Rr]))return h.error(`Expected first argument to be of type array or string, but found ${Ee(_.type)} instead`);if(a.length===4){let I=h.parse(a[3],3,Ct);return I?new em(_.type,_,w,I):null}return new em(_.type,_,w)}evaluate(a){let h=this.input.evaluate(a),_=this.beginIndex.evaluate(a);if(!je(h,["string","array"]))throw new mn(`Expected first argument to be of type array or string, but found ${Ee(an(h))} instead.`);if(this.endIndex){let w=this.endIndex.evaluate(a);return h.slice(_,w)}return h.slice(_)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}}function qx(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 Gx(u,a,h,_){return _.compare(a,h)===0}function Rd(u,a,h){let _=u!=="=="&&u!=="!=";return class rV{constructor(I,R,O){this.type=br,this.lhs=I,this.rhs=R,this.collator=O,this.hasUntypedArgument=I.type.kind==="value"||R.type.kind==="value"}static parse(I,R){if(I.length!==3&&I.length!==4)return R.error("Expected two or three arguments.");let O=I[0],z=R.parse(I[1],1,Rr);if(!z)return null;if(!qx(O,z.type))return R.concat(1).error(`"${O}" comparisons are not supported for type '${Ee(z.type)}'.`);let W=R.parse(I[2],2,Rr);if(!W)return null;if(!qx(O,W.type))return R.concat(2).error(`"${O}" comparisons are not supported for type '${Ee(W.type)}'.`);if(z.type.kind!==W.type.kind&&z.type.kind!=="value"&&W.type.kind!=="value")return R.error(`Cannot compare types '${Ee(z.type)}' and '${Ee(W.type)}'.`);_&&(z.type.kind==="value"&&W.type.kind!=="value"?z=new os(W.type,[z]):z.type.kind!=="value"&&W.type.kind==="value"&&(W=new os(z.type,[W])));let Z=null;if(I.length===4){if(z.type.kind!=="string"&&W.type.kind!=="string"&&z.type.kind!=="value"&&W.type.kind!=="value")return R.error("Cannot use collator to compare non-string types.");if(Z=R.parse(I[3],3,ca),!Z)return null}return new rV(z,W,Z)}evaluate(I){let R=this.lhs.evaluate(I),O=this.rhs.evaluate(I);if(_&&this.hasUntypedArgument){let z=an(R),W=an(O);if(z.kind!==W.kind||z.kind!=="string"&&z.kind!=="number")throw new mn(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${z.kind}, ${W.kind}) instead.`)}if(this.collator&&!_&&this.hasUntypedArgument){let z=an(R),W=an(O);if(z.kind!=="string"||W.kind!=="string")return a(I,R,O)}return this.collator?h(I,R,O,this.collator.evaluate(I)):a(I,R,O)}eachChild(I){I(this.lhs),I(this.rhs),this.collator&&I(this.collator)}outputDefined(){return!0}}}let FT=Rd("==",function(u,a,h){return a===h},Gx),NT=Rd("!=",function(u,a,h){return a!==h},function(u,a,h,_){return!Gx(0,a,h,_)}),zT=Rd("<",function(u,a,h){return a",function(u,a,h){return a>h},function(u,a,h,_){return _.compare(a,h)>0}),g_=Rd("<=",function(u,a,h){return a<=h},function(u,a,h,_){return _.compare(a,h)<=0}),Zx=Rd(">=",function(u,a,h){return a>=h},function(u,a,h,_){return _.compare(a,h)>=0});class tm{constructor(a,h,_,w,I){this.type=Vr,this.number=a,this.locale=h,this.currency=_,this.minFractionDigits=w,this.maxFractionDigits=I}static parse(a,h){if(a.length!==3)return h.error("Expected two arguments.");let _=h.parse(a[1],1,Ct);if(!_)return null;let w=a[2];if(typeof w!="object"||Array.isArray(w))return h.error("NumberFormat options argument must be an object.");let I=null;if(w.locale&&(I=h.parse(w.locale,1,Vr),!I))return null;let R=null;if(w.currency&&(R=h.parse(w.currency,1,Vr),!R))return null;let O=null;if(w["min-fraction-digits"]&&(O=h.parse(w["min-fraction-digits"],1,Ct),!O))return null;let z=null;return w["max-fraction-digits"]&&(z=h.parse(w["max-fraction-digits"],1,Ct),!z)?null:new tm(_,I,R,O,z)}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 xf{constructor(a){this.type=be,this.sections=a}static parse(a,h){if(a.length<2)return h.error("Expected at least one argument.");let _=a[1];if(!Array.isArray(_)&&typeof _=="object")return h.error("First argument must be an image or text section.");let w=[],I=!1;for(let R=1;R<=a.length-1;++R){let O=a[R];if(I&&typeof O=="object"&&!Array.isArray(O)){I=!1;let z=null;if(O["font-scale"]&&(z=h.parse(O["font-scale"],1,Ct),!z))return null;let W=null;if(O["text-font"]&&(W=h.parse(O["text-font"],1,Te(Vr)),!W))return null;let Z=null;if(O["text-color"]&&(Z=h.parse(O["text-color"],1,Gs),!Z))return null;let K=w[w.length-1];K.scale=z,K.font=W,K.textColor=Z}else{let z=h.parse(a[R],1,Rr);if(!z)return null;let W=z.type.kind;if(W!=="string"&&W!=="value"&&W!=="null"&&W!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");I=!0,w.push({content:z,scale:null,font:null,textColor:null})}}return new xf(w)}evaluate(a){return new An(this.sections.map(h=>{let _=h.content.evaluate(a);return an(_)===ne?new Dc("",_,null,null,null):new Dc(Ti(_),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 Xp{constructor(a){this.type=ne,this.input=a}static parse(a,h){if(a.length!==2)return h.error("Expected two arguments.");let _=h.parse(a[1],1,Vr);return _?new Xp(_):h.error("No image name provided.")}evaluate(a){let h=this.input.evaluate(a),_=Yn.fromString(h);return _&&a.availableImages&&(_.available=a.availableImages.indexOf(h)>-1),_}eachChild(a){a(this.input)}outputDefined(){return!1}}class Qp{constructor(a){this.type=Ct,this.input=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);let _=h.parse(a[1],1);return _?_.type.kind!=="array"&&_.type.kind!=="string"&&_.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${Ee(_.type)} instead.`):new Qp(_):null}evaluate(a){let h=this.input.evaluate(a);if(typeof h=="string"||Array.isArray(h))return h.length;throw new mn(`Expected value to be of type string or array, but found ${Ee(an(h))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}}let xh={"==":FT,"!=":NT,">":UT,"<":zT,">=":Zx,"<=":g_,array:os,at:d_,boolean:os,case:m_,coalesce:Q0,collator:Cd,format:xf,image:Xp,in:p_,"index-of":J0,interpolate:Ua,"interpolate-hcl":Ua,"interpolate-lab":Ua,length:Qp,let:K0,literal:Wl,match:A_,number:os,"number-format":tm,object:os,slice:em,step:yh,string:os,"to-boolean":Hl,"to-color":Hl,"to-number":Hl,"to-string":Hl,var:q0,within:yf};function kd(u,[a,h,_,w]){a=a.evaluate(u),h=h.evaluate(u),_=_.evaluate(u);let I=w?w.evaluate(u):1,R=mo(a,h,_,I);if(R)throw new mn(R);return new _i(a/255,h/255,_/255,I,!1)}function Kp(u,a){return u in a}function Oc(u,a){let h=a[u];return h===void 0?null:h}function Ke(u){return{type:u}}function mt(u){return{result:"success",value:u}}function Ot(u){return{result:"error",value:u}}function _r(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function m(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function $i(u){return!!u.expression&&u.expression.interpolated}function cr(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function ue(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Rs(u){return u}function Ir(u,a){let h=a.type==="color",_=u.stops&&typeof u.stops[0][0]=="object",w=_||!(_||u.property!==void 0),I=u.type||($i(a)?"exponential":"interval");if(h||a.type==="padding"){let Z=h?_i.parse:Fn.parse;(u=Ho({},u)).stops&&(u.stops=u.stops.map(K=>[K[0],Z(K[1])])),u.default=Z(u.default?u.default:a.default)}if(u.colorSpace&&(R=u.colorSpace)!=="rgb"&&R!=="hcl"&&R!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var R;let O,z,W;if(I==="exponential")O=Nn;else if(I==="interval")O=Fr;else if(I==="categorical"){O=Tr,z=Object.create(null);for(let Z of u.stops)z[Z[0]]=Z[1];W=typeof u.stops[0][0]}else{if(I!=="identity")throw new Error(`Unknown function type "${I}"`);O=Ri}if(_){let Z={},K=[];for(let ce=0;cece[0]),evaluate:({zoom:ce},_e)=>Nn({stops:re,base:u.base},a,ce).evaluate(ce,_e)}}if(w){let Z=I==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:Z,interpolationFactor:Ua.interpolationFactor.bind(void 0,Z),zoomStops:u.stops.map(K=>K[0]),evaluate:({zoom:K})=>O(u,a,K,z,W)}}return{kind:"source",evaluate(Z,K){let re=K&&K.properties?K.properties[u.property]:void 0;return re===void 0?En(u.default,a.default):O(u,a,re,z,W)}}}function En(u,a,h){return u!==void 0?u:a!==void 0?a:h!==void 0?h:void 0}function Tr(u,a,h,_,w){return En(typeof h===w?_[h]:void 0,u.default,a.default)}function Fr(u,a,h){if(cr(h)!=="number")return En(u.default,a.default);let _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];let w=Id(u.stops.map(I=>I[0]),h);return u.stops[w][1]}function Nn(u,a,h){let _=u.base!==void 0?u.base:1;if(cr(h)!=="number")return En(u.default,a.default);let w=u.stops.length;if(w===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[w-1][0])return u.stops[w-1][1];let I=Id(u.stops.map(Z=>Z[0]),h),R=function(Z,K,re,ae){let ce=ae-re,_e=Z-re;return ce===0?0:K===1?_e/ce:(Math.pow(K,_e)-1)/(Math.pow(K,ce)-1)}(h,_,u.stops[I][0],u.stops[I+1][0]),O=u.stops[I][1],z=u.stops[I+1][1],W=za[a.type]||Rs;return typeof O.evaluate=="function"?{evaluate(...Z){let K=O.evaluate.apply(void 0,Z),re=z.evaluate.apply(void 0,Z);if(K!==void 0&&re!==void 0)return W(K,re,R,u.colorSpace)}}:W(O,z,R,u.colorSpace)}function Ri(u,a,h){switch(a.type){case"color":h=_i.parse(h);break;case"formatted":h=An.fromString(h.toString());break;case"resolvedImage":h=Yn.fromString(h.toString());break;case"padding":h=Fn.parse(h);break;default:cr(h)===a.type||a.type==="enum"&&a.values[h]||(h=void 0)}return En(h,u.default,a.default)}fl.register(xh,{error:[{kind:"error"},[Vr],(u,[a])=>{throw new mn(a.evaluate(u))}],typeof:[Vr,[Rr],(u,[a])=>Ee(an(a.evaluate(u)))],"to-rgba":[Te(Ct,4),[Gs],(u,[a])=>{let[h,_,w,I]=a.evaluate(u).rgb;return[255*h,255*_,255*w,I]}],rgb:[Gs,[Ct,Ct,Ct],kd],rgba:[Gs,[Ct,Ct,Ct,Ct],kd],has:{type:br,overloads:[[[Vr],(u,[a])=>Kp(a.evaluate(u),u.properties())],[[Vr,Ba],(u,[a,h])=>Kp(a.evaluate(u),h.evaluate(u))]]},get:{type:Rr,overloads:[[[Vr],(u,[a])=>Oc(a.evaluate(u),u.properties())],[[Vr,Ba],(u,[a,h])=>Oc(a.evaluate(u),h.evaluate(u))]]},"feature-state":[Rr,[Vr],(u,[a])=>Oc(a.evaluate(u),u.featureState||{})],properties:[Ba,[],u=>u.properties()],"geometry-type":[Vr,[],u=>u.geometryType()],id:[Rr,[],u=>u.id()],zoom:[Ct,[],u=>u.globals.zoom],"heatmap-density":[Ct,[],u=>u.globals.heatmapDensity||0],"line-progress":[Ct,[],u=>u.globals.lineProgress||0],accumulated:[Rr,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[Ct,Ke(Ct),(u,a)=>{let h=0;for(let _ of a)h+=_.evaluate(u);return h}],"*":[Ct,Ke(Ct),(u,a)=>{let h=1;for(let _ of a)h*=_.evaluate(u);return h}],"-":{type:Ct,overloads:[[[Ct,Ct],(u,[a,h])=>a.evaluate(u)-h.evaluate(u)],[[Ct],(u,[a])=>-a.evaluate(u)]]},"/":[Ct,[Ct,Ct],(u,[a,h])=>a.evaluate(u)/h.evaluate(u)],"%":[Ct,[Ct,Ct],(u,[a,h])=>a.evaluate(u)%h.evaluate(u)],ln2:[Ct,[],()=>Math.LN2],pi:[Ct,[],()=>Math.PI],e:[Ct,[],()=>Math.E],"^":[Ct,[Ct,Ct],(u,[a,h])=>Math.pow(a.evaluate(u),h.evaluate(u))],sqrt:[Ct,[Ct],(u,[a])=>Math.sqrt(a.evaluate(u))],log10:[Ct,[Ct],(u,[a])=>Math.log(a.evaluate(u))/Math.LN10],ln:[Ct,[Ct],(u,[a])=>Math.log(a.evaluate(u))],log2:[Ct,[Ct],(u,[a])=>Math.log(a.evaluate(u))/Math.LN2],sin:[Ct,[Ct],(u,[a])=>Math.sin(a.evaluate(u))],cos:[Ct,[Ct],(u,[a])=>Math.cos(a.evaluate(u))],tan:[Ct,[Ct],(u,[a])=>Math.tan(a.evaluate(u))],asin:[Ct,[Ct],(u,[a])=>Math.asin(a.evaluate(u))],acos:[Ct,[Ct],(u,[a])=>Math.acos(a.evaluate(u))],atan:[Ct,[Ct],(u,[a])=>Math.atan(a.evaluate(u))],min:[Ct,Ke(Ct),(u,a)=>Math.min(...a.map(h=>h.evaluate(u)))],max:[Ct,Ke(Ct),(u,a)=>Math.max(...a.map(h=>h.evaluate(u)))],abs:[Ct,[Ct],(u,[a])=>Math.abs(a.evaluate(u))],round:[Ct,[Ct],(u,[a])=>{let h=a.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[Ct,[Ct],(u,[a])=>Math.floor(a.evaluate(u))],ceil:[Ct,[Ct],(u,[a])=>Math.ceil(a.evaluate(u))],"filter-==":[br,[Vr,Rr],(u,[a,h])=>u.properties()[a.value]===h.value],"filter-id-==":[br,[Rr],(u,[a])=>u.id()===a.value],"filter-type-==":[br,[Vr],(u,[a])=>u.geometryType()===a.value],"filter-<":[br,[Vr,Rr],(u,[a,h])=>{let _=u.properties()[a.value],w=h.value;return typeof _==typeof w&&_{let h=u.id(),_=a.value;return typeof h==typeof _&&h<_}],"filter->":[br,[Vr,Rr],(u,[a,h])=>{let _=u.properties()[a.value],w=h.value;return typeof _==typeof w&&_>w}],"filter-id->":[br,[Rr],(u,[a])=>{let h=u.id(),_=a.value;return typeof h==typeof _&&h>_}],"filter-<=":[br,[Vr,Rr],(u,[a,h])=>{let _=u.properties()[a.value],w=h.value;return typeof _==typeof w&&_<=w}],"filter-id-<=":[br,[Rr],(u,[a])=>{let h=u.id(),_=a.value;return typeof h==typeof _&&h<=_}],"filter->=":[br,[Vr,Rr],(u,[a,h])=>{let _=u.properties()[a.value],w=h.value;return typeof _==typeof w&&_>=w}],"filter-id->=":[br,[Rr],(u,[a])=>{let h=u.id(),_=a.value;return typeof h==typeof _&&h>=_}],"filter-has":[br,[Rr],(u,[a])=>a.value in u.properties()],"filter-has-id":[br,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[br,[Te(Vr)],(u,[a])=>a.value.indexOf(u.geometryType())>=0],"filter-id-in":[br,[Te(Rr)],(u,[a])=>a.value.indexOf(u.id())>=0],"filter-in-small":[br,[Vr,Te(Rr)],(u,[a,h])=>h.value.indexOf(u.properties()[a.value])>=0],"filter-in-large":[br,[Vr,Te(Rr)],(u,[a,h])=>function(_,w,I,R){for(;I<=R;){let O=I+R>>1;if(w[O]===_)return!0;w[O]>_?R=O-1:I=O+1}return!1}(u.properties()[a.value],h.value,0,h.value.length-1)],all:{type:br,overloads:[[[br,br],(u,[a,h])=>a.evaluate(u)&&h.evaluate(u)],[Ke(br),(u,a)=>{for(let h of a)if(!h.evaluate(u))return!1;return!0}]]},any:{type:br,overloads:[[[br,br],(u,[a,h])=>a.evaluate(u)||h.evaluate(u)],[Ke(br),(u,a)=>{for(let h of a)if(h.evaluate(u))return!0;return!1}]]},"!":[br,[br],(u,[a])=>!a.evaluate(u)],"is-supported-script":[br,[Vr],(u,[a])=>{let h=u.globals&&u.globals.isSupportedScript;return!h||h(a.evaluate(u))}],upcase:[Vr,[Vr],(u,[a])=>a.evaluate(u).toUpperCase()],downcase:[Vr,[Vr],(u,[a])=>a.evaluate(u).toLowerCase()],concat:[Vr,Ke(Rr),(u,a)=>a.map(h=>Ti(h.evaluate(u))).join("")],"resolved-locale":[Vr,[ca],(u,[a])=>a.evaluate(u).resolvedLocale()]});class ki{constructor(a,h){var _;this.expression=a,this._warningHistory={},this._evaluator=new Md,this._defaultValue=h?(_=h).type==="color"&&ue(_.default)?new _i(0,0,0,0):_.type==="color"?_i.parse(_.default)||null:_.type==="padding"?Fn.parse(_.default)||null:_.type==="variableAnchorOffsetCollection"?$o.parse(_.default)||null:_.default===void 0?null:_.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(a,h,_,w,I,R){return this._evaluator.globals=a,this._evaluator.feature=h,this._evaluator.featureState=_,this._evaluator.canonical=w,this._evaluator.availableImages=I||null,this._evaluator.formattedSection=R,this.expression.evaluate(this._evaluator)}evaluate(a,h,_,w,I,R){this._evaluator.globals=a,this._evaluator.feature=h||null,this._evaluator.featureState=_||null,this._evaluator.canonical=w,this._evaluator.availableImages=I||null,this._evaluator.formattedSection=R||null;try{let O=this.expression.evaluate(this._evaluator);if(O==null||typeof O=="number"&&O!=O)return this._defaultValue;if(this._enumValues&&!(O in this._enumValues))throw new mn(`Expected value to be one of ${Object.keys(this._enumValues).map(z=>JSON.stringify(z)).join(", ")}, but found ${JSON.stringify(O)} instead.`);return O}catch(O){return this._warningHistory[O.message]||(this._warningHistory[O.message]=!0,typeof console<"u"&&console.warn(O.message)),this._defaultValue}}}function wu(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in xh}function Jp(u,a){let h=new Pd(xh,G0,[],a?function(w){let I={color:Gs,string:Vr,number:Ct,enum:Vr,boolean:br,formatted:be,padding:te,resolvedImage:ne,variableAnchorOffsetCollection:fe};return w.type==="array"?Te(I[w.value]||Rr,w.length):I[w.type]}(a):void 0),_=h.parse(u,void 0,void 0,void 0,a&&a.type==="string"?{typeAnnotation:"coerce"}:void 0);return _?mt(new ki(_,a)):Ot(h.errors)}class rm{constructor(a,h){this.kind=a,this._styleExpression=h,this.isStateDependent=a!=="constant"&&!Yp(h.expression)}evaluateWithoutErrorHandling(a,h,_,w,I,R){return this._styleExpression.evaluateWithoutErrorHandling(a,h,_,w,I,R)}evaluate(a,h,_,w,I,R){return this._styleExpression.evaluate(a,h,_,w,I,R)}}class vf{constructor(a,h,_,w){this.kind=a,this.zoomStops=_,this._styleExpression=h,this.isStateDependent=a!=="camera"&&!Yp(h.expression),this.interpolationType=w}evaluateWithoutErrorHandling(a,h,_,w,I,R){return this._styleExpression.evaluateWithoutErrorHandling(a,h,_,w,I,R)}evaluate(a,h,_,w,I,R){return this._styleExpression.evaluate(a,h,_,w,I,R)}interpolationFactor(a,h,_){return this.interpolationType?Ua.interpolationFactor(this.interpolationType,a,h,_):0}}function qo(u,a){let h=Jp(u,a);if(h.result==="error")return h;let _=h.value.expression,w=Z0(_);if(!w&&!_r(a))return Ot([new bn("","data expressions not supported")]);let I=Y0(_,["zoom"]);if(!I&&!m(a))return Ot([new bn("","zoom expressions not supported")]);let R=Go(_);return R||I?R instanceof bn?Ot([R]):R instanceof Ua&&!$i(a)?Ot([new bn("",'"interpolate" expressions cannot be used with this property')]):mt(R?new vf(w?"camera":"composite",h.value,R.labels,R instanceof Ua?R.interpolation:void 0):new rm(w?"constant":"source",h.value)):Ot([new bn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $l{constructor(a,h){this._parameters=a,this._specification=h,Ho(this,Ir(this._parameters,this._specification))}static deserialize(a){return new $l(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function Go(u){let a=null;if(u instanceof K0)a=Go(u.result);else if(u instanceof Q0){for(let h of u.args)if(a=Go(h),a)break}else(u instanceof yh||u instanceof Ua)&&u.input instanceof fl&&u.input.name==="zoom"&&(a=u);return a instanceof bn||u.eachChild(h=>{let _=Go(h);_ instanceof bn?a=_:!a&&_?a=new bn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):a&&_&&a!==_&&(a=new bn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}function vh(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(!vh(a)&&typeof a!="boolean")return!1;return!0;default:return!0}}let Yx={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Bc(u){if(u==null)return{filter:()=>!0,needGeometry:!1};vh(u)||(u=Er(u));let a=Jp(u,Yx);if(a.result==="error")throw new Error(a.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,_,w)=>a.value.evaluate(h,_,{},w),needGeometry:ye(u)}}function ii(u,a){return ua?1:0}function ye(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let a=1;a"||a==="<="||a===">="?eA(u[1],u[2],a):a==="any"?(h=u.slice(1),["any"].concat(h.map(Er))):a==="all"?["all"].concat(u.slice(1).map(Er)):a==="none"?["all"].concat(u.slice(1).map(Er).map(Ld)):a==="in"?__(u[1],u.slice(2)):a==="!in"?Ld(__(u[1],u.slice(2))):a==="has"?y_(u[1]):a==="!has"?Ld(y_(u[1])):a!=="within"||u;var h}function eA(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 __(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(ii)]]:["filter-in-small",u,["literal",a]]}}function y_(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Ld(u){return["!",u]}function tA(u){let a=typeof u;if(a==="number"||a==="boolean"||a==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let w="[";for(let I of u)w+=`${tA(I)},`;return`${w}]`}let h=Object.keys(u).sort(),_="{";for(let w=0;w_.maximum?[new Tt(a,h,`${h} is greater than the maximum value ${_.maximum}`)]:[]}function Od(u){let a=u.valueSpec,h=Ln(u.value.type),_,w,I,R={},O=h!=="categorical"&&u.value.property===void 0,z=!O,W=cr(u.value.stops)==="array"&&cr(u.value.stops[0])==="array"&&cr(u.value.stops[0][0])==="object",Z=Zo({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(ae){if(h==="identity")return[new Tt(ae.key,ae.value,'identity function may not have a "stops" property')];let ce=[],_e=ae.value;return ce=ce.concat(bf({key:ae.key,value:_e,valueSpec:ae.valueSpec,validateSpec:ae.validateSpec,style:ae.style,styleSpec:ae.styleSpec,arrayElementValidator:K})),cr(_e)==="array"&&_e.length===0&&ce.push(new Tt(ae.key,_e,"array must have at least one stop")),ce},default:function(ae){return ae.validateSpec({key:ae.key,value:ae.value,valueSpec:a,validateSpec:ae.validateSpec,style:ae.style,styleSpec:ae.styleSpec})}}});return h==="identity"&&O&&Z.push(new Tt(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||Z.push(new Tt(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!$i(u.valueSpec)&&Z.push(new Tt(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(z&&!_r(u.valueSpec)?Z.push(new Tt(u.key,u.value,"property functions not supported")):O&&!m(u.valueSpec)&&Z.push(new Tt(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!W||u.value.property!==void 0||Z.push(new Tt(u.key,u.value,'"property" property is required')),Z;function K(ae){let ce=[],_e=ae.value,Pe=ae.key;if(cr(_e)!=="array")return[new Tt(Pe,_e,`array expected, ${cr(_e)} found`)];if(_e.length!==2)return[new Tt(Pe,_e,`array length 2 expected, length ${_e.length} found`)];if(W){if(cr(_e[0])!=="object")return[new Tt(Pe,_e,`object expected, ${cr(_e[0])} found`)];if(_e[0].zoom===void 0)return[new Tt(Pe,_e,"object stop key must have zoom")];if(_e[0].value===void 0)return[new Tt(Pe,_e,"object stop key must have value")];if(I&&I>Ln(_e[0].zoom))return[new Tt(Pe,_e[0].zoom,"stop zoom values must appear in ascending order")];Ln(_e[0].zoom)!==I&&(I=Ln(_e[0].zoom),w=void 0,R={}),ce=ce.concat(Zo({key:`${Pe}[0]`,value:_e[0],valueSpec:{zoom:{}},validateSpec:ae.validateSpec,style:ae.style,styleSpec:ae.styleSpec,objectElementValidators:{zoom:Dd,value:re}}))}else ce=ce.concat(re({key:`${Pe}[0]`,value:_e[0],valueSpec:{},validateSpec:ae.validateSpec,style:ae.style,styleSpec:ae.styleSpec},_e));return wu(bh(_e[1]))?ce.concat([new Tt(`${Pe}[1]`,_e[1],"expressions are not allowed in function stops.")]):ce.concat(ae.validateSpec({key:`${Pe}[1]`,value:_e[1],valueSpec:a,validateSpec:ae.validateSpec,style:ae.style,styleSpec:ae.styleSpec}))}function re(ae,ce){let _e=cr(ae.value),Pe=Ln(ae.value),ke=ae.value!==null?ae.value:ce;if(_){if(_e!==_)return[new Tt(ae.key,ke,`${_e} stop domain type must match previous stop domain type ${_}`)]}else _=_e;if(_e!=="number"&&_e!=="string"&&_e!=="boolean")return[new Tt(ae.key,ke,"stop domain value must be a number, string, or boolean")];if(_e!=="number"&&h!=="categorical"){let We=`number expected, ${_e} found`;return _r(a)&&h===void 0&&(We+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Tt(ae.key,ke,We)]}return h!=="categorical"||_e!=="number"||isFinite(Pe)&&Math.floor(Pe)===Pe?h!=="categorical"&&_e==="number"&&w!==void 0&&Penew Tt(`${u.key}${_.key}`,u.value,_.message));let h=a.value.expression||a.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new Tt(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"&&!Yp(h))return[new Tt(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!Yp(h))return[new Tt(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!Y0(h,["zoom","feature-state"]))return[new Tt(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!Z0(h))return[new Tt(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function wf(u){let a=u.key,h=u.value,_=u.valueSpec,w=[];return Array.isArray(_.values)?_.values.indexOf(Ln(h))===-1&&w.push(new Tt(a,h,`expected one of [${_.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(_.values).indexOf(Ln(h))===-1&&w.push(new Tt(a,h,`expected one of [${Object.keys(_.values).join(", ")}], ${JSON.stringify(h)} found`)),w}function Yo(u){return vh(bh(u.value))?Su(Ho({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ps(u)}function ps(u){let a=u.value,h=u.key;if(cr(a)!=="array")return[new Tt(h,a,`array expected, ${cr(a)} found`)];let _=u.styleSpec,w,I=[];if(a.length<1)return[new Tt(h,a,"filter array must have at least 1 element")];switch(I=I.concat(wf({key:`${h}[0]`,value:a[0],valueSpec:_.filter_operator,style:u.style,styleSpec:u.styleSpec})),Ln(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&Ln(a[1])==="$type"&&I.push(new Tt(h,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":a.length!==3&&I.push(new Tt(h,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&(w=cr(a[1]),w!=="string"&&I.push(new Tt(`${h}[1]`,a[1],`string expected, ${w} found`)));for(let R=2;R{W in h&&a.push(new Tt(_,h[W],`"${W}" is prohibited for ref layers`))}),w.layers.forEach(W=>{Ln(W.id)===O&&(z=W)}),z?z.ref?a.push(new Tt(_,h.ref,"ref cannot reference another ref layer")):R=Ln(z.type):a.push(new Tt(_,h.ref,`ref layer "${O}" not found`))}else if(R!=="background")if(h.source){let z=w.sources&&w.sources[h.source],W=z&&Ln(z.type);z?W==="vector"&&R==="raster"?a.push(new Tt(_,h.source,`layer "${h.id}" requires a raster source`)):W!=="raster-dem"&&R==="hillshade"?a.push(new Tt(_,h.source,`layer "${h.id}" requires a raster-dem source`)):W==="raster"&&R!=="raster"?a.push(new Tt(_,h.source,`layer "${h.id}" requires a vector source`)):W!=="vector"||h["source-layer"]?W==="raster-dem"&&R!=="hillshade"?a.push(new Tt(_,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):R!=="line"||!h.paint||!h.paint["line-gradient"]||W==="geojson"&&z.lineMetrics||a.push(new Tt(_,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):a.push(new Tt(_,h,`layer "${h.id}" must specify a "source-layer"`)):a.push(new Tt(_,h.source,`source "${h.source}" not found`))}else a.push(new Tt(_,h,'missing required property "source"'));return a=a.concat(Zo({key:_,value:h,valueSpec:I.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${_}.type`,value:h.type,valueSpec:I.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:Yo,layout:z=>Zo({layer:h,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":W=>b_(Ho({layerType:R},W))}}),paint:z=>Zo({layer:h,key:z.key,value:z.value,style:z.style,styleSpec:z.styleSpec,validateSpec:z.validateSpec,objectElementValidators:{"*":W=>v_(Ho({layerType:R},W))}})}})),a}function ql(u){let a=u.value,h=u.key,_=cr(a);return _!=="string"?[new Tt(h,a,`string expected, ${_} found`)]:[]}let Bd={promoteId:function({key:u,value:a}){if(cr(a)==="string")return ql({key:u,value:a});{let h=[];for(let _ in a)h.push(...ql({key:`${u}.${_}`,value:a[_]}));return h}}};function ha(u){let a=u.value,h=u.key,_=u.styleSpec,w=u.style,I=u.validateSpec;if(!a.type)return[new Tt(h,a,'"type" is required')];let R=Ln(a.type),O;switch(R){case"vector":case"raster":return O=Zo({key:h,value:a,valueSpec:_[`source_${R.replace("-","_")}`],style:u.style,styleSpec:_,objectElementValidators:Bd,validateSpec:I}),O;case"raster-dem":return O=function(z){var W;let Z=(W=z.sourceName)!==null&&W!==void 0?W:"",K=z.value,re=z.styleSpec,ae=re.source_raster_dem,ce=z.style,_e=[],Pe=cr(K);if(K===void 0)return _e;if(Pe!=="object")return _e.push(new Tt("source_raster_dem",K,`object expected, ${Pe} found`)),_e;let ke=Ln(K.encoding)==="custom",We=["redFactor","greenFactor","blueFactor","baseShift"],Oe=z.value.encoding?`"${z.value.encoding}"`:"Default";for(let $e in K)!ke&&We.includes($e)?_e.push(new Tt($e,K[$e],`In "${Z}": "${$e}" is only valid when "encoding" is set to "custom". ${Oe} encoding found`)):ae[$e]?_e=_e.concat(z.validateSpec({key:$e,value:K[$e],valueSpec:ae[$e],validateSpec:z.validateSpec,style:ce,styleSpec:re})):_e.push(new Tt($e,K[$e],`unknown property "${$e}"`));return _e}({sourceName:h,value:a,style:u.style,styleSpec:_,validateSpec:I}),O;case"geojson":if(O=Zo({key:h,value:a,valueSpec:_.source_geojson,style:w,styleSpec:_,validateSpec:I,objectElementValidators:Bd}),a.cluster)for(let z in a.clusterProperties){let[W,Z]=a.clusterProperties[z],K=typeof W=="string"?[W,["accumulated"],["get",z]]:W;O.push(...Su({key:`${h}.${z}.map`,value:Z,validateSpec:I,expressionContext:"cluster-map"})),O.push(...Su({key:`${h}.${z}.reduce`,value:K,validateSpec:I,expressionContext:"cluster-reduce"}))}return O;case"video":return Zo({key:h,value:a,valueSpec:_.source_video,style:w,validateSpec:I,styleSpec:_});case"image":return Zo({key:h,value:a,valueSpec:_.source_image,style:w,validateSpec:I,styleSpec:_});case"canvas":return[new Tt(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wf({key:`${h}.type`,value:a.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:w,validateSpec:I,styleSpec:_})}}function qi(u){let a=u.value,h=u.styleSpec,_=h.light,w=u.style,I=[],R=cr(a);if(a===void 0)return I;if(R!=="object")return I=I.concat([new Tt("light",a,`object expected, ${R} found`)]),I;for(let O in a){let z=O.match(/^(.*)-transition$/);I=I.concat(z&&_[z[1]]&&_[z[1]].transition?u.validateSpec({key:O,value:a[O],valueSpec:h.transition,validateSpec:u.validateSpec,style:w,styleSpec:h}):_[O]?u.validateSpec({key:O,value:a[O],valueSpec:_[O],validateSpec:u.validateSpec,style:w,styleSpec:h}):[new Tt(O,a[O],`unknown property "${O}"`)])}return I}function iA(u){let a=u.value,h=u.styleSpec,_=h.terrain,w=u.style,I=[],R=cr(a);if(a===void 0)return I;if(R!=="object")return I=I.concat([new Tt("terrain",a,`object expected, ${R} found`)]),I;for(let O in a)I=I.concat(_[O]?u.validateSpec({key:O,value:a[O],valueSpec:_[O],validateSpec:u.validateSpec,style:w,styleSpec:h}):[new Tt(O,a[O],`unknown property "${O}"`)]);return I}function nm(u){let a=[],h=u.value,_=u.key;if(Array.isArray(h)){let w=[],I=[];for(let R in h)h[R].id&&w.includes(h[R].id)&&a.push(new Tt(_,h,`all the sprites' ids must be unique, but ${h[R].id} is duplicated`)),w.push(h[R].id),h[R].url&&I.includes(h[R].url)&&a.push(new Tt(_,h,`all the sprites' URLs must be unique, but ${h[R].url} is duplicated`)),I.push(h[R].url),a=a.concat(Zo({key:`${_}[${R}]`,value:h[R],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return a}return ql({key:_,value:h})}let w_={"*":()=>[],array:bf,boolean:function(u){let a=u.value,h=u.key,_=cr(a);return _!=="boolean"?[new Tt(h,a,`boolean expected, ${_} found`)]:[]},number:Dd,color:function(u){let a=u.key,h=u.value,_=cr(h);return _!=="string"?[new Tt(a,h,`color expected, ${_} found`)]:_i.parse(String(h))?[]:[new Tt(a,h,`color expected, "${h}" found`)]},constants:x_,enum:wf,filter:Yo,function:Od,layer:im,object:Zo,source:ha,light:qi,terrain:iA,string:ql,formatted:function(u){return ql(u).length===0?[]:Su(u)},resolvedImage:function(u){return ql(u).length===0?[]:Su(u)},padding:function(u){let a=u.key,h=u.value;if(cr(h)==="array"){if(h.length<1||h.length>4)return[new Tt(a,h,`padding requires 1 to 4 values; ${h.length} values found`)];let _={type:"number"},w=[];for(let I=0;I[]}})),u.constants&&(h=h.concat(x_({key:"constants",value:u.constants,style:u,styleSpec:a,validateSpec:Fc}))),Sf(h)}function dl(u){return function(a){return u({...a,validateSpec:Fc})}}function Sf(u){return[].concat(u).sort((a,h)=>a.line-h.line)}function Nc(u){return function(...a){return Sf(u.apply(this,a))}}fa.source=Nc(dl(ha)),fa.sprite=Nc(dl(nm)),fa.glyphs=Nc(dl(S_)),fa.light=Nc(dl(qi)),fa.terrain=Nc(dl(iA)),fa.layer=Nc(dl(im)),fa.filter=Nc(dl(Yo)),fa.paintProperty=Nc(dl(v_)),fa.layoutProperty=Nc(dl(b_));let zc=fa,T_=zc.light,nA=zc.paintProperty,sm=zc.layoutProperty;function sA(u,a){let h=!1;if(a&&a.length)for(let _ of a)u.fire(new po(new Error(_.message))),h=!0;return h}class Tf{constructor(a,h,_){let w=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;let R=new Int32Array(this.arrayBuffer);a=R[0],this.d=(h=R[1])+2*(_=R[2]);for(let z=0;z=K[ce+0]&&w>=K[ce+1])?(O[ae]=!0,R.push(Z[ae])):O[ae]=!1}}}}_forEachCell(a,h,_,w,I,R,O,z){let W=this._convertToCellCoord(a),Z=this._convertToCellCoord(h),K=this._convertToCellCoord(_),re=this._convertToCellCoord(w);for(let ae=W;ae<=K;ae++)for(let ce=Z;ce<=re;ce++){let _e=this.d*ce+ae;if((!z||z(this._convertFromCellCoord(ae),this._convertFromCellCoord(ce),this._convertFromCellCoord(ae+1),this._convertFromCellCoord(ce+1)))&&I.call(this,a,h,_,w,_e,R,O,z))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,_=0;for(let R=0;R=0)continue;let R=u[I];w[I]=Uc[_].shallow.indexOf(I)>=0?R:zn(R,a)}u instanceof Error&&(w.message=u.message)}if(w.$name)throw new Error("$name property is reserved for worker serialization logic.");return _!=="Object"&&(w.$name=_),w}throw new Error("can't serialize object of type "+typeof u)}function Tu(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||Gl(u)||fo(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(Tu);if(typeof u=="object"){let a=u.$name||"Object";if(!Uc[a])throw new Error(`can't deserialize unregistered class ${a}`);let{klass:h}=Uc[a];if(!h)throw new Error(`can't deserialize unregistered class ${a}`);if(h.deserialize)return h.deserialize(u);let _=Object.create(h.prototype);for(let w of Object.keys(u)){if(w==="$name")continue;let I=u[w];_[w]=Uc[a].shallow.indexOf(w)>=0?I:Tu(I)}return _}throw new Error("can't deserialize object of type "+typeof u)}class om{constructor(){this.first=!0}update(a,h){let _=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=_,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=_,!0):(this.lastFloorZoom>_?(this.lastIntegerZoom=_+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<_&&(this.lastIntegerZoom=_,this.lastIntegerZoomTime=h),a!==this.lastZoom&&(this.lastZoom=a,this.lastFloorZoom=_,!0))}}let Nt={"Latin-1 Supplement":u=>u>=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 am(u){for(let a of u)if(oA(a.charCodeAt(0)))return!0;return!1}function lm(u){for(let a of u)if(!Xx(a.charCodeAt(0)))return!1;return!0}function Xx(u){return!(Nt.Arabic(u)||Nt["Arabic Supplement"](u)||Nt["Arabic Extended-A"](u)||Nt["Arabic Presentation Forms-A"](u)||Nt["Arabic Presentation Forms-B"](u))}function oA(u){return!(u!==746&&u!==747&&(u<4352||!(Nt["Bopomofo Extended"](u)||Nt.Bopomofo(u)||Nt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||Nt["CJK Compatibility Ideographs"](u)||Nt["CJK Compatibility"](u)||Nt["CJK Radicals Supplement"](u)||Nt["CJK Strokes"](u)||!(!Nt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||Nt["CJK Unified Ideographs Extension A"](u)||Nt["CJK Unified Ideographs"](u)||Nt["Enclosed CJK Letters and Months"](u)||Nt["Hangul Compatibility Jamo"](u)||Nt["Hangul Jamo Extended-A"](u)||Nt["Hangul Jamo Extended-B"](u)||Nt["Hangul Jamo"](u)||Nt["Hangul Syllables"](u)||Nt.Hiragana(u)||Nt["Ideographic Description Characters"](u)||Nt.Kanbun(u)||Nt["Kangxi Radicals"](u)||Nt["Katakana Phonetic Extensions"](u)||Nt.Katakana(u)&&u!==12540||!(!Nt["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)||!(!Nt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||Nt["Unified Canadian Aboriginal Syllabics"](u)||Nt["Unified Canadian Aboriginal Syllabics Extended"](u)||Nt["Vertical Forms"](u)||Nt["Yijing Hexagram Symbols"](u)||Nt["Yi Syllables"](u)||Nt["Yi Radicals"](u))))}function Fd(u){return!(oA(u)||function(a){return!!(Nt["Latin-1 Supplement"](a)&&(a===167||a===169||a===174||a===177||a===188||a===189||a===190||a===215||a===247)||Nt["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)||Nt["Letterlike Symbols"](a)||Nt["Number Forms"](a)||Nt["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)||Nt["Control Pictures"](a)&&a!==9251||Nt["Optical Character Recognition"](a)||Nt["Enclosed Alphanumerics"](a)||Nt["Geometric Shapes"](a)||Nt["Miscellaneous Symbols"](a)&&!(a>=9754&&a<=9759)||Nt["Miscellaneous Symbols and Arrows"](a)&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||Nt["CJK Symbols and Punctuation"](a)||Nt.Katakana(a)||Nt["Private Use Area"](a)||Nt["CJK Compatibility Forms"](a)||Nt["Small Form Variants"](a)||Nt["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 Eu(u){return u>=1424&&u<=2303||Nt["Arabic Presentation Forms-A"](u)||Nt["Arabic Presentation Forms-B"](u)}function cm(u,a){return!(!a&&Eu(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||Nt.Khmer(u))}function E_(u){for(let a of u)if(Eu(a.charCodeAt(0)))return!0;return!1}let Ef="deferred",Vc="loading",Zl="loaded",aA=null,ko="unavailable",Yl=null,Nd=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(ko="error"),aA&&aA(u)};function um(){Mf.fire(new fs("pluginStateChange",{pluginStatus:ko,pluginURL:Yl}))}let Mf=new zl,hm=function(){return ko},M_=function(){if(ko!==Ef||!Yl)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ko=Vc,um(),Yl&&cl({url:Yl},u=>{u?Nd(u):(ko=Zl,um())})},da={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ko===Zl||da.applyArabicShaping!=null,isLoading:()=>ko===Vc,setState(u){if(!ri())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");ko=u.pluginStatus,Yl=u.pluginURL},isParsed(){if(!ri())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return da.applyArabicShaping!=null&&da.processBidirectionalText!=null&&da.processStyledBidirectionalText!=null},getPluginURL(){if(!ri())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Yl}};class gn{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 om,this.transition={})}isSupportedScript(a){return function(h,_){for(let w of h)if(!cm(w.charCodeAt(0),_))return!1;return!0}(a,da.isLoaded())}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),_=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*_}:{fromScale:.5,toScale:1,t:1-(1-_)*h}}}class lA{constructor(a,h){this.property=a,this.value=h,this.expression=function(_,w){if(ue(_))return new $l(_,w);if(wu(_)){let I=qo(_,w);if(I.result==="error")throw new Error(I.value.map(R=>`${R.key}: ${R.message}`).join(", "));return I.value}{let I=_;return w.type==="color"&&typeof _=="string"?I=_i.parse(_):w.type!=="padding"||typeof _!="number"&&!Array.isArray(_)?w.type==="variableAnchorOffsetCollection"&&Array.isArray(_)&&(I=$o.parse(_)):I=Fn.parse(_),{kind:"constant",evaluate:()=>I}}}(h===void 0?a.specification.default:h,a.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(a,h,_){return this.property.possiblyEvaluate(this,a,h,_)}}class fm{constructor(a){this.property=a,this.value=new lA(a,void 0)}transitioned(a,h){return new C_(this.property,this.value,h,Re({},a.transition,this.transition),a.now)}untransitioned(){return new C_(this.property,this.value,null,{},0)}}class P_{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return et(this._values[a].value.value)}setValue(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new fm(this._values[a].property)),this._values[a].value=new lA(this._values[a].property,h===null?void 0:et(h))}getTransition(a){return et(this._values[a].transition)}setTransition(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new fm(this._values[a].property)),this._values[a].transition=et(h)||void 0}serialize(){let a={};for(let h of Object.keys(this._values)){let _=this.getValue(h);_!==void 0&&(a[h]=_);let w=this.getTransition(h);w!==void 0&&(a[`${h}-transition`]=w)}return a}transitioned(a,h){let _=new zd(this._properties);for(let w of Object.keys(this._values))_._values[w]=this._values[w].transitioned(a,h._values[w]);return _}untransitioned(){let a=new zd(this._properties);for(let h of Object.keys(this._values))a._values[h]=this._values[h].untransitioned();return a}}class C_{constructor(a,h,_,w,I){this.property=a,this.value=h,this.begin=I+w.delay||0,this.end=this.begin+w.duration||0,a.specification.transition&&(w.delay||w.duration)&&(this.prior=_)}possiblyEvaluate(a,h,_){let w=a.now||0,I=this.value.possiblyEvaluate(a,h,_),R=this.prior;if(R){if(w>this.end)return this.prior=null,I;if(this.value.isDataDriven())return this.prior=null,I;if(w=1)return 1;let W=z*z,Z=W*z;return 4*(z<.5?Z:3*(z-W)+Z-.75)}(O))}}return I}}class zd{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)}possiblyEvaluate(a,h,_){let w=new cA(this._properties);for(let I of Object.keys(this._values))w._values[I]=this._values[I].possiblyEvaluate(a,h,_);return w}hasTransition(){for(let a of Object.keys(this._values))if(this._values[a].prior)return!0;return!1}}class Qx{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}hasValue(a){return this._values[a].value!==void 0}getValue(a){return et(this._values[a].value)}setValue(a,h){this._values[a]=new lA(this._values[a].property,h===null?void 0:et(h))}serialize(){let a={};for(let h of Object.keys(this._values)){let _=this.getValue(h);_!==void 0&&(a[h]=_)}return a}possiblyEvaluate(a,h,_){let w=new cA(this._properties);for(let I of Object.keys(this._values))w._values[I]=this._values[I].possiblyEvaluate(a,h,_);return w}}class Lo{constructor(a,h,_){this.property=a,this.value=h,this.parameters=_}isConstant(){return this.value.kind==="constant"}constantOr(a){return this.value.kind==="constant"?this.value.value:a}evaluate(a,h,_,w){return this.property.evaluate(this.value,this.parameters,a,h,_,w)}}class cA{constructor(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)}get(a){return this._values[a]}}class tr{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,_){let w=za[this.specification.type];return w?w(a,h,_):a}}class yr{constructor(a,h){this.specification=a,this.overrides=h}possiblyEvaluate(a,h,_,w){return new Lo(this,a.expression.kind==="constant"||a.expression.kind==="camera"?{kind:"constant",value:a.expression.evaluate(h,null,{},_,w)}:a.expression,h)}interpolate(a,h,_){if(a.value.kind!=="constant"||h.value.kind!=="constant")return a;if(a.value.value===void 0||h.value.value===void 0)return new Lo(this,{kind:"constant",value:void 0},a.parameters);let w=za[this.specification.type];if(w){let I=w(a.value.value,h.value.value,_);return new Lo(this,{kind:"constant",value:I},a.parameters)}return a}evaluate(a,h,_,w,I,R){return a.kind==="constant"?a.value:a.evaluate(h,_,w,I,R)}}class wh extends yr{possiblyEvaluate(a,h,_,w){if(a.value===void 0)return new Lo(this,{kind:"constant",value:void 0},h);if(a.expression.kind==="constant"){let I=a.expression.evaluate(h,null,{},_,w),R=a.property.specification.type==="resolvedImage"&&typeof I!="string"?I.name:I,O=this._calculate(R,R,R,h);return new Lo(this,{kind:"constant",value:O},h)}if(a.expression.kind==="camera"){let I=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 Lo(this,{kind:"constant",value:I},h)}return new Lo(this,a.expression,h)}evaluate(a,h,_,w,I,R){if(a.kind==="source"){let O=a.evaluate(h,_,w,I,R);return this._calculate(O,O,O,h)}return a.kind==="composite"?this._calculate(a.evaluate({zoom:Math.floor(h.zoom)-1},_,w),a.evaluate({zoom:Math.floor(h.zoom)},_,w),a.evaluate({zoom:Math.floor(h.zoom)+1},_,w),h):a.value}_calculate(a,h,_,w){return w.zoom>w.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:_,to:h}}interpolate(a){return a}}class uA{constructor(a){this.specification=a}possiblyEvaluate(a,h,_,w){if(a.value!==void 0){if(a.expression.kind==="constant"){let I=a.expression.evaluate(h,null,{},_,w);return this._calculate(I,I,I,h)}return this._calculate(a.expression.evaluate(new gn(Math.floor(h.zoom-1),h)),a.expression.evaluate(new gn(Math.floor(h.zoom),h)),a.expression.evaluate(new gn(Math.floor(h.zoom+1),h)),h)}}_calculate(a,h,_,w){return w.zoom>w.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:_,to:h}}interpolate(a){return a}}class Mu{constructor(a){this.specification=a}possiblyEvaluate(a,h,_,w){return!!a.expression.evaluate(h,null,{},_,w)}interpolate(){return!1}}class Xn{constructor(a){this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let h in a){let _=a[h];_.specification.overridable&&this.overridableProperties.push(h);let w=this.defaultPropertyValues[h]=new lA(_,void 0),I=this.defaultTransitionablePropertyValues[h]=new fm(_);this.defaultTransitioningPropertyValues[h]=I.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=w.possiblyEvaluate({})}}}Rt("DataDrivenProperty",yr),Rt("DataConstantProperty",tr),Rt("CrossFadedDataDrivenProperty",wh),Rt("CrossFadedProperty",uA),Rt("ColorRampProperty",Mu);let Ud="-transition";class pa extends zl{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 Qx(h.layout)),h.paint)){this._transitionablePaint=new P_(h.paint);for(let _ in a.paint)this.setPaintProperty(_,a.paint[_],{validate:!1});for(let _ in a.layout)this.setLayoutProperty(_,a.layout[_],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new cA(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return a==="visibility"?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,h,_={}){h!=null&&this._validate(sm,`layers.${this.id}.layout.${a}`,a,h,_)||(a!=="visibility"?this._unevaluatedLayout.setValue(a,h):this.visibility=h)}getPaintProperty(a){return a.endsWith(Ud)?this._transitionablePaint.getTransition(a.slice(0,-11)):this._transitionablePaint.getValue(a)}setPaintProperty(a,h,_={}){if(h!=null&&this._validate(nA,`layers.${this.id}.paint.${a}`,a,h,_))return!1;if(a.endsWith(Ud))return this._transitionablePaint.setTransition(a.slice(0,-11),h||void 0),!1;{let w=this._transitionablePaint._values[a],I=w.property.specification["property-type"]==="cross-faded-data-driven",R=w.value.isDataDriven(),O=w.value;this._transitionablePaint.setValue(a,h),this._handleSpecialPaintPropertyUpdate(a);let z=this._transitionablePaint._values[a].value;return z.isDataDriven()||R||I||this._handleOverridablePaintPropertyUpdate(a,O,z)}}_handleSpecialPaintPropertyUpdate(a){}_handleOverridablePaintPropertyUpdate(a,h,_){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),ot(a,(h,_)=>!(h===void 0||_==="layout"&&!Object.keys(h).length||_==="paint"&&!Object.keys(h).length))}_validate(a,h,_,w,I={}){return(!I||I.validate!==!1)&&sA(this,a.call(zc,{key:h,layerType:this.type,objectKey:_,value:w,styleSpec:ct,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 Lo&&_r(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}let I_={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Pu{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 wn{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 _n(u,a=1){let h=0,_=0;return{members:u.map(w=>{let I=I_[w.type].BYTES_PER_ELEMENT,R=h=jc(h,Math.max(a,I)),O=w.components||1;return _=Math.max(_,I),h+=I*O,{name:w.name,type:w.type,components:O,offset:R}}),size:jc(h,Math.max(_,a)),alignment:a}}function jc(u,a){return Math.ceil(u/a)*a}class Gi extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h){let _=this.length;return this.resize(_+1),this.emplace(_,a,h)}emplace(a,h,_){let w=2*a;return this.int16[w+0]=h,this.int16[w+1]=_,a}}Gi.prototype.bytesPerElement=4,Rt("StructArrayLayout2i4",Gi);class Vd extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_){let w=this.length;return this.resize(w+1),this.emplace(w,a,h,_)}emplace(a,h,_,w){let I=3*a;return this.int16[I+0]=h,this.int16[I+1]=_,this.int16[I+2]=w,a}}Vd.prototype.bytesPerElement=6,Rt("StructArrayLayout3i6",Vd);class Sh extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_,w){let I=this.length;return this.resize(I+1),this.emplace(I,a,h,_,w)}emplace(a,h,_,w,I){let R=4*a;return this.int16[R+0]=h,this.int16[R+1]=_,this.int16[R+2]=w,this.int16[R+3]=I,a}}Sh.prototype.bytesPerElement=8,Rt("StructArrayLayout4i8",Sh);class dm extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I,R){let O=this.length;return this.resize(O+1),this.emplace(O,a,h,_,w,I,R)}emplace(a,h,_,w,I,R,O){let z=6*a;return this.int16[z+0]=h,this.int16[z+1]=_,this.int16[z+2]=w,this.int16[z+3]=I,this.int16[z+4]=R,this.int16[z+5]=O,a}}dm.prototype.bytesPerElement=12,Rt("StructArrayLayout2i4i12",dm);class pm extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I,R){let O=this.length;return this.resize(O+1),this.emplace(O,a,h,_,w,I,R)}emplace(a,h,_,w,I,R,O){let z=4*a,W=8*a;return this.int16[z+0]=h,this.int16[z+1]=_,this.uint8[W+4]=w,this.uint8[W+5]=I,this.uint8[W+6]=R,this.uint8[W+7]=O,a}}pm.prototype.bytesPerElement=8,Rt("StructArrayLayout2i4ub8",pm);class Pf extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h){let _=this.length;return this.resize(_+1),this.emplace(_,a,h)}emplace(a,h,_){let w=2*a;return this.float32[w+0]=h,this.float32[w+1]=_,a}}Pf.prototype.bytesPerElement=8,Rt("StructArrayLayout2f8",Pf);class Am extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I,R,O,z,W,Z){let K=this.length;return this.resize(K+1),this.emplace(K,a,h,_,w,I,R,O,z,W,Z)}emplace(a,h,_,w,I,R,O,z,W,Z,K){let re=10*a;return this.uint16[re+0]=h,this.uint16[re+1]=_,this.uint16[re+2]=w,this.uint16[re+3]=I,this.uint16[re+4]=R,this.uint16[re+5]=O,this.uint16[re+6]=z,this.uint16[re+7]=W,this.uint16[re+8]=Z,this.uint16[re+9]=K,a}}Am.prototype.bytesPerElement=20,Rt("StructArrayLayout10ui20",Am);class mm extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I,R,O,z,W,Z,K,re){let ae=this.length;return this.resize(ae+1),this.emplace(ae,a,h,_,w,I,R,O,z,W,Z,K,re)}emplace(a,h,_,w,I,R,O,z,W,Z,K,re,ae){let ce=12*a;return this.int16[ce+0]=h,this.int16[ce+1]=_,this.int16[ce+2]=w,this.int16[ce+3]=I,this.uint16[ce+4]=R,this.uint16[ce+5]=O,this.uint16[ce+6]=z,this.uint16[ce+7]=W,this.int16[ce+8]=Z,this.int16[ce+9]=K,this.int16[ce+10]=re,this.int16[ce+11]=ae,a}}mm.prototype.bytesPerElement=24,Rt("StructArrayLayout4i4ui4i24",mm);class jr extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,_){let w=this.length;return this.resize(w+1),this.emplace(w,a,h,_)}emplace(a,h,_,w){let I=3*a;return this.float32[I+0]=h,this.float32[I+1]=_,this.float32[I+2]=w,a}}jr.prototype.bytesPerElement=12,Rt("StructArrayLayout3f12",jr);class E extends wn{_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}}E.prototype.bytesPerElement=4,Rt("StructArrayLayout1ul4",E);class l extends wn{_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,_,w,I,R,O,z,W){let Z=this.length;return this.resize(Z+1),this.emplace(Z,a,h,_,w,I,R,O,z,W)}emplace(a,h,_,w,I,R,O,z,W,Z){let K=10*a,re=5*a;return this.int16[K+0]=h,this.int16[K+1]=_,this.int16[K+2]=w,this.int16[K+3]=I,this.int16[K+4]=R,this.int16[K+5]=O,this.uint32[re+3]=z,this.uint16[K+8]=W,this.uint16[K+9]=Z,a}}l.prototype.bytesPerElement=20,Rt("StructArrayLayout6i1ul2ui20",l);class A extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I,R){let O=this.length;return this.resize(O+1),this.emplace(O,a,h,_,w,I,R)}emplace(a,h,_,w,I,R,O){let z=6*a;return this.int16[z+0]=h,this.int16[z+1]=_,this.int16[z+2]=w,this.int16[z+3]=I,this.int16[z+4]=R,this.int16[z+5]=O,a}}A.prototype.bytesPerElement=12,Rt("StructArrayLayout2i2i2i12",A);class v extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,_,w,I){let R=this.length;return this.resize(R+1),this.emplace(R,a,h,_,w,I)}emplace(a,h,_,w,I,R){let O=4*a,z=8*a;return this.float32[O+0]=h,this.float32[O+1]=_,this.float32[O+2]=w,this.int16[z+6]=I,this.int16[z+7]=R,a}}v.prototype.bytesPerElement=16,Rt("StructArrayLayout2f1f2i16",v);class S extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,_,w){let I=this.length;return this.resize(I+1),this.emplace(I,a,h,_,w)}emplace(a,h,_,w,I){let R=12*a,O=3*a;return this.uint8[R+0]=h,this.uint8[R+1]=_,this.float32[O+1]=w,this.float32[O+2]=I,a}}S.prototype.bytesPerElement=12,Rt("StructArrayLayout2ub2f12",S);class P extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,_){let w=this.length;return this.resize(w+1),this.emplace(w,a,h,_)}emplace(a,h,_,w){let I=3*a;return this.uint16[I+0]=h,this.uint16[I+1]=_,this.uint16[I+2]=w,a}}P.prototype.bytesPerElement=6,Rt("StructArrayLayout3ui6",P);class B extends wn{_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,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke){let We=this.length;return this.resize(We+1),this.emplace(We,a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke)}emplace(a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke,We){let Oe=24*a,$e=12*a,Je=48*a;return this.int16[Oe+0]=h,this.int16[Oe+1]=_,this.uint16[Oe+2]=w,this.uint16[Oe+3]=I,this.uint32[$e+2]=R,this.uint32[$e+3]=O,this.uint32[$e+4]=z,this.uint16[Oe+10]=W,this.uint16[Oe+11]=Z,this.uint16[Oe+12]=K,this.float32[$e+7]=re,this.float32[$e+8]=ae,this.uint8[Je+36]=ce,this.uint8[Je+37]=_e,this.uint8[Je+38]=Pe,this.uint32[$e+10]=ke,this.int16[Oe+22]=We,a}}B.prototype.bytesPerElement=48,Rt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",B);class F extends wn{_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,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke,We,Oe,$e,Je,At,Ht,sr,jt,zt,kt,Kt){let Bt=this.length;return this.resize(Bt+1),this.emplace(Bt,a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke,We,Oe,$e,Je,At,Ht,sr,jt,zt,kt,Kt)}emplace(a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e,Pe,ke,We,Oe,$e,Je,At,Ht,sr,jt,zt,kt,Kt,Bt){let bt=32*a,gr=16*a;return this.int16[bt+0]=h,this.int16[bt+1]=_,this.int16[bt+2]=w,this.int16[bt+3]=I,this.int16[bt+4]=R,this.int16[bt+5]=O,this.int16[bt+6]=z,this.int16[bt+7]=W,this.uint16[bt+8]=Z,this.uint16[bt+9]=K,this.uint16[bt+10]=re,this.uint16[bt+11]=ae,this.uint16[bt+12]=ce,this.uint16[bt+13]=_e,this.uint16[bt+14]=Pe,this.uint16[bt+15]=ke,this.uint16[bt+16]=We,this.uint16[bt+17]=Oe,this.uint16[bt+18]=$e,this.uint16[bt+19]=Je,this.uint16[bt+20]=At,this.uint16[bt+21]=Ht,this.uint16[bt+22]=sr,this.uint32[gr+12]=jt,this.float32[gr+13]=zt,this.float32[gr+14]=kt,this.uint16[bt+30]=Kt,this.uint16[bt+31]=Bt,a}}F.prototype.bytesPerElement=64,Rt("StructArrayLayout8i15ui1ul2f2ui64",F);class U extends wn{_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}}U.prototype.bytesPerElement=4,Rt("StructArrayLayout1f4",U);class H extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,_){let w=this.length;return this.resize(w+1),this.emplace(w,a,h,_)}emplace(a,h,_,w){let I=3*a;return this.uint16[6*a+0]=h,this.float32[I+1]=_,this.float32[I+2]=w,a}}H.prototype.bytesPerElement=12,Rt("StructArrayLayout1ui2f12",H);class Y extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,_){let w=this.length;return this.resize(w+1),this.emplace(w,a,h,_)}emplace(a,h,_,w){let I=4*a;return this.uint32[2*a+0]=h,this.uint16[I+2]=_,this.uint16[I+3]=w,a}}Y.prototype.bytesPerElement=8,Rt("StructArrayLayout1ul2ui8",Y);class X extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h){let _=this.length;return this.resize(_+1),this.emplace(_,a,h)}emplace(a,h,_){let w=2*a;return this.uint16[w+0]=h,this.uint16[w+1]=_,a}}X.prototype.bytesPerElement=4,Rt("StructArrayLayout2ui4",X);class se extends wn{_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}}se.prototype.bytesPerElement=2,Rt("StructArrayLayout1ui2",se);class ge extends wn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,_,w){let I=this.length;return this.resize(I+1),this.emplace(I,a,h,_,w)}emplace(a,h,_,w,I){let R=4*a;return this.float32[R+0]=h,this.float32[R+1]=_,this.float32[R+2]=w,this.float32[R+3]=I,a}}ge.prototype.bytesPerElement=16,Rt("StructArrayLayout4f16",ge);class me extends Pu{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new b(this.anchorPointX,this.anchorPointY)}}me.prototype.size=20;class we extends l{get(a){return new me(this,a)}}Rt("CollisionBoxArray",we);class Ae extends Pu{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]}}Ae.prototype.size=48;class ze extends B{get(a){return new Ae(this,a)}}Rt("PlacedSymbolArray",ze);class Qe extends Pu{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]}}Qe.prototype.size=64;class Me extends F{get(a){return new Qe(this,a)}}Rt("SymbolInstanceArray",Me);class Ve extends U{getoffsetX(a){return this.float32[1*a+0]}}Rt("GlyphOffsetArray",Ve);class it extends Vd{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}Rt("SymbolLineVertexArray",it);class tt extends Pu{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]}}tt.prototype.size=12;class dt extends H{get(a){return new tt(this,a)}}Rt("TextAnchorOffsetArray",dt);class vt extends Pu{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]}}vt.prototype.size=8;class gt extends Y{get(a){return new vt(this,a)}}Rt("FeatureIndexArray",gt);class Mt extends Gi{}class rr extends Gi{}class ci extends Gi{}class Ft extends dm{}class mr extends pm{}class ir extends Pf{}class zi extends Am{}class oi extends mm{}class Gr extends jr{}class ui extends E{}class Un extends A{}class ln extends S{}class Ys extends P{}class As extends X{}let Vn=_n([{name:"a_pos",components:2,type:"Int16"}],4),{members:Aa}=Vn;class cn{constructor(a=[]){this.segments=a}prepareSegment(a,h,_,w){let I=this.segments[this.segments.length-1];return a>cn.MAX_VERTEX_ARRAY_LENGTH&&Gt(`Max vertices per segment is ${cn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!I||I.vertexLength+a>cn.MAX_VERTEX_ARRAY_LENGTH||I.sortKey!==w)&&(I={vertexOffset:h.length,primitiveOffset:_.length,vertexLength:0,primitiveLength:0},w!==void 0&&(I.sortKey=w),this.segments.push(I)),I}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,_,w){return new cn([{vertexOffset:a,primitiveOffset:h,vertexLength:_,primitiveLength:w,vaos:{},sortKey:0}])}}function ks(u,a){return 256*(u=oe(Math.floor(u),0,255))+oe(Math.floor(a),0,255)}cn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Rt("SegmentVector",cn);let pl=_n([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Cu={exports:{}},Th={exports:{}};Th.exports=function(u,a){var h,_,w,I,R,O,z,W;for(_=u.length-(h=3&u.length),w=a,R=3432918353,O=461845907,W=0;W<_;)z=255&u.charCodeAt(W)|(255&u.charCodeAt(++W))<<8|(255&u.charCodeAt(++W))<<16|(255&u.charCodeAt(++W))<<24,++W,w=27492+(65535&(I=5*(65535&(w=(w^=z=(65535&(z=(z=(65535&z)*R+(((z>>>16)*R&65535)<<16)&4294967295)<<15|z>>>17))*O+(((z>>>16)*O&65535)<<16)&4294967295)<<13|w>>>19))+((5*(w>>>16)&65535)<<16)&4294967295))+((58964+(I>>>16)&65535)<<16);switch(z=0,h){case 3:z^=(255&u.charCodeAt(W+2))<<16;case 2:z^=(255&u.charCodeAt(W+1))<<8;case 1:w^=z=(65535&(z=(z=(65535&(z^=255&u.charCodeAt(W)))*R+(((z>>>16)*R&65535)<<16)&4294967295)<<15|z>>>17))*O+(((z>>>16)*O&65535)<<16)&4294967295}return w^=u.length,w=2246822507*(65535&(w^=w>>>16))+((2246822507*(w>>>16)&65535)<<16)&4294967295,w=3266489909*(65535&(w^=w>>>13))+((3266489909*(w>>>16)&65535)<<16)&4294967295,(w^=w>>>16)>>>0};var Cf=Th.exports,go={exports:{}};go.exports=function(u,a){for(var h,_=u.length,w=a^_,I=0;_>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(I)|(255&u.charCodeAt(++I))<<8|(255&u.charCodeAt(++I))<<16|(255&u.charCodeAt(++I))<<24))+((1540483477*(h>>>16)&65535)<<16),w=1540483477*(65535&w)+((1540483477*(w>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),_-=4,++I;switch(_){case 3:w^=(255&u.charCodeAt(I+2))<<16;case 2:w^=(255&u.charCodeAt(I+1))<<8;case 1:w=1540483477*(65535&(w^=255&u.charCodeAt(I)))+((1540483477*(w>>>16)&65535)<<16)}return w=1540483477*(65535&(w^=w>>>13))+((1540483477*(w>>>16)&65535)<<16),(w^=w>>>15)>>>0};var Xs=Cf,jn=go.exports;Cu.exports=Xs,Cu.exports.murmur3=Xs,Cu.exports.murmur2=jn;var Iu=c(Cu.exports);class Dn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,h,_,w){this.ids.push(ms(a)),this.positions.push(h,_,w)}getPositions(a){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let h=ms(a),_=0,w=this.ids.length-1;for(;_>1;this.ids[R]>=h?w=R:_=R+1}let I=[];for(;this.ids[_]===h;)I.push({index:this.positions[3*_],start:this.positions[3*_+1],end:this.positions[3*_+2]}),_++;return I}static serialize(a,h){let _=new Float64Array(a.ids),w=new Uint32Array(a.positions);return Xo(_,w,0,_.length-1),h&&h.push(_.buffer,w.buffer),{ids:_,positions:w}}static deserialize(a){let h=new Dn;return h.ids=a.ids,h.positions=a.positions,h.indexed=!0,h}}function ms(u){let a=+u;return!isNaN(a)&&a<=Number.MAX_SAFE_INTEGER?a:Iu(String(u))}function Xo(u,a,h,_){for(;h<_;){let w=u[h+_>>1],I=h-1,R=_+1;for(;;){do I++;while(u[I]w);if(I>=R)break;Wn(u,I,R),Wn(a,3*I,3*R),Wn(a,3*I+1,3*R+1),Wn(a,3*I+2,3*R+2)}R-h<_-R?(Xo(u,a,h,R),h=R+1):(Xo(u,a,R+1,_),_=R)}}function Wn(u,a,h){let _=u[a];u[a]=u[h],u[h]=_}Rt("FeaturePositionMap",Dn);class Eh{constructor(a,h){this.gl=a.gl,this.location=h}}class hA extends Eh{constructor(a,h){super(a,h),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1f(this.location,a))}}class R_ extends Eh{constructor(a,h){super(a,h),this.current=[0,0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4f(this.location,a[0],a[1],a[2],a[3]))}}class k_ extends Eh{constructor(a,h){super(a,h),this.current=_i.transparent}set(a){a.r===this.current.r&&a.g===this.current.g&&a.b===this.current.b&&a.a===this.current.a||(this.current=a,this.gl.uniform4f(this.location,a.r,a.g,a.b,a.a))}}let Kx=new Float32Array(16);function gm(u){return[ks(255*u.r,255*u.g),ks(255*u.b,255*u.a)]}class Xl{constructor(a,h,_){this.value=a,this.uniformNames=h.map(w=>`u_${w}`),this.type=_}setUniform(a,h,_){a.set(_.constantOr(this.value))}getBinding(a,h,_){return this.type==="color"?new k_(a,h):new hA(a,h)}}class Mh{constructor(a,h){this.uniformNames=h.map(_=>`u_${_}`),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,_,w){let I=w==="u_pattern_to"?this.patternTo:w==="u_pattern_from"?this.patternFrom:w==="u_pixel_ratio_to"?this.pixelRatioTo:w==="u_pixel_ratio_from"?this.pixelRatioFrom:null;I&&a.set(I)}getBinding(a,h,_){return _.substr(0,9)==="u_pattern"?new R_(a,h):new hA(a,h)}}class Al{constructor(a,h,_,w){this.expression=a,this.type=_,this.maxValue=0,this.paintVertexAttributes=h.map(I=>({name:`a_${I}`,type:"Float32",components:_==="color"?2:1,offset:0})),this.paintVertexArray=new w}populatePaintArray(a,h,_,w,I){let R=this.paintVertexArray.length,O=this.expression.evaluate(new gn(0),h,{},w,[],I);this.paintVertexArray.resize(a),this._setPaintValue(R,a,O)}updatePaintArray(a,h,_,w){let I=this.expression.evaluate({zoom:0},_,w);this._setPaintValue(a,h,I)}_setPaintValue(a,h,_){if(this.type==="color"){let w=gm(_);for(let I=a;I`u_${O}_t`),this.type=_,this.useIntegerZoom=w,this.zoom=I,this.maxValue=0,this.paintVertexAttributes=h.map(O=>({name:`a_${O}`,type:"Float32",components:_==="color"?4:2,offset:0})),this.paintVertexArray=new R}populatePaintArray(a,h,_,w,I){let R=this.expression.evaluate(new gn(this.zoom),h,{},w,[],I),O=this.expression.evaluate(new gn(this.zoom+1),h,{},w,[],I),z=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(z,a,R,O)}updatePaintArray(a,h,_,w){let I=this.expression.evaluate({zoom:this.zoom},_,w),R=this.expression.evaluate({zoom:this.zoom+1},_,w);this._setPaintValue(a,h,I,R)}_setPaintValue(a,h,_,w){if(this.type==="color"){let I=gm(_),R=gm(w);for(let O=a;O`#define HAS_UNIFORM_${w}`))}return a}getBinderAttributes(){let a=[];for(let h in this.binders){let _=this.binders[h];if(_ instanceof Al||_ instanceof ma)for(let w=0;w<_.paintVertexAttributes.length;w++)a.push(_.paintVertexAttributes[w].name);else if(_ instanceof Ki)for(let w=0;w!0){this.programConfigurations={};for(let w of a)this.programConfigurations[w.id]=new _m(w,h,_);this.needsUpload=!1,this._featureMap=new Dn,this._bufferOffset=0}populatePaintArrays(a,h,_,w,I,R){for(let O in this.programConfigurations)this.programConfigurations[O].populatePaintArrays(a,h,w,I,R);h.id!==void 0&&this._featureMap.add(h.id,_,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,h,_,w){for(let I of _)this.needsUpload=this.programConfigurations[I.id].updatePaintArrays(a,this._featureMap,h,I,w)||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 ym(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 ml(u,a,h){let _={color:{source:Pf,composite:ge},number:{source:U,composite:Pf}},w=function(I){return{"line-pattern":{source:zi,composite:zi},"fill-pattern":{source:zi,composite:zi},"fill-extrusion-pattern":{source:zi,composite:zi}}[I]}(u);return w&&w[h]||_[a][h]}Rt("ConstantBinder",Xl),Rt("CrossFadedConstantBinder",Mh),Rt("SourceExpressionBinder",Al),Rt("CrossFadedCompositeBinder",Ki),Rt("CompositeExpressionBinder",ma),Rt("ProgramConfiguration",_m,{omit:["_buffers"]}),Rt("ProgramConfigurationSet",Wc);let ls=8192,Jx=Math.pow(2,14)-1,VT=-Jx-1;function If(u){let a=ls/u.extent,h=u.loadGeometry();for(let _=0;_R.x+1||zR.y+1)&&Gt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Rf(u,a){return{type:u.type,id:u.id,properties:u.properties,geometry:a?If(u):[]}}function xm(u,a,h,_,w){u.emplaceBack(2*a+(_+1)/2,2*h+(w+1)/2)}class L_{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 rr,this.indexArray=new Ys,this.segments=new cn,this.programConfigurations=new Wc(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,_){let w=this.layers[0],I=[],R=null,O=!1;w.type==="circle"&&(R=w.layout.get("circle-sort-key"),O=!R.isConstant());for(let{feature:z,id:W,index:Z,sourceLayerIndex:K}of a){let re=this.layers[0]._featureFilter.needGeometry,ae=Rf(z,re);if(!this.layers[0]._featureFilter.filter(new gn(this.zoom),ae,_))continue;let ce=O?R.evaluate(ae,{},_):void 0,_e={id:W,properties:z.properties,type:z.type,sourceLayerIndex:K,index:Z,geometry:re?ae.geometry:If(z),patterns:{},sortKey:ce};I.push(_e)}O&&I.sort((z,W)=>z.sortKey-W.sortKey);for(let z of I){let{geometry:W,index:Z,sourceLayerIndex:K}=z,re=a[Z].feature;this.addFeature(z,W,Z,_),h.featureIndex.insert(re,W,Z,K,this.index)}}update(a,h,_){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,_)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Aa),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,_,w){for(let I of h)for(let R of I){let O=R.x,z=R.y;if(O<0||O>=ls||z<0||z>=ls)continue;let W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),Z=W.vertexLength;xm(this.layoutVertexArray,O,z,-1,-1),xm(this.layoutVertexArray,O,z,1,-1),xm(this.layoutVertexArray,O,z,1,1),xm(this.layoutVertexArray,O,z,-1,1),this.indexArray.emplaceBack(Z,Z+1,Z+2),this.indexArray.emplaceBack(Z,Z+3,Z+2),W.vertexLength+=4,W.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,_,{},w)}}function jT(u,a){for(let h=0;h1){if(ev(u,a))return!0;for(let _=0;_1?h:h.sub(a)._mult(w)._add(a))}function Hc(u,a){let h,_,w,I=!1;for(let R=0;Ra.y!=w.y>a.y&&a.x<(w.x-_.x)*(a.y-_.y)/(w.y-_.y)+_.x&&(I=!I)}return I}function ni(u,a){let h=!1;for(let _=0,w=u.length-1;_a.y!=R.y>a.y&&a.x<(R.x-I.x)*(a.y-I.y)/(R.y-I.y)+I.x&&(h=!h)}return h}function Qo(u,a,h){let _=h[0],w=h[2];if(u.x<_.x&&a.x<_.x||u.x>w.x&&a.x>w.x||u.y<_.y&&a.y<_.y||u.y>w.y&&a.y>w.y)return!1;let I=qt(u,a,h[0]);return I!==qt(u,a,h[1])||I!==qt(u,a,h[2])||I!==qt(u,a,h[3])}function fA(u,a,h){let _=a.paint.get(u).value;return _.kind==="constant"?_.value:h.programConfigurations.get(a.id).getMaxValue(u)}function dA(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Ru(u,a,h,_,w){if(!a[0]&&!a[1])return u;let I=b.convert(a)._mult(w);h==="viewport"&&I._rotate(-_);let R=[];for(let O=0;OLf(Pe,_e))}(W,z),ae=K?Z*O:Z;for(let ce of w)for(let _e of ce){let Pe=K?_e:Lf(_e,z),ke=ae,We=Wd([],[_e.x,_e.y,0,1],z);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ke*=We[3]/R.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ke*=R.cameraToCenterDistance/We[3]),H4(re,Pe,ke))return!0}return!1}}function Lf(u,a){let h=Wd([],[u.x,u.y,0,1],a);return new b(h[0]/h[3],h[1]/h[3])}class rv extends L_{}let Ph;Rt("HeatmapBucket",rv,{omit:["layers"]});var p={get paint(){return Ph=Ph||new Xn({"heatmap-radius":new yr(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new yr(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new tr(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Mu(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new tr(ct.paint_heatmap["heatmap-opacity"])})}};function d(u,{width:a,height:h},_,w){if(w){if(w instanceof Uint8ClampedArray)w=new Uint8Array(w.buffer);else if(w.length!==a*h*_)throw new RangeError(`mismatched image size. expected: ${w.length} but got: ${a*h*_}`)}else w=new Uint8Array(a*h*_);return u.width=a,u.height=h,u.data=w,u}function g(u,{width:a,height:h},_){if(a===u.width&&h===u.height)return;let w=d({},{width:a,height:h},_);x(u,w,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,a),height:Math.min(u.height,h)},_),u.width=a,u.height=h,u.data=w.data}function x(u,a,h,_,w,I){if(w.width===0||w.height===0)return a;if(w.width>u.width||w.height>u.height||h.x>u.width-w.width||h.y>u.height-w.height)throw new RangeError("out of range source coordinates for image copy");if(w.width>a.width||w.height>a.height||_.x>a.width-w.width||_.y>a.height-w.height)throw new RangeError("out of range destination coordinates for image copy");let R=u.data,O=a.data;if(R===O)throw new Error("srcData equals dstData, so image is already copied");for(let z=0;z{a[u.evaluationKey]=z;let W=u.expression.evaluate(a);w.data[R+O+0]=Math.floor(255*W.r/W.a),w.data[R+O+1]=Math.floor(255*W.g/W.a),w.data[R+O+2]=Math.floor(255*W.b/W.a),w.data[R+O+3]=Math.floor(255*W.a)};if(u.clips)for(let R=0,O=0;R<_;++R,O+=4*h)for(let z=0,W=0;z80*h){_=I=u[0],w=R=u[1];for(var ce=h;ceI&&(I=O),z>R&&(R=z);W=(W=Math.max(I-_,R-w))!==0?32767/W:0}return lt(re,ae,h,_,w,W,0),ae}function Ye(u,a,h,_,w){var I,R;if(w===G4(u,a,h,_)>0)for(I=a;I=a;I-=_)R=ZF(I,u[I],u[I+1],R);return R&&Qr(R,R.next)&&(nv(R),R=R.next),R}function ut(u,a){if(!u)return u;a||(a=u);var h,_=u;do if(h=!1,_.steiner||!Qr(_,_.next)&&or(_.prev,_,_.next)!==0)_=_.next;else{if(nv(_),(_=a=_.prev)===_.next)break;h=!0}while(h||_!==a);return a}function lt(u,a,h,_,w,I,R){if(u){!R&&I&&function(Z,K,re,ae){var ce=Z;do ce.z===0&&(ce.z=Wi(ce.x,ce.y,K,re,ae)),ce.prevZ=ce.prev,ce.nextZ=ce.next,ce=ce.next;while(ce!==Z);ce.prevZ.nextZ=null,ce.prevZ=null,function(_e){var Pe,ke,We,Oe,$e,Je,At,Ht,sr=1;do{for(ke=_e,_e=null,$e=null,Je=0;ke;){for(Je++,We=ke,At=0,Pe=0;Pe0||Ht>0&&We;)At!==0&&(Ht===0||!We||ke.z<=We.z)?(Oe=ke,ke=ke.nextZ,At--):(Oe=We,We=We.nextZ,Ht--),$e?$e.nextZ=Oe:_e=Oe,Oe.prevZ=$e,$e=Oe;ke=We}$e.nextZ=null,sr*=2}while(Je>1)}(ce)}(u,_,w,I);for(var O,z,W=u;u.prev!==u.next;)if(O=u.prev,z=u.next,I?nt(u,_,w,I):rt(u))a.push(O.i/h|0),a.push(u.i/h|0),a.push(z.i/h|0),nv(u),u=z.next,W=z.next;else if((u=z)===W){R?R===1?lt(u=Xe(ut(u),a,h),a,h,_,w,I,2):R===2&&Zt(u,a,h,_,w,I):lt(ut(u),a,h,_,w,I,1);break}}}function rt(u){var a=u.prev,h=u,_=u.next;if(or(a,h,_)>=0)return!1;for(var w=a.x,I=h.x,R=_.x,O=a.y,z=h.y,W=_.y,Z=wI?w>R?w:R:I>R?I:R,ae=O>z?O>W?O:W:z>W?z:W,ce=_.next;ce!==a;){if(ce.x>=Z&&ce.x<=re&&ce.y>=K&&ce.y<=ae&&xi(w,O,I,z,R,W,ce.x,ce.y)&&or(ce.prev,ce,ce.next)>=0)return!1;ce=ce.next}return!0}function nt(u,a,h,_){var w=u.prev,I=u,R=u.next;if(or(w,I,R)>=0)return!1;for(var O=w.x,z=I.x,W=R.x,Z=w.y,K=I.y,re=R.y,ae=Oz?O>W?O:W:z>W?z:W,Pe=Z>K?Z>re?Z:re:K>re?K:re,ke=Wi(ae,ce,a,h,_),We=Wi(_e,Pe,a,h,_),Oe=u.prevZ,$e=u.nextZ;Oe&&Oe.z>=ke&&$e&&$e.z<=We;){if(Oe.x>=ae&&Oe.x<=_e&&Oe.y>=ce&&Oe.y<=Pe&&Oe!==w&&Oe!==R&&xi(O,Z,z,K,W,re,Oe.x,Oe.y)&&or(Oe.prev,Oe,Oe.next)>=0||(Oe=Oe.prevZ,$e.x>=ae&&$e.x<=_e&&$e.y>=ce&&$e.y<=Pe&&$e!==w&&$e!==R&&xi(O,Z,z,K,W,re,$e.x,$e.y)&&or($e.prev,$e,$e.next)>=0))return!1;$e=$e.nextZ}for(;Oe&&Oe.z>=ke;){if(Oe.x>=ae&&Oe.x<=_e&&Oe.y>=ce&&Oe.y<=Pe&&Oe!==w&&Oe!==R&&xi(O,Z,z,K,W,re,Oe.x,Oe.y)&&or(Oe.prev,Oe,Oe.next)>=0)return!1;Oe=Oe.prevZ}for(;$e&&$e.z<=We;){if($e.x>=ae&&$e.x<=_e&&$e.y>=ce&&$e.y<=Pe&&$e!==w&&$e!==R&&xi(O,Z,z,K,W,re,$e.x,$e.y)&&or($e.prev,$e,$e.next)>=0)return!1;$e=$e.nextZ}return!0}function Xe(u,a,h){var _=u;do{var w=_.prev,I=_.next.next;!Qr(w,I)&&tn(w,_,_.next,I)&&Qs(w,I)&&Qs(I,w)&&(a.push(w.i/h|0),a.push(_.i/h|0),a.push(I.i/h|0),nv(_),nv(_.next),_=u=I),_=_.next}while(_!==u);return ut(_)}function Zt(u,a,h,_,w,I){var R=u;do{for(var O=R.next.next;O!==R.prev;){if(R.i!==O.i&&ai(R,O)){var z=iv(R,O);return R=ut(R,R.next),z=ut(z,z.next),lt(R,a,h,_,w,I,0),void lt(z,a,h,_,w,I,0)}O=O.next}R=R.next}while(R!==u)}function nr(u,a){return u.x-a.x}function Ut(u,a){var h=function(w,I){var R,O=I,z=w.x,W=w.y,Z=-1/0;do{if(W<=O.y&&W>=O.next.y&&O.next.y!==O.y){var K=O.x+(W-O.y)*(O.next.x-O.x)/(O.next.y-O.y);if(K<=z&&K>Z&&(Z=K,R=O.x=O.x&&O.x>=ce&&z!==O.x&&xi(W<_e?z:Z,W,ce,_e,W<_e?Z:z,W,O.x,O.y)&&(re=Math.abs(W-O.y)/(z-O.x),Qs(O,w)&&(reR.x||O.x===R.x&&Yt(R,O)))&&(R=O,Pe=re)),O=O.next;while(O!==ae);return R}(u,a);if(!h)return a;var _=iv(h,u);return ut(_,_.next),ut(h,h.next)}function Yt(u,a){return or(u.prev,u,a.prev)<0&&or(a.next,u,u.next)<0}function Wi(u,a,h,_,w){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*w|0)|u<<8))|u<<4))|u<<2))|u<<1))|(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-_)*w|0)|a<<8))|a<<4))|a<<2))|a<<1))<<1}function Oi(u){var a=u,h=u;do(a.x=(u-R)*(I-O)&&(u-R)*(_-O)>=(h-R)*(a-O)&&(h-R)*(I-O)>=(w-R)*(_-O)}function ai(u,a){return u.next.i!==a.i&&u.prev.i!==a.i&&!function(h,_){var w=h;do{if(w.i!==h.i&&w.next.i!==h.i&&w.i!==_.i&&w.next.i!==_.i&&tn(w,w.next,h,_))return!0;w=w.next}while(w!==h);return!1}(u,a)&&(Qs(u,a)&&Qs(a,u)&&function(h,_){var w=h,I=!1,R=(h.x+_.x)/2,O=(h.y+_.y)/2;do w.y>O!=w.next.y>O&&w.next.y!==w.y&&R<(w.next.x-w.x)*(O-w.y)/(w.next.y-w.y)+w.x&&(I=!I),w=w.next;while(w!==h);return I}(u,a)&&(or(u.prev,u,a.prev)||or(u,a.prev,a))||Qr(u,a)&&or(u.prev,u,u.next)>0&&or(a.prev,a,a.next)>0)}function or(u,a,h){return(a.y-u.y)*(h.x-a.x)-(a.x-u.x)*(h.y-a.y)}function Qr(u,a){return u.x===a.x&&u.y===a.y}function tn(u,a,h,_){var w=rn(or(u,a,h)),I=rn(or(u,a,_)),R=rn(or(h,_,u)),O=rn(or(h,_,a));return w!==I&&R!==O||!(w!==0||!Nr(u,h,a))||!(I!==0||!Nr(u,_,a))||!(R!==0||!Nr(h,u,_))||!(O!==0||!Nr(h,a,_))}function Nr(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 rn(u){return u>0?1:u<0?-1:0}function Qs(u,a){return or(u.prev,u,u.next)<0?or(u,a,u.next)>=0&&or(u,u.prev,a)>=0:or(u,a,u.prev)<0||or(u,u.next,a)<0}function iv(u,a){var h=new q4(u.i,u.x,u.y),_=new q4(a.i,a.x,a.y),w=u.next,I=a.prev;return u.next=a,a.prev=u,h.next=w,w.prev=h,_.next=h,h.prev=_,I.next=_,_.prev=I,_}function ZF(u,a,h,_){var w=new q4(u,a,h);return _?(w.next=_.next,w.prev=_,_.next.prev=w,_.next=w):(w.prev=w,w.next=w),w}function nv(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 q4(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 G4(u,a,h,_){for(var w=0,I=a,R=h-_;I0&&h.holes.push(_+=u[w-1].length)}return h};var YF=c(Fe.exports);function Wte(u,a,h,_,w){XF(u,a,h||0,_||u.length-1,w||Hte)}function XF(u,a,h,_,w){for(;_>h;){if(_-h>600){var I=_-h+1,R=a-h+1,O=Math.log(I),z=.5*Math.exp(2*O/3),W=.5*Math.sqrt(O*z*(I-z)/I)*(R-I/2<0?-1:1);XF(u,a,Math.max(h,Math.floor(a-R*z/I+W)),Math.min(_,Math.floor(a+(I-R)*z/I+W)),w)}var Z=u[a],K=h,re=_;for(sv(u,h,a),w(u[_],Z)>0&&sv(u,h,_);K0;)re--}w(u[h],Z)===0?sv(u,h,re):sv(u,++re,_),re<=a&&(h=re+1),a<=re&&(_=re-1)}}function sv(u,a,h){var _=u[a];u[a]=u[h],u[h]=_}function Hte(u,a){return ua?1:0}function Z4(u,a){let h=u.length;if(h<=1)return[u];let _=[],w,I;for(let R=0;R1)for(let R=0;R<_.length;R++)_[R].length<=a||(Wte(_[R],a,1,_[R].length-1,$te),_[R]=_[R].slice(0,a));return _}function $te(u,a){return a.area-u.area}function Y4(u,a,h){let _=h.patternDependencies,w=!1;for(let I of a){let R=I.paint.get(`${u}-pattern`);R.isConstant()||(w=!0);let O=R.constantOr(null);O&&(w=!0,_[O.to]=!0,_[O.from]=!0)}return w}function X4(u,a,h,_,w){let I=w.patternDependencies;for(let R of a){let O=R.paint.get(`${u}-pattern`).value;if(O.kind!=="constant"){let z=O.evaluate({zoom:_-1},h,{},w.availableImages),W=O.evaluate({zoom:_},h,{},w.availableImages),Z=O.evaluate({zoom:_+1},h,{},w.availableImages);z=z&&z.name?z.name:z,W=W&&W.name?W.name:W,Z=Z&&Z.name?Z.name:Z,I[z]=!0,I[W]=!0,I[Z]=!0,h.patterns[R.id]={min:z,mid:W,max:Z}}}return h}class Q4{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.patternFeatures=[],this.layoutVertexArray=new ci,this.indexArray=new Ys,this.indexArray2=new As,this.programConfigurations=new Wc(a.layers,a.zoom),this.segments=new cn,this.segments2=new cn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,_){this.hasPattern=Y4("fill",this.layers,h);let w=this.layers[0].layout.get("fill-sort-key"),I=!w.isConstant(),R=[];for(let{feature:O,id:z,index:W,sourceLayerIndex:Z}of a){let K=this.layers[0]._featureFilter.needGeometry,re=Rf(O,K);if(!this.layers[0]._featureFilter.filter(new gn(this.zoom),re,_))continue;let ae=I?w.evaluate(re,{},_,h.availableImages):void 0,ce={id:z,properties:O.properties,type:O.type,sourceLayerIndex:Z,index:W,geometry:K?re.geometry:If(O),patterns:{},sortKey:ae};R.push(ce)}I&&R.sort((O,z)=>O.sortKey-z.sortKey);for(let O of R){let{geometry:z,index:W,sourceLayerIndex:Z}=O;if(this.hasPattern){let K=X4("fill",this.layers,O,this.zoom,h);this.patternFeatures.push(K)}else this.addFeature(O,z,W,_,{});h.featureIndex.insert(a[W].feature,z,W,Z,this.index)}}update(a,h,_){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,_)}addFeatures(a,h,_){for(let w of this.patternFeatures)this.addFeature(w,w.geometry,w.index,h,_)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Le),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,_,w,I){for(let R of Z4(h,500)){let O=0;for(let ae of R)O+=ae.length;let z=this.segments.prepareSegment(O,this.layoutVertexArray,this.indexArray),W=z.vertexLength,Z=[],K=[];for(let ae of R){if(ae.length===0)continue;ae!==R[0]&&K.push(Z.length/2);let ce=this.segments2.prepareSegment(ae.length,this.layoutVertexArray,this.indexArray2),_e=ce.vertexLength;this.layoutVertexArray.emplaceBack(ae[0].x,ae[0].y),this.indexArray2.emplaceBack(_e+ae.length-1,_e),Z.push(ae[0].x),Z.push(ae[0].y);for(let Pe=1;Pe>3}if(w--,_===1||_===2)I+=u.readSVarint(),R+=u.readSVarint(),_===1&&(a&&O.push(a),a=[]),a.push(new Qte(I,R));else{if(_!==7)throw new Error("unknown command "+_);a&&a.push(a[0].clone())}}return a&&O.push(a),O},B_.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var a=u.readVarint()+u.pos,h=1,_=0,w=0,I=0,R=1/0,O=-1/0,z=1/0,W=-1/0;u.pos>3}if(_--,h===1||h===2)(w+=u.readSVarint())O&&(O=w),(I+=u.readSVarint())W&&(W=I);else if(h!==7)throw new Error("unknown command "+h)}return[R,z,O,W]},B_.prototype.toGeoJSON=function(u,a,h){var _,w,I=this.extent*Math.pow(2,h),R=this.extent*u,O=this.extent*a,z=this.loadGeometry(),W=B_.types[this.type];function Z(ae){for(var ce=0;ce>3;w=R===1?_.readString():R===2?_.readFloat():R===3?_.readDouble():R===4?_.readVarint64():R===5?_.readVarint():R===6?_.readSVarint():R===7?_.readBoolean():null}return w}(h))}tN.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 ere(this._pbf,a,this.extent,this._keys,this._values)};var rre=eN;function ire(u,a,h){if(u===3){var _=new rre(h,h.readVarint()+h.pos);_.length&&(a[_.name]=_)}}AA.VectorTile=function(u,a){this.layers=u.readFields(ire,{},a)},AA.VectorTileFeature=JF,AA.VectorTileLayer=eN;let nre=AA.VectorTileFeature.types,K4=Math.pow(2,13);function ov(u,a,h,_,w,I,R,O){u.emplaceBack(a,h,2*Math.floor(_*K4)+R,w*K4*2,I*K4*2,Math.round(O))}class J4{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 Ft,this.centroidVertexArray=new Mt,this.indexArray=new Ys,this.programConfigurations=new Wc(a.layers,a.zoom),this.segments=new cn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,_){this.features=[],this.hasPattern=Y4("fill-extrusion",this.layers,h);for(let{feature:w,id:I,index:R,sourceLayerIndex:O}of a){let z=this.layers[0]._featureFilter.needGeometry,W=Rf(w,z);if(!this.layers[0]._featureFilter.filter(new gn(this.zoom),W,_))continue;let Z={id:I,sourceLayerIndex:O,index:R,geometry:z?W.geometry:If(w),properties:w.properties,type:w.type,patterns:{}};this.hasPattern?this.features.push(X4("fill-extrusion",this.layers,Z,this.zoom,h)):this.addFeature(Z,Z.geometry,R,_,{}),h.featureIndex.insert(w,Z.geometry,R,O,this.index,!0)}}addFeatures(a,h,_){for(let w of this.features){let{geometry:I}=w;this.addFeature(w,I,w.index,h,_)}}update(a,h,_){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,_)}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,Xte),this.centroidVertexBuffer=a.createVertexBuffer(this.centroidVertexArray,Yte.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,_,w,I){let R={x:0,y:0,vertexCount:0};for(let O of Z4(h,500)){let z=0;for(let ce of O)z+=ce.length;let W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ce of O){if(ce.length===0||ore(ce))continue;let _e=0;for(let Pe=0;Pe=1){let We=ce[Pe-1];if(!sre(ke,We)){W.vertexLength+4>cn.MAX_VERTEX_ARRAY_LENGTH&&(W=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let Oe=ke.sub(We)._perp()._unit(),$e=We.dist(ke);_e+$e>32768&&(_e=0),ov(this.layoutVertexArray,ke.x,ke.y,Oe.x,Oe.y,0,0,_e),ov(this.layoutVertexArray,ke.x,ke.y,Oe.x,Oe.y,0,1,_e),R.x+=2*ke.x,R.y+=2*ke.y,R.vertexCount+=2,_e+=$e,ov(this.layoutVertexArray,We.x,We.y,Oe.x,Oe.y,0,0,_e),ov(this.layoutVertexArray,We.x,We.y,Oe.x,Oe.y,0,1,_e),R.x+=2*We.x,R.y+=2*We.y,R.vertexCount+=2;let Je=W.vertexLength;this.indexArray.emplaceBack(Je,Je+2,Je+1),this.indexArray.emplaceBack(Je+1,Je+2,Je+3),W.vertexLength+=4,W.primitiveLength+=2}}}}if(W.vertexLength+z>cn.MAX_VERTEX_ARRAY_LENGTH&&(W=this.segments.prepareSegment(z,this.layoutVertexArray,this.indexArray)),nre[a.type]!=="Polygon")continue;let Z=[],K=[],re=W.vertexLength;for(let ce of O)if(ce.length!==0){ce!==O[0]&&K.push(Z.length/2);for(let _e=0;_els)||u.y===a.y&&(u.y<0||u.y>ls)}function ore(u){return u.every(a=>a.x<0)||u.every(a=>a.x>ls)||u.every(a=>a.y<0)||u.every(a=>a.y>ls)}let rN;Rt("FillExtrusionBucket",J4,{omit:["layers","features"]});var are={get paint(){return rN=rN||new Xn({"fill-extrusion-opacity":new tr(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new yr(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new tr(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new tr(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wh(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new yr(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new yr(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new tr(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class lre extends pa{constructor(a){super(a,are)}createBucket(a){return new J4(a)}queryRadius(){return dA(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(a,h,_,w,I,R,O,z){let W=Ru(a,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),R.angle,O),Z=this.paint.get("fill-extrusion-height").evaluate(h,_),K=this.paint.get("fill-extrusion-base").evaluate(h,_),re=function(ce,_e,Pe,ke){let We=[];for(let Oe of ce){let $e=[Oe.x,Oe.y,0,1];Wd($e,$e,_e),We.push(new b($e[0]/$e[3],$e[1]/$e[3]))}return We}(W,z),ae=function(ce,_e,Pe,ke){let We=[],Oe=[],$e=ke[8]*_e,Je=ke[9]*_e,At=ke[10]*_e,Ht=ke[11]*_e,sr=ke[8]*Pe,jt=ke[9]*Pe,zt=ke[10]*Pe,kt=ke[11]*Pe;for(let Kt of ce){let Bt=[],bt=[];for(let gr of Kt){let ar=gr.x,hi=gr.y,Mn=ke[0]*ar+ke[4]*hi+ke[12],On=ke[1]*ar+ke[5]*hi+ke[13],Js=ke[2]*ar+ke[6]*hi+ke[14],Kl=ke[3]*ar+ke[7]*hi+ke[15],Va=Js+At,Ls=Kl+Ht,Oo=Mn+sr,Jo=On+jt,ja=Js+zt,Wa=Kl+kt,eo=new b((Mn+$e)/Ls,(On+Je)/Ls);eo.z=Va/Ls,Bt.push(eo);let to=new b(Oo/Wa,Jo/Wa);to.z=ja/Wa,bt.push(to)}We.push(Bt),Oe.push(bt)}return[We,Oe]}(w,K,Z,z);return function(ce,_e,Pe){let ke=1/0;WT(Pe,_e)&&(ke=iN(Pe,_e[0]));for(let We=0;We<_e.length;We++){let Oe=_e[We],$e=ce[We];for(let Je=0;Jeh.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 mr,this.layoutVertexArray2=new ir,this.indexArray=new Ys,this.programConfigurations=new Wc(a.layers,a.zoom),this.segments=new cn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,_){this.hasPattern=Y4("line",this.layers,h);let w=this.layers[0].layout.get("line-sort-key"),I=!w.isConstant(),R=[];for(let{feature:O,id:z,index:W,sourceLayerIndex:Z}of a){let K=this.layers[0]._featureFilter.needGeometry,re=Rf(O,K);if(!this.layers[0]._featureFilter.filter(new gn(this.zoom),re,_))continue;let ae=I?w.evaluate(re,{},_):void 0,ce={id:z,properties:O.properties,type:O.type,sourceLayerIndex:Z,index:W,geometry:K?re.geometry:If(O),patterns:{},sortKey:ae};R.push(ce)}I&&R.sort((O,z)=>O.sortKey-z.sortKey);for(let O of R){let{geometry:z,index:W,sourceLayerIndex:Z}=O;if(this.hasPattern){let K=X4("line",this.layers,O,this.zoom,h);this.patternFeatures.push(K)}else this.addFeature(O,z,W,_,{});h.featureIndex.insert(a[W].feature,z,W,Z,this.index)}}update(a,h,_){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,_)}addFeatures(a,h,_){for(let w of this.patternFeatures)this.addFeature(w,w.geometry,w.index,h,_)}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,fre)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,ure),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,_,w,I){let R=this.layers[0].layout,O=R.get("line-join").evaluate(a,{}),z=R.get("line-cap"),W=R.get("line-miter-limit"),Z=R.get("line-round-limit");this.lineClips=this.lineFeatureClips(a);for(let K of h)this.addLine(K,a,O,z,W,Z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,_,I,w)}addLine(a,h,_,w,I,R){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ke=0;ke=2&&a[z-1].equals(a[z-2]);)z--;let W=0;for(;W0;if(Ht&&ke>W){let kt=re.dist(ae);if(kt>2*Z){let Kt=re.sub(re.sub(ae)._mult(Z/kt)._round());this.updateDistance(ae,Kt),this.addCurrentVertex(Kt,_e,0,0,K),ae=Kt}}let jt=ae&&ce,zt=jt?_:O?"butt":w;if(jt&&zt==="round"&&(JeI&&(zt="bevel"),zt==="bevel"&&(Je>2&&(zt="flipbevel"),Je100)We=Pe.mult(-1);else{let kt=Je*_e.add(Pe).mag()/_e.sub(Pe).mag();We._perp()._mult(kt*(sr?-1:1))}this.addCurrentVertex(re,We,0,0,K),this.addCurrentVertex(re,We.mult(-1),0,0,K)}else if(zt==="bevel"||zt==="fakeround"){let kt=-Math.sqrt(Je*Je-1),Kt=sr?kt:0,Bt=sr?0:kt;if(ae&&this.addCurrentVertex(re,_e,Kt,Bt,K),zt==="fakeround"){let bt=Math.round(180*At/Math.PI/20);for(let gr=1;gr2*Z){let Kt=re.add(ce.sub(re)._mult(Z/kt)._round());this.updateDistance(re,Kt),this.addCurrentVertex(Kt,Pe,0,0,K),re=Kt}}}}addCurrentVertex(a,h,_,w,I,R=!1){let O=h.y*w-h.x,z=-h.y-h.x*w;this.addHalfVertex(a,h.x+h.y*_,h.y-h.x*_,R,!1,_,I),this.addHalfVertex(a,O,z,R,!0,-w,I),this.distance>nN/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(a,h,_,w,I,R))}addHalfVertex({x:a,y:h},_,w,I,R,O,z){let W=.5*(this.lineClips?this.scaledDistance*(nN-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a<<1)+(I?1:0),(h<<1)+(R?1:0),Math.round(63*_)+128,Math.round(63*w)+128,1+(O===0?0:O<0?-1:1)|(63&W)<<2,W>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let Z=z.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Z),z.primitiveLength++),R?this.e2=Z:this.e1=Z}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 sN,oN;Rt("LineBucket",eR,{omit:["layers","patternFeatures"]});var aN={get paint(){return oN=oN||new Xn({"line-opacity":new yr(ct.paint_line["line-opacity"]),"line-color":new yr(ct.paint_line["line-color"]),"line-translate":new tr(ct.paint_line["line-translate"]),"line-translate-anchor":new tr(ct.paint_line["line-translate-anchor"]),"line-width":new yr(ct.paint_line["line-width"]),"line-gap-width":new yr(ct.paint_line["line-gap-width"]),"line-offset":new yr(ct.paint_line["line-offset"]),"line-blur":new yr(ct.paint_line["line-blur"]),"line-dasharray":new uA(ct.paint_line["line-dasharray"]),"line-pattern":new wh(ct.paint_line["line-pattern"]),"line-gradient":new Mu(ct.paint_line["line-gradient"])})},get layout(){return sN=sN||new Xn({"line-cap":new tr(ct.layout_line["line-cap"]),"line-join":new yr(ct.layout_line["line-join"]),"line-miter-limit":new tr(ct.layout_line["line-miter-limit"]),"line-round-limit":new tr(ct.layout_line["line-round-limit"]),"line-sort-key":new yr(ct.layout_line["line-sort-key"])})}};class Are extends yr{possiblyEvaluate(a,h){return h=new gn(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(a,h)}evaluate(a,h,_,w){return h=Re({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(a,h,_,w)}}let $T;class mre extends pa{constructor(a){super(a,aN),this.gradientVersion=0,$T||($T=new Are(aN.paint.properties["line-width"].specification),$T.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(a){if(a==="line-gradient"){let h=this.gradientExpression();this.stepInterpolant=!!function(_){return _._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof yh,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"]=$T.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,a)}createBucket(a){return new eR(a)}queryRadius(a){let h=a,_=lN(fA("line-width",this,h),fA("line-gap-width",this,h)),w=fA("line-offset",this,h);return _/2+Math.abs(w)+dA(this.paint.get("line-translate"))}queryIntersectsFeature(a,h,_,w,I,R,O){let z=Ru(a,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),R.angle,O),W=O/2*lN(this.paint.get("line-width").evaluate(h,_),this.paint.get("line-gap-width").evaluate(h,_)),Z=this.paint.get("line-offset").evaluate(h,_);return Z&&(w=function(K,re){let ae=[];for(let ce=0;ce=3){for(let Pe=0;Pe<_e.length;Pe++)if(ni(K,_e[Pe]))return!0}if($4(K,_e,ae))return!0}return!1}(z,w,W)}isTileClipped(){return!0}}function lN(u,a){return a>0?a+2*u:u}let gre=_n([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_re=_n([{name:"a_projected_pos",components:3,type:"Float32"}],4);_n([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let yre=_n([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);_n([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let cN=_n([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),xre=_n([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function vre(u,a,h){return u.sections.forEach(_=>{_.text=function(w,I,R){let O=I.layout.get("text-transform").evaluate(R,{});return O==="uppercase"?w=w.toLocaleUpperCase():O==="lowercase"&&(w=w.toLocaleLowerCase()),da.applyArabicShaping&&(w=da.applyArabicShaping(w)),w}(_.text,a,h)}),u}_n([{name:"triangle",components:3,type:"Uint16"}]),_n([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),_n([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),_n([{type:"Float32",name:"offsetX"}]),_n([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),_n([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let lv={"!":"\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 Ks=24,uN=un,hN=function(u,a,h,_,w){var I,R,O=8*w-_-1,z=(1<>1,Z=-7,K=h?w-1:0,re=h?-1:1,ae=u[a+K];for(K+=re,I=ae&(1<<-Z)-1,ae>>=-Z,Z+=O;Z>0;I=256*I+u[a+K],K+=re,Z-=8);for(R=I&(1<<-Z)-1,I>>=-Z,Z+=_;Z>0;R=256*R+u[a+K],K+=re,Z-=8);if(I===0)I=1-W;else{if(I===z)return R?NaN:1/0*(ae?-1:1);R+=Math.pow(2,_),I-=W}return(ae?-1:1)*R*Math.pow(2,I-_)},fN=function(u,a,h,_,w,I){var R,O,z,W=8*I-w-1,Z=(1<>1,re=w===23?Math.pow(2,-24)-Math.pow(2,-77):0,ae=_?0:I-1,ce=_?1:-1,_e=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(O=isNaN(a)?1:0,R=Z):(R=Math.floor(Math.log(a)/Math.LN2),a*(z=Math.pow(2,-R))<1&&(R--,z*=2),(a+=R+K>=1?re/z:re*Math.pow(2,1-K))*z>=2&&(R++,z/=2),R+K>=Z?(O=0,R=Z):R+K>=1?(O=(a*z-1)*Math.pow(2,w),R+=K):(O=a*Math.pow(2,K-1)*Math.pow(2,w),R=0));w>=8;u[h+ae]=255&O,ae+=ce,O/=256,w-=8);for(R=R<0;u[h+ae]=255&R,ae+=ce,R/=256,W-=8);u[h+ae-ce]|=128*_e};function un(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}un.Varint=0,un.Fixed64=1,un.Bytes=2,un.Fixed32=5;var tR=4294967296,dN=1/tR,pN=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Hd(u){return u.type===un.Bytes?u.readVarint()+u.pos:u.pos+1}function F_(u,a,h){return h?4294967296*a+(u>>>0):4294967296*(a>>>0)+(u>>>0)}function AN(u,a,h){var _=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));h.realloc(_);for(var w=h.pos-1;w>=u;w--)h.buf[w+_]=h.buf[w]}function bre(u,a){for(var h=0;h>>8,u[h+2]=a>>>16,u[h+3]=a>>>24}function mN(u,a){return(u[a]|u[a+1]<<8|u[a+2]<<16)+(u[a+3]<<24)}un.prototype={destroy:function(){this.buf=null},readFields:function(u,a,h){for(h=h||this.length;this.pos>3,I=this.pos;this.type=7&_,u(w,a,this),this.pos===I&&this.skip(_)}return a},readMessage:function(u,a){return this.readFields(u,a,this.readVarint()+this.pos)},readFixed32:function(){var u=qT(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=mN(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=qT(this.buf,this.pos)+qT(this.buf,this.pos+4)*tR;return this.pos+=8,u},readSFixed64:function(){var u=qT(this.buf,this.pos)+mN(this.buf,this.pos+4)*tR;return this.pos+=8,u},readFloat:function(){var u=hN(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=hN(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var a,h,_=this.buf;return a=127&(h=_[this.pos++]),h<128?a:(a|=(127&(h=_[this.pos++]))<<7,h<128?a:(a|=(127&(h=_[this.pos++]))<<14,h<128?a:(a|=(127&(h=_[this.pos++]))<<21,h<128?a:function(w,I,R){var O,z,W=R.buf;if(O=(112&(z=W[R.pos++]))>>4,z<128||(O|=(127&(z=W[R.pos++]))<<3,z<128)||(O|=(127&(z=W[R.pos++]))<<10,z<128)||(O|=(127&(z=W[R.pos++]))<<17,z<128)||(O|=(127&(z=W[R.pos++]))<<24,z<128)||(O|=(1&(z=W[R.pos++]))<<31,z<128))return F_(w,O,I);throw new Error("Expected varint not more than 10 bytes")}(a|=(15&(h=_[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&&pN?function(h,_,w){return pN.decode(h.subarray(_,w))}(this.buf,a,u):function(h,_,w){for(var I="",R=_;R239?4:Z>223?3:Z>191?2:1;if(R+re>w)break;re===1?Z<128&&(K=Z):re===2?(192&(O=h[R+1]))==128&&(K=(31&Z)<<6|63&O)<=127&&(K=null):re===3?(z=h[R+2],(192&(O=h[R+1]))==128&&(192&z)==128&&((K=(15&Z)<<12|(63&O)<<6|63&z)<=2047||K>=55296&&K<=57343)&&(K=null)):re===4&&(z=h[R+2],W=h[R+3],(192&(O=h[R+1]))==128&&(192&z)==128&&(192&W)==128&&((K=(15&Z)<<18|(63&O)<<12|(63&z)<<6|63&W)<=65535||K>=1114112)&&(K=null)),K===null?(K=65533,re=1):K>65535&&(K-=65536,I+=String.fromCharCode(K>>>10&1023|55296),K=56320|1023&K),I+=String.fromCharCode(K),R+=re}return I}(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!==un.Bytes)return u.push(this.readVarint(a));var h=Hd(this);for(u=u||[];this.pos127;);else if(a===un.Bytes)this.pos=this.readVarint()+this.pos;else if(a===un.Fixed32)this.pos+=4;else{if(a!==un.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 _,w;if(a>=0?(_=a%4294967296|0,w=a/4294967296|0):(w=~(-a/4294967296),4294967295^(_=~(-a%4294967296))?_=_+1|0:(_=0,w=w+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(I,R,O){O.buf[O.pos++]=127&I|128,I>>>=7,O.buf[O.pos++]=127&I|128,I>>>=7,O.buf[O.pos++]=127&I|128,I>>>=7,O.buf[O.pos++]=127&I|128,O.buf[O.pos]=127&(I>>>=7)}(_,0,h),function(I,R){var O=(7&I)<<4;R.buf[R.pos++]|=O|((I>>>=3)?128:0),I&&(R.buf[R.pos++]=127&I|((I>>>=7)?128:0),I&&(R.buf[R.pos++]=127&I|((I>>>=7)?128:0),I&&(R.buf[R.pos++]=127&I|((I>>>=7)?128:0),I&&(R.buf[R.pos++]=127&I|((I>>>=7)?128:0),I&&(R.buf[R.pos++]=127&I)))))}(w,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(_,w,I){for(var R,O,z=0;z55295&&R<57344){if(!O){R>56319||z+1===w.length?(_[I++]=239,_[I++]=191,_[I++]=189):O=R;continue}if(R<56320){_[I++]=239,_[I++]=191,_[I++]=189,O=R;continue}R=O-55296<<10|R-56320|65536,O=null}else O&&(_[I++]=239,_[I++]=191,_[I++]=189,O=null);R<128?_[I++]=R:(R<2048?_[I++]=R>>6|192:(R<65536?_[I++]=R>>12|224:(_[I++]=R>>18|240,_[I++]=R>>12&63|128),_[I++]=R>>6&63|128),_[I++]=63&R|128)}return I}(this.buf,u,this.pos);var h=this.pos-a;h>=128&&AN(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),fN(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),fN(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&&AN(h,_,this),this.pos=h-1,this.writeVarint(_),this.pos+=_},writeMessage:function(u,a,h){this.writeTag(u,un.Bytes),this.writeRawMessage(a,h)},writePackedVarint:function(u,a){a.length&&this.writeMessage(u,bre,a)},writePackedSVarint:function(u,a){a.length&&this.writeMessage(u,wre,a)},writePackedBoolean:function(u,a){a.length&&this.writeMessage(u,Ere,a)},writePackedFloat:function(u,a){a.length&&this.writeMessage(u,Sre,a)},writePackedDouble:function(u,a){a.length&&this.writeMessage(u,Tre,a)},writePackedFixed32:function(u,a){a.length&&this.writeMessage(u,Mre,a)},writePackedSFixed32:function(u,a){a.length&&this.writeMessage(u,Pre,a)},writePackedFixed64:function(u,a){a.length&&this.writeMessage(u,Cre,a)},writePackedSFixed64:function(u,a){a.length&&this.writeMessage(u,Ire,a)},writeBytesField:function(u,a){this.writeTag(u,un.Bytes),this.writeBytes(a)},writeFixed32Field:function(u,a){this.writeTag(u,un.Fixed32),this.writeFixed32(a)},writeSFixed32Field:function(u,a){this.writeTag(u,un.Fixed32),this.writeSFixed32(a)},writeFixed64Field:function(u,a){this.writeTag(u,un.Fixed64),this.writeFixed64(a)},writeSFixed64Field:function(u,a){this.writeTag(u,un.Fixed64),this.writeSFixed64(a)},writeVarintField:function(u,a){this.writeTag(u,un.Varint),this.writeVarint(a)},writeSVarintField:function(u,a){this.writeTag(u,un.Varint),this.writeSVarint(a)},writeStringField:function(u,a){this.writeTag(u,un.Bytes),this.writeString(a)},writeFloatField:function(u,a){this.writeTag(u,un.Fixed32),this.writeFloat(a)},writeDoubleField:function(u,a){this.writeTag(u,un.Fixed64),this.writeDouble(a)},writeBooleanField:function(u,a){this.writeVarintField(u,!!a)}};var rR=c(uN);let iR=3;function Rre(u,a,h){u===1&&h.readMessage(kre,a)}function kre(u,a,h){if(u===3){let{id:_,bitmap:w,width:I,height:R,left:O,top:z,advance:W}=h.readMessage(Lre,{});a.push({id:_,bitmap:new T({width:I+2*iR,height:R+2*iR},w),metrics:{width:I,height:R,left:O,top:z,advance:W}})}}function Lre(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 gN=iR;function _N(u){let a=0,h=0;for(let R of u)a+=R.w*R.h,h=Math.max(h,R.w);u.sort((R,O)=>O.h-R.h);let _=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(a/.95)),h),h:1/0}],w=0,I=0;for(let R of u)for(let O=_.length-1;O>=0;O--){let z=_[O];if(!(R.w>z.w||R.h>z.h)){if(R.x=z.x,R.y=z.y,I=Math.max(I,R.y+R.h),w=Math.max(w,R.x+R.w),R.w===z.w&&R.h===z.h){let W=_.pop();O<_.length&&(_[O]=W)}else R.h===z.h?(z.x+=R.w,z.w-=R.w):R.w===z.w?(z.y+=R.h,z.h-=R.h):(_.push({x:z.x+R.w,y:z.y,w:z.w-R.w,h:R.h}),z.y+=R.h,z.h-=R.h);break}}return{w,h:I,fill:a/(w*I)||0}}let gl=1;class nR{constructor(a,{pixelRatio:h,version:_,stretchX:w,stretchY:I,content:R}){this.paddedRect=a,this.pixelRatio=h,this.stretchX=w,this.stretchY=I,this.content=R,this.version=_}get tl(){return[this.paddedRect.x+gl,this.paddedRect.y+gl]}get br(){return[this.paddedRect.x+this.paddedRect.w-gl,this.paddedRect.y+this.paddedRect.h-gl]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*gl)/this.pixelRatio,(this.paddedRect.h-2*gl)/this.pixelRatio]}}class yN{constructor(a,h){let _={},w={};this.haveRenderCallbacks=[];let I=[];this.addImages(a,_,I),this.addImages(h,w,I);let{w:R,h:O}=_N(I),z=new C({width:R||1,height:O||1});for(let W in a){let Z=a[W],K=_[W].paddedRect;C.copy(Z.data,z,{x:0,y:0},{x:K.x+gl,y:K.y+gl},Z.data)}for(let W in h){let Z=h[W],K=w[W].paddedRect,re=K.x+gl,ae=K.y+gl,ce=Z.data.width,_e=Z.data.height;C.copy(Z.data,z,{x:0,y:0},{x:re,y:ae},Z.data),C.copy(Z.data,z,{x:0,y:_e-1},{x:re,y:ae-1},{width:ce,height:1}),C.copy(Z.data,z,{x:0,y:0},{x:re,y:ae+_e},{width:ce,height:1}),C.copy(Z.data,z,{x:ce-1,y:0},{x:re-1,y:ae},{width:1,height:_e}),C.copy(Z.data,z,{x:0,y:0},{x:re+ce,y:ae},{width:1,height:_e})}this.image=z,this.iconPositions=_,this.patternPositions=w}addImages(a,h,_){for(let w in a){let I=a[w],R={x:0,y:0,w:I.data.width+2*gl,h:I.data.height+2*gl};_.push(R),h[w]=new nR(R,I),I.hasRenderCallback&&this.haveRenderCallbacks.push(w)}}patchUpdatedImages(a,h){a.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let _ in a.updatedImages)this.patchUpdatedImage(this.iconPositions[_],a.getImage(_),h),this.patchUpdatedImage(this.patternPositions[_],a.getImage(_),h)}patchUpdatedImage(a,h,_){if(!a||!h||a.version===h.version)return;a.version=h.version;let[w,I]=a.tl;_.update(h.data,void 0,{x:w,y:I})}}var mA;Rt("ImagePosition",nR),Rt("ImageAtlas",yN),s.ai=void 0,(mA=s.ai||(s.ai={}))[mA.none=0]="none",mA[mA.horizontal=1]="horizontal",mA[mA.vertical=2]="vertical",mA[mA.horizontalOnly=3]="horizontalOnly";let cv=-17;class uv{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(a,h){let _=new uv;return _.scale=a||1,_.fontStack=h,_}static forImage(a){let h=new uv;return h.imageName=a,h}}class z_{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(a,h){let _=new z_;for(let w=0;w=0&&_>=a&&ZT[this.text.charCodeAt(_)];_--)h--;this.text=this.text.substring(a,h),this.sectionIndex=this.sectionIndex.slice(a,h)}substring(a,h){let _=new z_;return _.text=this.text.substring(a,h),_.sectionIndex=this.sectionIndex.slice(a,h),_.sections=this.sections,_}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(uv.forText(a.scale,a.fontStack||h));let _=this.sections.length-1;for(let w=0;w=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function GT(u,a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce,_e){let Pe=z_.fromFeature(u,w),ke;K===s.ai.vertical&&Pe.verticalizePunctuation();let{processBidirectionalText:We,processStyledBidirectionalText:Oe}=da;if(We&&Pe.sections.length===1){ke=[];let At=We(Pe.toString(),sR(Pe,W,I,a,_,ae,ce));for(let Ht of At){let sr=new z_;sr.text=Ht,sr.sections=Pe.sections;for(let jt=0;jt0&&qd>_l&&(_l=qd)}else{let qc=sr[vi.fontStack],xl=qc&&qc[ea];if(xl&&xl.rect)Ch=xl.rect,ku=xl.metrics;else{let qd=Ht[vi.fontStack],Av=qd&&qd[ea];if(!Av)continue;ku=Av.metrics}io=(to-vi.scale)*Ks}Lu?(At.verticalizable=!0,_a.push({glyph:ea,imageName:Ih,x:Mn,y:On+io,vertical:Lu,scale:vi.scale,fontStack:vi.fontStack,sectionIndex:ya,metrics:ku,rect:Ch}),Mn+=$d*vi.scale+gr):(_a.push({glyph:ea,imageName:Ih,x:Mn,y:On+io,vertical:Lu,scale:vi.scale,fontStack:vi.fontStack,sectionIndex:ya,metrics:ku,rect:Ch}),Mn+=ku.advance*vi.scale+gr)}_a.length!==0&&(Js=Math.max(Mn-gr,Js),Bre(_a,0,_a.length-1,Va,_l)),Mn=0;let yl=kt*to+_l;Ha.lineOffset=Math.max(_l,ga),On+=yl,Kl=Math.max(yl,Kl),++Ls}var Oo;let Jo=On-cv,{horizontalAlign:ja,verticalAlign:Wa}=oR(Kt);(function(eo,to,ga,Ha,_a,_l,yl,ro,vi){let ya=(to-ga)*_a,ea=0;ea=_l!==yl?-ro*Ha-cv:(-Ha*vi+.5)*yl;for(let io of eo)for(let ku of io.positionedGlyphs)ku.x+=ya,ku.y+=ea})(At.positionedLines,Va,ja,Wa,Js,Kl,kt,Jo,zt.length),At.top+=-Wa*Jo,At.bottom=At.top+Jo,At.left+=-ja*Js,At.right=At.left+Js}(Je,a,h,_,ke,R,O,z,K,W,re,_e),!function(At){for(let Ht of At)if(Ht.positionedGlyphs.length!==0)return!1;return!0}($e)&&Je}let ZT={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Dre={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 xN(u,a,h,_,w,I){if(a.imageName){let R=_[a.imageName];return R?R.displaySize[0]*a.scale*Ks/I+w:0}{let R=h[a.fontStack],O=R&&R[u];return O?O.metrics.advance*a.scale+w:0}}function vN(u,a,h,_){let w=Math.pow(u-a,2);return _?u=0,Z=0;for(let re=0;reR.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=wt([]),this.placementViewportMatrix=wt([]);let h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=TN(this.zoom,h["text-size"]),this.iconSizeData=TN(this.zoom,h["icon-size"]);let _=this.layers[0].layout,w=_.get("symbol-sort-key"),I=_.get("symbol-z-order");this.canOverlap=aR(_,"text-overlap","text-allow-overlap")!=="never"||aR(_,"icon-overlap","icon-allow-overlap")!=="never"||_.get("text-ignore-placement")||_.get("icon-ignore-placement"),this.sortFeaturesByKey=I!=="viewport-y"&&!w.isConstant(),this.sortFeaturesByY=(I==="viewport-y"||I==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,_.get("symbol-placement")==="point"&&(this.writingModes=_.get("text-writing-mode").map(R=>s.ai[R])),this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id),this.sourceID=a.sourceID}createArrays(){this.text=new cR(new Wc(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new cR(new Wc(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new Ve,this.lineVertexArray=new it,this.symbolInstances=new Me,this.textAnchorOffsets=new dt}calculateGlyphDependencies(a,h,_,w,I){for(let R=0;R0)&&(R.value.kind!=="constant"||R.value.value.length>0),Z=z.value.kind!=="constant"||!!z.value.value||Object.keys(z.parameters).length>0,K=I.get("symbol-sort-key");if(this.features=[],!W&&!Z)return;let re=h.iconDependencies,ae=h.glyphDependencies,ce=h.availableImages,_e=new gn(this.zoom);for(let{feature:Pe,id:ke,index:We,sourceLayerIndex:Oe}of a){let $e=w._featureFilter.needGeometry,Je=Rf(Pe,$e);if(!w._featureFilter.filter(_e,Je,_))continue;let At,Ht;if($e||(Je.geometry=If(Pe)),W){let jt=w.getValueAndResolveTokens("text-field",Je,_,ce),zt=An.factory(jt);Ure(zt)&&(this.hasRTLText=!0),(!this.hasRTLText||hm()==="unavailable"||this.hasRTLText&&da.isParsed())&&(At=vre(zt,w,Je))}if(Z){let jt=w.getValueAndResolveTokens("icon-image",Je,_,ce);Ht=jt instanceof Yn?jt:Yn.fromString(jt)}if(!At&&!Ht)continue;let sr=this.sortFeaturesByKey?K.evaluate(Je,{},_):void 0;if(this.features.push({id:ke,text:At,icon:Ht,index:We,sourceLayerIndex:Oe,geometry:Je.geometry,properties:Pe.properties,type:Nre[Pe.type],sortKey:sr}),Ht&&(re[Ht.name]=!0),At){let jt=R.evaluate(Je,{},_).join(","),zt=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(s.ai.vertical)>=0;for(let kt of At.sections)if(kt.image)re[kt.image.name]=!0;else{let Kt=am(At.toString()),Bt=kt.fontStack||jt,bt=ae[Bt]=ae[Bt]||{};this.calculateGlyphDependencies(kt.text,bt,zt,this.allowVerticalPlacement,Kt)}}}I.get("symbol-placement")==="line"&&(this.features=function(Pe){let ke={},We={},Oe=[],$e=0;function Je(jt){Oe.push(Pe[jt]),$e++}function At(jt,zt,kt){let Kt=We[jt];return delete We[jt],We[zt]=Kt,Oe[Kt].geometry[0].pop(),Oe[Kt].geometry[0]=Oe[Kt].geometry[0].concat(kt[0]),Kt}function Ht(jt,zt,kt){let Kt=ke[zt];return delete ke[zt],ke[jt]=Kt,Oe[Kt].geometry[0].shift(),Oe[Kt].geometry[0]=kt[0].concat(Oe[Kt].geometry[0]),Kt}function sr(jt,zt,kt){let Kt=kt?zt[0][zt[0].length-1]:zt[0][0];return`${jt}:${Kt.x}:${Kt.y}`}for(let jt=0;jtjt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Pe,ke)=>Pe.sortKey-ke.sortKey)}update(a,h,_){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,h,this.layers,_),this.icon.programConfigurations.updatePaintArrays(a,h,this.layers,_))}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 _=this.lineVertexArray.length;if(a.segment!==void 0){let w=a.dist(h[a.segment+1]),I=a.dist(h[a.segment]),R={};for(let O=a.segment+1;O=0;O--)R[O]={x:h[O].x,y:h[O].y,tileUnitDistanceFromAnchor:I},O>0&&(I+=h[O-1].dist(h[O]));for(let O=0;O0}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.placedSymbolArray.get(h),w=_.vertexStartIndex+4*_.numGlyphs;for(let I=_.vertexStartIndex;Iw[O]-w[z]||I[z]-I[O]),R}addToSortKeyRanges(a,h){let _=this.sortKeyRanges[this.sortKeyRanges.length-1];_&&_.sortKey===h?_.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 _=this.symbolInstances.get(h);this.featureSortOrder.push(_.featureIndex),[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach((w,I,R)=>{w>=0&&R.indexOf(w)===I&&this.addIndicesForPlacedSymbol(this.text,w)}),_.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,_.verticalPlacedTextSymbolIndex),_.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,_.placedIconSymbolIndex),_.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,_.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let EN,MN;Rt("SymbolBucket",U_,{omit:["layers","collisionBoxArray","features","compareText"]}),U_.MAX_GLYPHS=65535,U_.addDynamicAttributes=lR;var hR={get paint(){return MN=MN||new Xn({"icon-opacity":new yr(ct.paint_symbol["icon-opacity"]),"icon-color":new yr(ct.paint_symbol["icon-color"]),"icon-halo-color":new yr(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new yr(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new yr(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new tr(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new tr(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new yr(ct.paint_symbol["text-opacity"]),"text-color":new yr(ct.paint_symbol["text-color"],{runtimeType:Gs,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new yr(ct.paint_symbol["text-halo-color"]),"text-halo-width":new yr(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new yr(ct.paint_symbol["text-halo-blur"]),"text-translate":new tr(ct.paint_symbol["text-translate"]),"text-translate-anchor":new tr(ct.paint_symbol["text-translate-anchor"])})},get layout(){return EN=EN||new Xn({"symbol-placement":new tr(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new tr(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new tr(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new yr(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new tr(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new tr(ct.layout_symbol["icon-allow-overlap"]),"icon-overlap":new tr(ct.layout_symbol["icon-overlap"]),"icon-ignore-placement":new tr(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new tr(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new tr(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new yr(ct.layout_symbol["icon-size"]),"icon-text-fit":new tr(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new tr(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new yr(ct.layout_symbol["icon-image"]),"icon-rotate":new yr(ct.layout_symbol["icon-rotate"]),"icon-padding":new yr(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new tr(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new yr(ct.layout_symbol["icon-offset"]),"icon-anchor":new yr(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new tr(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new tr(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new tr(ct.layout_symbol["text-rotation-alignment"]),"text-field":new yr(ct.layout_symbol["text-field"]),"text-font":new yr(ct.layout_symbol["text-font"]),"text-size":new yr(ct.layout_symbol["text-size"]),"text-max-width":new yr(ct.layout_symbol["text-max-width"]),"text-line-height":new tr(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new yr(ct.layout_symbol["text-letter-spacing"]),"text-justify":new yr(ct.layout_symbol["text-justify"]),"text-radial-offset":new yr(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new tr(ct.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new yr(ct.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new yr(ct.layout_symbol["text-anchor"]),"text-max-angle":new tr(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new tr(ct.layout_symbol["text-writing-mode"]),"text-rotate":new yr(ct.layout_symbol["text-rotate"]),"text-padding":new tr(ct.layout_symbol["text-padding"]),"text-keep-upright":new tr(ct.layout_symbol["text-keep-upright"]),"text-transform":new yr(ct.layout_symbol["text-transform"]),"text-offset":new yr(ct.layout_symbol["text-offset"]),"text-allow-overlap":new tr(ct.layout_symbol["text-allow-overlap"]),"text-overlap":new tr(ct.layout_symbol["text-overlap"]),"text-ignore-placement":new tr(ct.layout_symbol["text-ignore-placement"]),"text-optional":new tr(ct.layout_symbol["text-optional"])})}};class PN{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:Oa,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}}Rt("FormatSectionOverride",PN,{omit:["defaultValue"]});class XT extends pa{constructor(a){super(a,hR)}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 _=this.layout.get("text-writing-mode");if(_){let w=[];for(let I of _)w.indexOf(I)<0&&w.push(I);this.layout._values["text-writing-mode"]=w}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(a,h,_,w){let I=this.layout.get(a).evaluate(h,{},_,w),R=this._unevaluatedLayout._values[a];return R.isDataDriven()||wu(R.value)||!I?I:function(O,z){return z.replace(/{([^{}]+)}/g,(W,Z)=>O&&Z in O?String(O[Z]):"")}(h.properties,I)}createBucket(a){return new U_(a)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let a of hR.paint.overridableProperties){if(!XT.hasPaintOverride(this.layout,a))continue;let h=this.paint.get(a),_=new PN(h),w=new ki(_,h.property.specification),I=null;I=h.value.kind==="constant"||h.value.kind==="source"?new rm("source",w):new vf("composite",w,h.value.zoomStops),this.paint._values[a]=new Lo(h.property,I,h.parameters)}}_handleOverridablePaintPropertyUpdate(a,h,_){return!(!this.layout||h.isDataDriven()||_.isDataDriven())&&XT.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,h){let _=a.get("text-field"),w=hR.paint.properties[h],I=!1,R=O=>{for(let z of O)if(w.overrides&&w.overrides.hasOverride(z))return void(I=!0)};if(_.value.kind==="constant"&&_.value.value instanceof An)R(_.value.value.sections);else if(_.value.kind==="source"){let O=W=>{I||(W instanceof Wl&&an(W.value)===be?R(W.value.sections):W instanceof xf?R(W.sections):W.eachChild(O))},z=_.value;z._styleExpression&&O(z._styleExpression.expression)}return I}}let CN;var Vre={get paint(){return CN=CN||new Xn({"background-color":new tr(ct.paint_background["background-color"]),"background-pattern":new uA(ct.paint_background["background-pattern"]),"background-opacity":new tr(ct.paint_background["background-opacity"])})}};class jre extends pa{constructor(a){super(a,Vre)}}let IN;var Wre={get paint(){return IN=IN||new Xn({"raster-opacity":new tr(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new tr(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new tr(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new tr(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new tr(ct.paint_raster["raster-saturation"]),"raster-contrast":new tr(ct.paint_raster["raster-contrast"]),"raster-resampling":new tr(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new tr(ct.paint_raster["raster-fade-duration"])})}};class Hre extends pa{constructor(a){super(a,Wre)}}class $re extends pa{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 qre{constructor(a){this._callback=a,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}let fR=63710088e-1;class _A{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 _A(ve(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,_=this.lat*h,w=a.lat*h,I=Math.sin(_)*Math.sin(w)+Math.cos(_)*Math.cos(w)*Math.cos((a.lng-this.lng)*h);return fR*Math.acos(Math.min(I,1))}static convert(a){if(a instanceof _A)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new _A(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a=="object"&&a!==null)return new _A(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 RN=2*Math.PI*fR;function kN(u){return RN*Math.cos(u*Math.PI/180)}function LN(u){return(180+u)/360}function DN(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function ON(u,a){return u/kN(a)}function BN(u){return 360*u-180}function dR(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class QT{constructor(a,h,_=0){this.x=+a,this.y=+h,this.z=+_}static fromLngLat(a,h=0){let _=_A.convert(a);return new QT(LN(_.lng),DN(_.lat),ON(h,_.lat))}toLngLat(){return new _A(BN(this.x),dR(this.y))}toAltitude(){return this.z*kN(dR(this.y))}meterInMercatorCoordinateUnits(){return 1/RN*(a=dR(this.y),1/Math.cos(a*Math.PI/180));var a}}function FN(u,a,h){var _=2*Math.PI*6378137/256/Math.pow(2,h);return[u*_-2*Math.PI*6378137/2,a*_-2*Math.PI*6378137/2]}class pR{constructor(a,h,_){if(a<0||a>25||_<0||_>=Math.pow(2,a)||h<0||h>=Math.pow(2,a))throw new Error(`x=${h}, y=${_}, 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=_,this.key=fv(0,a,a,h,_)}equals(a){return this.z===a.z&&this.x===a.x&&this.y===a.y}url(a,h,_){let w=(R=this.y,O=this.z,z=FN(256*(I=this.x),256*(R=Math.pow(2,O)-R-1),O),W=FN(256*(I+1),256*(R+1),O),z[0]+","+z[1]+","+W[0]+","+W[1]);var I,R,O,z,W;let Z=function(K,re,ae){let ce,_e="";for(let Pe=K;Pe>0;Pe--)ce=1<1?"@2x":"").replace(/{quadkey}/g,Z).replace(/{bbox-epsg-3857}/g,w)}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 b((a.x*h-this.x)*ls,(a.y*h-this.y)*ls)}toString(){return`${this.z}/${this.x}/${this.y}`}}class NN{constructor(a,h){this.wrap=a,this.canonical=h,this.key=fv(a,h.z,h.z,h.x,h.y)}}class $c{constructor(a,h,_,w,I){if(a<_)throw new Error(`overscaledZ should be >= z; overscaledZ = ${a}; z = ${_}`);this.overscaledZ=a,this.wrap=h,this.canonical=new pR(_,+w,+I),this.key=fv(h,a,_,w,I)}clone(){return new $c(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 $c(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new $c(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 _=this.canonical.z-a;return a>this.canonical.z?fv(this.wrap*+h,a,this.canonical.z,this.canonical.x,this.canonical.y):fv(this.wrap*+h,a,a,this.canonical.x>>_,this.canonical.y>>_)}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 $c(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let h=this.canonical.z+1,_=2*this.canonical.x,w=2*this.canonical.y;return[new $c(h,this.wrap,h,_,w),new $c(h,this.wrap,h,_+1,w),new $c(h,this.wrap,h,_,w+1),new $c(h,this.wrap,h,_+1,w+1)]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.ythis.max&&(this.max=K),K=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,_){return a*this.redFactor+h*this.greenFactor+_*this.blueFactor-this.baseShift}getPixels(){return new C({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,h,_){if(this.dim!==a.dim)throw new Error("dem dimension mismatch");let w=h*this.dim,I=h*this.dim+this.dim,R=_*this.dim,O=_*this.dim+this.dim;switch(h){case-1:w=I-1;break;case 1:I=w+1}switch(_){case-1:R=O-1;break;case 1:O=R+1}let z=-h*this.dim,W=-_*this.dim;for(let Z=R;Z=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 VN{constructor(a,h,_,w,I){this.type="Feature",this._vectorTileFeature=a,a._z=h,a._x=_,a._y=w,this.properties=a.properties,this.id=I}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 jN{constructor(a,h){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new Tf(ls,16,0),this.grid3D=new Tf(ls,16,0),this.featureIndexArray=new gt,this.promoteId=h}insert(a,h,_,w,I,R){let O=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(_,w,I);let z=R?this.grid3D:this.grid;for(let W=0;W=0&&K[3]>=0&&z.insert(O,K[0],K[1],K[2],K[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new AA.VectorTile(new rR(this.rawTileData)).layers,this.sourceLayerCoder=new UN(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(a,h,_,w){this.loadVTLayers();let I=a.params||{},R=ls/a.tileSize/a.scale,O=Bc(I.filter),z=a.queryGeometry,W=a.queryPadding*R,Z=HN(z),K=this.grid.query(Z.minX-W,Z.minY-W,Z.maxX+W,Z.maxY+W),re=HN(a.cameraQueryGeometry),ae=this.grid3D.query(re.minX-W,re.minY-W,re.maxX+W,re.maxY+W,(Pe,ke,We,Oe)=>function($e,Je,At,Ht,sr){for(let zt of $e)if(Je<=zt.x&&At<=zt.y&&Ht>=zt.x&&sr>=zt.y)return!0;let jt=[new b(Je,At),new b(Je,sr),new b(Ht,sr),new b(Ht,At)];if($e.length>2){for(let zt of jt)if(ni($e,zt))return!0}for(let zt=0;zt<$e.length-1;zt++)if(Qo($e[zt],$e[zt+1],jt))return!0;return!1}(a.cameraQueryGeometry,Pe-W,ke-W,We+W,Oe+W));for(let Pe of ae)K.push(Pe);K.sort(Gre);let ce={},_e;for(let Pe=0;Pe(Oe||(Oe=If($e)),Je.queryIntersectsFeature(z,$e,At,Oe,this.z,a.transform,R,a.pixelPosMatrix)))}return ce}loadMatchingFeature(a,h,_,w,I,R,O,z,W,Z,K){let re=this.bucketLayerIDs[h];if(R&&!function(Pe,ke){for(let We=0;We=0)return!0;return!1}(R,re))return;let ae=this.sourceLayerCoder.decode(_),ce=this.vtLayers[ae].feature(w);if(I.needGeometry){let Pe=Rf(ce,!0);if(!I.filter(new gn(this.tileID.overscaledZ),Pe,this.tileID.canonical))return}else if(!I.filter(new gn(this.tileID.overscaledZ),ce))return;let _e=this.getId(ce,ae);for(let Pe=0;Pe{let O=a instanceof cA?a.get(R):null;return O&&O.evaluate?O.evaluate(h,_,w):O})}function HN(u){let a=1/0,h=1/0,_=-1/0,w=-1/0;for(let I of u)a=Math.min(a,I.x),h=Math.min(h,I.y),_=Math.max(_,I.x),w=Math.max(w,I.y);return{minX:a,minY:h,maxX:_,maxY:w}}function Gre(u,a){return a-u}function $N(u,a,h,_,w){let I=[];for(let R=0;R=_&&K.x>=_||(Z.x>=_?Z=new b(_,Z.y+(_-Z.x)/(K.x-Z.x)*(K.y-Z.y))._round():K.x>=_&&(K=new b(_,Z.y+(_-Z.x)/(K.x-Z.x)*(K.y-Z.y))._round()),Z.y>=w&&K.y>=w||(Z.y>=w?Z=new b(Z.x+(w-Z.y)/(K.y-Z.y)*(K.x-Z.x),w)._round():K.y>=w&&(K=new b(Z.x+(w-Z.y)/(K.y-Z.y)*(K.x-Z.x),w)._round()),z&&Z.equals(z[z.length-1])||(z=[Z],I.push(z)),z.push(K)))))}}return I}Rt("FeatureIndex",jN,{omit:["rawTileData","sourceLayerCoder"]});class yA extends b{constructor(a,h,_,w){super(a,h),this.angle=_,w!==void 0&&(this.segment=w)}clone(){return new yA(this.x,this.y,this.angle,this.segment)}}function qN(u,a,h,_,w){if(a.segment===void 0||h===0)return!0;let I=a,R=a.segment+1,O=0;for(;O>-h/2;){if(R--,R<0)return!1;O-=u[R].dist(I),I=u[R]}O+=u[R].dist(u[R+1]),R++;let z=[],W=0;for(;O_;)W-=z.shift().angleDelta;if(W>w)return!1;R++,O+=Z.dist(K)}return!0}function GN(u){let a=0;for(let h=0;hW){let ce=(W-z)/ae,_e=za.number(K.x,re.x,ce),Pe=za.number(K.y,re.y,ce),ke=new yA(_e,Pe,re.angleTo(K),Z);return ke._round(),!R||qN(u,ke,O,R,a)?ke:void 0}z+=ae}}function Yre(u,a,h,_,w,I,R,O,z){let W=ZN(_,I,R),Z=YN(_,w),K=Z*R,re=u[0].x===0||u[0].x===z||u[0].y===0||u[0].y===z;return a-K=0&&$e=0&&Je=0&&re+W<=Z){let At=new yA($e,Je,We,ce);At._round(),_&&!qN(u,At,I,_,w)||ae.push(At)}}K+=ke}return O||ae.length||R||(ae=XN(u,K/2,h,_,w,I,R,!0,z)),ae}Rt("Anchor",yA);let V_=gl;function QN(u,a,h,_){let w=[],I=u.image,R=I.pixelRatio,O=I.paddedRect.w-2*V_,z=I.paddedRect.h-2*V_,W=u.right-u.left,Z=u.bottom-u.top,K=I.stretchX||[[0,O]],re=I.stretchY||[[0,z]],ae=(kt,Kt)=>kt+Kt[1]-Kt[0],ce=K.reduce(ae,0),_e=re.reduce(ae,0),Pe=O-ce,ke=z-_e,We=0,Oe=ce,$e=0,Je=_e,At=0,Ht=Pe,sr=0,jt=ke;if(I.content&&_){let kt=I.content;We=KT(K,0,kt[0]),$e=KT(re,0,kt[1]),Oe=KT(K,kt[0],kt[2]),Je=KT(re,kt[1],kt[3]),At=kt[0]-We,sr=kt[1]-$e,Ht=kt[2]-kt[0]-Oe,jt=kt[3]-kt[1]-Je}let zt=(kt,Kt,Bt,bt)=>{let gr=JT(kt.stretch-We,Oe,W,u.left),ar=e3(kt.fixed-At,Ht,kt.stretch,ce),hi=JT(Kt.stretch-$e,Je,Z,u.top),Mn=e3(Kt.fixed-sr,jt,Kt.stretch,_e),On=JT(Bt.stretch-We,Oe,W,u.left),Js=e3(Bt.fixed-At,Ht,Bt.stretch,ce),Kl=JT(bt.stretch-$e,Je,Z,u.top),Va=e3(bt.fixed-sr,jt,bt.stretch,_e),Ls=new b(gr,hi),Oo=new b(On,hi),Jo=new b(On,Kl),ja=new b(gr,Kl),Wa=new b(ar/R,Mn/R),eo=new b(Js/R,Va/R),to=a*Math.PI/180;if(to){let _a=Math.sin(to),_l=Math.cos(to),yl=[_l,-_a,_a,_l];Ls._matMult(yl),Oo._matMult(yl),ja._matMult(yl),Jo._matMult(yl)}let ga=kt.stretch+kt.fixed,Ha=Kt.stretch+Kt.fixed;return{tl:Ls,tr:Oo,bl:ja,br:Jo,tex:{x:I.paddedRect.x+V_+ga,y:I.paddedRect.y+V_+Ha,w:Bt.stretch+Bt.fixed-ga,h:bt.stretch+bt.fixed-Ha},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Wa,pixelOffsetBR:eo,minFontScaleX:Ht/R/W,minFontScaleY:jt/R/Z,isSDF:h}};if(_&&(I.stretchX||I.stretchY)){let kt=KN(K,Pe,ce),Kt=KN(re,ke,_e);for(let Bt=0;Bt0&&(ce=Math.max(10,ce),this.circleDiameter=ce)}else{let K=R.top*O-z[0],re=R.bottom*O+z[2],ae=R.left*O-z[3],ce=R.right*O+z[1],_e=R.collisionPadding;if(_e&&(ae-=_e[0]*O,K-=_e[1]*O,ce+=_e[2]*O,re+=_e[3]*O),Z){let Pe=new b(ae,K),ke=new b(ce,K),We=new b(ae,re),Oe=new b(ce,re),$e=Z*Math.PI/180;Pe._rotate($e),ke._rotate($e),We._rotate($e),Oe._rotate($e),ae=Math.min(Pe.x,ke.x,We.x,Oe.x),ce=Math.max(Pe.x,ke.x,We.x,Oe.x),K=Math.min(Pe.y,ke.y,We.y,Oe.y),re=Math.max(Pe.y,ke.y,We.y,Oe.y)}a.emplaceBack(h.x,h.y,ae,K,ce,re,_,w,I)}this.boxEndIndex=a.length}}class Xre{constructor(a=[],h=Qre){if(this.data=a,this.length=this.data.length,this.compare=h,this.length>0)for(let _=(this.length>>1)-1;_>=0;_--)this._down(_)}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:_}=this,w=h[a];for(;a>0;){let I=a-1>>1,R=h[I];if(_(w,R)>=0)break;h[a]=R,a=I}h[a]=w}_down(a){let{data:h,compare:_}=this,w=this.length>>1,I=h[a];for(;a=0)break;h[a]=O,a=R}h[a]=I}}function Qre(u,a){return ua?1:0}function Kre(u,a=1,h=!1){let _=1/0,w=1/0,I=-1/0,R=-1/0,O=u[0];for(let ae=0;aeI)&&(I=ce.x),(!ae||ce.y>R)&&(R=ce.y)}let z=Math.min(I-_,R-w),W=z/2,Z=new Xre([],Jre);if(z===0)return new b(_,w);for(let ae=_;aeK.d||!K.d)&&(K=ae,h&&console.log("found best %d after %d probes",Math.round(1e4*ae.d)/1e4,re)),ae.max-K.d<=a||(W=ae.h/2,Z.push(new j_(ae.p.x-W,ae.p.y-W,W,u)),Z.push(new j_(ae.p.x+W,ae.p.y-W,W,u)),Z.push(new j_(ae.p.x-W,ae.p.y+W,W,u)),Z.push(new j_(ae.p.x+W,ae.p.y+W,W,u)),re+=4)}return h&&(console.log(`num probes: ${re}`),console.log(`best distance: ${K.d}`)),K.p}function Jre(u,a){return a.max-u.max}function j_(u,a,h,_){this.p=new b(u,a),this.h=h,this.d=function(w,I){let R=!1,O=1/0;for(let z=0;zw.y!=ce.y>w.y&&w.x<(ce.x-ae.x)*(w.y-ae.y)/(ce.y-ae.y)+ae.x&&(R=!R),O=Math.min(O,Wr(w,ae,ce))}}return(R?1:-1)*Math.sqrt(O)}(this.p,_),this.max=this.d+this.h*Math.SQRT2}var Ko;s.aq=void 0,(Ko=s.aq||(s.aq={}))[Ko.center=1]="center",Ko[Ko.left=2]="left",Ko[Ko.right=3]="right",Ko[Ko.top=4]="top",Ko[Ko.bottom=5]="bottom",Ko[Ko["top-left"]=6]="top-left",Ko[Ko["top-right"]=7]="top-right",Ko[Ko["bottom-left"]=8]="bottom-left",Ko[Ko["bottom-right"]=9]="bottom-right";let xA=7,AR=Number.POSITIVE_INFINITY;function JN(u,a){return a[1]!==AR?function(h,_,w){let I=0,R=0;switch(_=Math.abs(_),w=Math.abs(w),h){case"top-right":case"top-left":case"top":R=w-xA;break;case"bottom-right":case"bottom-left":case"bottom":R=-w+xA}switch(h){case"top-right":case"bottom-right":case"right":I=-_;break;case"top-left":case"bottom-left":case"left":I=_}return[I,R]}(u,a[0],a[1]):function(h,_){let w=0,I=0;_<0&&(_=0);let R=_/Math.SQRT2;switch(h){case"top-right":case"top-left":I=R-xA;break;case"bottom-right":case"bottom-left":I=-R+xA;break;case"bottom":I=-_+xA;break;case"top":I=_-xA}switch(h){case"top-right":case"bottom-right":w=-R;break;case"top-left":case"bottom-left":w=R;break;case"left":w=_;break;case"right":w=-_}return[w,I]}(u,a[0])}function ez(u,a,h){var _;let w=u.layout,I=(_=w.get("text-variable-anchor-offset"))===null||_===void 0?void 0:_.evaluate(a,{},h);if(I){let O=I.values,z=[];for(let W=0;Wre*Ks);Z.startsWith("top")?K[1]-=xA:Z.startsWith("bottom")&&(K[1]+=xA),z[W+1]=K}return new $o(z)}let R=w.get("text-variable-anchor");if(R){let O;O=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[w.get("text-radial-offset").evaluate(a,{},h)*Ks,AR]:w.get("text-offset").evaluate(a,{},h).map(W=>W*Ks);let z=[];for(let W of R)z.push(W,JN(W,O));return new $o(z)}return null}function mR(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 eie(u,a,h,_,w,I,R,O,z,W,Z){let K=I.textMaxSize.evaluate(a,{});K===void 0&&(K=R);let re=u.layers[0].layout,ae=re.get("icon-offset").evaluate(a,{},Z),ce=rz(h.horizontal),_e=R/24,Pe=u.tilePixelRatio*_e,ke=u.tilePixelRatio*K/24,We=u.tilePixelRatio*O,Oe=u.tilePixelRatio*re.get("symbol-spacing"),$e=re.get("text-padding")*u.tilePixelRatio,Je=function(bt,gr,ar,hi=1){let Mn=bt.get("icon-padding").evaluate(gr,{},ar),On=Mn&&Mn.values;return[On[0]*hi,On[1]*hi,On[2]*hi,On[3]*hi]}(re,a,Z,u.tilePixelRatio),At=re.get("text-max-angle")/180*Math.PI,Ht=re.get("text-rotation-alignment")!=="viewport"&&re.get("symbol-placement")!=="point",sr=re.get("icon-rotation-alignment")==="map"&&re.get("symbol-placement")!=="point",jt=re.get("symbol-placement"),zt=Oe/2,kt=re.get("icon-text-fit"),Kt;_&&kt!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(Kt=SN(_,h.vertical,kt,re.get("icon-text-fit-padding"),ae,_e)),ce&&(_=SN(_,ce,kt,re.get("icon-text-fit-padding"),ae,_e)));let Bt=(bt,gr)=>{gr.x<0||gr.x>=ls||gr.y<0||gr.y>=ls||function(ar,hi,Mn,On,Js,Kl,Va,Ls,Oo,Jo,ja,Wa,eo,to,ga,Ha,_a,_l,yl,ro,vi,ya,ea,io,ku){let Ch=ar.addToLineVertexArray(hi,Mn),Ih,$d,Lu,qc,xl=0,qd=0,Av=0,oz=0,SR=-1,TR=-1,Gd={},az=Iu("");if(ar.allowVerticalPlacement&&On.vertical){let xa=Ls.layout.get("text-rotate").evaluate(vi,{},io)+90;Lu=new t3(Oo,hi,Jo,ja,Wa,On.vertical,eo,to,ga,xa),Va&&(qc=new t3(Oo,hi,Jo,ja,Wa,Va,_a,_l,ga,xa))}if(Js){let xa=Ls.layout.get("icon-rotate").evaluate(vi,{}),Gc=Ls.layout.get("icon-text-fit")!=="none",vm=QN(Js,xa,ea,Gc),kh=Va?QN(Va,xa,ea,Gc):void 0;$d=new t3(Oo,hi,Jo,ja,Wa,Js,_a,_l,!1,xa),xl=4*vm.length;let bm=ar.iconSizeData,Of=null;bm.kind==="source"?(Of=[Df*Ls.layout.get("icon-size").evaluate(vi,{})],Of[0]>gA&&Gt(`${ar.layerIds[0]}: Value for "icon-size" is >= ${hv}. Reduce your "icon-size".`)):bm.kind==="composite"&&(Of=[Df*ya.compositeIconSizes[0].evaluate(vi,{},io),Df*ya.compositeIconSizes[1].evaluate(vi,{},io)],(Of[0]>gA||Of[1]>gA)&&Gt(`${ar.layerIds[0]}: Value for "icon-size" is >= ${hv}. Reduce your "icon-size".`)),ar.addSymbols(ar.icon,vm,Of,ro,yl,vi,s.ai.none,hi,Ch.lineStartIndex,Ch.lineLength,-1,io),SR=ar.icon.placedSymbolArray.length-1,kh&&(qd=4*kh.length,ar.addSymbols(ar.icon,kh,Of,ro,yl,vi,s.ai.vertical,hi,Ch.lineStartIndex,Ch.lineLength,-1,io),TR=ar.icon.placedSymbolArray.length-1)}let lz=Object.keys(On.horizontal);for(let xa of lz){let Gc=On.horizontal[xa];if(!Ih){az=Iu(Gc.text);let kh=Ls.layout.get("text-rotate").evaluate(vi,{},io);Ih=new t3(Oo,hi,Jo,ja,Wa,Gc,eo,to,ga,kh)}let vm=Gc.positionedLines.length===1;if(Av+=tz(ar,hi,Gc,Kl,Ls,ga,vi,Ha,Ch,On.vertical?s.ai.horizontal:s.ai.horizontalOnly,vm?lz:[xa],Gd,SR,ya,io),vm)break}On.vertical&&(oz+=tz(ar,hi,On.vertical,Kl,Ls,ga,vi,Ha,Ch,s.ai.vertical,["vertical"],Gd,TR,ya,io));let iie=Ih?Ih.boxStartIndex:ar.collisionBoxArray.length,nie=Ih?Ih.boxEndIndex:ar.collisionBoxArray.length,sie=Lu?Lu.boxStartIndex:ar.collisionBoxArray.length,oie=Lu?Lu.boxEndIndex:ar.collisionBoxArray.length,aie=$d?$d.boxStartIndex:ar.collisionBoxArray.length,lie=$d?$d.boxEndIndex:ar.collisionBoxArray.length,cie=qc?qc.boxStartIndex:ar.collisionBoxArray.length,uie=qc?qc.boxEndIndex:ar.collisionBoxArray.length,Rh=-1,i3=(xa,Gc)=>xa&&xa.circleDiameter?Math.max(xa.circleDiameter,Gc):Gc;Rh=i3(Ih,Rh),Rh=i3(Lu,Rh),Rh=i3($d,Rh),Rh=i3(qc,Rh);let cz=Rh>-1?1:0;cz&&(Rh*=ku/Ks),ar.glyphOffsetArray.length>=U_.MAX_GLYPHS&&Gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),vi.sortKey!==void 0&&ar.addToSortKeyRanges(ar.symbolInstances.length,vi.sortKey);let hie=ez(Ls,vi,io),[fie,die]=function(xa,Gc){let vm=xa.length,kh=Gc?.values;if(kh?.length>0)for(let bm=0;bm=0?Gd.right:-1,Gd.center>=0?Gd.center:-1,Gd.left>=0?Gd.left:-1,Gd.vertical||-1,SR,TR,az,iie,nie,sie,oie,aie,lie,cie,uie,Jo,Av,oz,xl,qd,cz,0,eo,Rh,fie,die)}(u,gr,bt,h,_,w,Kt,u.layers[0],u.collisionBoxArray,a.index,a.sourceLayerIndex,u.index,Pe,[$e,$e,$e,$e],Ht,z,We,Je,sr,ae,a,I,W,Z,R)};if(jt==="line")for(let bt of $N(a.geometry,0,0,ls,ls)){let gr=Yre(bt,Oe,At,h.vertical||ce,_,24,ke,u.overscaling,ls);for(let ar of gr)ce&&tie(u,ce.text,zt,ar)||Bt(bt,ar)}else if(jt==="line-center"){for(let bt of a.geometry)if(bt.length>1){let gr=Zre(bt,At,h.vertical||ce,_,24,ke);gr&&Bt(bt,gr)}}else if(a.type==="Polygon")for(let bt of Z4(a.geometry,0)){let gr=Kre(bt,16);Bt(bt[0],new yA(gr.x,gr.y,0))}else if(a.type==="LineString")for(let bt of a.geometry)Bt(bt,new yA(bt[0].x,bt[0].y,0));else if(a.type==="Point")for(let bt of a.geometry)for(let gr of bt)Bt([gr],new yA(gr.x,gr.y,0))}function tz(u,a,h,_,w,I,R,O,z,W,Z,K,re,ae,ce){let _e=function(We,Oe,$e,Je,At,Ht,sr,jt){let zt=Je.layout.get("text-rotate").evaluate(Ht,{})*Math.PI/180,kt=[];for(let Kt of Oe.positionedLines)for(let Bt of Kt.positionedGlyphs){if(!Bt.rect)continue;let bt=Bt.rect||{},gr=gN+1,ar=!0,hi=1,Mn=0,On=(At||jt)&&Bt.vertical,Js=Bt.metrics.advance*Bt.scale/2;if(jt&&Oe.verticalizable&&(Mn=Kt.lineOffset/2-(Bt.imageName?-(Ks-Bt.metrics.width*Bt.scale)/2:(Bt.scale-1)*Ks)),Bt.imageName){let ro=sr[Bt.imageName];ar=ro.sdf,hi=ro.pixelRatio,gr=gl/hi}let Kl=At?[Bt.x+Js,Bt.y]:[0,0],Va=At?[0,0]:[Bt.x+Js+$e[0],Bt.y+$e[1]-Mn],Ls=[0,0];On&&(Ls=Va,Va=[0,0]);let Oo=Bt.metrics.isDoubleResolution?2:1,Jo=(Bt.metrics.left-gr)*Bt.scale-Js+Va[0],ja=(-Bt.metrics.top-gr)*Bt.scale+Va[1],Wa=Jo+bt.w/Oo*Bt.scale/hi,eo=ja+bt.h/Oo*Bt.scale/hi,to=new b(Jo,ja),ga=new b(Wa,ja),Ha=new b(Jo,eo),_a=new b(Wa,eo);if(On){let ro=new b(-Js,Js-cv),vi=-Math.PI/2,ya=Ks/2-Js,ea=new b(5-cv-ya,-(Bt.imageName?ya:0)),io=new b(...Ls);to._rotateAround(vi,ro)._add(ea)._add(io),ga._rotateAround(vi,ro)._add(ea)._add(io),Ha._rotateAround(vi,ro)._add(ea)._add(io),_a._rotateAround(vi,ro)._add(ea)._add(io)}if(zt){let ro=Math.sin(zt),vi=Math.cos(zt),ya=[vi,-ro,ro,vi];to._matMult(ya),ga._matMult(ya),Ha._matMult(ya),_a._matMult(ya)}let _l=new b(0,0),yl=new b(0,0);kt.push({tl:to,tr:ga,bl:Ha,br:_a,tex:bt,writingMode:Oe.writingMode,glyphOffset:Kl,sectionIndex:Bt.sectionIndex,isSDF:ar,pixelOffsetTL:_l,pixelOffsetBR:yl,minFontScaleX:0,minFontScaleY:0})}return kt}(0,h,O,w,I,R,_,u.allowVerticalPlacement),Pe=u.textSizeData,ke=null;Pe.kind==="source"?(ke=[Df*w.layout.get("text-size").evaluate(R,{})],ke[0]>gA&&Gt(`${u.layerIds[0]}: Value for "text-size" is >= ${hv}. Reduce your "text-size".`)):Pe.kind==="composite"&&(ke=[Df*ae.compositeTextSizes[0].evaluate(R,{},ce),Df*ae.compositeTextSizes[1].evaluate(R,{},ce)],(ke[0]>gA||ke[1]>gA)&&Gt(`${u.layerIds[0]}: Value for "text-size" is >= ${hv}. Reduce your "text-size".`)),u.addSymbols(u.text,_e,ke,O,I,R,W,a,z.lineStartIndex,z.lineLength,re,ce);for(let We of Z)K[We]=u.text.placedSymbolArray.length-1;return 4*_e.length}function rz(u){for(let a in u)return u[a];return null}function tie(u,a,h,_){let w=u.compareText;if(a in w){let I=w[a];for(let R=I.length-1;R>=0;R--)if(_.dist(I[R])>4;if(w!==1)throw new Error(`Got v${w} data when expected v1.`);let I=iz[15&_];if(!I)throw new Error("Unrecognized array type.");let[R]=new Uint16Array(a,2,1),[O]=new Uint32Array(a,4,1);return new gR(O,R,I,a)}constructor(a,h=64,_=Float64Array,w){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=_,this.IndexArrayType=a<65536?Uint16Array:Uint32Array;let I=iz.indexOf(this.ArrayType),R=2*a*this.ArrayType.BYTES_PER_ELEMENT,O=a*this.IndexArrayType.BYTES_PER_ELEMENT,z=(8-O%8)%8;if(I<0)throw new Error(`Unexpected typed array class: ${_}.`);w&&w instanceof ArrayBuffer?(this.data=w,this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+O+z,2*a),this._pos=2*a,this._finished=!0):(this.data=new ArrayBuffer(8+R+O+z),this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+O+z,2*a),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+I]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=a)}add(a,h){let _=this._pos>>1;return this.ids[_]=_,this.coords[this._pos++]=a,this.coords[this._pos++]=h,_}finish(){let a=this._pos>>1;if(a!==this.numItems)throw new Error(`Added ${a} items when expected ${this.numItems}.`);return _R(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(a,h,_,w){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:I,coords:R,nodeSize:O}=this,z=[0,I.length-1,0],W=[];for(;z.length;){let Z=z.pop()||0,K=z.pop()||0,re=z.pop()||0;if(K-re<=O){for(let Pe=re;Pe<=K;Pe++){let ke=R[2*Pe],We=R[2*Pe+1];ke>=a&&ke<=_&&We>=h&&We<=w&&W.push(I[Pe])}continue}let ae=re+K>>1,ce=R[2*ae],_e=R[2*ae+1];ce>=a&&ce<=_&&_e>=h&&_e<=w&&W.push(I[ae]),(Z===0?a<=ce:h<=_e)&&(z.push(re),z.push(ae-1),z.push(1-Z)),(Z===0?_>=ce:w>=_e)&&(z.push(ae+1),z.push(K),z.push(1-Z))}return W}within(a,h,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:w,coords:I,nodeSize:R}=this,O=[0,w.length-1,0],z=[],W=_*_;for(;O.length;){let Z=O.pop()||0,K=O.pop()||0,re=O.pop()||0;if(K-re<=R){for(let Pe=re;Pe<=K;Pe++)sz(I[2*Pe],I[2*Pe+1],a,h)<=W&&z.push(w[Pe]);continue}let ae=re+K>>1,ce=I[2*ae],_e=I[2*ae+1];sz(ce,_e,a,h)<=W&&z.push(w[ae]),(Z===0?a-_<=ce:h-_<=_e)&&(O.push(re),O.push(ae-1),O.push(1-Z)),(Z===0?a+_>=ce:h+_>=_e)&&(O.push(ae+1),O.push(K),O.push(1-Z))}return z}}function _R(u,a,h,_,w,I){if(w-_<=h)return;let R=_+w>>1;nz(u,a,R,_,w,I),_R(u,a,h,_,R-1,1-I),_R(u,a,h,R+1,w,1-I)}function nz(u,a,h,_,w,I){for(;w>_;){if(w-_>600){let W=w-_+1,Z=h-_+1,K=Math.log(W),re=.5*Math.exp(2*K/3),ae=.5*Math.sqrt(K*re*(W-re)/W)*(Z-W/2<0?-1:1);nz(u,a,h,Math.max(_,Math.floor(h-Z*re/W+ae)),Math.min(w,Math.floor(h+(W-Z)*re/W+ae)),I)}let R=a[2*h+I],O=_,z=w;for(dv(u,a,_,h),a[2*w+I]>R&&dv(u,a,_,w);OR;)z--}a[2*_+I]===R?dv(u,a,_,z):(z++,dv(u,a,z,w)),z<=h&&(_=z+1),h<=z&&(w=z-1)}}function dv(u,a,h,_){yR(u,h,_),yR(a,2*h,2*_),yR(a,2*h+1,2*_+1)}function yR(u,a,h){let _=u[a];u[a]=u[h],u[h]=_}function sz(u,a,h,_){let w=u-h,I=a-_;return w*w+I*I}var xR;s.bh=void 0,(xR=s.bh||(s.bh={})).create="create",xR.load="load",xR.fullLoad="fullLoad";let r3=null,pv=[],vR=1e3/60,bR="loadTime",wR="fullLoadTime",rie={mark(u){performance.mark(u)},frame(u){let a=u;r3!=null&&pv.push(a-r3),r3=a},clearMetrics(){r3=null,pv=[],performance.clearMeasures(bR),performance.clearMeasures(wR);for(let u in s.bh)performance.clearMarks(s.bh[u])},getPerformanceMetrics(){performance.measure(bR,s.bh.create,s.bh.load),performance.measure(wR,s.bh.create,s.bh.fullLoad);let u=performance.getEntriesByName(bR)[0].duration,a=performance.getEntriesByName(wR)[0].duration,h=pv.length,_=1/(pv.reduce((I,R)=>I+R,0)/h/1e3),w=pv.filter(I=>I>vR).reduce((I,R)=>I+(R-vR)/vR,0);return{loadTime:u,fullLoadTime:a,fps:_,percentDroppedFrames:w/(h+w)*100,totalFrames:h}}};s.$=function(u,a,h){var _,w,I,R,O,z,W,Z,K,re,ae,ce,_e=h[0],Pe=h[1],ke=h[2];return a===u?(u[12]=a[0]*_e+a[4]*Pe+a[8]*ke+a[12],u[13]=a[1]*_e+a[5]*Pe+a[9]*ke+a[13],u[14]=a[2]*_e+a[6]*Pe+a[10]*ke+a[14],u[15]=a[3]*_e+a[7]*Pe+a[11]*ke+a[15]):(w=a[1],I=a[2],R=a[3],O=a[4],z=a[5],W=a[6],Z=a[7],K=a[8],re=a[9],ae=a[10],ce=a[11],u[0]=_=a[0],u[1]=w,u[2]=I,u[3]=R,u[4]=O,u[5]=z,u[6]=W,u[7]=Z,u[8]=K,u[9]=re,u[10]=ae,u[11]=ce,u[12]=_*_e+O*Pe+K*ke+a[12],u[13]=w*_e+z*Pe+re*ke+a[13],u[14]=I*_e+W*Pe+ae*ke+a[14],u[15]=R*_e+Z*Pe+ce*ke+a[15]),u},s.A=jd,s.B=za,s.C=class{constructor(u,a,h){this.receive=_=>{let w=_.data,I=w.id;if(I&&(!w.targetMapId||this.mapId===w.targetMapId))if(w.type===""){delete this.tasks[I];let R=this.cancelCallbacks[I];delete this.cancelCallbacks[I],R&&R()}else ri()||w.mustQueue?(this.tasks[I]=w,this.taskQueue.push(I),this.invoker.trigger()):this.processTask(I,w)},this.process=()=>{if(!this.taskQueue.length)return;let _=this.taskQueue.shift(),w=this.tasks[_];delete this.tasks[_],this.taskQueue.length&&this.invoker.trigger(),w&&this.processTask(_,w)},this.target=u,this.parent=a,this.mapId=h,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new qre(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ri()?u:window}send(u,a,h,_,w=!1){let I=Math.round(1e18*Math.random()).toString(36).substring(0,10);h&&(this.callbacks[I]=h);let R=[],O={id:I,type:u,hasCallback:!!h,targetMapId:_,mustQueue:w,sourceMapId:this.mapId,data:zn(a,R)};return this.target.postMessage(O,{transfer:R}),{cancel:()=>{h&&delete this.callbacks[I],this.target.postMessage({id:I,type:"",targetMapId:_,sourceMapId:this.mapId})}}}processTask(u,a){if(a.type===""){let h=this.callbacks[u];delete this.callbacks[u],h&&(a.error?h(Tu(a.error)):h(null,Tu(a.data)))}else{let h=!1,_=[],w=a.hasCallback?(O,z)=>{h=!0,delete this.cancelCallbacks[u];let W={id:u,type:"",sourceMapId:this.mapId,error:O?zn(O):null,data:zn(z,_)};this.target.postMessage(W,{transfer:_})}:O=>{h=!0},I=null,R=Tu(a.data);if(this.parent[a.type])I=this.parent[a.type](a.sourceMapId,R,w);else if("getWorkerSource"in this.parent){let O=a.type.split(".");I=this.parent.getWorkerSource(a.sourceMapId,O[0],R.source)[O[1]](R,w)}else w(new Error(`Could not find function ${a.type}`));!h&&I&&I.cancel&&(this.cancelCallbacks[u]=I.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},s.D=tr,s.E=zl,s.F=function(u,a){let h={};for(let _=0;_{}}},s.Y=Tt,s.Z=function(){var u=new jd(16);return jd!=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},s._=o,s.a=fo,s.a$=class extends se{},s.a0=function(u,a,h){var _=h[0],w=h[1],I=h[2];return u[0]=a[0]*_,u[1]=a[1]*_,u[2]=a[2]*_,u[3]=a[3]*_,u[4]=a[4]*w,u[5]=a[5]*w,u[6]=a[6]*w,u[7]=a[7]*w,u[8]=a[8]*I,u[9]=a[9]*I,u[10]=a[10]*I,u[11]=a[11]*I,u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},s.a1=Vt,s.a2=function(){return Ze++},s.a3=we,s.a4=U_,s.a5=function(){da.isLoading()||da.isLoaded()||hm()!=="deferred"||M_()},s.a6=Bc,s.a7=Rf,s.a8=gn,s.a9=VN,s.aA=Nd,s.aB=function(u){u=u.slice();let a=Object.create(null);for(let h=0;h{_[R.source]?h.push({command:gi.removeLayer,args:[R.id]}):I.push(R)}),h=h.concat(w),function(R,O,z){O=O||[];let W=(R=R||[]).map(Da),Z=O.map(Da),K=R.reduce(Ro,{}),re=O.reduce(Ro,{}),ae=W.slice(),ce=Object.create(null),_e,Pe,ke,We,Oe,$e,Je;for(_e=0,Pe=0;_e@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,_,w,I)=>{let R=w||I;return a[_]=!R||R.toLowerCase(),""}),a["max-age"]){let h=parseInt(a["max-age"],10);isNaN(h)?delete a["max-age"]:a["max-age"]=h}return a},s.ab=function(u,a){let h=[];for(let _ in u)_ in a||h.push(_);return h},s.ac=function(u){if(Bn==null){let a=u.navigator?u.navigator.userAgent:null;Bn=!!u.safari||!(!a||!(/\b(iPad|iPhone|iPod)\b/.test(a)||a.match("Safari")&&!a.match("Chrome")))}return Bn},s.ad=oe,s.ae=function(u,a,h){var _=Math.sin(h),w=Math.cos(h),I=a[0],R=a[1],O=a[2],z=a[3],W=a[4],Z=a[5],K=a[6],re=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]=I*w+W*_,u[1]=R*w+Z*_,u[2]=O*w+K*_,u[3]=z*w+re*_,u[4]=W*w-I*_,u[5]=Z*w-R*_,u[6]=K*w-O*_,u[7]=re*w-z*_,u},s.af=function(u){var a=new jd(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},s.ag=Wd,s.ah=function(u,a){let h=0,_=0;if(u.kind==="constant")_=u.layoutSize;else if(u.kind!=="source"){let{interpolationType:w,minZoom:I,maxZoom:R}=u,O=w?oe(Ua.interpolationFactor(w,a,I,R),0,1):0;u.kind==="camera"?_=za.number(u.minSize,u.maxSize,O):h=O}return{uSizeT:h,uSize:_}},s.aj=function(u,{uSize:a,uSizeT:h},{lowerSize:_,upperSize:w}){return u.kind==="source"?_/Df:u.kind==="composite"?za.number(_/Df,w/Df,h):a},s.ak=lR,s.al=function(u,a,h,_){let w=a.y-u.y,I=a.x-u.x,R=_.y-h.y,O=_.x-h.x,z=R*I-O*w;if(z===0)return null;let W=(O*(u.y-h.y)-R*(u.x-h.x))/z;return new b(u.x+W*I,u.y+W*w)},s.am=$N,s.an=jT,s.ao=wt,s.ap=Ks,s.ar=aR,s.as=function(u,a){var h=a[0],_=a[1],w=a[2],I=a[3],R=a[4],O=a[5],z=a[6],W=a[7],Z=a[8],K=a[9],re=a[10],ae=a[11],ce=a[12],_e=a[13],Pe=a[14],ke=a[15],We=h*O-_*R,Oe=h*z-w*R,$e=h*W-I*R,Je=_*z-w*O,At=_*W-I*O,Ht=w*W-I*z,sr=Z*_e-K*ce,jt=Z*Pe-re*ce,zt=Z*ke-ae*ce,kt=K*Pe-re*_e,Kt=K*ke-ae*_e,Bt=re*ke-ae*Pe,bt=We*Bt-Oe*Kt+$e*kt+Je*zt-At*jt+Ht*sr;return bt?(u[0]=(O*Bt-z*Kt+W*kt)*(bt=1/bt),u[1]=(w*Kt-_*Bt-I*kt)*bt,u[2]=(_e*Ht-Pe*At+ke*Je)*bt,u[3]=(re*At-K*Ht-ae*Je)*bt,u[4]=(z*zt-R*Bt-W*jt)*bt,u[5]=(h*Bt-w*zt+I*jt)*bt,u[6]=(Pe*$e-ce*Ht-ke*Oe)*bt,u[7]=(Z*Ht-re*$e+ae*Oe)*bt,u[8]=(R*Kt-O*zt+W*sr)*bt,u[9]=(_*zt-h*Kt-I*sr)*bt,u[10]=(ce*At-_e*$e+ke*We)*bt,u[11]=(K*$e-Z*At-ae*We)*bt,u[12]=(O*jt-R*kt-z*sr)*bt,u[13]=(h*kt-_*jt+w*sr)*bt,u[14]=(_e*Oe-ce*Je-Pe*We)*bt,u[15]=(Z*Je-K*Oe+re*We)*bt,u):null},s.at=mR,s.au=oR,s.av=gR,s.aw=function(){let u={},a=ct.$version;for(let h in ct.$root){let _=ct.$root[h];if(_.required){let w=null;w=h==="version"?a:_.type==="array"?[]:{},w!=null&&(u[h]=w)}}return u},s.ax=gi,s.ay=om,s.az=is,s.b=function(u,a){let h=new Blob([new Uint8Array(u)],{type:"image/png"});createImageBitmap(h).then(_=>{a(null,_)}).catch(_=>{a(new Error(`Could not load image because of ${_.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},s.b0=Ys,s.b1=function(u,a){var h=u[0],_=u[1],w=u[2],I=u[3],R=u[4],O=u[5],z=u[6],W=u[7],Z=u[8],K=u[9],re=u[10],ae=u[11],ce=u[12],_e=u[13],Pe=u[14],ke=u[15],We=a[0],Oe=a[1],$e=a[2],Je=a[3],At=a[4],Ht=a[5],sr=a[6],jt=a[7],zt=a[8],kt=a[9],Kt=a[10],Bt=a[11],bt=a[12],gr=a[13],ar=a[14],hi=a[15];return Math.abs(h-We)<=gs*Math.max(1,Math.abs(h),Math.abs(We))&&Math.abs(_-Oe)<=gs*Math.max(1,Math.abs(_),Math.abs(Oe))&&Math.abs(w-$e)<=gs*Math.max(1,Math.abs(w),Math.abs($e))&&Math.abs(I-Je)<=gs*Math.max(1,Math.abs(I),Math.abs(Je))&&Math.abs(R-At)<=gs*Math.max(1,Math.abs(R),Math.abs(At))&&Math.abs(O-Ht)<=gs*Math.max(1,Math.abs(O),Math.abs(Ht))&&Math.abs(z-sr)<=gs*Math.max(1,Math.abs(z),Math.abs(sr))&&Math.abs(W-jt)<=gs*Math.max(1,Math.abs(W),Math.abs(jt))&&Math.abs(Z-zt)<=gs*Math.max(1,Math.abs(Z),Math.abs(zt))&&Math.abs(K-kt)<=gs*Math.max(1,Math.abs(K),Math.abs(kt))&&Math.abs(re-Kt)<=gs*Math.max(1,Math.abs(re),Math.abs(Kt))&&Math.abs(ae-Bt)<=gs*Math.max(1,Math.abs(ae),Math.abs(Bt))&&Math.abs(ce-bt)<=gs*Math.max(1,Math.abs(ce),Math.abs(bt))&&Math.abs(_e-gr)<=gs*Math.max(1,Math.abs(_e),Math.abs(gr))&&Math.abs(Pe-ar)<=gs*Math.max(1,Math.abs(Pe),Math.abs(ar))&&Math.abs(ke-hi)<=gs*Math.max(1,Math.abs(ke),Math.abs(hi))},s.b2=function(u,a){return u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[4]=a[4],u[5]=a[5],u[6]=a[6],u[7]=a[7],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},s.b3=function(u,a,h){return u[0]=a[0]*h[0],u[1]=a[1]*h[1],u[2]=a[2]*h[2],u[3]=a[3]*h[3],u},s.b4=function(u,a){return u[0]*a[0]+u[1]*a[1]+u[2]*a[2]+u[3]*a[3]},s.b5=ve,s.b6=NN,s.b7=ON,s.b8=function(u,a,h,_,w){var I,R=1/Math.tan(a/2);return u[0]=R/h,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=R,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,w!=null&&w!==1/0?(u[10]=(w+_)*(I=1/(_-w)),u[14]=2*w*_*I):(u[10]=-1,u[14]=-2*_),u},s.b9=function(u,a,h){var _=Math.sin(h),w=Math.cos(h),I=a[4],R=a[5],O=a[6],z=a[7],W=a[8],Z=a[9],K=a[10],re=a[11];return a!==u&&(u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[4]=I*w+W*_,u[5]=R*w+Z*_,u[6]=O*w+K*_,u[7]=z*w+re*_,u[8]=W*w-I*_,u[9]=Z*w-R*_,u[10]=K*w-O*_,u[11]=re*w-z*_,u},s.bA=f,s.bB=uN,s.bC=Jp,s.bD=da,s.ba=J,s.bb=ee,s.bc=function(u,a){return u[0]=a[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=a[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=a[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u},s.bd=class extends Vd{},s.be=fR,s.bf=BN,s.bg=rie,s.bi=on,s.bj=function(u,a,h=!1){if(ko===Ef||ko===Vc||ko===Zl)throw new Error("setRTLTextPlugin cannot be called multiple times.");Yl=kc.resolveURL(u),ko=Ef,aA=a,um(),h||M_()},s.bk=hm,s.bl=function(u,a){let h={};for(let w=0;wbt*Ks)}let jt=R?"center":h.get("text-justify").evaluate(W,{},u.canonical),zt=h.get("symbol-placement"),kt=zt==="point"?h.get("text-max-width").evaluate(W,{},u.canonical)*Ks:0,Kt=()=>{u.bucket.allowVerticalPlacement&&am($e)&&(ce.vertical=GT(_e,u.glyphMap,u.glyphPositions,u.imagePositions,Z,kt,I,Ht,"left",At,ke,s.ai.vertical,!0,zt,re,K))};if(!R&&sr){let Bt=new Set;if(jt==="auto")for(let gr=0;gr{a(null,h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=$s})},h.onerror=()=>a(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let _=new Blob([new Uint8Array(u)],{type:"image/png"});h.src=u.byteLength?URL.createObjectURL(_):$s},s.e=Re,s.f=function(u,a){return Wo(Re(u,{type:"json"}),a)},s.g=Di,s.h=kc,s.i=ri,s.j=po,s.k=fs,s.l=cl,s.m=Wo,s.n=function(u){return new rR(u).readFields(Rre,[])},s.o=function(u,a,h){if(!u.length)return h(null,[]);let _=u.length,w=new Array(u.length),I=null;u.forEach((R,O)=>{a(R,(z,W)=>{z&&(I=z),w[O]=W,--_==0&&h(I,w)})})},s.p=_N,s.q=T,s.r=Xn,s.s=Co,s.t=T_,s.u=Nt,s.v=ct,s.w=Gt,s.x=sA,s.y=zc,s.z=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)}}}),i(["./shared"],function(s){"use strict";class o{constructor(te){this.keyCache={},te&&this.replace(te)}replace(te){this._layerConfigs={},this._layers={},this.update(te,[])}update(te,ne){for(let Te of te){this._layerConfigs[Te.id]=Te;let Ee=this._layers[Te.id]=s.aC(Te);Ee._featureFilter=s.a6(Ee.filter),this.keyCache[Te.id]&&delete this.keyCache[Te.id]}for(let Te of ne)delete this.keyCache[Te],delete this._layerConfigs[Te],delete this._layers[Te];this.familiesBySource={};let fe=s.bl(Object.values(this._layerConfigs),this.keyCache);for(let Te of fe){let Ee=Te.map(ft=>this._layers[ft.id]),xe=Ee[0];if(xe.visibility==="none")continue;let Be=xe.source||"",Ce=this.familiesBySource[Be];Ce||(Ce=this.familiesBySource[Be]={});let je=xe.sourceLayer||"_geojsonTileLayer",ht=Ce[je];ht||(ht=Ce[je]=[]),ht.push(Ee)}}}class c{constructor(te){let ne={},fe=[];for(let Be in te){let Ce=te[Be],je=ne[Be]={};for(let ht in Ce){let ft=Ce[+ht];if(!ft||ft.bitmap.width===0||ft.bitmap.height===0)continue;let pt={x:0,y:0,w:ft.bitmap.width+2,h:ft.bitmap.height+2};fe.push(pt),je[ht]={rect:pt,metrics:ft.metrics}}}let{w:Te,h:Ee}=s.p(fe),xe=new s.q({width:Te||1,height:Ee||1});for(let Be in te){let Ce=te[Be];for(let je in Ce){let ht=Ce[+je];if(!ht||ht.bitmap.width===0||ht.bitmap.height===0)continue;let ft=ne[Be][je].rect;s.q.copy(ht.bitmap,xe,{x:0,y:0},{x:ft.x+1,y:ft.y+1},ht.bitmap)}}this.image=xe,this.positions=ne}}s.bm("GlyphAtlas",c);class f{constructor(te){this.tileID=new s.O(te.tileID.overscaledZ,te.tileID.wrap,te.tileID.canonical.z,te.tileID.canonical.x,te.tileID.canonical.y),this.uid=te.uid,this.zoom=te.zoom,this.pixelRatio=te.pixelRatio,this.tileSize=te.tileSize,this.source=te.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=te.showCollisionBoxes,this.collectResourceTiming=!!te.collectResourceTiming,this.returnDependencies=!!te.returnDependencies,this.promoteId=te.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(te,ne,fe,Te,Ee){this.status="parsing",this.data=te,this.collisionBoxArray=new s.a3;let xe=new s.bn(Object.keys(te.layers).sort()),Be=new s.bo(this.tileID,this.promoteId);Be.bucketLayerIDs=[];let Ce={},je={featureIndex:Be,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:fe},ht=ne.familiesBySource[this.source];for(let pi in ht){let Xr=te.layers[pi];if(!Xr)continue;Xr.version===1&&s.w(`Vector tile source "${this.source}" layer "${pi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Zn=xe.encode(pi),Ni=[];for(let Tn=0;Tn=ss.maxzoom||ss.visibility!=="none"&&(y(Tn,this.zoom,fe),(Ce[ss.id]=ss.createBucket({index:Be.bucketLayerIDs.length,layers:Tn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Zn,sourceID:this.source})).populate(Ni,je,this.tileID.canonical),Be.bucketLayerIDs.push(Tn.map(ua=>ua.id)))}}let ft,pt,ur,Sr,er=s.aH(je.glyphDependencies,pi=>Object.keys(pi).map(Number));this.inFlightDependencies.forEach(pi=>pi?.cancel()),this.inFlightDependencies=[];let hr=++this.dependencySentinel;Object.keys(er).length?this.inFlightDependencies.push(Te.send("getGlyphs",{uid:this.uid,stacks:er,source:this.source,tileID:this.tileID,type:"glyphs"},(pi,Xr)=>{hr===this.dependencySentinel&&(ft||(ft=pi,pt=Xr,ji.call(this)))})):pt={};let Cr=Object.keys(je.iconDependencies);Cr.length?this.inFlightDependencies.push(Te.send("getImages",{icons:Cr,source:this.source,tileID:this.tileID,type:"icons"},(pi,Xr)=>{hr===this.dependencySentinel&&(ft||(ft=pi,ur=Xr,ji.call(this)))})):ur={};let Ii=Object.keys(je.patternDependencies);function ji(){if(ft)return Ee(ft);if(pt&&ur&&Sr){let pi=new c(pt),Xr=new s.bp(ur,Sr);for(let Zn in Ce){let Ni=Ce[Zn];Ni instanceof s.a4?(y(Ni.layers,this.zoom,fe),s.bq({bucket:Ni,glyphMap:pt,glyphPositions:pi.positions,imageMap:ur,imagePositions:Xr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ni.hasPattern&&(Ni instanceof s.br||Ni instanceof s.bs||Ni instanceof s.bt)&&(y(Ni.layers,this.zoom,fe),Ni.addFeatures(je,this.tileID.canonical,Xr.patternPositions))}this.status="done",Ee(null,{buckets:Object.values(Ce).filter(Zn=>!Zn.isEmpty()),featureIndex:Be,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:pi.image,imageAtlas:Xr,glyphMap:this.returnDependencies?pt:null,iconMap:this.returnDependencies?ur:null,glyphPositions:this.returnDependencies?pi.positions:null})}}Ii.length?this.inFlightDependencies.push(Te.send("getImages",{icons:Ii,source:this.source,tileID:this.tileID,type:"patterns"},(pi,Xr)=>{hr===this.dependencySentinel&&(ft||(ft=pi,Sr=Xr,ji.call(this)))})):Sr={},ji.call(this)}}function y(be,te,ne){let fe=new s.a8(te);for(let Te of be)Te.recalculate(fe,ne)}function b(be,te){let ne=s.l(be.request,(fe,Te,Ee,xe)=>{if(fe)te(fe);else if(Te)try{let Be=new s.bw.VectorTile(new s.bv(Te));te(null,{vectorTile:Be,rawData:Te,cacheControl:Ee,expires:xe})}catch(Be){let Ce=new Uint8Array(Te),je=`Unable to parse the tile at ${be.request.url}, `;je+=Ce[0]===31&&Ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Be.messge}`,te(new Error(je))}});return()=>{ne.cancel(),te()}}class M{constructor(te,ne,fe,Te){this.actor=te,this.layerIndex=ne,this.availableImages=fe,this.loadVectorData=Te||b,this.fetching={},this.loading={},this.loaded={}}loadTile(te,ne){let fe=te.uid;this.loading||(this.loading={});let Te=!!(te&&te.request&&te.request.collectResourceTiming)&&new s.bu(te.request),Ee=this.loading[fe]=new f(te);Ee.abort=this.loadVectorData(te,(xe,Be)=>{if(delete this.loading[fe],xe||!Be)return Ee.status="done",this.loaded[fe]=Ee,ne(xe);let Ce=Be.rawData,je={};Be.expires&&(je.expires=Be.expires),Be.cacheControl&&(je.cacheControl=Be.cacheControl);let ht={};if(Te){let ft=Te.finish();ft&&(ht.resourceTiming=JSON.parse(JSON.stringify(ft)))}Ee.vectorTile=Be.vectorTile,Ee.parse(Be.vectorTile,this.layerIndex,this.availableImages,this.actor,(ft,pt)=>{if(delete this.fetching[fe],ft||!pt)return ne(ft);ne(null,s.e({rawTileData:Ce.slice(0)},pt,je,ht))}),this.loaded=this.loaded||{},this.loaded[fe]=Ee,this.fetching[fe]={rawTileData:Ce,cacheControl:je,resourceTiming:ht}})}reloadTile(te,ne){let fe=this.loaded,Te=te.uid;if(fe&&fe[Te]){let Ee=fe[Te];Ee.showCollisionBoxes=te.showCollisionBoxes,Ee.status==="parsing"?Ee.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.actor,(xe,Be)=>{if(xe||!Be)return ne(xe,Be);let Ce;if(this.fetching[Te]){let{rawTileData:je,cacheControl:ht,resourceTiming:ft}=this.fetching[Te];delete this.fetching[Te],Ce=s.e({rawTileData:je.slice(0)},Be,ht,ft)}else Ce=Be;ne(null,Ce)}):Ee.status==="done"&&(Ee.vectorTile?Ee.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.actor,ne):ne())}}abortTile(te,ne){let fe=this.loading,Te=te.uid;fe&&fe[Te]&&fe[Te].abort&&(fe[Te].abort(),delete fe[Te]),ne()}removeTile(te,ne){let fe=this.loaded,Te=te.uid;fe&&fe[Te]&&delete fe[Te],ne()}}class L{constructor(){this.loaded={}}loadTile(te,ne){return s._(this,void 0,void 0,function*(){let{uid:fe,encoding:Te,rawImageData:Ee,redFactor:xe,greenFactor:Be,blueFactor:Ce,baseShift:je}=te,ht=Ee.width+2,ft=Ee.height+2,pt=s.a(Ee)?new s.R({width:ht,height:ft},yield s.bx(Ee,-1,-1,ht,ft)):Ee,ur=new s.by(fe,pt,Te,xe,Be,Ce,je);this.loaded=this.loaded||{},this.loaded[fe]=ur,ne(null,ur)})}removeTile(te){let ne=this.loaded,fe=te.uid;ne&&ne[fe]&&delete ne[fe]}}function N(be,te){if(be.length!==0){V(be[0],te);for(var ne=1;ne=Math.abs(Be)?ne-Ce+Be:Be-Ce+ne,ne=Ce}ne+fe>=0!=!!te&&be.reverse()}var $=s.bz(function be(te,ne){var fe,Te=te&&te.type;if(Te==="FeatureCollection")for(fe=0;fe>31}function ri(be,te){for(var ne=be.loadGeometry(),fe=be.type,Te=0,Ee=0,xe=ne.length,Be=0;Bebe},Nl=Math.fround||(jo=new Float32Array(1),be=>(jo[0]=+be,jo[0]));var jo;let Ci=3,qs=5,ll=6;class kc{constructor(te){this.options=Object.assign(Object.create($s),te),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(te){let{log:ne,minZoom:fe,maxZoom:Te}=this.options;ne&&console.time("total time");let Ee=`prepare ${te.length} points`;ne&&console.time(Ee),this.points=te;let xe=[];for(let Ce=0;Ce=fe;Ce--){let je=+Date.now();Be=this.trees[Ce]=this._createTree(this._cluster(Be,Ce)),ne&&console.log("z%d: %d clusters in %dms",Ce,Be.numItems,+Date.now()-je)}return ne&&console.timeEnd("total time"),this}getClusters(te,ne){let fe=((te[0]+180)%360+360)%360-180,Te=Math.max(-90,Math.min(90,te[1])),Ee=te[2]===180?180:((te[2]+180)%360+360)%360-180,xe=Math.max(-90,Math.min(90,te[3]));if(te[2]-te[0]>=360)fe=-180,Ee=180;else if(fe>Ee){let ft=this.getClusters([fe,Te,180,xe],ne),pt=this.getClusters([-180,Te,Ee,xe],ne);return ft.concat(pt)}let Be=this.trees[this._limitZoom(ne)],Ce=Be.range(is(fe),Di(xe),is(Ee),Di(Te)),je=Be.data,ht=[];for(let ft of Ce){let pt=this.stride*ft;ht.push(je[pt+qs]>1?Lc(je,pt,this.clusterProps):this.points[je[pt+Ci]])}return ht}getChildren(te){let ne=this._getOriginId(te),fe=this._getOriginZoom(te),Te="No cluster with the specified id.",Ee=this.trees[fe];if(!Ee)throw new Error(Te);let xe=Ee.data;if(ne*this.stride>=xe.length)throw new Error(Te);let Be=this.options.radius/(this.options.extent*Math.pow(2,fe-1)),Ce=Ee.within(xe[ne*this.stride],xe[ne*this.stride+1],Be),je=[];for(let ht of Ce){let ft=ht*this.stride;xe[ft+4]===te&&je.push(xe[ft+qs]>1?Lc(xe,ft,this.clusterProps):this.points[xe[ft+Ci]])}if(je.length===0)throw new Error(Te);return je}getLeaves(te,ne,fe){let Te=[];return this._appendLeaves(Te,te,ne=ne||10,fe=fe||0,0),Te}getTile(te,ne,fe){let Te=this.trees[this._limitZoom(te)],Ee=Math.pow(2,te),{extent:xe,radius:Be}=this.options,Ce=Be/xe,je=(fe-Ce)/Ee,ht=(fe+1+Ce)/Ee,ft={features:[]};return this._addTileFeatures(Te.range((ne-Ce)/Ee,je,(ne+1+Ce)/Ee,ht),Te.data,ne,fe,Ee,ft),ne===0&&this._addTileFeatures(Te.range(1-Ce/Ee,je,1,ht),Te.data,Ee,fe,Ee,ft),ne===Ee-1&&this._addTileFeatures(Te.range(0,je,Ce/Ee,ht),Te.data,-1,fe,Ee,ft),ft.features.length?ft:null}getClusterExpansionZoom(te){let ne=this._getOriginZoom(te)-1;for(;ne<=this.options.maxZoom;){let fe=this.getChildren(te);if(ne++,fe.length!==1)break;te=fe[0].properties.cluster_id}return ne}_appendLeaves(te,ne,fe,Te,Ee){let xe=this.getChildren(ne);for(let Be of xe){let Ce=Be.properties;if(Ce&&Ce.cluster?Ee+Ce.point_count<=Te?Ee+=Ce.point_count:Ee=this._appendLeaves(te,Ce.cluster_id,fe,Te,Ee):Ee1,ht,ft,pt;if(je)ht=on(ne,Ce,this.clusterProps),ft=ne[Ce],pt=ne[Ce+1];else{let er=this.points[ne[Ce+Ci]];ht=er.properties;let[hr,Cr]=er.geometry.coordinates;ft=is(hr),pt=Di(Cr)}let ur={type:1,geometry:[[Math.round(this.options.extent*(ft*Ee-fe)),Math.round(this.options.extent*(pt*Ee-Te))]],tags:ht},Sr;Sr=je||this.options.generateId?ne[Ce+Ci]:this.points[ne[Ce+Ci]].id,Sr!==void 0&&(ur.id=Sr),xe.features.push(ur)}}_limitZoom(te){return Math.max(this.options.minZoom,Math.min(Math.floor(+te),this.options.maxZoom+1))}_cluster(te,ne){let{radius:fe,extent:Te,reduce:Ee,minPoints:xe}=this.options,Be=fe/(Te*Math.pow(2,ne)),Ce=te.data,je=[],ht=this.stride;for(let ft=0;ftne&&(hr+=Ce[Ii+qs])}if(hr>er&&hr>=xe){let Cr,Ii=pt*er,ji=ur*er,pi=-1,Xr=((ft/ht|0)<<5)+(ne+1)+this.points.length;for(let Zn of Sr){let Ni=Zn*ht;if(Ce[Ni+2]<=ne)continue;Ce[Ni+2]=ne;let Tn=Ce[Ni+qs];Ii+=Ce[Ni]*Tn,ji+=Ce[Ni+1]*Tn,Ce[Ni+4]=Xr,Ee&&(Cr||(Cr=this._map(Ce,ft,!0),pi=this.clusterProps.length,this.clusterProps.push(Cr)),Ee(Cr,this._map(Ce,Ni)))}Ce[ft+4]=Xr,je.push(Ii/hr,ji/hr,1/0,Xr,-1,hr),Ee&&je.push(pi)}else{for(let Cr=0;Cr1)for(let Cr of Sr){let Ii=Cr*ht;if(!(Ce[Ii+2]<=ne)){Ce[Ii+2]=ne;for(let ji=0;ji>5}_getOriginZoom(te){return(te-this.points.length)%32}_map(te,ne,fe){if(te[ne+qs]>1){let xe=this.clusterProps[te[ne+ll]];return fe?Object.assign({},xe):xe}let Te=this.points[te[ne+Ci]].properties,Ee=this.options.map(Te);return fe&&Ee===Te?Object.assign({},Ee):Ee}}function Lc(be,te,ne){return{type:"Feature",id:be[te+Ci],properties:on(be,te,ne),geometry:{type:"Point",coordinates:[(fe=be[te],360*(fe-.5)),ns(be[te+1])]}};var fe}function on(be,te,ne){let fe=be[te+qs],Te=fe>=1e4?`${Math.round(fe/1e3)}k`:fe>=1e3?Math.round(fe/100)/10+"k":fe,Ee=be[te+ll],xe=Ee===-1?{}:Object.assign({},ne[Ee]);return Object.assign(xe,{cluster:!0,cluster_id:be[te+Ci],point_count:fe,point_count_abbreviated:Te})}function is(be){return be/360+.5}function Di(be){let te=Math.sin(be*Math.PI/180),ne=.5-.25*Math.log((1+te)/(1-te))/Math.PI;return ne<0?0:ne>1?1:ne}function ns(be){let te=(180-360*be)*Math.PI/180;return 360*Math.atan(Math.exp(te))/Math.PI-90}function Wo(be,te,ne,fe){for(var Te,Ee=fe,xe=ne-te>>1,Be=ne-te,Ce=be[te],je=be[te+1],ht=be[ne],ft=be[ne+1],pt=te+3;ptEe)Te=pt,Ee=ur;else if(ur===Ee){var Sr=Math.abs(pt-xe);Srfe&&(Te-te>3&&Wo(be,te,Te,fe),be[Te+2]=Ee,ne-Te>3&&Wo(be,Te,ne,fe))}function cl(be,te,ne,fe,Te,Ee){var xe=Te-ne,Be=Ee-fe;if(xe!==0||Be!==0){var Ce=((be-ne)*xe+(te-fe)*Be)/(xe*xe+Be*Be);Ce>1?(ne=Te,fe=Ee):Ce>0&&(ne+=xe*Ce,fe+=Be*Ce)}return(xe=be-ne)*xe+(Be=te-fe)*Be}function Co(be,te,ne,fe){var Te={id:be===void 0?null:be,type:te,geometry:ne,tags:fe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ee){var xe=Ee.geometry,Be=Ee.type;if(Be==="Point"||Be==="MultiPoint"||Be==="LineString")La(Ee,xe);else if(Be==="Polygon"||Be==="MultiLineString")for(var Ce=0;Ce0&&(xe+=fe?(Te*je-Ce*Ee)/2:Math.sqrt(Math.pow(Ce-Te,2)+Math.pow(je-Ee,2))),Te=Ce,Ee=je}var ht=te.length-3;te[2]=1,Wo(te,0,ht,ne),te[ht+2]=1,te.size=Math.abs(xe),te.start=0,te.end=te.size}function zl(be,te,ne,fe){for(var Te=0;Te1?1:ne}function vn(be,te,ne,fe,Te,Ee,xe,Be){if(fe/=te,Ee>=(ne/=te)&&xe=fe)return null;for(var Ce=[],je=0;je=ne&&Sr=fe)){var er=[];if(pt==="Point"||pt==="MultiPoint")Si(ft,er,ne,fe,Te);else if(pt==="LineString")gi(ft,er,ne,fe,Te,!1,Be.lineMetrics);else if(pt==="MultiLineString")vu(ft,er,ne,fe,Te,!1);else if(pt==="Polygon")vu(ft,er,ne,fe,Te,!0);else if(pt==="MultiPolygon")for(var hr=0;hr=ne&&xe<=fe&&(te.push(be[Ee]),te.push(be[Ee+1]),te.push(be[Ee+2]))}}function gi(be,te,ne,fe,Te,Ee,xe){for(var Be,Ce,je=Ao(be),ht=Te===0?Io:hl,ft=be.start,pt=0;ptne&&(Ce=ht(je,ur,Sr,hr,Cr,ne),xe&&(je.start=ft+Be*Ce)):Ii>fe?ji=ne&&(Ce=ht(je,ur,Sr,hr,Cr,ne),pi=!0),ji>fe&&Ii<=fe&&(Ce=ht(je,ur,Sr,hr,Cr,fe),pi=!0),!Ee&&pi&&(xe&&(je.end=ft+Be*Ce),te.push(je),je=Ao(be)),xe&&(ft+=Be)}var Xr=be.length-3;ur=be[Xr],Sr=be[Xr+1],er=be[Xr+2],(Ii=Te===0?ur:Sr)>=ne&&Ii<=fe&&ul(je,ur,Sr,er),Xr=je.length-3,Ee&&Xr>=3&&(je[Xr]!==je[0]||je[Xr+1]!==je[1])&&ul(je,je[0],je[1],je[2]),je.length&&te.push(je)}function Ao(be){var te=[];return te.size=be.size,te.start=be.start,te.end=be.end,te}function vu(be,te,ne,fe,Te,Ee){for(var xe=0;xexe.maxX&&(xe.maxX=ht),ft>xe.maxY&&(xe.maxY=ft)}return xe}function Ul(be,te,ne,fe){var Te=te.geometry,Ee=te.type,xe=[];if(Ee==="Point"||Ee==="MultiPoint")for(var Be=0;Be0&&te.size<(Te?xe:fe))ne.numPoints+=te.length/3;else{for(var Be=[],Ce=0;Cexe)&&(ne.numSimplified++,Be.push(te[Ce]),Be.push(te[Ce+1])),ne.numPoints++;Te&&function(je,ht){for(var ft=0,pt=0,ur=je.length,Sr=ur-2;pt0===ht)for(pt=0,ur=je.length;pt24)throw new Error("maxZoom should be in the 0-24 range");if(te.promoteId&&te.generateId)throw new Error("promoteId and generateId cannot be used together.");var fe=function(Te,Ee){var xe=[];if(Te.type==="FeatureCollection")for(var Be=0;Be1&&console.time("creation"),pt=this.tiles[ft]=bn(be,te,ne,fe,Ce),this.tileCoords.push({z:te,x:ne,y:fe}),je)){je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",te,ne,fe,pt.numFeatures,pt.numPoints,pt.numSimplified),console.timeEnd("creation"));var ur="z"+te;this.stats[ur]=(this.stats[ur]||0)+1,this.total++}if(pt.source=be,Te){if(te===Ce.maxZoom||te===Te)continue;var Sr=1<1&&console.time("clipping");var er,hr,Cr,Ii,ji,pi,Xr=.5*Ce.buffer/Ce.extent,Zn=.5-Xr,Ni=.5+Xr,Tn=1+Xr;er=hr=Cr=Ii=null,ji=vn(be,ht,ne-Xr,ne+Ni,0,pt.minX,pt.maxX,Ce),pi=vn(be,ht,ne+Zn,ne+Tn,0,pt.minX,pt.maxX,Ce),be=null,ji&&(er=vn(ji,ht,fe-Xr,fe+Ni,1,pt.minY,pt.maxY,Ce),hr=vn(ji,ht,fe+Zn,fe+Tn,1,pt.minY,pt.maxY,Ce),ji=null),pi&&(Cr=vn(pi,ht,fe-Xr,fe+Ni,1,pt.minY,pt.maxY,Ce),Ii=vn(pi,ht,fe+Zn,fe+Tn,1,pt.minY,pt.maxY,Ce),pi=null),je>1&&console.timeEnd("clipping"),Be.push(er||[],te+1,2*ne,2*fe),Be.push(hr||[],te+1,2*ne,2*fe+1),Be.push(Cr||[],te+1,2*ne+1,2*fe),Be.push(Ii||[],te+1,2*ne+1,2*fe+1)}}},Ct.prototype.getTile=function(be,te,ne){var fe=this.options,Te=fe.extent,Ee=fe.debug;if(be<0||be>24)return null;var xe=1<1&&console.log("drilling down to z%d-%d-%d",be,te,ne);for(var Ce,je=be,ht=te,ft=ne;!Ce&&je>0;)je--,ht=Math.floor(ht/2),ft=Math.floor(ft/2),Ce=this.tiles[Vr(je,ht,ft)];return Ce&&Ce.source?(Ee>1&&console.log("found parent tile z%d-%d-%d",je,ht,ft),Ee>1&&console.time("drilling down"),this.splitTile(Ce.source,je,ht,ft,be,te,ne),Ee>1&&console.timeEnd("drilling down"),this.tiles[Be]?Tt(this.tiles[Be],Te):null):null};class Rr extends M{constructor(te,ne,fe,Te){super(te,ne,fe),this._dataUpdateable=new Map,this.loadGeoJSON=(Ee,xe)=>{let{promoteId:Be}=Ee;if(Ee.request)return s.f(Ee.request,(Ce,je,ht,ft)=>{this._dataUpdateable=Gs(je,Be)?Ba(je,Be):void 0,xe(Ce,je,ht,ft)});if(typeof Ee.data=="string")try{let Ce=JSON.parse(Ee.data);this._dataUpdateable=Gs(Ce,Be)?Ba(Ce,Be):void 0,xe(null,Ce)}catch{xe(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`))}else Ee.dataDiff?this._dataUpdateable?(function(Ce,je,ht){var ft,pt,ur,Sr;if(je.removeAll&&Ce.clear(),je.remove)for(let er of je.remove)Ce.delete(er);if(je.add)for(let er of je.add){let hr=br(er,ht);hr!=null&&Ce.set(hr,er)}if(je.update)for(let er of je.update){let hr=Ce.get(er.id);if(hr==null)continue;let Cr=!er.removeAllProperties&&(((ft=er.removeProperties)===null||ft===void 0?void 0:ft.length)>0||((pt=er.addOrUpdateProperties)===null||pt===void 0?void 0:pt.length)>0);if((er.newGeometry||er.removeAllProperties||Cr)&&(hr=Object.assign({},hr),Ce.set(er.id,hr),Cr&&(hr.properties=Object.assign({},hr.properties))),er.newGeometry&&(hr.geometry=er.newGeometry),er.removeAllProperties)hr.properties={};else if(((ur=er.removeProperties)===null||ur===void 0?void 0:ur.length)>0)for(let Ii of er.removeProperties)Object.prototype.hasOwnProperty.call(hr.properties,Ii)&&delete hr.properties[Ii];if(((Sr=er.addOrUpdateProperties)===null||Sr===void 0?void 0:Sr.length)>0)for(let{key:Ii,value:ji}of er.addOrUpdateProperties)hr.properties[Ii]=ji}}(this._dataUpdateable,Ee.dataDiff,Be),xe(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):xe(new Error(`Cannot update existing geojson data in ${Ee.source}`)):xe(new Error(`Input data given to '${Ee.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,Te&&(this.loadGeoJSON=Te)}loadGeoJSONTile(te,ne){let fe=te.tileID.canonical;if(!this._geoJSONIndex)return ne(null,null);let Te=this._geoJSONIndex.getTile(fe.z,fe.x,fe.y);if(!Te)return ne(null,null);let Ee=new class{constructor(Be){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=s.N,this.length=Be.length,this._features=Be}feature(Be){return new class{constructor(Ce){this._feature=Ce,this.extent=s.N,this.type=Ce.type,this.properties=Ce.tags,"id"in Ce&&!isNaN(Ce.id)&&(this.id=parseInt(Ce.id,10))}loadGeometry(){if(this._feature.type===1){let Ce=[];for(let je of this._feature.geometry)Ce.push([new s.P(je[0],je[1])]);return Ce}{let Ce=[];for(let je of this._feature.geometry){let ht=[];for(let ft of je)ht.push(new s.P(ft[0],ft[1]));Ce.push(ht)}return Ce}}toGeoJSON(Ce,je,ht){return Q.call(this,Ce,je,ht)}}(this._features[Be])}}(Te.features),xe=fo(Ee);xe.byteOffset===0&&xe.byteLength===xe.buffer.byteLength||(xe=new Uint8Array(xe)),ne(null,{vectorTile:Ee,rawData:xe.buffer})}loadData(te,ne){var fe;(fe=this._pendingRequest)===null||fe===void 0||fe.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let Te=!!(te&&te.request&&te.request.collectResourceTiming)&&new s.bu(te.request);this._pendingCallback=ne,this._pendingRequest=this.loadGeoJSON(te,(Ee,xe)=>{if(delete this._pendingCallback,delete this._pendingRequest,Ee||!xe)return ne(Ee);if(typeof xe!="object")return ne(new Error(`Input data given to '${te.source}' is not a valid GeoJSON object.`));{$(xe,!0);try{if(te.filter){let Ce=s.bC(te.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ce.result==="error")throw new Error(Ce.value.map(ht=>`${ht.key}: ${ht.message}`).join(", "));xe={type:"FeatureCollection",features:xe.features.filter(ht=>Ce.value.evaluate({zoom:0},ht))}}this._geoJSONIndex=te.cluster?new kc(function({superclusterOptions:Ce,clusterProperties:je}){if(!je||!Ce)return Ce;let ht={},ft={},pt={accumulated:null,zoom:0},ur={properties:null},Sr=Object.keys(je);for(let er of Sr){let[hr,Cr]=je[er],Ii=s.bC(Cr),ji=s.bC(typeof hr=="string"?[hr,["accumulated"],["get",er]]:hr);ht[er]=Ii.value,ft[er]=ji.value}return Ce.map=er=>{ur.properties=er;let hr={};for(let Cr of Sr)hr[Cr]=ht[Cr].evaluate(pt,ur);return hr},Ce.reduce=(er,hr)=>{ur.properties=hr;for(let Cr of Sr)pt.accumulated=er[Cr],er[Cr]=ft[Cr].evaluate(pt,ur)},Ce}(te)).load(xe.features):function(Ce,je){return new Ct(Ce,je)}(xe,te.geojsonVtOptions)}catch(Ce){return ne(Ce)}this.loaded={};let Be={};if(Te){let Ce=Te.finish();Ce&&(Be.resourceTiming={},Be.resourceTiming[te.source]=JSON.parse(JSON.stringify(Ce)))}ne(null,Be)}})}reloadTile(te,ne){let fe=this.loaded;return fe&&fe[te.uid]?super.reloadTile(te,ne):this.loadTile(te,ne)}removeSource(te,ne){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),ne()}getClusterExpansionZoom(te,ne){try{ne(null,this._geoJSONIndex.getClusterExpansionZoom(te.clusterId))}catch(fe){ne(fe)}}getClusterChildren(te,ne){try{ne(null,this._geoJSONIndex.getChildren(te.clusterId))}catch(fe){ne(fe)}}getClusterLeaves(te,ne){try{ne(null,this._geoJSONIndex.getLeaves(te.clusterId,te.limit,te.offset))}catch(fe){ne(fe)}}}class ca{constructor(te){this.self=te,this.actor=new s.C(te,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:M,geojson:Rr},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(ne,fe)=>{if(this.workerSourceTypes[ne])throw new Error(`Worker source with name "${ne}" already registered.`);this.workerSourceTypes[ne]=fe},this.self.registerRTLTextPlugin=ne=>{if(s.bD.isParsed())throw new Error("RTL text plugin already registered.");s.bD.applyArabicShaping=ne.applyArabicShaping,s.bD.processBidirectionalText=ne.processBidirectionalText,s.bD.processStyledBidirectionalText=ne.processStyledBidirectionalText}}setReferrer(te,ne){this.referrer=ne}setImages(te,ne,fe){this.availableImages[te]=ne;for(let Te in this.workerSources[te]){let Ee=this.workerSources[te][Te];for(let xe in Ee)Ee[xe].availableImages=ne}fe()}setLayers(te,ne,fe){this.getLayerIndex(te).replace(ne),fe()}updateLayers(te,ne,fe){this.getLayerIndex(te).update(ne.layers,ne.removedIds),fe()}loadTile(te,ne,fe){this.getWorkerSource(te,ne.type,ne.source).loadTile(ne,fe)}loadDEMTile(te,ne,fe){this.getDEMWorkerSource(te,ne.source).loadTile(ne,fe)}reloadTile(te,ne,fe){this.getWorkerSource(te,ne.type,ne.source).reloadTile(ne,fe)}abortTile(te,ne,fe){this.getWorkerSource(te,ne.type,ne.source).abortTile(ne,fe)}removeTile(te,ne,fe){this.getWorkerSource(te,ne.type,ne.source).removeTile(ne,fe)}removeDEMTile(te,ne){this.getDEMWorkerSource(te,ne.source).removeTile(ne)}removeSource(te,ne,fe){if(!this.workerSources[te]||!this.workerSources[te][ne.type]||!this.workerSources[te][ne.type][ne.source])return;let Te=this.workerSources[te][ne.type][ne.source];delete this.workerSources[te][ne.type][ne.source],Te.removeSource!==void 0?Te.removeSource(ne,fe):fe()}loadWorkerSource(te,ne,fe){try{this.self.importScripts(ne.url),fe()}catch(Te){fe(Te.toString())}}syncRTLPluginState(te,ne,fe){try{s.bD.setState(ne);let Te=s.bD.getPluginURL();if(s.bD.isLoaded()&&!s.bD.isParsed()&&Te!=null){this.self.importScripts(Te);let Ee=s.bD.isParsed();fe(Ee?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Te}`),Ee)}}catch(Te){fe(Te.toString())}}getAvailableImages(te){let ne=this.availableImages[te];return ne||(ne=[]),ne}getLayerIndex(te){let ne=this.layerIndexes[te];return ne||(ne=this.layerIndexes[te]=new o),ne}getWorkerSource(te,ne,fe){return this.workerSources[te]||(this.workerSources[te]={}),this.workerSources[te][ne]||(this.workerSources[te][ne]={}),this.workerSources[te][ne][fe]||(this.workerSources[te][ne][fe]=new this.workerSourceTypes[ne]({send:(Te,Ee,xe)=>{this.actor.send(Te,Ee,xe,te)}},this.getLayerIndex(te),this.getAvailableImages(te))),this.workerSources[te][ne][fe]}getDEMWorkerSource(te,ne){return this.demWorkerSources[te]||(this.demWorkerSources[te]={}),this.demWorkerSources[te][ne]||(this.demWorkerSources[te][ne]=new L),this.demWorkerSources[te][ne]}}return s.i()&&(self.worker=new ca(self)),ca}),i(["./shared"],function(s){"use strict";var o="3.6.2";class c{static testProp(l){if(!c.docStyle)return l[0];for(let A=0;A{window.removeEventListener("click",c.suppressClickInternal,!0)},0)}static mousePos(l,A){let v=l.getBoundingClientRect();return new s.P(A.clientX-v.left-l.clientLeft,A.clientY-v.top-l.clientTop)}static touchPos(l,A){let v=l.getBoundingClientRect(),S=[];for(let P=0;P{l=[],A=0,v=0,S={}},E.addThrottleControl=H=>{let Y=v++;return S[Y]=H,Y},E.removeThrottleControl=H=>{delete S[H],F()},E.getImage=(H,Y,X=!0)=>{f.supported&&(H.headers||(H.headers={}),H.headers.accept="image/webp,*/*");let se={requestParameters:H,supportImageRefresh:X,callback:Y,cancelled:!1,completed:!1,cancel:()=>{se.completed||se.cancelled||(se.cancelled=!0,se.innerRequest&&(se.innerRequest.cancel(),A--),F())}};return l.push(se),F(),se};let P=H=>{let{requestParameters:Y,supportImageRefresh:X,callback:se}=H;return s.e(Y,{type:"image"}),(X!==!1||s.i()||s.g(Y.url)||Y.headers&&!Object.keys(Y.headers).reduce((ge,me)=>ge&&me==="accept",!0)?s.m:U)(Y,(ge,me,we,Ae)=>{B(H,se,ge,me,we,Ae)})},B=(H,Y,X,se,ge,me)=>{X?Y(X):se instanceof HTMLImageElement||s.a(se)?Y(null,se):se&&((we,Ae)=>{typeof createImageBitmap=="function"?s.b(we,Ae):s.d(we,Ae)})(se,(we,Ae)=>{we!=null?Y(we):Ae!=null&&Y(null,Ae,{cacheControl:ge,expires:me})}),H.cancelled||(H.completed=!0,A--,F())},F=()=>{let H=(()=>{let Y=Object.keys(S),X=!1;if(Y.length>0){for(let se of Y)if(X=S[se](),X)break}return X})()?s.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:s.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let Y=A;Y0;Y++){let X=l.shift();if(X.cancelled){Y--;continue}let se=P(X);A++,X.innerRequest=se}},U=(H,Y)=>{let X=new Image,se=H.url,ge=!1,me=H.credentials;return me&&me==="include"?X.crossOrigin="use-credentials":(me&&me==="same-origin"||!s.s(se))&&(X.crossOrigin="anonymous"),X.fetchPriority="high",X.onload=()=>{Y(null,X),X.onerror=X.onload=null},X.onerror=()=>{ge||Y(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.")),X.onerror=X.onload=null},X.src=se,{cancel:()=>{ge=!0,X.src=""}}}}(V||(V={})),V.resetRequestQueue(),function(E){E.Glyphs="Glyphs",E.Image="Image",E.Source="Source",E.SpriteImage="SpriteImage",E.SpriteJSON="SpriteJSON",E.Style="Style",E.Tile="Tile",E.Unknown="Unknown"}($||($={}));class Q{constructor(l){this._transformRequestFn=l}transformRequest(l,A){return this._transformRequestFn&&this._transformRequestFn(l,A)||{url:l}}normalizeSpriteURL(l,A,v){let S=function(P){let B=P.match(q);if(!B)throw new Error(`Unable to parse URL "${P}"`);return{protocol:B[1],authority:B[2],path:B[3]||"/",params:B[4]?B[4].split("&"):[]}}(l);return S.path+=`${A}${v}`,function(P){let B=P.params.length?`?${P.params.join("&")}`:"";return`${P.protocol}://${P.authority}${P.path}${B}`}(S)}setTransformRequest(l){this._transformRequestFn=l}}let q=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(E){var l=new s.A(3);return l[0]=E[0],l[1]=E[1],l[2]=E[2],l}var ee,oe=function(E,l,A){return E[0]=l[0]-A[0],E[1]=l[1]-A[1],E[2]=l[2]-A[2],E};ee=new s.A(3),s.A!=Float32Array&&(ee[0]=0,ee[1]=0,ee[2]=0);var ve=function(E){var l=E[0],A=E[1];return l*l+A*A};function Re(E){let l=[];if(typeof E=="string")l.push({id:"default",url:E});else if(E&&E.length>0){let A=[];for(let{id:v,url:S}of E){let P=`${v}${S}`;A.indexOf(P)===-1&&(A.push(P),l.push({id:v,url:S}))}}return l}function Ze(E,l,A,v,S){if(v)return void E(v);if(S!==Object.values(l).length||S!==Object.values(A).length)return;let P={};for(let B in l){P[B]={};let F=s.h.getImageCanvasContext(A[B]),U=l[B];for(let H in U){let{width:Y,height:X,x:se,y:ge,sdf:me,pixelRatio:we,stretchX:Ae,stretchY:ze,content:Qe}=U[H];P[B][H]={data:null,pixelRatio:we,sdf:me,stretchX:Ae,stretchY:ze,content:Qe,spriteData:{width:Y,height:X,x:se,y:ge,context:F}}}}E(null,P)}(function(){var E=new s.A(2);s.A!=Float32Array&&(E[0]=0,E[1]=0)})();class He{constructor(l,A,v,S){this.context=l,this.format=v,this.texture=l.gl.createTexture(),this.update(A,S)}update(l,A,v){let{width:S,height:P}=l,B=!(this.size&&this.size[0]===S&&this.size[1]===P||v),{context:F}=this,{gl:U}=F;if(this.useMipmap=!!(A&&A.useMipmap),U.bindTexture(U.TEXTURE_2D,this.texture),F.pixelStoreUnpackFlipY.set(!1),F.pixelStoreUnpack.set(1),F.pixelStoreUnpackPremultiplyAlpha.set(this.format===U.RGBA&&(!A||A.premultiply!==!1)),B)this.size=[S,P],l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||s.a(l)?U.texImage2D(U.TEXTURE_2D,0,this.format,this.format,U.UNSIGNED_BYTE,l):U.texImage2D(U.TEXTURE_2D,0,this.format,S,P,0,this.format,U.UNSIGNED_BYTE,l.data);else{let{x:H,y:Y}=v||{x:0,y:0};l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||s.a(l)?U.texSubImage2D(U.TEXTURE_2D,0,H,Y,U.RGBA,U.UNSIGNED_BYTE,l):U.texSubImage2D(U.TEXTURE_2D,0,H,Y,S,P,U.RGBA,U.UNSIGNED_BYTE,l.data)}this.useMipmap&&this.isSizePowerOfTwo()&&U.generateMipmap(U.TEXTURE_2D)}bind(l,A,v){let{context:S}=this,{gl:P}=S;P.bindTexture(P.TEXTURE_2D,this.texture),v!==P.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(v=P.LINEAR),l!==this.filter&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MAG_FILTER,l),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MIN_FILTER,v||l),this.filter=l),A!==this.wrap&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,A),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,A),this.wrap=A)}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 ot(E){let{userImage:l}=E;return!!(l&&l.render&&l.render())&&(E.data.replace(new Uint8Array(l.data.buffer)),!0)}class et 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:A,callback:v}of this.requestors)this._notify(A,v);this.requestors=[]}}getImage(l){let A=this.images[l];if(A&&!A.data&&A.spriteData){let v=A.spriteData;A.data=new s.R({width:v.width,height:v.height},v.context.getImageData(v.x,v.y,v.width,v.height).data),A.spriteData=null}return A}addImage(l,A){if(this.images[l])throw new Error(`Image id ${l} already exist, use updateImage instead`);this._validate(l,A)&&(this.images[l]=A)}_validate(l,A){let v=!0,S=A.data||A.spriteData;return this._validateStretch(A.stretchX,S&&S.width)||(this.fire(new s.j(new Error(`Image "${l}" has invalid "stretchX" value`))),v=!1),this._validateStretch(A.stretchY,S&&S.height)||(this.fire(new s.j(new Error(`Image "${l}" has invalid "stretchY" value`))),v=!1),this._validateContent(A.content,A)||(this.fire(new s.j(new Error(`Image "${l}" has invalid "content" value`))),v=!1),v}_validateStretch(l,A){if(!l)return!0;let v=0;for(let S of l){if(S[0]-1);U++,P[U]=F,B[U]=H,B[U+1]=Lt}for(let F=0,U=0;F{let F=this.entries[S];F||(F=this.entries[S]={glyphs:{},requests:{},ranges:{}});let U=F.glyphs[P];if(U!==void 0)return void B(null,{stack:S,id:P,glyph:U});if(U=this._tinySDF(F,S,P),U)return F.glyphs[P]=U,void B(null,{stack:S,id:P,glyph:U});let H=Math.floor(P/256);if(256*H>65535)return void B(new Error("glyphs > 65535 not supported"));if(F.ranges[H])return void B(null,{stack:S,id:P,glyph:U});if(!this.url)return void B(new Error("glyphsUrl is not set"));let Y=F.requests[H];Y||(Y=F.requests[H]=[],Ar.loadGlyphRange(S,H,this.url,this.requestManager,(X,se)=>{if(se){for(let ge in se)this._doesCharSupportLocalGlyph(+ge)||(F.glyphs[+ge]=se[+ge]);F.ranges[H]=!0}for(let ge of Y)ge(X,se);delete F.requests[H]})),Y.push((X,se)=>{X?B(X):se&&B(null,{stack:S,id:P,glyph:se[P]||null})})},(S,P)=>{if(S)A(S);else if(P){let B={};for(let{stack:F,id:U,glyph:H}of P)(B[F]||(B[F]={}))[U]=H&&{id:H.id,bitmap:H.bitmap.clone(),metrics:H.metrics};A(null,B)}})}_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,A,v){let S=this.localIdeographFontFamily;if(!S||!this._doesCharSupportLocalGlyph(v))return;let P=l.tinySDF;if(!P){let F="400";/bold/i.test(A)?F="900":/medium/i.test(A)?F="500":/light/i.test(A)&&(F="200"),P=l.tinySDF=new Ar.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:S,fontWeight:F})}let B=P.draw(String.fromCharCode(v));return{id:v,bitmap:new s.q({width:B.width||60,height:B.height||60},B.data),metrics:{width:B.glyphWidth/2||24,height:B.glyphHeight/2||24,left:B.glyphLeft/2+.5||0,top:B.glyphTop/2-27.5||-8,advance:B.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ar.loadGlyphRange=function(E,l,A,v,S){let P=256*l,B=P+255,F=v.transformRequest(A.replace("{fontstack}",E).replace("{range}",`${P}-${B}`),$.Glyphs);s.l(F,(U,H)=>{if(U)S(U);else if(H){let Y={};for(let X of s.n(H))Y[X.id]=X;S(null,Y)}})},Ar.TinySDF=class{constructor({fontSize:E=24,buffer:l=3,radius:A=8,cutoff:v=.25,fontFamily:S="sans-serif",fontWeight:P="normal",fontStyle:B="normal"}={}){this.buffer=l,this.cutoff=v,this.radius=A;let F=this.size=E+4*l,U=this._createCanvas(F),H=this.ctx=U.getContext("2d",{willReadFrequently:!0});H.font=`${B} ${P} ${E}px ${S}`,H.textBaseline="alphabetic",H.textAlign="left",H.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(E){let l=document.createElement("canvas");return l.width=l.height=E,l}draw(E){let{width:l,actualBoundingBoxAscent:A,actualBoundingBoxDescent:v,actualBoundingBoxLeft:S,actualBoundingBoxRight:P}=this.ctx.measureText(E),B=Math.ceil(A),F=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(P-S))),U=Math.min(this.size-this.buffer,B+Math.ceil(v)),H=F+2*this.buffer,Y=U+2*this.buffer,X=Math.max(H*Y,0),se=new Uint8ClampedArray(X),ge={data:se,width:H,height:Y,glyphWidth:F,glyphHeight:U,glyphTop:B,glyphLeft:0,glyphAdvance:l};if(F===0||U===0)return ge;let{ctx:me,buffer:we,gridInner:Ae,gridOuter:ze}=this;me.clearRect(we,we,F,U),me.fillText(E,we,we+B);let Qe=me.getImageData(we,we,F,U);ze.fill(Lt,0,X),Ae.fill(0,0,X);for(let Me=0;Me0?dt*dt:0,Ae[tt]=dt<0?dt*dt:0}}Gt(ze,0,0,H,Y,H,this.f,this.v,this.z),Gt(Ae,we,we,F,U,H,this.f,this.v,this.z);for(let Me=0;Me1&&(U=l[++F]);let Y=Math.abs(H-U.left),X=Math.abs(H-U.right),se=Math.min(Y,X),ge,me=P/v*(S+1);if(U.isDash){let we=S-Math.abs(me);ge=Math.sqrt(se*se+we*we)}else ge=S-Math.sqrt(se*se+me*me);this.data[B+H]=Math.max(0,Math.min(255,ge+128))}}}addRegularDash(l){for(let F=l.length-1;F>=0;--F){let U=l[F],H=l[F+1];U.zeroLength?l.splice(F,1):H&&H.isDash===U.isDash&&(H.left=U.left,l.splice(F,1))}let A=l[0],v=l[l.length-1];A.isDash===v.isDash&&(A.left=v.left-this.width,v.right=A.right+this.width);let S=this.width*this.nextRow,P=0,B=l[P];for(let F=0;F1&&(B=l[++P]);let U=Math.abs(F-B.left),H=Math.abs(F-B.right),Y=Math.min(U,H);this.data[S+F]=Math.max(0,Math.min(255,(B.isDash?Y:-Y)+128))}}addDash(l,A){let v=A?7:0,S=2*v+1;if(this.nextRow+S>this.height)return s.w("LineAtlas out of space"),null;let P=0;for(let F=0;F{S.send(l,A,P)},v=v||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(l=!0){this.actors.forEach(A=>{A.remove()}),this.actors=[],l&&this.workerPool.release(this.id)}}function jo(E,l,A){let v=function(S,P){if(S)return A(S);if(P){let B=s.F(s.e(P,E),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);P.vector_layers&&(B.vectorLayers=P.vector_layers,B.vectorLayerIds=B.vectorLayers.map(F=>F.id)),A(null,B)}};return E.url?s.f(l.transformRequest(E.url,$.Source),v):s.h.frame(()=>v(null,E))}class Ci{constructor(l,A){l&&(A?this.setSouthWest(l).setNorthEast(A):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.L?new s.L(l.lng,l.lat):s.L.convert(l),this}setSouthWest(l){return this._sw=l instanceof s.L?new s.L(l.lng,l.lat):s.L.convert(l),this}extend(l){let A=this._sw,v=this._ne,S,P;if(l instanceof s.L)S=l,P=l;else{if(!(l instanceof Ci))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(Ci.convert(l)):this.extend(s.L.convert(l)):l&&("lng"in l||"lon"in l)&&"lat"in l?this.extend(s.L.convert(l)):this;if(S=l._sw,P=l._ne,!S||!P)return this}return A||v?(A.lng=Math.min(S.lng,A.lng),A.lat=Math.min(S.lat,A.lat),v.lng=Math.max(P.lng,v.lng),v.lat=Math.max(P.lat,v.lat)):(this._sw=new s.L(S.lng,S.lat),this._ne=new s.L(P.lng,P.lat)),this}getCenter(){return new s.L((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.L(this.getWest(),this.getNorth())}getSouthEast(){return new s.L(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:A,lat:v}=s.L.convert(l),S=this._sw.lng<=A&&A<=this._ne.lng;return this._sw.lng>this._ne.lng&&(S=this._sw.lng>=A&&A>=this._ne.lng),this._sw.lat<=v&&v<=this._ne.lat&&S}static convert(l){return l instanceof Ci?l:l&&new Ci(l)}static fromLngLat(l,A=0){let v=360*A/40075017,S=v/Math.cos(Math.PI/180*l.lat);return new Ci(new s.L(l.lng-S,l.lat-v),new s.L(l.lng+S,l.lat+v))}}class qs{constructor(l,A,v){this.bounds=Ci.convert(this.validateBounds(l)),this.minzoom=A||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 A=Math.pow(2,l.z),v=Math.floor(s.G(this.bounds.getWest())*A),S=Math.floor(s.H(this.bounds.getNorth())*A),P=Math.ceil(s.G(this.bounds.getEast())*A),B=Math.ceil(s.H(this.bounds.getSouth())*A);return l.x>=v&&l.x=S&&l.y{this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=jo(this._options,this.map._requestManager,(P,B)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),P?this.fire(new s.j(P)):B&&(s.e(this,B),B.bounds&&(this.tileBounds=new qs(B.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"})))})},this.serialize=()=>s.e({},this._options),this.id=l,this.dispatcher=v,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.e(this,s.F(A,["url","scheme","tileSize","promoteId"])),this._options=s.e({type:"vector"},A),this._collectResourceTiming=A.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(S)}loaded(){return this._loaded}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}onAdd(l){this.map=l,this.load()}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}setUrl(l){return this.setSourceProperty(()=>{this.url=l,this._options.url=l}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(l,A){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S={request:this.map._requestManager.transformRequest(v,$.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};function P(B,F){return delete l.request,l.aborted?A(null):B&&B.status!==404?A(B):(F&&F.resourceTiming&&(l.resourceTiming=F.resourceTiming),this.map._refreshExpiredTiles&&F&&l.setExpiryData(F),l.loadVectorData(F,this.map.painter),A(null),void(l.reloadCallback&&(this.loadTile(l,l.reloadCallback),l.reloadCallback=null)))}S.request.collectResourceTiming=this._collectResourceTiming,l.actor&&l.state!=="expired"?l.state==="loading"?l.reloadCallback=A:l.request=l.actor.send("reloadTile",S,P.bind(this)):(l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",S,P.bind(this)))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.actor&&l.actor.send("abortTile",{uid:l.uid,type:this.type,source:this.id},void 0)}unloadTile(l){l.unloadVectorData(),l.actor&&l.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class kc extends s.E{constructor(l,A,v,S){super(),this.id=l,this.dispatcher=v,this.setEventedParent(S),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"},A),s.e(this,s.F(A,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this._tileJSONRequest=jo(this._options,this.map._requestManager,(l,A)=>{this._tileJSONRequest=null,this._loaded=!0,l?this.fire(new s.j(l)):A&&(s.e(this,A),A.bounds&&(this.tileBounds=new qs(A.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"})))})}loaded(){return this._loaded}onAdd(l){this.map=l,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),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,A){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);l.request=V.getImage(this.map._requestManager.transformRequest(v,$.Tile),(S,P,B)=>{if(delete l.request,l.aborted)l.state="unloaded",A(null);else if(S)l.state="errored",A(S);else if(P){this.map._refreshExpiredTiles&&B&&l.setExpiryData(B);let F=this.map.painter.context,U=F.gl;l.texture=this.map.painter.getTileTexture(P.width),l.texture?l.texture.update(P,{useMipmap:!0}):(l.texture=new He(F,P,U.RGBA,{useMipmap:!0}),l.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST),F.extTextureFilterAnisotropic&&U.texParameterf(U.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax)),l.state="loaded",A(null)}},this.map._refreshExpiredTiles)}abortTile(l,A){l.request&&(l.request.cancel(),delete l.request),A()}unloadTile(l,A){l.texture&&this.map.painter.saveTileTexture(l.texture),A()}hasTransition(){return!1}}class Lc extends kc{constructor(l,A,v,S){super(l,A,v,S),this.type="raster-dem",this.maxzoom=22,this._options=s.e({type:"raster-dem"},A),this.encoding=A.encoding||"mapbox",this.redFactor=A.redFactor,this.greenFactor=A.greenFactor,this.blueFactor=A.blueFactor,this.baseShift=A.baseShift}loadTile(l,A){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),S=this.map._requestManager.transformRequest(v,$.Tile);function P(B,F){B&&(l.state="errored",A(B)),F&&(l.dem=F,l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0,l.state="loaded",A(null))}l.neighboringTiles=this._getNeighboringTiles(l.tileID),l.request=V.getImage(S,(B,F,U)=>s._(this,void 0,void 0,function*(){if(delete l.request,l.aborted)l.state="unloaded",A(null);else if(B)l.state="errored",A(B);else if(F){this.map._refreshExpiredTiles&&l.setExpiryData(U);let H=s.a(F)&&s.J()?F:yield function(X){return s._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&s.K()){let se=X.width+2,ge=X.height+2;try{return new s.R({width:se,height:ge},yield s.M(X,-1,-1,se,ge))}catch{}}return s.h.getImageData(X,1)})}(F),Y={uid:l.uid,coord:l.tileID,source:this.id,rawImageData:H,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadDEMTile",Y,P))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(l){let A=l.canonical,v=Math.pow(2,A.z),S=(A.x-1+v)%v,P=A.x===0?l.wrap-1:l.wrap,B=(A.x+1+v)%v,F=A.x+1===v?l.wrap+1:l.wrap,U={};return U[new s.O(l.overscaledZ,P,A.z,S,A.y).key]={backfilled:!1},U[new s.O(l.overscaledZ,F,A.z,B,A.y).key]={backfilled:!1},A.y>0&&(U[new s.O(l.overscaledZ,P,A.z,S,A.y-1).key]={backfilled:!1},U[new s.O(l.overscaledZ,l.wrap,A.z,A.x,A.y-1).key]={backfilled:!1},U[new s.O(l.overscaledZ,F,A.z,B,A.y-1).key]={backfilled:!1}),A.y+1{this._updateWorkerData()},this.serialize=()=>s.e({},this._options,{type:this.type,data:this._data}),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=v.getActor(),this.setEventedParent(S),this._data=A.data,this._options=s.e({},A),this._collectResourceTiming=A.collectResourceTiming,A.maxzoom!==void 0&&(this.maxzoom=A.maxzoom),A.type&&(this.type=A.type),A.attribution&&(this.attribution=A.attribution),this.promoteId=A.promoteId;let P=s.N/this.tileSize;this.workerOptions=s.e({source:this.id,cluster:A.cluster||!1,geojsonVtOptions:{buffer:(A.buffer!==void 0?A.buffer:128)*P,tolerance:(A.tolerance!==void 0?A.tolerance:.375)*P,extent:s.N,maxZoom:this.maxzoom,lineMetrics:A.lineMetrics||!1,generateId:A.generateId||!1},superclusterOptions:{maxZoom:A.clusterMaxZoom!==void 0?A.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,A.clusterMinPoints||2),extent:s.N,radius:(A.clusterRadius||50)*P,log:!1,generateId:A.generateId||!1},clusterProperties:A.clusterProperties,filter:A.filter},A.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(l){this.map=l,this.load()}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){return this._updateWorkerData(l),this}setClusterOptions(l){return this.workerOptions.cluster=l.cluster,l&&(l.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=l.clusterRadius),l.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=l.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(l,A){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id},A),this}getClusterChildren(l,A){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id},A),this}getClusterLeaves(l,A,v,S){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:l,limit:A,offset:v},S),this}_updateWorkerData(l){let A=s.e({},this.workerOptions);l?A.dataDiff=l:typeof this._data=="string"?(A.request=this.map._requestManager.transformRequest(s.h.resolveURL(this._data),$.Source),A.request.collectResourceTiming=this._collectResourceTiming):A.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new s.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,A,(v,S)=>{if(this._pendingLoads--,this._removed||S&&S.abandoned)return void this.fire(new s.k("dataabort",{dataType:"source"}));let P=null;if(S&&S.resourceTiming&&S.resourceTiming[this.id]&&(P=S.resourceTiming[this.id].slice(0)),v)return void this.fire(new s.j(v));let B={dataType:"source"};this._collectResourceTiming&&P&&P.length>0&&s.e(B,{resourceTiming:P}),this.fire(new s.k("data",Object.assign(Object.assign({},B),{sourceDataType:"metadata"}))),this.fire(new s.k("data",Object.assign(Object.assign({},B),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(l,A){let v=l.actor?"reloadTile":"loadTile";l.actor=this.actor;let S={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.request=this.actor.send(v,S,(P,B)=>(delete l.request,l.unloadVectorData(),l.aborted?A(null):P?A(P):(l.loadVectorData(B,this.map.painter,v==="reloadTile"),A(null))))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l){l.unloadVectorData(),this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var is=s.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Di extends s.E{constructor(l,A,v,S){super(),this.load=(P,B)=>{this._loaded=!1,this.fire(new s.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=V.getImage(this.map._requestManager.transformRequest(this.url,$.Image),(F,U)=>{this._request=null,this._loaded=!0,F?this.fire(new s.j(F)):U&&(this.image=U,P&&(this.coordinates=P),B&&B(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;let P=this.map.painter.context,B=P.gl;this.boundsBuffer||(this.boundsBuffer=P.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=s.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new He(P,this.image,B.RGBA),this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE));let F=!1;for(let U in this.tiles){let H=this.tiles[U];H.state!=="loaded"&&(H.state="loaded",H.texture=this.texture,F=!0)}F&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=l,this.dispatcher=v,this.coordinates=A.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(S),this.options=A}loaded(){return this._loaded}updateImage(l){return l.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=l.url,this.load(l.coordinates,()=>{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.cancel(),this._request=null)}setCoordinates(l){this.coordinates=l;let A=l.map(s.U.fromLngLat);this.tileID=function(S){let P=1/0,B=1/0,F=-1/0,U=-1/0;for(let se of S)P=Math.min(P,se.x),B=Math.min(B,se.y),F=Math.max(F,se.x),U=Math.max(U,se.y);let H=Math.max(F-P,U-B),Y=Math.max(0,Math.floor(-Math.log(H)/Math.LN2)),X=Math.pow(2,Y);return new s.W(Y,Math.floor((P+F)/2*X),Math.floor((B+U)/2*X))}(A),this.minzoom=this.maxzoom=this.tileID.z;let v=A.map(S=>this.tileID.getTilePoint(S)._round());return this._boundsArray=new s.V,this._boundsArray.emplaceBack(v[0].x,v[0].y,0,0),this._boundsArray.emplaceBack(v[1].x,v[1].y,s.N,0),this._boundsArray.emplaceBack(v[3].x,v[3].y,0,s.N),this._boundsArray.emplaceBack(v[2].x,v[2].y,s.N,s.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new s.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(l,A){this.tileID&&this.tileID.equals(l.tileID.canonical)?(this.tiles[String(l.tileID.wrap)]=l,l.buckets={},A(null)):(l.state="errored",A(null))}hasTransition(){return!1}}class ns extends Di{constructor(l,A,v,S){super(l,A,v,S),this.load=()=>{this._loaded=!1;let P=this.options;this.urls=[];for(let B of P.urls)this.urls.push(this.map._requestManager.transformRequest(B,$.Source).url);s.X(this.urls,(B,F)=>{this._loaded=!0,B?this.fire(new s.j(B)):F&&(this.video=F,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let P=this.map.painter.context,B=P.gl;this.boundsBuffer||(this.boundsBuffer=P.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=s.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE),B.texSubImage2D(B.TEXTURE_2D,0,0,0,B.RGBA,B.UNSIGNED_BYTE,this.video)):(this.texture=new He(P,this.video,B.RGBA),this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE));let F=!1;for(let U in this.tiles){let H=this.tiles[U];H.state!=="loaded"&&(H.state="loaded",H.texture=this.texture,F=!0)}F&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=A}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){let A=this.video.seekable;lA.end(0)?this.fire(new s.j(new s.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${A.start(0)} and ${A.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)))}hasTransition(){return this.video&&!this.video.paused}}class Wo extends Di{constructor(l,A,v,S){super(l,A,v,S),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new 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())},this.prepare=()=>{let P=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,P=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,P=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let B=this.map.painter.context,F=B.gl;this.boundsBuffer||(this.boundsBuffer=B.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=s.S.simpleSegment(0,0,4,2)),this.texture?(P||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new He(B,this.canvas,F.RGBA,{premultiply:!0});let U=!1;for(let H in this.tiles){let Y=this.tiles[H];Y.state!=="loaded"&&(Y.state="loaded",Y.texture=this.texture,U=!0)}U&&this.fire(new s.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),A.coordinates?Array.isArray(A.coordinates)&&A.coordinates.length===4&&!A.coordinates.some(P=>!Array.isArray(P)||P.length!==2||P.some(B=>typeof B!="number"))||this.fire(new s.j(new s.Y(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.j(new s.Y(`sources.${l}`,null,'missing required property "coordinates"'))),A.animate&&typeof A.animate!="boolean"&&this.fire(new s.j(new s.Y(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),A.canvas?typeof A.canvas=="string"||A.canvas instanceof HTMLCanvasElement||this.fire(new s.j(new s.Y(`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.Y(`sources.${l}`,null,'missing required property "canvas"'))),this.options=A,this.animate=A.animate===void 0||A.animate}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}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 cl={},Co=E=>{switch(E){case"geojson":return on;case"image":return Di;case"raster":return kc;case"raster-dem":return Lc;case"vector":return ll;case"video":return ns;case"canvas":return Wo}return cl[E]};function La(E,l){let A=s.Z();return s.$(A,A,[1,1,0]),s.a0(A,A,[.5*E.width,.5*E.height,1]),s.a1(A,A,E.calculatePosMatrix(l.toUnwrapped()))}function la(E,l,A,v,S,P){let B=function(X,se,ge){if(X)for(let me of X){let we=se[me];if(we&&we.source===ge&&we.type==="fill-extrusion")return!0}else for(let me in se){let we=se[me];if(we.source===ge&&we.type==="fill-extrusion")return!0}return!1}(S&&S.layers,l,E.id),F=P.maxPitchScaleFactor(),U=E.tilesIn(v,F,B);U.sort(fs);let H=[];for(let X of U)H.push({wrappedTileID:X.tileID.wrapped().key,queryResults:X.tile.queryRenderedFeatures(l,A,E._state,X.queryGeometry,X.cameraQueryGeometry,X.scale,S,P,F,La(E.transform,X.tileID))});let Y=function(X){let se={},ge={};for(let me of X){let we=me.queryResults,Ae=me.wrappedTileID,ze=ge[Ae]=ge[Ae]||{};for(let Qe in we){let Me=we[Qe],Ve=ze[Qe]=ze[Qe]||{},it=se[Qe]=se[Qe]||[];for(let tt of Me)Ve[tt.featureIndex]||(Ve[tt.featureIndex]=!0,it.push(tt))}}return se}(H);for(let X in Y)Y[X].forEach(se=>{let ge=se.feature,me=E.getFeatureState(ge.layer["source-layer"],ge.id);ge.source=ge.layer.source,ge.layer["source-layer"]&&(ge.sourceLayer=ge.layer["source-layer"]),ge.state=me});return Y}function fs(E,l){let A=E.tileID,v=l.tileID;return A.overscaledZ-v.overscaledZ||A.canonical.y-v.canonical.y||A.wrap-v.wrap||A.canonical.x-v.canonical.x}class po{constructor(l,A){this.timeAdded=0,this.fadeEndTime=0,this.tileID=l,this.uid=s.a2(),this.uses=0,this.tileSize=A,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 A=l+this.timeAdded;AP.getLayer(H)).filter(Boolean);if(U.length!==0){F.layers=U,F.stateDependentLayerIds&&(F.stateDependentLayers=F.stateDependentLayerIds.map(H=>U.filter(Y=>Y.id===H)[0]));for(let H of U)B[H.id]=F}}return B}(l.buckets,A.style),this.hasSymbolBuckets=!1;for(let S in this.buckets){let P=this.buckets[S];if(P instanceof s.a4){if(this.hasSymbolBuckets=!0,!v)break;P.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let S in this.buckets){let P=this.buckets[S];if(P instanceof s.a4&&P.hasRTLText){this.hasRTLText=!0,s.a5();break}}this.queryPadding=0;for(let S in this.buckets){let P=this.buckets[S];this.queryPadding=Math.max(this.queryPadding,A.style.getLayer(S).queryRadius(P))}l.imageAtlas&&(this.imageAtlas=l.imageAtlas),l.glyphAtlasImage&&(this.glyphAtlasImage=l.glyphAtlasImage)}else this.collisionBoxArray=new s.a3}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 S=this.buckets[v];S.uploadPending()&&S.upload(l)}let A=l.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new He(l,this.imageAtlas.image,A.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new He(l,this.glyphAtlasImage,A.ALPHA),this.glyphAtlasImage=null)}prepare(l){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(l,this.imageAtlasTexture)}queryRenderedFeatures(l,A,v,S,P,B,F,U,H,Y){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:S,cameraQueryGeometry:P,scale:B,tileSize:this.tileSize,pixelPosMatrix:Y,transform:U,params:F,queryPadding:this.queryPadding*H},l,A,v):{}}querySourceFeatures(l,A){let v=this.latestFeatureIndex;if(!v||!v.rawTileData)return;let S=v.loadVTLayers(),P=A&&A.sourceLayer?A.sourceLayer:"",B=S._geojsonTileLayer||S[P];if(!B)return;let F=s.a6(A&&A.filter),{z:U,x:H,y:Y}=this.tileID.canonical,X={z:U,x:H,y:Y};for(let se=0;sev)S=!1;else if(A)if(this.expirationTime{this.remove(l,P)},v)),this.data[S].push(P),this.order.push(S),this.order.length>this.max){let B=this._getAndRemoveByKey(this.order[0]);B&&this.onRemove(B)}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 A=this.data[l].shift();return A.timeout&&clearTimeout(A.timeout),this.data[l].length===0&&delete this.data[l],this.order.splice(this.order.indexOf(l),1),A.value}getByKey(l){let A=this.data[l];return A?A[0].value:null}get(l){return this.has(l)?this.data[l.wrapped().key][0].value:null}remove(l,A){if(!this.has(l))return this;let v=l.wrapped().key,S=A===void 0?0:this.data[v].indexOf(A),P=this.data[v][S];return this.data[v].splice(S,1),P.timeout&&clearTimeout(P.timeout),this.data[v].length===0&&delete this.data[v],this.onRemove(P.value),this.order.splice(this.order.indexOf(v),1),this}setMaxSize(l){for(this.max=l;this.order.length>this.max;){let A=this._getAndRemoveByKey(this.order[0]);A&&this.onRemove(A)}return this}filter(l){let A=[];for(let v in this.data)for(let S of this.data[v])l(S.value)||A.push(S);for(let v of A)this.remove(v.value.tileID,v)}}class ct{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(l,A,v){let S=String(A);if(this.stateChanges[l]=this.stateChanges[l]||{},this.stateChanges[l][S]=this.stateChanges[l][S]||{},s.e(this.stateChanges[l][S],v),this.deletedStates[l]===null){this.deletedStates[l]={};for(let P in this.state[l])P!==S&&(this.deletedStates[l][P]=null)}else if(this.deletedStates[l]&&this.deletedStates[l][S]===null){this.deletedStates[l][S]={};for(let P in this.state[l][S])v[P]||(this.deletedStates[l][S][P]=null)}else for(let P in v)this.deletedStates[l]&&this.deletedStates[l][S]&&this.deletedStates[l][S][P]===null&&delete this.deletedStates[l][S][P]}removeFeatureState(l,A,v){if(this.deletedStates[l]===null)return;let S=String(A);if(this.deletedStates[l]=this.deletedStates[l]||{},v&&A!==void 0)this.deletedStates[l][S]!==null&&(this.deletedStates[l][S]=this.deletedStates[l][S]||{},this.deletedStates[l][S][v]=null);else if(A!==void 0)if(this.stateChanges[l]&&this.stateChanges[l][S])for(v in this.deletedStates[l][S]={},this.stateChanges[l][S])this.deletedStates[l][S][v]=null;else this.deletedStates[l][S]=null;else this.deletedStates[l]=null}getState(l,A){let v=String(A),S=s.e({},(this.state[l]||{})[v],(this.stateChanges[l]||{})[v]);if(this.deletedStates[l]===null)return{};if(this.deletedStates[l]){let P=this.deletedStates[l][A];if(P===null)return{};for(let B in P)delete S[B]}return S}initializeTileState(l,A){l.setFeatureState(this.state,A)}coalesceChanges(l,A){let v={};for(let S in this.stateChanges){this.state[S]=this.state[S]||{};let P={};for(let B in this.stateChanges[S])this.state[S][B]||(this.state[S][B]={}),s.e(this.state[S][B],this.stateChanges[S][B]),P[B]=this.state[S][B];v[S]=P}for(let S in this.deletedStates){this.state[S]=this.state[S]||{};let P={};if(this.deletedStates[S]===null)for(let B in this.state[S])P[B]={},this.state[S][B]={};else for(let B in this.deletedStates[S]){if(this.deletedStates[S][B]===null)this.state[S][B]={};else for(let F of Object.keys(this.deletedStates[S][B]))delete this.state[S][B][F];P[B]=this.state[S][B]}v[S]=v[S]||{},s.e(v[S],P)}if(this.stateChanges={},this.deletedStates={},Object.keys(v).length!==0)for(let S in l)l[S].setFeatureState(v,A)}}class ds extends s.E{constructor(l,A,v){super(),this.id=l,this.dispatcher=v,this.on("data",S=>{S.dataType==="source"&&S.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&S.dataType==="source"&&S.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=((S,P,B,F)=>{let U=new(Co(P.type))(S,P,B,F);if(U.id!==S)throw new Error(`Expected Source id to be ${S} instead of ${U.id}`);return U})(l,A,v,this),this._tiles={},this._cache=new zl(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ct,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 A=this._tiles[l];if(A.state!=="loaded"&&A.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,A){return this._source.loadTile(l,A)}_unloadTile(l){if(this._source.unloadTile)return 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 A in this._tiles){let v=this._tiles[A];v.upload(l),v.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(l=>l.tileID).sort(vn).map(l=>l.key)}getRenderableIds(l){let A=[];for(let v in this._tiles)this._isIdRenderable(v,l)&&A.push(this._tiles[v]);return l?A.sort((v,S)=>{let P=v.tileID,B=S.tileID,F=new s.P(P.canonical.x,P.canonical.y)._rotate(this.transform.angle),U=new s.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return P.overscaledZ-B.overscaledZ||U.y-F.y||U.x-F.x}).map(v=>v.tileID.key):A.map(v=>v.tileID).sort(vn).map(v=>v.key)}hasRenderableParent(l){let A=this.findLoadedParent(l,0);return!!A&&this._isIdRenderable(A.tileID.key)}_isIdRenderable(l,A){return this._tiles[l]&&this._tiles[l].hasData()&&!this._coveredTiles[l]&&(A||!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,A){let v=this._tiles[l];v&&(v.state!=="loading"&&(v.state=A),this._loadTile(v,this._tileLoaded.bind(this,v,l,A)))}_tileLoaded(l,A,v,S){if(S)return l.state="errored",void(S.status!==404?this._source.fire(new s.j(S,{tile:l})):this.update(this.transform,this.terrain));l.timeAdded=s.h.now(),v==="expired"&&(l.refreshedUponExpiration=!0),this._setTileReloadTimer(A,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 A=this.getRenderableIds();for(let S=0;S1||(Math.abs(B)>1&&(Math.abs(B+U)===1?B+=U:Math.abs(B-U)===1&&(B-=U)),P.dem&&S.dem&&(S.dem.backfillBorder(P.dem,B,F),S.neighboringTiles&&S.neighboringTiles[H]&&(S.neighboringTiles[H].backfilled=!0)))}}getTile(l){return this.getTileByID(l.key)}getTileByID(l){return this._tiles[l]}_retainLoadedChildren(l,A,v,S){for(let P in this._tiles){let B=this._tiles[P];if(S[P]||!B.hasData()||B.tileID.overscaledZ<=A||B.tileID.overscaledZ>v)continue;let F=B.tileID;for(;B&&B.tileID.overscaledZ>A+1;){let H=B.tileID.scaledTo(B.tileID.overscaledZ-1);B=this._tiles[H.key],B&&B.hasData()&&(F=H)}let U=F;for(;U.overscaledZ>A;)if(U=U.scaledTo(U.overscaledZ-1),l[U.key]){S[F.key]=F;break}}}findLoadedParent(l,A){if(l.key in this._loadedParentTiles){let v=this._loadedParentTiles[l.key];return v&&v.tileID.overscaledZ>=A?v:null}for(let v=l.overscaledZ-1;v>=A;v--){let S=l.scaledTo(v),P=this._getLoadedTile(S);if(P)return P}}_getLoadedTile(l){let A=this._tiles[l.key];return A&&A.hasData()?A:this._cache.getByKey(l.wrapped().key)}updateCacheSize(l){let A=Math.ceil(l.width/this._source.tileSize)+1,v=Math.ceil(l.height/this._source.tileSize)+1,S=Math.floor(A*v*(this._maxTileCacheZoomLevels===null?s.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),P=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,S):S;this._cache.setMaxSize(P)}handleWrapJump(l){let A=Math.round((l-(this._prevLng===void 0?l:this._prevLng))/360);if(this._prevLng=l,A){let v={};for(let S in this._tiles){let P=this._tiles[S];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+A),v[P.tileID.key]=P}this._tiles=v;for(let S in this._timers)clearTimeout(this._timers[S]),delete this._timers[S];for(let S in this._tiles)this._setTileReloadTimer(S,this._tiles[S])}}update(l,A){if(this.transform=l,this.terrain=A,!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(Y=>new s.O(Y.canonical.z,Y.wrap,Y.canonical.z,Y.canonical.x,Y.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:A}),this._source.hasTile&&(v=v.filter(Y=>this._source.hasTile(Y)))):v=[];let S=l.coveringZoomLevel(this._source),P=Math.max(S-ds.maxOverzooming,this._source.minzoom),B=Math.max(S+ds.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Y={};for(let X of v)if(X.canonical.z>this._source.minzoom){let se=X.scaledTo(X.canonical.z-1);Y[se.key]=se;let ge=X.scaledTo(Math.max(this._source.minzoom,Math.min(X.canonical.z,5)));Y[ge.key]=ge}v=v.concat(Object.values(Y))}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,S);if(Si(this._source.type)){let Y={},X={},se=Object.keys(U),ge=s.h.now();for(let me of se){let we=U[me],Ae=this._tiles[me];if(!Ae||Ae.fadeEndTime!==0&&Ae.fadeEndTime<=ge)continue;let ze=this.findLoadedParent(we,P);ze&&(this._addTile(ze.tileID),Y[ze.tileID.key]=ze.tileID),X[me]=we}this._retainLoadedChildren(X,S,B,U);for(let me in Y)U[me]||(this._coveredTiles[me]=!0,U[me]=Y[me]);if(A){let me={},we={};for(let Ae of v)this._tiles[Ae.key].hasData()?me[Ae.key]=Ae:we[Ae.key]=Ae;for(let Ae in we){let ze=we[Ae].children(this._source.maxzoom);this._tiles[ze[0].key]&&this._tiles[ze[1].key]&&this._tiles[ze[2].key]&&this._tiles[ze[3].key]&&(me[ze[0].key]=U[ze[0].key]=ze[0],me[ze[1].key]=U[ze[1].key]=ze[1],me[ze[2].key]=U[ze[2].key]=ze[2],me[ze[3].key]=U[ze[3].key]=ze[3],delete we[Ae])}for(let Ae in we){let ze=this.findLoadedParent(we[Ae],this._source.minzoom);if(ze){me[ze.tileID.key]=U[ze.tileID.key]=ze.tileID;for(let Qe in me)me[Qe].isChildOf(ze.tileID)&&delete me[Qe]}}for(let Ae in this._tiles)me[Ae]||(this._coveredTiles[Ae]=!0)}}for(let Y in U)this._tiles[Y].clearFadeHold();let H=s.ab(this._tiles,U);for(let Y of H){let X=this._tiles[Y];X.hasSymbolBuckets&&!X.holdingForFade()?X.setHoldDuration(this.map._fadeDuration):X.hasSymbolBuckets&&!X.symbolFadeFinished()||this._removeTile(Y)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let l in this._tiles)this._tiles[l].holdingForFade()&&this._removeTile(l)}_updateRetainedTiles(l,A){let v={},S={},P=Math.max(A-ds.maxOverzooming,this._source.minzoom),B=Math.max(A+ds.maxUnderzooming,this._source.minzoom),F={};for(let U of l){let H=this._addTile(U);v[U.key]=U,H.hasData()||Athis._source.maxzoom){let X=U.children(this._source.maxzoom)[0],se=this.getTile(X);if(se&&se.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 Y=H.wasRequested();for(let X=U.overscaledZ-1;X>=P;--X){let se=U.scaledTo(X);if(S[se.key])break;if(S[se.key]=!0,H=this.getTile(se),!H&&Y&&(H=this._addTile(se)),H){let ge=H.hasData();if((Y||ge)&&(v[se.key]=se),Y=H.wasRequested(),ge)break}}}return v}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let l in this._tiles){let A=[],v,S=this._tiles[l].tileID;for(;S.overscaledZ>0;){if(S.key in this._loadedParentTiles){v=this._loadedParentTiles[S.key];break}A.push(S.key);let P=S.scaledTo(S.overscaledZ-1);if(v=this._getLoadedTile(P),v)break;S=P}for(let P of A)this._loadedParentTiles[P]=v}}_addTile(l){let A=this._tiles[l.key];if(A)return A;A=this._cache.getAndRemove(l),A&&(this._setTileReloadTimer(l.key,A),A.tileID=l,this._state.initializeTileState(A,this.map?this.map.painter:null),this._cacheTimers[l.key]&&(clearTimeout(this._cacheTimers[l.key]),delete this._cacheTimers[l.key],this._setTileReloadTimer(l.key,A)));let v=A;return A||(A=new po(l,this._source.tileSize*l.overscaleFactor()),this._loadTile(A,this._tileLoaded.bind(this,A,l.key,A.state))),A.uses++,this._tiles[l.key]=A,v||this._source.fire(new s.k("dataloading",{tile:A,coord:A.tileID,dataType:"source"})),A}_setTileReloadTimer(l,A){l in this._timers&&(clearTimeout(this._timers[l]),delete this._timers[l]);let v=A.getExpiryTimeout();v&&(this._timers[l]=setTimeout(()=>{this._reloadTile(l,"expired"),delete this._timers[l]},v))}_removeTile(l){let A=this._tiles[l];A&&(A.uses--,delete this._tiles[l],this._timers[l]&&(clearTimeout(this._timers[l]),delete this._timers[l]),A.uses>0||(A.hasData()&&A.state!=="reloading"?this._cache.add(A.tileID,A,A.getExpiryTimeout()):(A.aborted=!0,this._abortTile(A),this._unloadTile(A))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let l in this._tiles)this._removeTile(l);this._cache.reset()}tilesIn(l,A,v){let S=[],P=this.transform;if(!P)return S;let B=v?P.getCameraQueryGeometry(l):l,F=l.map(me=>P.pointCoordinate(me,this.terrain)),U=B.map(me=>P.pointCoordinate(me,this.terrain)),H=this.getIds(),Y=1/0,X=1/0,se=-1/0,ge=-1/0;for(let me of U)Y=Math.min(Y,me.x),X=Math.min(X,me.y),se=Math.max(se,me.x),ge=Math.max(ge,me.y);for(let me=0;me=0&&Me[1].y+Qe>=0){let Ve=F.map(tt=>Ae.getTilePoint(tt)),it=U.map(tt=>Ae.getTilePoint(tt));S.push({tile:we,tileID:Ae,queryGeometry:Ve,cameraQueryGeometry:it,scale:ze})}}return S}getVisibleCoordinates(l){let A=this.getRenderableIds(l).map(v=>this._tiles[v].tileID);for(let v of A)v.posMatrix=this.transform.calculatePosMatrix(v.toUnwrapped());return A}hasTransition(){if(this._source.hasTransition())return!0;if(Si(this._source.type)){let l=s.h.now();for(let A in this._tiles)if(this._tiles[A].fadeEndTime>=l)return!0}return!1}setFeatureState(l,A,v){this._state.updateState(l=l||"_geojsonTileLayer",A,v)}removeFeatureState(l,A,v){this._state.removeFeatureState(l=l||"_geojsonTileLayer",A,v)}getFeatureState(l,A){return this._state.getState(l=l||"_geojsonTileLayer",A)}setDependencies(l,A,v){let S=this._tiles[l];S&&S.setDependencies(A,v)}reloadTilesForDependencies(l,A){for(let v in this._tiles)this._tiles[v].hasDependency(l,A)&&this._reloadTile(v,"reloading");this._cache.filter(v=>!v.hasDependency(l,A))}}function vn(E,l){let A=Math.abs(2*E.wrap)-+(E.wrap<0),v=Math.abs(2*l.wrap)-+(l.wrap<0);return E.overscaledZ-l.overscaledZ||v-A||l.canonical.y-E.canonical.y||l.canonical.x-E.canonical.x}function Si(E){return E==="raster"||E==="image"||E==="video"}ds.maxOverzooming=10,ds.maxUnderzooming=3;let gi="mapboxgl_preloaded_worker_pool";class Ao{constructor(){this.active={}}acquire(l){if(!this.workers)for(this.workers=[];this.workers.length{A.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[gi]}numActive(){return Object.keys(this.active).length}}let vu=Math.floor(s.h.hardwareConcurrency/2),ul;function Io(){return ul||(ul=new Ao),ul}Ao.workerCount=s.ac(globalThis)?Math.max(Math.min(vu,3),1):1;class hl{constructor(l,A){this.reset(l,A)}reset(l,A){this.points=l||[],this._distances=[0];for(let v=1;v0?(S-B)/F:0;return this.points[P].mult(1-U).add(this.points[A].mult(U))}}function Da(E,l){let A=!0;return E==="always"||E!=="never"&&l!=="never"||(A=!1),A}class Ro{constructor(l,A,v){let S=this.boxCells=[],P=this.circleCells=[];this.xCellCount=Math.ceil(l/v),this.yCellCount=Math.ceil(A/v);for(let B=0;Bthis.width||S<0||A>this.height)return[];let U=[];if(l<=0&&A<=0&&this.width<=v&&this.height<=S){if(P)return[{key:null,x1:l,y1:A,x2:v,y2:S}];for(let H=0;H0}hitTestCircle(l,A,v,S,P){let B=l-v,F=l+v,U=A-v,H=A+v;if(F<0||B>this.width||H<0||U>this.height)return!1;let Y=[];return this._forEachCell(B,U,F,H,this._queryCellCircle,Y,{hitTest:!0,overlapMode:S,circle:{x:l,y:A,radius:v},seenUids:{box:{},circle:{}}},P),Y.length>0}_queryCell(l,A,v,S,P,B,F,U){let{seenUids:H,hitTest:Y,overlapMode:X}=F,se=this.boxCells[P];if(se!==null){let me=this.bboxes;for(let we of se)if(!H.box[we]){H.box[we]=!0;let Ae=4*we,ze=this.boxKeys[we];if(l<=me[Ae+2]&&A<=me[Ae+3]&&v>=me[Ae+0]&&S>=me[Ae+1]&&(!U||U(ze))&&(!Y||!Da(X,ze.overlapMode))&&(B.push({key:ze,x1:me[Ae],y1:me[Ae+1],x2:me[Ae+2],y2:me[Ae+3]}),Y))return!0}}let ge=this.circleCells[P];if(ge!==null){let me=this.circles;for(let we of ge)if(!H.circle[we]){H.circle[we]=!0;let Ae=3*we,ze=this.circleKeys[we];if(this._circleAndRectCollide(me[Ae],me[Ae+1],me[Ae+2],l,A,v,S)&&(!U||U(ze))&&(!Y||!Da(X,ze.overlapMode))){let Qe=me[Ae],Me=me[Ae+1],Ve=me[Ae+2];if(B.push({key:ze,x1:Qe-Ve,y1:Me-Ve,x2:Qe+Ve,y2:Me+Ve}),Y)return!0}}}return!1}_queryCellCircle(l,A,v,S,P,B,F,U){let{circle:H,seenUids:Y,overlapMode:X}=F,se=this.boxCells[P];if(se!==null){let me=this.bboxes;for(let we of se)if(!Y.box[we]){Y.box[we]=!0;let Ae=4*we,ze=this.boxKeys[we];if(this._circleAndRectCollide(H.x,H.y,H.radius,me[Ae+0],me[Ae+1],me[Ae+2],me[Ae+3])&&(!U||U(ze))&&!Da(X,ze.overlapMode))return B.push(!0),!0}}let ge=this.circleCells[P];if(ge!==null){let me=this.circles;for(let we of ge)if(!Y.circle[we]){Y.circle[we]=!0;let Ae=3*we,ze=this.circleKeys[we];if(this._circlesCollide(me[Ae],me[Ae+1],me[Ae+2],H.x,H.y,H.radius)&&(!U||U(ze))&&!Da(X,ze.overlapMode))return B.push(!0),!0}}}_forEachCell(l,A,v,S,P,B,F,U){let H=this._convertToXCellCoord(l),Y=this._convertToYCellCoord(A),X=this._convertToXCellCoord(v),se=this._convertToYCellCoord(S);for(let ge=H;ge<=X;ge++)for(let me=Y;me<=se;me++)if(P.call(this,l,A,v,S,this.xCellCount*me+ge,B,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,A,v,S,P,B){let F=S-l,U=P-A,H=v+B;return H*H>F*F+U*U}_circleAndRectCollide(l,A,v,S,P,B,F){let U=(B-S)/2,H=Math.abs(l-(S+U));if(H>U+v)return!1;let Y=(F-P)/2,X=Math.abs(A-(P+Y));if(X>Y+v)return!1;if(H<=U||X<=Y)return!0;let se=H-U,ge=X-Y;return se*se+ge*ge<=v*v}}function Tt(E,l,A,v,S){let P=s.Z();return l?(s.a0(P,P,[1/S,1/S,1]),A||s.ae(P,P,v.angle)):s.a1(P,v.labelPlaneMatrix,E),P}function Ho(E,l,A,v,S){if(l){let P=s.af(E);return s.a0(P,P,[S,S,1]),A||s.ae(P,P,-v.angle),P}return v.glCoordMatrix}function bn(E,l,A){let v;A?(v=[E.x,E.y,A(E.x,E.y),1],s.ag(v,v,l)):(v=[E.x,E.y,0,1],Te(v,v,l));let S=v[3];return{point:new s.P(v[0]/S,v[1]/S),signedDistanceFromCamera:S}}function Ul(E,l){return .5+E/l*.5}function Oa(E,l){let A=E[0]/E[3],v=E[1]/E[3];return A>=-l[0]&&A<=l[0]&&v>=-l[1]&&v<=l[1]}function Ct(E,l,A,v,S,P,B,F,U,H){let Y=v?E.textSizeData:E.iconSizeData,X=s.ah(Y,A.transform.zoom),se=[256/A.width*2+1,256/A.height*2+1],ge=v?E.text.dynamicLayoutVertexArray:E.icon.dynamicLayoutVertexArray;ge.clear();let me=E.lineVertexArray,we=v?E.text.placedSymbolArray:E.icon.placedSymbolArray,Ae=A.transform.width/A.transform.height,ze=!1;for(let Qe=0;QeMath.abs(A.x-l.x)*v?{useVertical:!0}:(E===s.ai.vertical?l.yA.x)?{needsFlipping:!0}:null}function Gs(E,l,A,v,S,P,B,F,U,H,Y,X,se,ge,me,we){let Ae=l/24,ze=E.lineOffsetX*Ae,Qe=E.lineOffsetY*Ae,Me;if(E.numGlyphs>1){let Ve=E.glyphStartIndex+E.numGlyphs,it=E.lineStartIndex,tt=E.lineStartIndex+E.lineLength,dt=Vr(Ae,F,ze,Qe,A,Y,X,E,U,P,se,me,we);if(!dt)return{notEnoughRoom:!0};let vt=bn(dt.first.point,B,we).point,gt=bn(dt.last.point,B,we).point;if(v&&!A){let Mt=br(E.writingMode,vt,gt,ge);if(Mt)return Mt}Me=[dt.first];for(let Mt=E.glyphStartIndex+1;Mt0?vt.point:Ba(X,dt,it,1,S,we),Mt=br(E.writingMode,it,gt,ge);if(Mt)return Mt}let Ve=te(Ae*F.getoffsetX(E.glyphStartIndex),ze,Qe,A,Y,X,E.segment,E.lineStartIndex,E.lineStartIndex+E.lineLength,U,P,se,me,we);if(!Ve)return{notEnoughRoom:!0};Me=[Ve]}for(let Ve of Me)s.ak(H,Ve.point,Ve.angle);return{}}function Ba(E,l,A,v,S,P){let B=bn(E.add(E.sub(l)._unit()),S,P).point,F=A.sub(B);return A.add(F._mult(v/F.mag()))}function Rr(E,l){let{projectionCache:A,lineVertexArray:v,labelPlaneMatrix:S,tileAnchorPoint:P,distanceFromAnchor:B,getElevation:F,previousVertex:U,direction:H,absOffsetX:Y}=l;if(A.projections[E])return A.projections[E];let X=new s.P(v.getx(E),v.gety(E)),se=bn(X,S,F);if(se.signedDistanceFromCamera>0)return A.projections[E]=se.point,se.point;let ge=E-H;return Ba(B===0?P:new s.P(v.getx(ge),v.gety(ge)),X,U,Y-B+1,S,F)}function ca(E,l,A){return E._unit()._perp()._mult(l*A)}function be(E,l,A,v,S,P,B,F){let{projectionCache:U,direction:H}=F;if(U.offsets[E])return U.offsets[E];let Y=A.add(l);if(E+H=S)return U.offsets[E]=Y,Y;let X=Rr(E+H,F),se=ca(X.sub(A),B,H),ge=A.add(se),me=X.add(se);return U.offsets[E]=s.al(P,Y,ge,me)||Y,U.offsets[E]}function te(E,l,A,v,S,P,B,F,U,H,Y,X,se,ge){let me=v?E-l:E+l,we=me>0?1:-1,Ae=0;v&&(we*=-1,Ae=Math.PI),we<0&&(Ae+=Math.PI);let ze,Qe,Me=we>0?F+B:F+B+1,Ve=S,it=S,tt=0,dt=0,vt=Math.abs(me),gt=[],Mt;for(;tt+dt<=vt;){if(Me+=we,Me=U)return null;tt+=dt,it=Ve,Qe=ze;let Ft={projectionCache:X,lineVertexArray:H,labelPlaneMatrix:Y,tileAnchorPoint:P,distanceFromAnchor:tt,getElevation:ge,previousVertex:it,direction:we,absOffsetX:vt};if(Ve=Rr(Me,Ft),A===0)gt.push(it),Mt=Ve.sub(it);else{let mr,ir=Ve.sub(it);mr=ir.mag()===0?ca(Rr(Me+we,Ft).sub(Ve),A,we):ca(ir,A,we),Qe||(Qe=it.add(mr)),ze=be(Me,mr,Ve,F,U,Qe,A,Ft),gt.push(Qe),Mt=ze.sub(Qe)}dt=Mt.mag()}let rr=Mt._mult((vt-tt)/dt)._add(Qe||it),ci=Ae+Math.atan2(Ve.y-it.y,Ve.x-it.x);return gt.push(rr),{point:rr,angle:se?ci:0,path:gt}}let ne=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function fe(E,l){for(let A=0;A=1;Gr--)ir.push(Ft.path[Gr]);for(let Gr=1;Grbn(ui,U,me));ir=Gr.some(ui=>ui.signedDistanceFromCamera<=0)?[]:Gr.map(ui=>ui.point)}let oi=[];if(ir.length>0){let Gr=ir[0].clone(),ui=ir[0].clone();for(let Un=1;Un=Mt.x&&ui.x<=rr.x&&Gr.y>=Mt.y&&ui.y<=rr.y?[ir]:ui.xrr.x||ui.yrr.y?[]:s.am([ir],Mt.x,Mt.y,rr.x,rr.y)}for(let Gr of oi){ci.reset(Gr,.25*gt);let ui=0;ui=ci.length<=.5*gt?1:Math.ceil(ci.paddedLength/zi)+1;for(let Un=0;Un=this.screenRightBoundary||Sthis.screenBottomBoundary}isInsideGrid(l,A,v,S){return v>=0&&l=0&&Av.collisionGroupID===A}}return this.collisionGroups[l]}}function Sr(E,l,A,v,S){let{horizontalAlign:P,verticalAlign:B}=s.au(E);return new s.P(-(P-.5)*l+v[0]*S,-(B-.5)*A+v[1]*S)}function er(E,l,A,v,S,P){let{x1:B,x2:F,y1:U,y2:H,anchorPointX:Y,anchorPointY:X}=E,se=new s.P(l,A);return v&&se._rotate(S?P:-P),{x1:B+se.x,y1:U+se.y,x2:F+se.x,y2:H+se.y,anchorPointX:Y,anchorPointY:X}}class hr{constructor(l,A,v,S,P){this.transform=l.clone(),this.terrain=A,this.collisionIndex=new xe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=v,this.retainedQueryData={},this.collisionGroups=new ur(S),this.collisionCircleArrays={},this.prevPlacement=P,P&&(P.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(l,A,v,S){let P=v.getBucket(A),B=v.latestFeatureIndex;if(!P||!B||A.id!==P.layerIds[0])return;let F=v.collisionBoxArray,U=P.layers[0].layout,H=Math.pow(2,this.transform.zoom-v.tileID.overscaledZ),Y=v.tileSize/s.N,X=this.transform.calculatePosMatrix(v.tileID.toUnwrapped()),se=U.get("text-pitch-alignment")==="map",ge=U.get("text-rotation-alignment")==="map",me=Be(v,1,this.transform.zoom),we=Tt(X,se,ge,this.transform,me),Ae=null;if(se){let Qe=Ho(X,se,ge,this.transform,me);Ae=s.a1([],this.transform.labelPlaneMatrix,Qe)}this.retainedQueryData[P.bucketInstanceId]=new pt(P.bucketInstanceId,B,P.sourceLayerIndex,P.index,v.tileID);let ze={bucket:P,layout:U,posMatrix:X,textLabelPlaneMatrix:we,labelToScreenMatrix:Ae,scale:H,textPixelRatio:Y,holdingForFade:v.holdingForFade(),collisionBoxArray:F,partiallyEvaluatedTextSize:s.ah(P.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(P.sourceID)};if(S)for(let Qe of P.sortKeyRanges){let{sortKey:Me,symbolInstanceStart:Ve,symbolInstanceEnd:it}=Qe;l.push({sortKey:Me,symbolInstanceStart:Ve,symbolInstanceEnd:it,parameters:ze})}else l.push({symbolInstanceStart:0,symbolInstanceEnd:P.symbolInstances.length,parameters:ze})}attemptAnchorPlacement(l,A,v,S,P,B,F,U,H,Y,X,se,ge,me,we,Ae){let ze=s.aq[l.textAnchor],Qe=[l.textOffset0,l.textOffset1],Me=Sr(ze,v,S,Qe,P),Ve=this.collisionIndex.placeCollisionBox(er(A,Me.x,Me.y,B,F,this.transform.angle),X,U,H,Y.predicate,Ae);if((!we||this.collisionIndex.placeCollisionBox(er(we,Me.x,Me.y,B,F,this.transform.angle),X,U,H,Y.predicate,Ae).box.length!==0)&&Ve.box.length>0){let it;if(this.prevPlacement&&this.prevPlacement.variableOffsets[se.crossTileID]&&this.prevPlacement.placements[se.crossTileID]&&this.prevPlacement.placements[se.crossTileID].text&&(it=this.prevPlacement.variableOffsets[se.crossTileID].anchor),se.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[se.crossTileID]={textOffset:Qe,width:v,height:S,anchor:ze,textBoxScale:P,prevAnchor:it},this.markUsedJustification(ge,ze,se,me),ge.allowVerticalPlacement&&(this.markUsedOrientation(ge,me,se),this.placedOrientations[se.crossTileID]=me),{shift:Me,placedGlyphBoxes:Ve}}}placeLayerBucketPart(l,A,v){let{bucket:S,layout:P,posMatrix:B,textLabelPlaneMatrix:F,labelToScreenMatrix:U,textPixelRatio:H,holdingForFade:Y,collisionBoxArray:X,partiallyEvaluatedTextSize:se,collisionGroup:ge}=l.parameters,me=P.get("text-optional"),we=P.get("icon-optional"),Ae=s.ar(P,"text-overlap","text-allow-overlap"),ze=Ae==="always",Qe=s.ar(P,"icon-overlap","icon-allow-overlap"),Me=Qe==="always",Ve=P.get("text-rotation-alignment")==="map",it=P.get("text-pitch-alignment")==="map",tt=P.get("icon-text-fit")!=="none",dt=P.get("symbol-z-order")==="viewport-y",vt=ze&&(Me||!S.hasIconData()||we),gt=Me&&(ze||!S.hasTextData()||me);!S.collisionArrays&&X&&S.deserializeCollisionBoxes(X);let Mt=this.retainedQueryData[S.bucketInstanceId].tileID,rr=this.terrain?(Ft,mr)=>this.terrain.getElevation(Mt,Ft,mr):null,ci=(Ft,mr)=>{var ir,zi;if(A[Ft.crossTileID])return;if(Y)return void(this.placements[Ft.crossTileID]=new ht(!1,!1,!1));let oi=!1,Gr=!1,ui=!0,Un=null,ln={box:null,offscreen:null},Ys={box:null,offscreen:null},As=null,Vn=null,Aa=null,cn=0,ks=0,pl=0;mr.textFeatureIndex?cn=mr.textFeatureIndex:Ft.useRuntimeCollisionCircles&&(cn=Ft.featureIndex),mr.verticalTextFeatureIndex&&(ks=mr.verticalTextFeatureIndex);let Cu=mr.textBox;if(Cu){let go=Dn=>{let ms=s.ai.horizontal;if(S.allowVerticalPlacement&&!Dn&&this.prevPlacement){let Xo=this.prevPlacement.placedOrientations[Ft.crossTileID];Xo&&(this.placedOrientations[Ft.crossTileID]=Xo,ms=Xo,this.markUsedOrientation(S,ms,Ft))}return ms},Xs=(Dn,ms)=>{if(S.allowVerticalPlacement&&Ft.numVerticalGlyphVertices>0&&mr.verticalTextBox){for(let Xo of S.writingModes)if(Xo===s.ai.vertical?(ln=ms(),Ys=ln):ln=Dn(),ln&&ln.box&&ln.box.length)break}else ln=Dn()},jn=Ft.textAnchorOffsetStartIndex,Iu=Ft.textAnchorOffsetEndIndex;if(Iu===jn){let Dn=(ms,Xo)=>{let Wn=this.collisionIndex.placeCollisionBox(ms,Ae,H,B,ge.predicate,rr);return Wn&&Wn.box&&Wn.box.length&&(this.markUsedOrientation(S,Xo,Ft),this.placedOrientations[Ft.crossTileID]=Xo),Wn};Xs(()=>Dn(Cu,s.ai.horizontal),()=>{let ms=mr.verticalTextBox;return S.allowVerticalPlacement&&Ft.numVerticalGlyphVertices>0&&ms?Dn(ms,s.ai.vertical):{box:null,offscreen:null}}),go(ln&&ln.box&&ln.box.length)}else{let Dn=s.aq[(zi=(ir=this.prevPlacement)===null||ir===void 0?void 0:ir.variableOffsets[Ft.crossTileID])===null||zi===void 0?void 0:zi.anchor],ms=(Wn,Eh,hA)=>{let R_=Wn.x2-Wn.x1,k_=Wn.y2-Wn.y1,Kx=Ft.textBoxScale,gm=tt&&Qe==="never"?Eh:null,Xl={box:[],offscreen:!1},Mh=Ae==="never"?1:2,Al="never";Dn&&Mh++;for(let ma=0;mams(Cu,mr.iconBox,s.ai.horizontal),()=>{let Wn=mr.verticalTextBox;return S.allowVerticalPlacement&&!(ln&&ln.box&&ln.box.length)&&Ft.numVerticalGlyphVertices>0&&Wn?ms(Wn,mr.verticalIconBox,s.ai.vertical):{box:null,offscreen:null}}),ln&&(oi=ln.box,ui=ln.offscreen);let Xo=go(ln&&ln.box);if(!oi&&this.prevPlacement){let Wn=this.prevPlacement.variableOffsets[Ft.crossTileID];Wn&&(this.variableOffsets[Ft.crossTileID]=Wn,this.markUsedJustification(S,Wn.anchor,Ft,Xo))}}}if(As=ln,oi=As&&As.box&&As.box.length>0,ui=As&&As.offscreen,Ft.useRuntimeCollisionCircles){let go=S.text.placedSymbolArray.get(Ft.centerJustifiedTextSymbolIndex),Xs=s.aj(S.textSizeData,se,go),jn=P.get("text-padding");Vn=this.collisionIndex.placeCollisionCircles(Ae,go,S.lineVertexArray,S.glyphOffsetArray,Xs,B,F,U,v,it,ge.predicate,Ft.collisionCircleDiameter,jn,rr),Vn.circles.length&&Vn.collisionDetected&&!v&&s.w("Collisions detected, but collision boxes are not shown"),oi=ze||Vn.circles.length>0&&!Vn.collisionDetected,ui=ui&&Vn.offscreen}if(mr.iconFeatureIndex&&(pl=mr.iconFeatureIndex),mr.iconBox){let go=Xs=>{let jn=tt&&Un?er(Xs,Un.x,Un.y,Ve,it,this.transform.angle):Xs;return this.collisionIndex.placeCollisionBox(jn,Qe,H,B,ge.predicate,rr)};Ys&&Ys.box&&Ys.box.length&&mr.verticalIconBox?(Aa=go(mr.verticalIconBox),Gr=Aa.box.length>0):(Aa=go(mr.iconBox),Gr=Aa.box.length>0),ui=ui&&Aa.offscreen}let Th=me||Ft.numHorizontalGlyphVertices===0&&Ft.numVerticalGlyphVertices===0,Cf=we||Ft.numIconVertices===0;if(Th||Cf?Cf?Th||(Gr=Gr&&oi):oi=Gr&&oi:Gr=oi=Gr&&oi,oi&&As&&As.box&&this.collisionIndex.insertCollisionBox(As.box,Ae,P.get("text-ignore-placement"),S.bucketInstanceId,Ys&&Ys.box&&ks?ks:cn,ge.ID),Gr&&Aa&&this.collisionIndex.insertCollisionBox(Aa.box,Qe,P.get("icon-ignore-placement"),S.bucketInstanceId,pl,ge.ID),Vn&&(oi&&this.collisionIndex.insertCollisionCircles(Vn.circles,Ae,P.get("text-ignore-placement"),S.bucketInstanceId,cn,ge.ID),v)){let go=S.bucketInstanceId,Xs=this.collisionCircleArrays[go];Xs===void 0&&(Xs=this.collisionCircleArrays[go]=new ft);for(let jn=0;jn=0;--mr){let ir=Ft[mr];ci(S.symbolInstances.get(ir),S.collisionArrays[ir])}}else for(let Ft=l.symbolInstanceStart;Ft=0&&(l.text.placedSymbolArray.get(F).crossTileID=P>=0&&F!==P?0:v.crossTileID)}markUsedOrientation(l,A,v){let S=A===s.ai.horizontal||A===s.ai.horizontalOnly?A:0,P=A===s.ai.vertical?A:0,B=[v.leftJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.rightJustifiedTextSymbolIndex];for(let F of B)l.text.placedSymbolArray.get(F).placedOrientation=S;v.verticalPlacedTextSymbolIndex&&(l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation=P)}commit(l){this.commitTime=l,this.zoomAtLastRecencyCheck=this.transform.zoom;let A=this.prevPlacement,v=!1;this.prevZoomAdjustment=A?A.zoomAdjustment(this.transform.zoom):0;let S=A?A.symbolFadeChange(l):1,P=A?A.opacities:{},B=A?A.variableOffsets:{},F=A?A.placedOrientations:{};for(let U in this.placements){let H=this.placements[U],Y=P[U];Y?(this.opacities[U]=new je(Y,S,H.text,H.icon),v=v||H.text!==Y.text.placed||H.icon!==Y.icon.placed):(this.opacities[U]=new je(null,S,H.text,H.icon,H.skipFade),v=v||H.text||H.icon)}for(let U in P){let H=P[U];if(!this.opacities[U]){let Y=new je(H,S,!1,!1);Y.isHidden()||(this.opacities[U]=Y,v=v||H.text.placed||H.icon.placed)}}for(let U in B)this.variableOffsets[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.variableOffsets[U]=B[U]);for(let U in F)this.placedOrientations[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.placedOrientations[U]=F[U]);if(A&&A.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=A?A.lastPlacementChangeTime:l)}updateLayerOpacities(l,A){let v={};for(let S of A){let P=S.getBucket(l);P&&S.latestFeatureIndex&&l.id===P.layerIds[0]&&this.updateBucketOpacities(P,v,S.collisionBoxArray)}}updateBucketOpacities(l,A,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 S=l.layers[0],P=S.layout,B=new je(null,0,!1,!1,!0),F=P.get("text-allow-overlap"),U=P.get("icon-allow-overlap"),H=S._unevaluatedLayout.hasValue("text-variable-anchor")||S._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Y=P.get("text-rotation-alignment")==="map",X=P.get("text-pitch-alignment")==="map",se=P.get("icon-text-fit")!=="none",ge=new je(null,0,F&&(U||!l.hasIconData()||P.get("icon-optional")),U&&(F||!l.hasTextData()||P.get("text-optional")),!0);!l.collisionArrays&&v&&(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData())&&l.deserializeCollisionBoxes(v);let me=(we,Ae,ze)=>{for(let Qe=0;Qe0,tt=this.placedOrientations[Ae.crossTileID],dt=tt===s.ai.vertical,vt=tt===s.ai.horizontal||tt===s.ai.horizontalOnly;if(ze>0||Qe>0){let gt=ss(Ve.text);me(l.text,ze,dt?ua:gt),me(l.text,Qe,vt?ua:gt);let Mt=Ve.text.isHidden();[Ae.rightJustifiedTextSymbolIndex,Ae.centerJustifiedTextSymbolIndex,Ae.leftJustifiedTextSymbolIndex].forEach(Ft=>{Ft>=0&&(l.text.placedSymbolArray.get(Ft).hidden=Mt||dt?1:0)}),Ae.verticalPlacedTextSymbolIndex>=0&&(l.text.placedSymbolArray.get(Ae.verticalPlacedTextSymbolIndex).hidden=Mt||vt?1:0);let rr=this.variableOffsets[Ae.crossTileID];rr&&this.markUsedJustification(l,rr.anchor,Ae,tt);let ci=this.placedOrientations[Ae.crossTileID];ci&&(this.markUsedJustification(l,"left",Ae,ci),this.markUsedOrientation(l,ci,Ae))}if(it){let gt=ss(Ve.icon),Mt=!(se&&Ae.verticalPlacedIconSymbolIndex&&dt);Ae.placedIconSymbolIndex>=0&&(me(l.icon,Ae.numIconVertices,Mt?gt:ua),l.icon.placedSymbolArray.get(Ae.placedIconSymbolIndex).hidden=Ve.icon.isHidden()),Ae.verticalPlacedIconSymbolIndex>=0&&(me(l.icon,Ae.numVerticalIconVertices,Mt?ua:gt),l.icon.placedSymbolArray.get(Ae.verticalPlacedIconSymbolIndex).hidden=Ve.icon.isHidden())}if(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData()){let gt=l.collisionArrays[we];if(gt){let Mt=new s.P(0,0);if(gt.textBox||gt.verticalTextBox){let ci=!0;if(H){let Ft=this.variableOffsets[Me];Ft?(Mt=Sr(Ft.anchor,Ft.width,Ft.height,Ft.textOffset,Ft.textBoxScale),Y&&Mt._rotate(X?this.transform.angle:-this.transform.angle)):ci=!1}gt.textBox&&Cr(l.textCollisionBox.collisionVertexArray,Ve.text.placed,!ci||dt,Mt.x,Mt.y),gt.verticalTextBox&&Cr(l.textCollisionBox.collisionVertexArray,Ve.text.placed,!ci||vt,Mt.x,Mt.y)}let rr=!!(!vt&>.verticalIconBox);gt.iconBox&&Cr(l.iconCollisionBox.collisionVertexArray,Ve.icon.placed,rr,se?Mt.x:0,se?Mt.y:0),gt.verticalIconBox&&Cr(l.iconCollisionBox.collisionVertexArray,Ve.icon.placed,!rr,se?Mt.x:0,se?Mt.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 we=this.collisionCircleArrays[l.bucketInstanceId];l.placementInvProjMatrix=we.invProjMatrix,l.placementViewportMatrix=we.viewportMatrix,l.collisionCircleArray=we.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 Cr(E,l,A,v,S){E.emplaceBack(l?1:0,A?1:0,v||0,S||0),E.emplaceBack(l?1:0,A?1:0,v||0,S||0),E.emplaceBack(l?1:0,A?1:0,v||0,S||0),E.emplaceBack(l?1:0,A?1:0,v||0,S||0)}let Ii=Math.pow(2,25),ji=Math.pow(2,24),pi=Math.pow(2,17),Xr=Math.pow(2,16),Zn=Math.pow(2,9),Ni=Math.pow(2,8),Tn=Math.pow(2,1);function ss(E){if(E.opacity===0&&!E.placed)return 0;if(E.opacity===1&&E.placed)return 4294967295;let l=E.placed?1:0,A=Math.floor(127*E.opacity);return A*Ii+l*ji+A*pi+l*Xr+A*Zn+l*Ni+A*Tn+l}let ua=0;class W0{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,A,v,S,P){let B=this._bucketParts;for(;this._currentTileIndexF.sortKey-U.sortKey));this._currentPartIndex!this._forceFullPlacement&&s.h.now()-S>2;for(;this._currentPlacementIndex>=0;){let B=A[l[this._currentPlacementIndex]],F=this.placement.collisionIndex.transform.zoom;if(B.type==="symbol"&&(!B.minzoom||B.minzoom<=F)&&(!B.maxzoom||B.maxzoom>F)){if(this._inProgressLayer||(this._inProgressLayer=new W0(B)),this._inProgressLayer.continuePlacement(v[B.source],this.placement,this._showCollisionBoxes,B,P))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(l){return this.placement.commit(l),this.placement}}let Cs=512/s.N/2;class _h{constructor(l,A,v){this.tileID=l,this.bucketInstanceId=v,this._symbolsByKey={};let S=new Map;for(let P=0;P({x:Math.floor(U.anchorX*Cs),y:Math.floor(U.anchorY*Cs)})),crossTileIDs:B.map(U=>U.crossTileID)};if(F.positions.length>128){let U=new s.av(F.positions.length,16,Uint16Array);for(let{x:H,y:Y}of F.positions)U.add(H,Y);U.finish(),delete F.positions,F.index=U}this._symbolsByKey[P]=F}}getScaledCoordinates(l,A){let{x:v,y:S,z:P}=this.tileID.canonical,{x:B,y:F,z:U}=A.canonical,H=Cs/Math.pow(2,U-P),Y=(F*s.N+l.anchorY)*H,X=S*s.N*Cs;return{x:Math.floor((B*s.N+l.anchorX)*H-v*s.N*Cs),y:Math.floor(Y-X)}}findMatches(l,A,v){let S=this.tileID.canonical.zl)}}class _i{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Fa{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(l){let A=Math.round((l-this.lng)/360);if(A!==0)for(let v in this.indexes){let S=this.indexes[v],P={};for(let B in S){let F=S[B];F.tileID=F.tileID.unwrapTo(F.tileID.wrap+A),P[F.tileID.key]=F}this.indexes[v]=P}this.lng=l}addBucket(l,A,v){if(this.indexes[l.overscaledZ]&&this.indexes[l.overscaledZ][l.key]){if(this.indexes[l.overscaledZ][l.key].bucketInstanceId===A.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(l.overscaledZ,this.indexes[l.overscaledZ][l.key])}for(let P=0;Pl.overscaledZ)for(let F in B){let U=B[F];U.tileID.isChildOf(l)&&U.findMatches(A.symbolInstances,l,S)}else{let F=B[l.scaledTo(Number(P)).key];F&&F.findMatches(A.symbolInstances,l,S)}}for(let P=0;P{A[v]=!0});for(let v in this.layerIndexes)A[v]||delete this.layerIndexes[v]}}let An=(E,l)=>s.x(E,l&&l.filter(A=>A.identifier!=="source.canvas")),Fn=s.F(s.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),H0=s.F(s.ax,["setCenter","setZoom","setBearing","setPitch"]),$o=s.aw();class Yn extends s.E{constructor(l,A={}){super(),this.map=l,this.dispatcher=new Nl(Io(),this,l._getMapId()),this.imageManager=new et,this.imageManager.setEventedParent(this),this.glyphManager=new Ar(l._requestManager,A.localIdeographFontFamily),this.lineAtlas=new $s(256,512),this.crossTileSymbolIndex=new Dc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new s.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",s.az());let v=this;this._rtlTextPluginCallback=Yn.registerForPluginStateChange(S=>{v.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:S.pluginStatus,pluginURL:S.pluginURL},(P,B)=>{if(s.aA(P),B&&B.every(F=>F))for(let F in v.sourceCaches){let U=v.sourceCaches[F].getSource().type;U!=="vector"&&U!=="geojson"||v.sourceCaches[F].reload()}})}),this.on("data",S=>{if(S.dataType!=="source"||S.sourceDataType!=="metadata")return;let P=this.sourceCaches[S.sourceId];if(!P)return;let B=P.getSource();if(B&&B.vectorLayerIds)for(let F in this._layers){let U=this._layers[F];U.source===B.id&&this._validateLayer(U)}})}loadURL(l,A={},v){this.fire(new s.k("dataloading",{dataType:"style"})),A.validate=typeof A.validate!="boolean"||A.validate;let S=this.map._requestManager.transformRequest(l,$.Style);this._request=s.f(S,(P,B)=>{this._request=null,P?this.fire(new s.j(P)):B&&this._load(B,A,v)})}loadJSON(l,A={},v){this.fire(new s.k("dataloading",{dataType:"style"})),this._request=s.h.frame(()=>{this._request=null,A.validate=A.validate!==!1,this._load(l,A,v)})}loadEmpty(){this.fire(new s.k("dataloading",{dataType:"style"})),this._load($o,{validate:!1})}_load(l,A,v){var S;let P=A.transformStyle?A.transformStyle(v,l):l;if(!A.validate||!An(this,s.y(P))){this._loaded=!0,this.stylesheet=P;for(let B in P.sources)this.addSource(B,P.sources[B],{validate:!1});P.sprite?this._loadSprite(P.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(P.glyphs),this._createLayers(),this.light=new fo(this.stylesheet.light),this.map.setTerrain((S=this.stylesheet.terrain)!==null&&S!==void 0?S:null),this.fire(new s.k("data",{dataType:"style"})),this.fire(new s.k("style.load"))}}_createLayers(){let l=s.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",l),this._order=l.map(A=>A.id),this._layers={},this._serializedLayers=null;for(let A of l){let v=s.aC(A);v.setEventedParent(this,{layer:{id:A.id}}),this._layers[A.id]=v}}_loadSprite(l,A=!1,v=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(S,P,B,F){let U=Re(S),H=U.length,Y=B>1?"@2x":"",X={},se={},ge={};for(let{id:me,url:we}of U){let Ae=P.transformRequest(P.normalizeSpriteURL(we,Y,".json"),$.SpriteJSON),ze=`${me}_${Ae.url}`;X[ze]=s.f(Ae,(Ve,it)=>{delete X[ze],se[me]=it,Ze(F,se,ge,Ve,H)});let Qe=P.transformRequest(P.normalizeSpriteURL(we,Y,".png"),$.SpriteImage),Me=`${me}_${Qe.url}`;X[Me]=V.getImage(Qe,(Ve,it)=>{delete X[Me],ge[me]=it,Ze(F,se,ge,Ve,H)})}return{cancel(){for(let me of Object.values(X))me.cancel()}}}(l,this.map._requestManager,this.map.getPixelRatio(),(S,P)=>{if(this._spriteRequest=null,S)this.fire(new s.j(S));else if(P)for(let B in P){this._spritesImagesIds[B]=[];let F=this._spritesImagesIds[B]?this._spritesImagesIds[B].filter(U=>!(U in P)):[];for(let U of F)this.imageManager.removeImage(U),this._changedImages[U]=!0;for(let U in P[B]){let H=B==="default"?U:`${B}:${U}`;this._spritesImagesIds[B].push(H),H in this.imageManager.images?this.imageManager.updateImage(H,P[B][U],!1):this.imageManager.addImage(H,P[B][U]),A&&(this._changedImages[H]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),A&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new s.k("data",{dataType:"style"})),v&&v(S)})}_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 A=this.sourceCaches[l.source];if(!A)return;let v=l.sourceLayer;if(!v)return;let S=A.getSource();(S.type==="geojson"||S.vectorLayerIds&&S.vectorLayerIds.indexOf(v)===-1)&&this.fire(new s.j(new Error(`Source layer "${v}" does not exist on source "${S.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 A=this._serializedAllLayers();if(!l||l.length===0)return Object.values(A);let v=[];for(let S of l)A[S]&&v.push(A[S]);return v}_serializedAllLayers(){let l=this._serializedLayers;if(l)return l;l=this._serializedLayers={};let A=Object.keys(this._layers);for(let v of A){let S=this._layers[v];S.type!=="custom"&&(l[v]=S.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 A=this._changed;if(this._changed){let S=Object.keys(this._updatedLayers),P=Object.keys(this._removedLayers);(S.length||P.length)&&this._updateWorkerLayers(S,P);for(let B in this._updatedSources){let F=this._updatedSources[B];if(F==="reload")this._reloadSource(B);else{if(F!=="clear")throw new Error(`Invalid action ${F}`);this._clearSource(B)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let B in this._updatedPaintProps)this._layers[B].updateTransitions(l);this.light.updateTransitions(l),this._resetUpdates()}let v={};for(let S in this.sourceCaches){let P=this.sourceCaches[S];v[S]=P.used,P.used=!1}for(let S of this._order){let P=this._layers[S];P.recalculate(l,this._availableImages),!P.isHidden(l.zoom)&&P.source&&(this.sourceCaches[P.source].used=!0)}for(let S in v){let P=this.sourceCaches[S];v[S]!==P.used&&P.fire(new s.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:S}))}this.light.recalculate(l),this.z=l.zoom,A&&this.fire(new s.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let l=Object.keys(this._changedImages);if(l.length){for(let A in this.sourceCaches)this.sourceCaches[A].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,A){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(l),removedIds:A})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(l,A={}){this._checkLoaded();let v=this.serialize();if(l=A.transformStyle?A.transformStyle(v,l):l,An(this,s.y(l)))return!1;(l=s.aD(l)).layers=s.aB(l.layers);let S=s.aE(v,l).filter(B=>!(B.command in H0));if(S.length===0)return!1;let P=S.filter(B=>!(B.command in Fn));if(P.length>0)throw new Error(`Unimplemented: ${P.map(B=>B.command).join(", ")}.`);for(let B of S)B.command!=="setTransition"&&this[B.command].apply(this,B.args);return this.stylesheet=l,this._serializedLayers=null,!0}addImage(l,A){if(this.getImage(l))return this.fire(new s.j(new Error(`An image named "${l}" already exists.`)));this.imageManager.addImage(l,A),this._afterImageUpdated(l)}updateImage(l,A){this.imageManager.updateImage(l,A)}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,A,v={}){if(this._checkLoaded(),this.sourceCaches[l]!==void 0)throw new Error(`Source "${l}" already exists.`);if(!A.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(A).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(A.type)>=0&&this._validate(s.y.source,`sources.${l}`,A,null,v))return;this.map&&this.map._collectResourceTiming&&(A.collectResourceTiming=!0);let S=this.sourceCaches[l]=new ds(l,A,this.dispatcher);S.style=this,S.setEventedParent(this,()=>({isSourceLoaded:S.loaded(),source:S.serialize(),sourceId:l})),S.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 A=this.sourceCaches[l];delete this.sourceCaches[l],delete this._updatedSources[l],A.fire(new s.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:l})),A.setEventedParent(null),A.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(l,A){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(A),this._changed=!0}getSource(l){return this.sourceCaches[l]&&this.sourceCaches[l].getSource()}addLayer(l,A,v={}){this._checkLoaded();let S=l.id;if(this.getLayer(S))return void this.fire(new s.j(new Error(`Layer "${S}" already exists on this map.`)));let P;if(l.type==="custom"){if(An(this,s.aF(l)))return;P=s.aC(l)}else{if("source"in l&&typeof l.source=="object"&&(this.addSource(S,l.source),l=s.aD(l),l=s.e(l,{source:S})),this._validate(s.y.layer,`layers.${S}`,l,{arrayIndex:-1},v))return;P=s.aC(l),this._validateLayer(P),P.setEventedParent(this,{layer:{id:S}})}let B=A?this._order.indexOf(A):this._order.length;if(A&&B===-1)this.fire(new s.j(new Error(`Cannot add layer "${S}" before non-existing layer "${A}".`)));else{if(this._order.splice(B,0,S),this._layerOrderChanged=!0,this._layers[S]=P,this._removedLayers[S]&&P.source&&P.type!=="custom"){let F=this._removedLayers[S];delete this._removedLayers[S],F.type!==P.type?this._updatedSources[P.source]="clear":(this._updatedSources[P.source]="reload",this.sourceCaches[P.source].pause())}this._updateLayer(P),P.onAdd&&P.onAdd(this.map)}}moveLayer(l,A){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===A)return;let v=this._order.indexOf(l);this._order.splice(v,1);let S=A?this._order.indexOf(A):this._order.length;A&&S===-1?this.fire(new s.j(new Error(`Cannot move layer "${l}" before non-existing layer "${A}".`))):(this._order.splice(S,0,l),this._layerOrderChanged=!0)}removeLayer(l){this._checkLoaded();let A=this._layers[l];if(!A)return void this.fire(new s.j(new Error(`Cannot remove non-existing layer "${l}".`)));A.setEventedParent(null);let v=this._order.indexOf(l);this._order.splice(v,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[l]=A,delete this._layers[l],this._serializedLayers&&delete this._serializedLayers[l],delete this._updatedLayers[l],delete this._updatedPaintProps[l],A.onRemove&&A.onRemove(this.map)}getLayer(l){return this._layers[l]}getLayersOrder(){return[...this._order]}hasLayer(l){return l in this._layers}setLayerZoomRange(l,A,v){this._checkLoaded();let S=this.getLayer(l);S?S.minzoom===A&&S.maxzoom===v||(A!=null&&(S.minzoom=A),v!=null&&(S.maxzoom=v),this._updateLayer(S)):this.fire(new s.j(new Error(`Cannot set the zoom range of non-existing layer "${l}".`)))}setFilter(l,A,v={}){this._checkLoaded();let S=this.getLayer(l);if(S){if(!s.aG(S.filter,A))return A==null?(S.filter=void 0,void this._updateLayer(S)):void(this._validate(s.y.filter,`layers.${S.id}.filter`,A,null,v)||(S.filter=s.aD(A),this._updateLayer(S)))}else this.fire(new s.j(new Error(`Cannot filter non-existing layer "${l}".`)))}getFilter(l){return s.aD(this.getLayer(l).filter)}setLayoutProperty(l,A,v,S={}){this._checkLoaded();let P=this.getLayer(l);P?s.aG(P.getLayoutProperty(A),v)||(P.setLayoutProperty(A,v,S),this._updateLayer(P)):this.fire(new s.j(new Error(`Cannot style non-existing layer "${l}".`)))}getLayoutProperty(l,A){let v=this.getLayer(l);if(v)return v.getLayoutProperty(A);this.fire(new s.j(new Error(`Cannot get style of non-existing layer "${l}".`)))}setPaintProperty(l,A,v,S={}){this._checkLoaded();let P=this.getLayer(l);P?s.aG(P.getPaintProperty(A),v)||(P.setPaintProperty(A,v,S)&&this._updateLayer(P),this._changed=!0,this._updatedPaintProps[l]=!0):this.fire(new s.j(new Error(`Cannot style non-existing layer "${l}".`)))}getPaintProperty(l,A){return this.getLayer(l).getPaintProperty(A)}setFeatureState(l,A){this._checkLoaded();let v=l.source,S=l.sourceLayer,P=this.sourceCaches[v];if(P===void 0)return void this.fire(new s.j(new Error(`The source '${v}' does not exist in the map's style.`)));let B=P.getSource().type;B==="geojson"&&S?this.fire(new s.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):B!=="vector"||S?(l.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),P.setFeatureState(S,l.id,A)):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(l,A){this._checkLoaded();let v=l.source,S=this.sourceCaches[v];if(S===void 0)return void this.fire(new s.j(new Error(`The source '${v}' does not exist in the map's style.`)));let P=S.getSource().type,B=P==="vector"?l.sourceLayer:void 0;P!=="vector"||B?A&&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."))):S.removeFeatureState(B,l.id,A):this.fire(new s.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(l){this._checkLoaded();let A=l.source,v=l.sourceLayer,S=this.sourceCaches[A];if(S!==void 0)return S.getSource().type!=="vector"||v?(l.id===void 0&&this.fire(new s.j(new Error("The feature id parameter must be provided."))),S.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 '${A}' 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.aH(this.sourceCaches,P=>P.serialize()),A=this._serializeByIds(this._order),v=this.map.getTerrain()||void 0,S=this.stylesheet;return s.aI({version:S.version,name:S.name,metadata:S.metadata,light:S.light,center:S.center,zoom:S.zoom,bearing:S.bearing,pitch:S.pitch,sprite:S.sprite,glyphs:S.glyphs,transition:S.transition,sources:l,layers:A,terrain:v},P=>P!==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 A=B=>this._layers[B].type==="fill-extrusion",v={},S=[];for(let B=this._order.length-1;B>=0;B--){let F=this._order[B];if(A(F)){v[F]=B;for(let U of l){let H=U[F];if(H)for(let Y of H)S.push(Y)}}}S.sort((B,F)=>F.intersectionZ-B.intersectionZ);let P=[];for(let B=this._order.length-1;B>=0;B--){let F=this._order[B];if(A(F))for(let U=S.length-1;U>=0;U--){let H=S[U].feature;if(v[H.layer.id]{let vt=ze.featureSortOrder;if(vt){let gt=vt.indexOf(tt.featureIndex);return vt.indexOf(dt.featureIndex)-gt}return dt.featureIndex-tt.featureIndex});for(let tt of it)Ve.push(tt)}}for(let ze in me)me[ze].forEach(Qe=>{let Me=Qe.feature,Ve=H[F[ze].source].getFeatureState(Me.layer["source-layer"],Me.id);Me.source=Me.layer.source,Me.layer["source-layer"]&&(Me.sourceLayer=Me.layer["source-layer"]),Me.state=Ve});return me}(this._layers,B,this.sourceCaches,l,A,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(P)}querySourceFeatures(l,A){A&&A.filter&&this._validate(s.y.filter,"querySourceFeatures.filter",A.filter,null,A);let v=this.sourceCaches[l];return v?function(S,P){let B=S.getRenderableIds().map(H=>S.getTileByID(H)),F=[],U={};for(let H=0;H{cl[S]=P})(l,A),A.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:l,url:A.workerSourceURL},v):v(null,null))}getLight(){return this.light.getLight()}setLight(l,A={}){this._checkLoaded();let v=this.light.getLight(),S=!1;for(let B in l)if(!s.aG(l[B],v[B])){S=!0;break}if(!S)return;let P={now:s.h.now(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(l,A),this.light.updateTransitions(P)}_validate(l,A,v,S,P={}){return(!P||P.validate!==!1)&&An(this,l.call(s.y,s.e({key:A,style:this.serialize(),value:v,styleSpec:s.v},S)))}_remove(l=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(let A in this._layers)this._layers[A].setEventedParent(null);for(let A in this.sourceCaches){let v=this.sourceCaches[A];v.setEventedParent(null),v.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(l)}_clearSource(l){this.sourceCaches[l].clearTiles()}_reloadSource(l){this.sourceCaches[l].resume(),this.sourceCaches[l].reload()}_updateSources(l){for(let A in this.sourceCaches)this.sourceCaches[A].update(l,this.map.terrain)}_generateCollisionBoxes(){for(let l in this.sourceCaches)this._reloadSource(l)}_updatePlacement(l,A,v,S,P=!1){let B=!1,F=!1,U={};for(let H of this._order){let Y=this._layers[H];if(Y.type!=="symbol")continue;if(!U[Y.source]){let se=this.sourceCaches[Y.source];U[Y.source]=se.getRenderableIds(!0).map(ge=>se.getTileByID(ge)).sort((ge,me)=>me.tileID.overscaledZ-ge.tileID.overscaledZ||(ge.tileID.isLessThan(me.tileID)?-1:1))}let X=this.crossTileSymbolIndex.addLayer(Y,U[Y.source],l.center.lng);B=B||X}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((P=P||this._layerOrderChanged||v===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.h.now(),l.zoom))&&(this.pauseablePlacement=new Vl(l,this.map.terrain,this._order,P,A,v,S,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(s.h.now()),F=!0),B&&this.pauseablePlacement.placement.setStale()),F||B)for(let H of this._order){let Y=this._layers[H];Y.type==="symbol"&&this.placement.updateLayerOpacities(Y,U[Y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.h.now())}_releaseSymbolFadeTiles(){for(let l in this.sourceCaches)this.sourceCaches[l].releaseSymbolFadeTiles()}getImages(l,A,v){this.imageManager.getImages(A.icons,v),this._updateTilesForChangedImages();let S=this.sourceCaches[A.source];S&&S.setDependencies(A.tileID.key,A.type,A.icons)}getGlyphs(l,A,v){this.glyphManager.getGlyphs(A.stacks,v);let S=this.sourceCaches[A.source];S&&S.setDependencies(A.tileID.key,A.type,[""])}getResource(l,A,v){return s.m(A,v)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(l,A={}){this._checkLoaded(),l&&this._validate(s.y.glyphs,"glyphs",l,null,A)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=l,this.glyphManager.entries={},this.glyphManager.setURL(l))}addSprite(l,A,v={},S){this._checkLoaded();let P=[{id:l,url:A}],B=[...Re(this.stylesheet.sprite),...P];this._validate(s.y.sprite,"sprite",B,null,v)||(this.stylesheet.sprite=B,this._loadSprite(P,!0,S))}removeSprite(l){this._checkLoaded();let A=Re(this.stylesheet.sprite);if(A.find(v=>v.id===l)){if(this._spritesImagesIds[l])for(let v of this._spritesImagesIds[l])this.imageManager.removeImage(v),this._changedImages[v]=!0;A.splice(A.findIndex(v=>v.id===l),1),this.stylesheet.sprite=A.length>0?A: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 Re(this.stylesheet.sprite)}setSprite(l,A={},v){this._checkLoaded(),l&&this._validate(s.y.sprite,"sprite",l,null,A)||(this.stylesheet.sprite=l,l?this._loadSprite(l,!0,v):(this._unloadSprite(),v&&v(null)))}}Yn.registerForPluginStateChange=s.aK;var mo=s.Q([{name:"a_pos",type:"Int16",components:2}]),jl="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 an={prelude:Ti(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}`),background:Ti(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Ti(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Ti(`varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ti("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:Ti(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Ti(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Ti("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:Ti("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:Ti("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:Ti(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Ti(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Ti(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Ti(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Ti(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Ti(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Ti(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ti(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Ti(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:Ti(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:Ti(`#ifdef GL_ES +precision highp float; +#endif +uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ti(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Ti(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Ti(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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:Ti(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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:Ti(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`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; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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:Ti("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",jl),terrainDepth:Ti("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);}",jl),terrainCoords:Ti("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);}",jl)};function Ti(E,l){let A=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,v=l.match(/attribute ([\w]+) ([\w]+)/g),S=E.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),P=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),B=P?P.concat(S):S,F={};return{fragmentSource:E=E.replace(A,(U,H,Y,X,se)=>(F[se]=!0,H==="define"?` +#ifndef HAS_UNIFORM_u_${se} +varying ${Y} ${X} ${se}; +#else +uniform ${Y} ${X} u_${se}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${se} + ${Y} ${X} ${se} = u_${se}; +#endif +`)),vertexSource:l=l.replace(A,(U,H,Y,X,se)=>{let ge=X==="float"?"vec2":"vec4",me=se.match(/color/)?"color":ge;return F[se]?H==="define"?` +#ifndef HAS_UNIFORM_u_${se} +uniform lowp float u_${se}_t; +attribute ${Y} ${ge} a_${se}; +varying ${Y} ${X} ${se}; +#else +uniform ${Y} ${X} u_${se}; +#endif +`:me==="vec4"?` +#ifndef HAS_UNIFORM_u_${se} + ${se} = a_${se}; +#else + ${Y} ${X} ${se} = u_${se}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${se} + ${se} = unpack_mix_${me}(a_${se}, u_${se}_t); +#else + ${Y} ${X} ${se} = u_${se}; +#endif +`:H==="define"?` +#ifndef HAS_UNIFORM_u_${se} +uniform lowp float u_${se}_t; +attribute ${Y} ${ge} a_${se}; +#else +uniform ${Y} ${X} u_${se}; +#endif +`:me==="vec4"?` +#ifndef HAS_UNIFORM_u_${se} + ${Y} ${X} ${se} = a_${se}; +#else + ${Y} ${X} ${se} = u_${se}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${se} + ${Y} ${X} ${se} = unpack_mix_${me}(a_${se}, u_${se}_t); +#else + ${Y} ${X} ${se} = u_${se}; +#endif +`}),staticAttributes:v,staticUniforms:B}}class Wl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(l,A,v,S,P,B,F,U,H){this.context=l;let Y=this.boundPaintVertexBuffers.length!==S.length;for(let X=0;!Y&&X({u_depth:new s.aL(tt,dt.u_depth),u_terrain:new s.aL(tt,dt.u_terrain),u_terrain_dim:new s.aM(tt,dt.u_terrain_dim),u_terrain_matrix:new s.aN(tt,dt.u_terrain_matrix),u_terrain_unpack:new s.aO(tt,dt.u_terrain_unpack),u_terrain_exaggeration:new s.aM(tt,dt.u_terrain_exaggeration)}))(l,it),this.binderUniforms=v?v.getUniforms(l,it):[]}draw(l,A,v,S,P,B,F,U,H,Y,X,se,ge,me,we,Ae,ze,Qe){let Me=l.gl;if(this.failedToCreate)return;if(l.program.set(this.program),l.setDepthMode(v),l.setStencilMode(S),l.setColorMode(P),l.setCullFace(B),U){l.activeTexture.set(Me.TEXTURE2),Me.bindTexture(Me.TEXTURE_2D,U.depthTexture),l.activeTexture.set(Me.TEXTURE3),Me.bindTexture(Me.TEXTURE_2D,U.texture);for(let it in this.terrainUniforms)this.terrainUniforms[it].set(U[it])}for(let it in this.fixedUniforms)this.fixedUniforms[it].set(F[it]);we&&we.setUniforms(l,this.binderUniforms,ge,{zoom:me});let Ve=0;switch(A){case Me.LINES:Ve=2;break;case Me.TRIANGLES:Ve=3;break;case Me.LINE_STRIP:Ve=1}for(let it of se.get()){let tt=it.vaos||(it.vaos={});(tt[H]||(tt[H]=new Wl)).bind(l,this,Y,we?we.getPaintVertexBuffers():[],X,it.vertexOffset,Ae,ze,Qe),Me.drawElements(A,it.primitiveLength*Ve,Me.UNSIGNED_SHORT,it.primitiveOffset*Ve*2)}}}function os(E,l,A){let v=1/Be(A,1,l.transform.tileZoom),S=Math.pow(2,A.tileID.overscaledZ),P=A.tileSize*Math.pow(2,l.transform.tileZoom)/S,B=P*(A.tileID.canonical.x+A.tileID.wrap*S),F=P*A.tileID.canonical.y;return{u_image:0,u_texsize:A.imageAtlasTexture.size,u_scale:[v,E.fromScale,E.toScale],u_fade:E.t,u_pixel_coord_upper:[B>>16,F>>16],u_pixel_coord_lower:[65535&B,65535&F]}}let Zp=(E,l,A,v)=>{let S=l.style.light,P=S.properties.get("position"),B=[P.x,P.y,P.z],F=function(){var H=new s.A(9);return s.A!=Float32Array&&(H[1]=0,H[2]=0,H[3]=0,H[5]=0,H[6]=0,H[7]=0),H[0]=1,H[4]=1,H[8]=1,H}();S.properties.get("anchor")==="viewport"&&function(H,Y){var X=Math.sin(Y),se=Math.cos(Y);H[0]=se,H[1]=X,H[2]=0,H[3]=-X,H[4]=se,H[5]=0,H[6]=0,H[7]=0,H[8]=1}(F,-l.transform.angle),function(H,Y,X){var se=Y[0],ge=Y[1],me=Y[2];H[0]=se*X[0]+ge*X[3]+me*X[6],H[1]=se*X[1]+ge*X[4]+me*X[7],H[2]=se*X[2]+ge*X[5]+me*X[8]}(B,B,F);let U=S.properties.get("color");return{u_matrix:E,u_lightpos:B,u_lightintensity:S.properties.get("intensity"),u_lightcolor:[U.r,U.g,U.b],u_vertical_gradient:+A,u_opacity:v}},Hl=(E,l,A,v,S,P,B)=>s.e(Zp(E,l,A,v),os(P,l,B),{u_height_factor:-Math.pow(2,S.overscaledZ)/B.tileSize/8}),Ed=E=>({u_matrix:E}),Md=(E,l,A,v)=>s.e(Ed(E),os(A,l,v)),Pd=(E,l)=>({u_matrix:E,u_world:l}),Cd=(E,l,A,v,S)=>s.e(Md(E,l,A,v),{u_world:S}),le=(E,l,A,v)=>{let S=E.transform,P,B;if(v.paint.get("circle-pitch-alignment")==="map"){let F=Be(A,1,S.zoom);P=!0,B=[F,F]}else P=!1,B=S.pixelsToGLUnits;return{u_camera_to_center_distance:S.cameraToCenterDistance,u_scale_with_map:+(v.paint.get("circle-pitch-scale")==="map"),u_matrix:E.translatePosMatrix(l.posMatrix,A,v.paint.get("circle-translate"),v.paint.get("circle-translate-anchor")),u_pitch_with_map:+P,u_device_pixel_ratio:E.pixelRatio,u_extrude_scale:B}},pe=(E,l,A)=>{let v=Be(A,1,l.zoom),S=Math.pow(2,l.zoom-A.tileID.overscaledZ),P=A.tileID.overscaleFactor();return{u_matrix:E,u_camera_to_center_distance:l.cameraToCenterDistance,u_pixels_to_tile_units:v,u_extrude_scale:[l.pixelsToGLUnits[0]/(v*S),l.pixelsToGLUnits[1]/(v*S)],u_overscale_factor:P}},De=(E,l,A=1)=>({u_matrix:E,u_color:l,u_overlay:0,u_overlay_scale:A}),st=E=>({u_matrix:E}),St=(E,l,A,v)=>({u_matrix:E,u_extrude_scale:Be(l,1,A),u_intensity:v});function Jt(E,l){let A=Math.pow(2,l.canonical.z),v=l.canonical.y;return[new s.U(0,v/A).toLngLat().lat,new s.U(0,(v+1)/A).toLngLat().lat]}let li=(E,l,A,v)=>{let S=E.transform;return{u_matrix:$0(E,l,A,v),u_ratio:1/Be(l,1,S.zoom),u_device_pixel_ratio:E.pixelRatio,u_units_to_pixels:[1/S.pixelsToGLUnits[0],1/S.pixelsToGLUnits[1]]}},as=(E,l,A,v,S)=>s.e(li(E,l,A,S),{u_image:0,u_image_height:v}),Is=(E,l,A,v,S)=>{let P=E.transform,B=Na(l,P);return{u_matrix:$0(E,l,A,S),u_texsize:l.imageAtlasTexture.size,u_ratio:1/Be(l,1,P.zoom),u_device_pixel_ratio:E.pixelRatio,u_image:0,u_scale:[B,v.fromScale,v.toScale],u_fade:v.t,u_units_to_pixels:[1/P.pixelsToGLUnits[0],1/P.pixelsToGLUnits[1]]}},Zs=(E,l,A,v,S,P)=>{let B=E.lineAtlas,F=Na(l,E.transform),U=A.layout.get("line-cap")==="round",H=B.getDash(v.from,U),Y=B.getDash(v.to,U),X=H.width*S.fromScale,se=Y.width*S.toScale;return s.e(li(E,l,A,P),{u_patternscale_a:[F/X,-H.height/2],u_patternscale_b:[F/se,-Y.height/2],u_sdfgamma:B.width/(256*Math.min(X,se)*E.pixelRatio)/2,u_image:0,u_tex_y_a:H.y,u_tex_y_b:Y.y,u_mix:S.t})};function Na(E,l){return 1/Be(E,1,l.tileZoom)}function $0(E,l,A,v){return E.translatePosMatrix(v?v.posMatrix:l.tileID.posMatrix,l,A.paint.get("line-translate"),A.paint.get("line-translate-anchor"))}let Hx=(E,l,A,v,S)=>{return{u_matrix:E,u_tl_parent:l,u_scale_parent:A,u_buffer_scale:1,u_fade_t:v.mix,u_opacity:v.opacity*S.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:S.paint.get("raster-brightness-min"),u_brightness_high:S.paint.get("raster-brightness-max"),u_saturation_factor:(B=S.paint.get("raster-saturation"),B>0?1-1/(1.001-B):-B),u_contrast_factor:(P=S.paint.get("raster-contrast"),P>0?1/(1-P):1+P),u_spin_weights:$x(S.paint.get("raster-hue-rotate"))};var P,B};function $x(E){E*=Math.PI/180;let l=Math.sin(E),A=Math.cos(E);return[(2*A+1)/3,(-Math.sqrt(3)*l-A+1)/3,(Math.sqrt(3)*l-A+1)/3]}let u_=(E,l,A,v,S,P,B,F,U,H)=>{let Y=S.transform;return{u_is_size_zoom_constant:+(E==="constant"||E==="source"),u_is_size_feature_constant:+(E==="constant"||E==="camera"),u_size_t:l?l.uSizeT:0,u_size:l?l.uSize:0,u_camera_to_center_distance:Y.cameraToCenterDistance,u_pitch:Y.pitch/360*2*Math.PI,u_rotate_symbol:+A,u_aspect_ratio:Y.width/Y.height,u_fade_change:S.options.fadeDuration?S.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:B,u_coord_matrix:F,u_is_text:+U,u_pitch_with_map:+v,u_texsize:H,u_texture:0}},h_=(E,l,A,v,S,P,B,F,U,H,Y)=>{let X=S.transform;return s.e(u_(E,l,A,v,S,P,B,F,U,H),{u_gamma_scale:v?Math.cos(X._pitch)*X.cameraToCenterDistance:1,u_device_pixel_ratio:S.pixelRatio,u_is_halo:+Y})},yf=(E,l,A,v,S,P,B,F,U,H)=>s.e(h_(E,l,A,v,S,P,B,F,!0,U,!0),{u_texsize_icon:H,u_texture_icon:1}),q0=(E,l,A)=>({u_matrix:E,u_opacity:l,u_color:A}),fl=(E,l,A,v,S,P)=>s.e(function(B,F,U,H){let Y=U.imageManager.getPattern(B.from.toString()),X=U.imageManager.getPattern(B.to.toString()),{width:se,height:ge}=U.imageManager.getPixelSize(),me=Math.pow(2,H.tileID.overscaledZ),we=H.tileSize*Math.pow(2,U.transform.tileZoom)/me,Ae=we*(H.tileID.canonical.x+H.tileID.wrap*me),ze=we*H.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Y.tl,u_pattern_br_a:Y.br,u_pattern_tl_b:X.tl,u_pattern_br_b:X.br,u_texsize:[se,ge],u_mix:F.t,u_pattern_size_a:Y.displaySize,u_pattern_size_b:X.displaySize,u_scale_a:F.fromScale,u_scale_b:F.toScale,u_tile_units_to_pixels:1/Be(H,1,U.transform.tileZoom),u_pixel_coord_upper:[Ae>>16,ze>>16],u_pixel_coord_lower:[65535&Ae,65535&ze]}}(v,P,A,S),{u_matrix:E,u_opacity:l}),G0={fillExtrusion:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_lightpos:new s.aP(E,l.u_lightpos),u_lightintensity:new s.aM(E,l.u_lightintensity),u_lightcolor:new s.aP(E,l.u_lightcolor),u_vertical_gradient:new s.aM(E,l.u_vertical_gradient),u_opacity:new s.aM(E,l.u_opacity)}),fillExtrusionPattern:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_lightpos:new s.aP(E,l.u_lightpos),u_lightintensity:new s.aM(E,l.u_lightintensity),u_lightcolor:new s.aP(E,l.u_lightcolor),u_vertical_gradient:new s.aM(E,l.u_vertical_gradient),u_height_factor:new s.aM(E,l.u_height_factor),u_image:new s.aL(E,l.u_image),u_texsize:new s.aQ(E,l.u_texsize),u_pixel_coord_upper:new s.aQ(E,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aQ(E,l.u_pixel_coord_lower),u_scale:new s.aP(E,l.u_scale),u_fade:new s.aM(E,l.u_fade),u_opacity:new s.aM(E,l.u_opacity)}),fill:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix)}),fillPattern:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_image:new s.aL(E,l.u_image),u_texsize:new s.aQ(E,l.u_texsize),u_pixel_coord_upper:new s.aQ(E,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aQ(E,l.u_pixel_coord_lower),u_scale:new s.aP(E,l.u_scale),u_fade:new s.aM(E,l.u_fade)}),fillOutline:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_world:new s.aQ(E,l.u_world)}),fillOutlinePattern:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_world:new s.aQ(E,l.u_world),u_image:new s.aL(E,l.u_image),u_texsize:new s.aQ(E,l.u_texsize),u_pixel_coord_upper:new s.aQ(E,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aQ(E,l.u_pixel_coord_lower),u_scale:new s.aP(E,l.u_scale),u_fade:new s.aM(E,l.u_fade)}),circle:(E,l)=>({u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_scale_with_map:new s.aL(E,l.u_scale_with_map),u_pitch_with_map:new s.aL(E,l.u_pitch_with_map),u_extrude_scale:new s.aQ(E,l.u_extrude_scale),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_matrix:new s.aN(E,l.u_matrix)}),collisionBox:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_pixels_to_tile_units:new s.aM(E,l.u_pixels_to_tile_units),u_extrude_scale:new s.aQ(E,l.u_extrude_scale),u_overscale_factor:new s.aM(E,l.u_overscale_factor)}),collisionCircle:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_inv_matrix:new s.aN(E,l.u_inv_matrix),u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_viewport_size:new s.aQ(E,l.u_viewport_size)}),debug:(E,l)=>({u_color:new s.aR(E,l.u_color),u_matrix:new s.aN(E,l.u_matrix),u_overlay:new s.aL(E,l.u_overlay),u_overlay_scale:new s.aM(E,l.u_overlay_scale)}),clippingMask:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix)}),heatmap:(E,l)=>({u_extrude_scale:new s.aM(E,l.u_extrude_scale),u_intensity:new s.aM(E,l.u_intensity),u_matrix:new s.aN(E,l.u_matrix)}),heatmapTexture:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_world:new s.aQ(E,l.u_world),u_image:new s.aL(E,l.u_image),u_color_ramp:new s.aL(E,l.u_color_ramp),u_opacity:new s.aM(E,l.u_opacity)}),hillshade:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_image:new s.aL(E,l.u_image),u_latrange:new s.aQ(E,l.u_latrange),u_light:new s.aQ(E,l.u_light),u_shadow:new s.aR(E,l.u_shadow),u_highlight:new s.aR(E,l.u_highlight),u_accent:new s.aR(E,l.u_accent)}),hillshadePrepare:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_image:new s.aL(E,l.u_image),u_dimension:new s.aQ(E,l.u_dimension),u_zoom:new s.aM(E,l.u_zoom),u_unpack:new s.aO(E,l.u_unpack)}),line:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_ratio:new s.aM(E,l.u_ratio),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_units_to_pixels:new s.aQ(E,l.u_units_to_pixels)}),lineGradient:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_ratio:new s.aM(E,l.u_ratio),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_units_to_pixels:new s.aQ(E,l.u_units_to_pixels),u_image:new s.aL(E,l.u_image),u_image_height:new s.aM(E,l.u_image_height)}),linePattern:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_texsize:new s.aQ(E,l.u_texsize),u_ratio:new s.aM(E,l.u_ratio),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_image:new s.aL(E,l.u_image),u_units_to_pixels:new s.aQ(E,l.u_units_to_pixels),u_scale:new s.aP(E,l.u_scale),u_fade:new s.aM(E,l.u_fade)}),lineSDF:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_ratio:new s.aM(E,l.u_ratio),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_units_to_pixels:new s.aQ(E,l.u_units_to_pixels),u_patternscale_a:new s.aQ(E,l.u_patternscale_a),u_patternscale_b:new s.aQ(E,l.u_patternscale_b),u_sdfgamma:new s.aM(E,l.u_sdfgamma),u_image:new s.aL(E,l.u_image),u_tex_y_a:new s.aM(E,l.u_tex_y_a),u_tex_y_b:new s.aM(E,l.u_tex_y_b),u_mix:new s.aM(E,l.u_mix)}),raster:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_tl_parent:new s.aQ(E,l.u_tl_parent),u_scale_parent:new s.aM(E,l.u_scale_parent),u_buffer_scale:new s.aM(E,l.u_buffer_scale),u_fade_t:new s.aM(E,l.u_fade_t),u_opacity:new s.aM(E,l.u_opacity),u_image0:new s.aL(E,l.u_image0),u_image1:new s.aL(E,l.u_image1),u_brightness_low:new s.aM(E,l.u_brightness_low),u_brightness_high:new s.aM(E,l.u_brightness_high),u_saturation_factor:new s.aM(E,l.u_saturation_factor),u_contrast_factor:new s.aM(E,l.u_contrast_factor),u_spin_weights:new s.aP(E,l.u_spin_weights)}),symbolIcon:(E,l)=>({u_is_size_zoom_constant:new s.aL(E,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aL(E,l.u_is_size_feature_constant),u_size_t:new s.aM(E,l.u_size_t),u_size:new s.aM(E,l.u_size),u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_pitch:new s.aM(E,l.u_pitch),u_rotate_symbol:new s.aL(E,l.u_rotate_symbol),u_aspect_ratio:new s.aM(E,l.u_aspect_ratio),u_fade_change:new s.aM(E,l.u_fade_change),u_matrix:new s.aN(E,l.u_matrix),u_label_plane_matrix:new s.aN(E,l.u_label_plane_matrix),u_coord_matrix:new s.aN(E,l.u_coord_matrix),u_is_text:new s.aL(E,l.u_is_text),u_pitch_with_map:new s.aL(E,l.u_pitch_with_map),u_texsize:new s.aQ(E,l.u_texsize),u_texture:new s.aL(E,l.u_texture)}),symbolSDF:(E,l)=>({u_is_size_zoom_constant:new s.aL(E,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aL(E,l.u_is_size_feature_constant),u_size_t:new s.aM(E,l.u_size_t),u_size:new s.aM(E,l.u_size),u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_pitch:new s.aM(E,l.u_pitch),u_rotate_symbol:new s.aL(E,l.u_rotate_symbol),u_aspect_ratio:new s.aM(E,l.u_aspect_ratio),u_fade_change:new s.aM(E,l.u_fade_change),u_matrix:new s.aN(E,l.u_matrix),u_label_plane_matrix:new s.aN(E,l.u_label_plane_matrix),u_coord_matrix:new s.aN(E,l.u_coord_matrix),u_is_text:new s.aL(E,l.u_is_text),u_pitch_with_map:new s.aL(E,l.u_pitch_with_map),u_texsize:new s.aQ(E,l.u_texsize),u_texture:new s.aL(E,l.u_texture),u_gamma_scale:new s.aM(E,l.u_gamma_scale),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_is_halo:new s.aL(E,l.u_is_halo)}),symbolTextAndIcon:(E,l)=>({u_is_size_zoom_constant:new s.aL(E,l.u_is_size_zoom_constant),u_is_size_feature_constant:new s.aL(E,l.u_is_size_feature_constant),u_size_t:new s.aM(E,l.u_size_t),u_size:new s.aM(E,l.u_size),u_camera_to_center_distance:new s.aM(E,l.u_camera_to_center_distance),u_pitch:new s.aM(E,l.u_pitch),u_rotate_symbol:new s.aL(E,l.u_rotate_symbol),u_aspect_ratio:new s.aM(E,l.u_aspect_ratio),u_fade_change:new s.aM(E,l.u_fade_change),u_matrix:new s.aN(E,l.u_matrix),u_label_plane_matrix:new s.aN(E,l.u_label_plane_matrix),u_coord_matrix:new s.aN(E,l.u_coord_matrix),u_is_text:new s.aL(E,l.u_is_text),u_pitch_with_map:new s.aL(E,l.u_pitch_with_map),u_texsize:new s.aQ(E,l.u_texsize),u_texsize_icon:new s.aQ(E,l.u_texsize_icon),u_texture:new s.aL(E,l.u_texture),u_texture_icon:new s.aL(E,l.u_texture_icon),u_gamma_scale:new s.aM(E,l.u_gamma_scale),u_device_pixel_ratio:new s.aM(E,l.u_device_pixel_ratio),u_is_halo:new s.aL(E,l.u_is_halo)}),background:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_opacity:new s.aM(E,l.u_opacity),u_color:new s.aR(E,l.u_color)}),backgroundPattern:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_opacity:new s.aM(E,l.u_opacity),u_image:new s.aL(E,l.u_image),u_pattern_tl_a:new s.aQ(E,l.u_pattern_tl_a),u_pattern_br_a:new s.aQ(E,l.u_pattern_br_a),u_pattern_tl_b:new s.aQ(E,l.u_pattern_tl_b),u_pattern_br_b:new s.aQ(E,l.u_pattern_br_b),u_texsize:new s.aQ(E,l.u_texsize),u_mix:new s.aM(E,l.u_mix),u_pattern_size_a:new s.aQ(E,l.u_pattern_size_a),u_pattern_size_b:new s.aQ(E,l.u_pattern_size_b),u_scale_a:new s.aM(E,l.u_scale_a),u_scale_b:new s.aM(E,l.u_scale_b),u_pixel_coord_upper:new s.aQ(E,l.u_pixel_coord_upper),u_pixel_coord_lower:new s.aQ(E,l.u_pixel_coord_lower),u_tile_units_to_pixels:new s.aM(E,l.u_tile_units_to_pixels)}),terrain:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_texture:new s.aL(E,l.u_texture),u_ele_delta:new s.aM(E,l.u_ele_delta)}),terrainDepth:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_ele_delta:new s.aM(E,l.u_ele_delta)}),terrainCoords:(E,l)=>({u_matrix:new s.aN(E,l.u_matrix),u_texture:new s.aL(E,l.u_texture),u_terrain_coords_id:new s.aM(E,l.u_terrain_coords_id),u_ele_delta:new s.aM(E,l.u_ele_delta)})};class Z0{constructor(l,A,v){this.context=l;let S=l.gl;this.buffer=S.createBuffer(),this.dynamicDraw=!!v,this.context.unbindVAO(),l.bindElementBuffer.set(this.buffer),S.bufferData(S.ELEMENT_ARRAY_BUFFER,A.arrayBuffer,this.dynamicDraw?S.DYNAMIC_DRAW:S.STATIC_DRAW),this.dynamicDraw||delete A.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(l){let A=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),A.bufferSubData(A.ELEMENT_ARRAY_BUFFER,0,l.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Yp={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Y0{constructor(l,A,v,S){this.length=A.length,this.attributes=v,this.itemSize=A.bytesPerElement,this.dynamicDraw=S,this.context=l;let P=l.gl;this.buffer=P.createBuffer(),l.bindVertexBuffer.set(this.buffer),P.bufferData(P.ARRAY_BUFFER,A.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||delete A.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 A=this.context.gl;this.bind(),A.bufferSubData(A.ARRAY_BUFFER,0,l.arrayBuffer)}enableAttributes(l,A){for(let v=0;v0){let Mt=s.Z(),rr=dt;s.aU(Mt,tt.placementInvProjMatrix,E.transform.glCoordMatrix),s.aU(Mt,Mt,tt.placementViewportMatrix),Y.push({circleArray:gt,circleOffset:se,transform:rr,invTransform:Mt,coord:Ve}),X+=gt.length/4,se=X}vt&&H.draw(F,U.LINES,Ir.disabled,Tr.disabled,E.colorModeForRenderPass(),Fr.disabled,pe(dt,E.transform,it),E.style.map.terrain&&E.style.map.terrain.getTerrainData(Ve),A.id,vt.layoutVertexBuffer,vt.indexBuffer,vt.segments,null,E.transform.zoom,null,null,vt.collisionVertexBuffer)}if(!B||!Y.length)return;let ge=E.useProgram("collisionCircle"),me=new s.aV;me.resize(4*X),me._trim();let we=0;for(let Me of Y)for(let Ve=0;Ve=0&&(me[Ae.associatedIconIndex]={shiftedAnchor:ci,angle:Ft})}else fe(Ae.numGlyphs,se)}if(H){ge.clear();let we=E.icon.placedSymbolArray;for(let Ae=0;AeE.style.map.terrain.getElevation(vt,Xo,Wn):null,ms=A.layout.get("text-rotation-alignment")==="map";Ct(Mt,vt.posMatrix,E,S,cn,ks,Ae,H,ms,Dn)}let Th=E.translatePosMatrix(vt.posMatrix,gt,P,B),Cf=ze||S&&tt||Cu?ki:cn,go=E.translatePosMatrix(ks,gt,P,B,!0),Xs=Ft&&A.paint.get(S?"text-halo-width":"icon-halo-width").constantOr(1)!==0,jn;jn=Ft?Mt.iconsInText?yf(mr.kind,oi,Qe,Ae,E,Th,Cf,go,ui,As):h_(mr.kind,oi,Qe,Ae,E,Th,Cf,go,S,ui,!0):u_(mr.kind,oi,Qe,Ae,E,Th,Cf,go,S,ui);let Iu={program:zi,buffers:rr,uniformValues:jn,atlasTexture:Un,atlasTextureIcon:Vn,atlasInterpolation:ln,atlasInterpolationIcon:Ys,isSDF:Ft,hasHalo:Xs};if(Me&&Mt.canOverlap){Ve=!0;let Dn=rr.segments.get();for(let ms of Dn)dt.push({segments:new s.S([ms]),sortKey:ms.sortKey,state:Iu,terrainData:Gr})}else dt.push({segments:rr.segments,sortKey:0,state:Iu,terrainData:Gr})}Ve&&dt.sort((vt,gt)=>vt.sortKey-gt.sortKey);for(let vt of dt){let gt=vt.state;if(se.activeTexture.set(ge.TEXTURE0),gt.atlasTexture.bind(gt.atlasInterpolation,ge.CLAMP_TO_EDGE),gt.atlasTextureIcon&&(se.activeTexture.set(ge.TEXTURE1),gt.atlasTextureIcon&>.atlasTextureIcon.bind(gt.atlasInterpolationIcon,ge.CLAMP_TO_EDGE)),gt.isSDF){let Mt=gt.uniformValues;gt.hasHalo&&(Mt.u_is_halo=1,qo(gt.buffers,vt.segments,A,E,gt.program,it,Y,X,Mt,vt.terrainData)),Mt.u_is_halo=0}qo(gt.buffers,vt.segments,A,E,gt.program,it,Y,X,gt.uniformValues,vt.terrainData)}}function qo(E,l,A,v,S,P,B,F,U,H){let Y=v.context;S.draw(Y,Y.gl.TRIANGLES,P,B,F,Fr.disabled,U,H,A.id,E.layoutVertexBuffer,E.indexBuffer,l,A.paint,v.transform.zoom,E.programConfigurations.get(A.id),E.dynamicLayoutVertexBuffer,E.opacityVertexBuffer)}function $l(E,l,A,v,S){if(!A||!v||!v.imageAtlas)return;let P=v.imageAtlas.patternPositions,B=P[A.to.toString()],F=P[A.from.toString()];if(!B&&F&&(B=F),!F&&B&&(F=B),!B||!F){let U=S.getPaintProperty(l);B=P[U],F=P[U]}B&&F&&E.setConstantPatternPositions(B,F)}function Go(E,l,A,v,S,P,B){let F=E.context.gl,U="fill-pattern",H=A.paint.get(U),Y=H&&H.constantOr(1),X=A.getCrossfadeParameters(),se,ge,me,we,Ae;B?(ge=Y&&!A.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",se=F.LINES):(ge=Y?"fillPattern":"fill",se=F.TRIANGLES);let ze=H.constantOr(null);for(let Qe of v){let Me=l.getTile(Qe);if(Y&&!Me.patternsLoaded())continue;let Ve=Me.getBucket(A);if(!Ve)continue;let it=Ve.programConfigurations.get(A.id),tt=E.useProgram(ge,it),dt=E.style.map.terrain&&E.style.map.terrain.getTerrainData(Qe);Y&&(E.context.activeTexture.set(F.TEXTURE0),Me.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),it.updatePaintBuffers(X)),$l(it,U,ze,Me,A);let vt=dt?Qe:null,gt=E.translatePosMatrix(vt?vt.posMatrix:Qe.posMatrix,Me,A.paint.get("fill-translate"),A.paint.get("fill-translate-anchor"));if(B){we=Ve.indexBuffer2,Ae=Ve.segments2;let Mt=[F.drawingBufferWidth,F.drawingBufferHeight];me=ge==="fillOutlinePattern"&&Y?Cd(gt,E,X,Me,Mt):Pd(gt,Mt)}else we=Ve.indexBuffer,Ae=Ve.segments,me=Y?Md(gt,E,X,Me):Ed(gt);tt.draw(E.context,se,S,E.stencilModeForClipping(Qe),P,Fr.disabled,me,dt,A.id,Ve.layoutVertexBuffer,we,Ae,A.paint,E.transform.zoom,it)}}function vh(E,l,A,v,S,P,B){let F=E.context,U=F.gl,H="fill-extrusion-pattern",Y=A.paint.get(H),X=Y.constantOr(1),se=A.getCrossfadeParameters(),ge=A.paint.get("fill-extrusion-opacity"),me=Y.constantOr(null);for(let we of v){let Ae=l.getTile(we),ze=Ae.getBucket(A);if(!ze)continue;let Qe=E.style.map.terrain&&E.style.map.terrain.getTerrainData(we),Me=ze.programConfigurations.get(A.id),Ve=E.useProgram(X?"fillExtrusionPattern":"fillExtrusion",Me);X&&(E.context.activeTexture.set(U.TEXTURE0),Ae.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),Me.updatePaintBuffers(se)),$l(Me,H,me,Ae,A);let it=E.translatePosMatrix(we.posMatrix,Ae,A.paint.get("fill-extrusion-translate"),A.paint.get("fill-extrusion-translate-anchor")),tt=A.paint.get("fill-extrusion-vertical-gradient"),dt=X?Hl(it,E,tt,ge,we,se,Ae):Zp(it,E,tt,ge);Ve.draw(F,F.gl.TRIANGLES,S,P,B,Fr.backCCW,dt,Qe,A.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,A.paint,E.transform.zoom,Me,E.style.map.terrain&&ze.centroidVertexBuffer)}}function Yx(E,l,A,v,S,P,B){let F=E.context,U=F.gl,H=A.fbo;if(!H)return;let Y=E.useProgram("hillshade"),X=E.style.map.terrain&&E.style.map.terrain.getTerrainData(l);F.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,H.colorAttachment.get()),Y.draw(F,U.TRIANGLES,S,P,B,Fr.disabled,((se,ge,me,we)=>{let Ae=me.paint.get("hillshade-shadow-color"),ze=me.paint.get("hillshade-highlight-color"),Qe=me.paint.get("hillshade-accent-color"),Me=me.paint.get("hillshade-illumination-direction")*(Math.PI/180);me.paint.get("hillshade-illumination-anchor")==="viewport"&&(Me-=se.transform.angle);let Ve=!se.options.moving;return{u_matrix:we?we.posMatrix:se.transform.calculatePosMatrix(ge.tileID.toUnwrapped(),Ve),u_image:0,u_latrange:Jt(0,ge.tileID),u_light:[me.paint.get("hillshade-exaggeration"),Me],u_shadow:Ae,u_highlight:ze,u_accent:Qe}})(E,A,v,X?l:null),X,v.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments)}function Bc(E,l,A,v,S,P){let B=E.context,F=B.gl,U=l.dem;if(U&&U.data){let H=U.dim,Y=U.stride,X=U.getPixels();if(B.activeTexture.set(F.TEXTURE1),B.pixelStoreUnpackPremultiplyAlpha.set(!1),l.demTexture=l.demTexture||E.getTileTexture(Y),l.demTexture){let ge=l.demTexture;ge.update(X,{premultiply:!1}),ge.bind(F.NEAREST,F.CLAMP_TO_EDGE)}else l.demTexture=new He(B,X,F.RGBA,{premultiply:!1}),l.demTexture.bind(F.NEAREST,F.CLAMP_TO_EDGE);B.activeTexture.set(F.TEXTURE0);let se=l.fbo;if(!se){let ge=new He(B,{width:H,height:H,data:null},F.RGBA);ge.bind(F.LINEAR,F.CLAMP_TO_EDGE),se=l.fbo=B.createFramebuffer(H,H,!0,!1),se.colorAttachment.set(ge.texture)}B.bindFramebuffer.set(se.framebuffer),B.viewport.set([0,0,H,H]),E.useProgram("hillshadePrepare").draw(B,F.TRIANGLES,v,S,P,Fr.disabled,((ge,me)=>{let we=me.stride,Ae=s.Z();return s.aS(Ae,0,s.N,-s.N,0,0,1),s.$(Ae,Ae,[0,-s.N,0]),{u_matrix:Ae,u_image:1,u_dimension:[we,we],u_zoom:ge.overscaledZ,u_unpack:me.getUnpackVector()}})(l.tileID,U),null,A.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments),l.needsHillshadePrepare=!1}}function ii(E,l,A,v,S,P){let B=v.paint.get("raster-fade-duration");if(!P&&B>0){let F=s.h.now(),U=(F-E.timeAdded)/B,H=l?(F-l.timeAdded)/B:-1,Y=A.getSource(),X=S.coveringZoomLevel({tileSize:Y.tileSize,roundZoom:Y.roundZoom}),se=!l||Math.abs(l.tileID.overscaledZ-X)>Math.abs(E.tileID.overscaledZ-X),ge=se&&E.refreshedUponExpiration?1:s.ad(se?U:1-H,0,1);return E.refreshedUponExpiration&&U>=1&&(E.refreshedUponExpiration=!1),l?{opacity:1,mix:1-ge}:{opacity:ge,mix:0}}return{opacity:1,mix:0}}let ye=new s.aT(1,0,0,1),Er=new s.aT(0,1,0,1),eA=new s.aT(0,0,1,1),__=new s.aT(1,0,1,1),y_=new s.aT(0,1,1,1);function Ld(E,l,A,v){he(E,0,l+A/2,E.transform.width,A,v)}function tA(E,l,A,v){he(E,l-A/2,0,A,E.transform.height,v)}function he(E,l,A,v,S,P){let B=E.context,F=B.gl;F.enable(F.SCISSOR_TEST),F.scissor(l*E.pixelRatio,A*E.pixelRatio,v*E.pixelRatio,S*E.pixelRatio),B.clear({color:P}),F.disable(F.SCISSOR_TEST)}function x_(E,l,A){let v=E.context,S=v.gl,P=A.posMatrix,B=E.useProgram("debug"),F=Ir.disabled,U=Tr.disabled,H=E.colorModeForRenderPass(),Y="$debug",X=E.style.map.terrain&&E.style.map.terrain.getTerrainData(A);v.activeTexture.set(S.TEXTURE0);let se=l.getTileByID(A.key).latestRawTileData,ge=Math.floor((se&&se.byteLength||0)/1024),me=l.getTile(A).tileSize,we=512/Math.min(me,512)*(A.overscaledZ/E.transform.zoom)*.5,Ae=A.canonical.toString();A.overscaledZ!==A.canonical.z&&(Ae+=` => ${A.overscaledZ}`),function(ze,Qe){ze.initDebugOverlayCanvas();let Me=ze.debugOverlayCanvas,Ve=ze.context.gl,it=ze.debugOverlayCanvas.getContext("2d");it.clearRect(0,0,Me.width,Me.height),it.shadowColor="white",it.shadowBlur=2,it.lineWidth=1.5,it.strokeStyle="white",it.textBaseline="top",it.font="bold 36px Open Sans, sans-serif",it.fillText(Qe,5,5),it.strokeText(Qe,5,5),ze.debugOverlayTexture.update(Me),ze.debugOverlayTexture.bind(Ve.LINEAR,Ve.CLAMP_TO_EDGE)}(E,`${Ae} ${ge}kB`),B.draw(v,S.TRIANGLES,F,U,ue.alphaBlended,Fr.disabled,De(P,s.aT.transparent,we),null,Y,E.debugBuffer,E.quadTriangleIndexBuffer,E.debugSegments),B.draw(v,S.LINE_STRIP,F,U,H,Fr.disabled,De(P,s.aT.red),X,Y,E.debugBuffer,E.tileBorderIndexBuffer,E.debugSegments)}function Ln(E,l,A){let v=E.context,S=v.gl,P=E.colorModeForRenderPass(),B=new Ir(S.LEQUAL,Ir.ReadWrite,E.depthRangeFor3D),F=E.useProgram("terrain"),U=l.getTerrainMesh();v.bindFramebuffer.set(null),v.viewport.set([0,0,E.width,E.height]);for(let H of A){let Y=E.renderToTexture.getTexture(H),X=l.getTerrainData(H.tileID);v.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,Y.texture);let se={u_matrix:E.transform.calculatePosMatrix(H.tileID.toUnwrapped()),u_texture:0,u_ele_delta:l.getMeshFrameDelta(E.transform.zoom)};F.draw(v,S.TRIANGLES,B,Tr.disabled,P,Fr.backCCW,se,X,"terrain",U.vertexBuffer,U.indexBuffer,U.segments)}}class bh{constructor(l,A){this.context=new Rs(l),this.transform=A,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.Z(),renderTime:0},this.setup(),this.numSublayers=ds.maxUnderzooming+ds.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Dc}resize(l,A,v){if(this.width=Math.floor(l*v),this.height=Math.floor(A*v),this.pixelRatio=v,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let S of this.style._order)this.style._layers[S].resize()}setup(){let l=this.context,A=new s.a_;A.emplaceBack(0,0),A.emplaceBack(s.N,0),A.emplaceBack(0,s.N),A.emplaceBack(s.N,s.N),this.tileExtentBuffer=l.createVertexBuffer(A,mo.members),this.tileExtentSegments=s.S.simpleSegment(0,0,4,2);let v=new s.a_;v.emplaceBack(0,0),v.emplaceBack(s.N,0),v.emplaceBack(0,s.N),v.emplaceBack(s.N,s.N),this.debugBuffer=l.createVertexBuffer(v,mo.members),this.debugSegments=s.S.simpleSegment(0,0,4,5);let S=new s.V;S.emplaceBack(0,0,0,0),S.emplaceBack(s.N,0,s.N,0),S.emplaceBack(0,s.N,0,s.N),S.emplaceBack(s.N,s.N,s.N,s.N),this.rasterBoundsBuffer=l.createVertexBuffer(S,is.members),this.rasterBoundsSegments=s.S.simpleSegment(0,0,4,2);let P=new s.a_;P.emplaceBack(0,0),P.emplaceBack(1,0),P.emplaceBack(0,1),P.emplaceBack(1,1),this.viewportBuffer=l.createVertexBuffer(P,mo.members),this.viewportSegments=s.S.simpleSegment(0,0,4,2);let B=new s.a$;B.emplaceBack(0),B.emplaceBack(1),B.emplaceBack(3),B.emplaceBack(2),B.emplaceBack(0),this.tileBorderIndexBuffer=l.createIndexBuffer(B);let F=new s.b0;F.emplaceBack(0,1,2),F.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=l.createIndexBuffer(F);let U=this.context.gl;this.stencilClearMode=new Tr({func:U.ALWAYS,mask:0},0,255,U.ZERO,U.ZERO,U.ZERO)}clearStencil(){let l=this.context,A=l.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let v=s.Z();s.aS(v,0,this.width,this.height,0,0,1),s.a0(v,v,[A.drawingBufferWidth,A.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(l,A.TRIANGLES,Ir.disabled,this.stencilClearMode,ue.disabled,Fr.disabled,st(v),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(l,A){if(this.currentStencilSource===l.source||!l.isTileClipped()||!A||!A.length)return;this.currentStencilSource=l.source;let v=this.context,S=v.gl;this.nextStencilID+A.length>256&&this.clearStencil(),v.setColorMode(ue.disabled),v.setDepthMode(Ir.disabled);let P=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let B of A){let F=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,U=this.style.map.terrain&&this.style.map.terrain.getTerrainData(B);P.draw(v,S.TRIANGLES,Ir.disabled,new Tr({func:S.ALWAYS,mask:0},F,255,S.KEEP,S.KEEP,S.REPLACE),ue.disabled,Fr.disabled,st(B.posMatrix),U,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let l=this.nextStencilID++,A=this.context.gl;return new Tr({func:A.NOTEQUAL,mask:255},l,255,A.KEEP,A.KEEP,A.REPLACE)}stencilModeForClipping(l){let A=this.context.gl;return new Tr({func:A.EQUAL,mask:255},this._tileClippingMaskIDs[l.key],0,A.KEEP,A.KEEP,A.REPLACE)}stencilConfigForOverlap(l){let A=this.context.gl,v=l.sort((B,F)=>F.overscaledZ-B.overscaledZ),S=v[v.length-1].overscaledZ,P=v[0].overscaledZ-S+1;if(P>1){this.currentStencilSource=void 0,this.nextStencilID+P>256&&this.clearStencil();let B={};for(let F=0;F=0;this.currentLayer--){let U=this.style._layers[v[this.currentLayer]],H=S[U.source],Y=P[U.source];this._renderTileClippingMasks(U,Y),this.renderLayer(this,H,U,Y)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerAe.source&&!Ae.isHidden(Y)?[H.sourceCaches[Ae.source]]:[]),ge=se.filter(Ae=>Ae.getSource().type==="vector"),me=se.filter(Ae=>Ae.getSource().type!=="vector"),we=Ae=>{(!X||X.getSource().maxzoomwe(Ae)),X||me.forEach(Ae=>we(Ae)),X}(this.style,this.transform.zoom);U&&function(H,Y,X){for(let se=0;sege.style.map.terrain.getElevation(tt,mr,ir):null)}}}(U,P,F,B,F.layout.get("text-rotation-alignment"),F.layout.get("text-pitch-alignment"),H),F.paint.get("icon-opacity").constantOr(1)!==0&&vf(P,B,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"),Y,X),F.paint.get("text-opacity").constantOr(1)!==0&&vf(P,B,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"),Y,X),B.map.showCollisionBoxes&&(Ri(P,B,F,U,F.paint.get("text-translate"),F.paint.get("text-translate-anchor"),!0),Ri(P,B,F,U,F.paint.get("icon-translate"),F.paint.get("icon-translate-anchor"),!1))})(l,A,v,S,this.style.placement.variableOffsets);break;case"circle":(function(P,B,F,U){if(P.renderPass!=="translucent")return;let H=F.paint.get("circle-opacity"),Y=F.paint.get("circle-stroke-width"),X=F.paint.get("circle-stroke-opacity"),se=!F.layout.get("circle-sort-key").isConstant();if(H.constantOr(1)===0&&(Y.constantOr(1)===0||X.constantOr(1)===0))return;let ge=P.context,me=ge.gl,we=P.depthModeForSublayer(0,Ir.ReadOnly),Ae=Tr.disabled,ze=P.colorModeForRenderPass(),Qe=[];for(let Me=0;MeMe.sortKey-Ve.sortKey);for(let Me of Qe){let{programConfiguration:Ve,program:it,layoutVertexBuffer:tt,indexBuffer:dt,uniformValues:vt,terrainData:gt}=Me.state;it.draw(ge,me.TRIANGLES,we,Ae,ze,Fr.disabled,vt,gt,F.id,tt,dt,Me.segments,F.paint,P.transform.zoom,Ve)}})(l,A,v,S);break;case"heatmap":(function(P,B,F,U){if(F.paint.get("heatmap-opacity")!==0)if(P.renderPass==="offscreen"){let H=P.context,Y=H.gl,X=Tr.disabled,se=new ue([Y.ONE,Y.ONE],s.aT.transparent,[!0,!0,!0,!0]);(function(ge,me,we){let Ae=ge.gl;ge.activeTexture.set(Ae.TEXTURE1),ge.viewport.set([0,0,me.width/4,me.height/4]);let ze=we.heatmapFbo;if(ze)Ae.bindTexture(Ae.TEXTURE_2D,ze.colorAttachment.get()),ge.bindFramebuffer.set(ze.framebuffer);else{let Qe=Ae.createTexture();Ae.bindTexture(Ae.TEXTURE_2D,Qe),Ae.texParameteri(Ae.TEXTURE_2D,Ae.TEXTURE_WRAP_S,Ae.CLAMP_TO_EDGE),Ae.texParameteri(Ae.TEXTURE_2D,Ae.TEXTURE_WRAP_T,Ae.CLAMP_TO_EDGE),Ae.texParameteri(Ae.TEXTURE_2D,Ae.TEXTURE_MIN_FILTER,Ae.LINEAR),Ae.texParameteri(Ae.TEXTURE_2D,Ae.TEXTURE_MAG_FILTER,Ae.LINEAR),ze=we.heatmapFbo=ge.createFramebuffer(me.width/4,me.height/4,!1,!1),function(Me,Ve,it,tt){var dt,vt;let gt=Me.gl,Mt=(dt=Me.HALF_FLOAT)!==null&&dt!==void 0?dt:gt.UNSIGNED_BYTE,rr=(vt=Me.RGBA16F)!==null&&vt!==void 0?vt:gt.RGBA;gt.texImage2D(gt.TEXTURE_2D,0,rr,Ve.width/4,Ve.height/4,0,gt.RGBA,Mt,null),tt.colorAttachment.set(it)}(ge,me,Qe,ze)}})(H,P,F),H.clear({color:s.aT.transparent});for(let ge=0;ge{let Me=s.Z();s.aS(Me,0,we.width,we.height,0,0,1);let Ve=we.context.gl;return{u_matrix:Me,u_world:[Ve.drawingBufferWidth,Ve.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:Ae.paint.get("heatmap-opacity")}})(H,Y),null,Y.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments,Y.paint,H.transform.zoom)}(P,F))})(l,A,v,S);break;case"line":(function(P,B,F,U){if(P.renderPass!=="translucent")return;let H=F.paint.get("line-opacity"),Y=F.paint.get("line-width");if(H.constantOr(1)===0||Y.constantOr(1)===0)return;let X=P.depthModeForSublayer(0,Ir.ReadOnly),se=P.colorModeForRenderPass(),ge=F.paint.get("line-dasharray"),me=F.paint.get("line-pattern"),we=me.constantOr(1),Ae=F.paint.get("line-gradient"),ze=F.getCrossfadeParameters(),Qe=we?"linePattern":ge?"lineSDF":Ae?"lineGradient":"line",Me=P.context,Ve=Me.gl,it=!0;for(let tt of U){let dt=B.getTile(tt);if(we&&!dt.patternsLoaded())continue;let vt=dt.getBucket(F);if(!vt)continue;let gt=vt.programConfigurations.get(F.id),Mt=P.context.program.get(),rr=P.useProgram(Qe,gt),ci=it||rr.program!==Mt,Ft=P.style.map.terrain&&P.style.map.terrain.getTerrainData(tt),mr=me.constantOr(null);if(mr&&dt.imageAtlas){let oi=dt.imageAtlas,Gr=oi.patternPositions[mr.to.toString()],ui=oi.patternPositions[mr.from.toString()];Gr&&ui&>.setConstantPatternPositions(Gr,ui)}let ir=Ft?tt:null,zi=we?Is(P,dt,F,ze,ir):ge?Zs(P,dt,F,ge,ze,ir):Ae?as(P,dt,F,vt.lineClipsArray.length,ir):li(P,dt,F,ir);if(we)Me.activeTexture.set(Ve.TEXTURE0),dt.imageAtlasTexture.bind(Ve.LINEAR,Ve.CLAMP_TO_EDGE),gt.updatePaintBuffers(ze);else if(ge&&(ci||P.lineAtlas.dirty))Me.activeTexture.set(Ve.TEXTURE0),P.lineAtlas.bind(Me);else if(Ae){let oi=vt.gradients[F.id],Gr=oi.texture;if(F.gradientVersion!==oi.version){let ui=256;if(F.stepInterpolant){let Un=B.getSource().maxzoom,ln=tt.canonical.z===Un?Math.ceil(1<0?A.pop():null}isPatternMissing(l){if(!l)return!1;if(!l.from||!l.to)return!0;let A=this.imageManager.getPattern(l.from.toString()),v=this.imageManager.getPattern(l.to.toString());return!A||!v}useProgram(l,A){this.cache=this.cache||{};let v=l+(A?A.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[v]||(this.cache[v]=new bu(this.context,an[l],A,G0[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 He(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:l,drawingBufferHeight:A}=this.context.gl;return this.width!==l||this.height!==A}}class Zo{constructor(l,A){this.points=l,this.planes=A}static fromInvProjectionMatrix(l,A,v){let S=Math.pow(2,v),P=[[-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.ag([],F,l))[3]/A*S;return s.b3(F,F,[U,U,1/F[3],U])}),B=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(F=>{let U=function(se,ge){var me=ge[0],we=ge[1],Ae=ge[2],ze=me*me+we*we+Ae*Ae;return ze>0&&(ze=1/Math.sqrt(ze)),se[0]=ge[0]*ze,se[1]=ge[1]*ze,se[2]=ge[2]*ze,se}([],function(se,ge,me){var we=ge[0],Ae=ge[1],ze=ge[2],Qe=me[0],Me=me[1],Ve=me[2];return se[0]=Ae*Ve-ze*Me,se[1]=ze*Qe-we*Ve,se[2]=we*Me-Ae*Qe,se}([],oe([],P[F[0]],P[F[1]]),oe([],P[F[2]],P[F[1]]))),H=-((Y=U)[0]*(X=P[F[1]])[0]+Y[1]*X[1]+Y[2]*X[2]);var Y,X;return U.concat(H)});return new Zo(P,B)}}class bf{constructor(l,A){this.min=l,this.max=A,this.center=function(v,S,P){return v[0]=.5*S[0],v[1]=.5*S[1],v[2]=.5*S[2],v}([],function(v,S,P){return v[0]=S[0]+P[0],v[1]=S[1]+P[1],v[2]=S[2]+P[2],v}([],this.min,this.max))}quadrant(l){let A=[l%2==0,l<2],v=J(this.min),S=J(this.max);for(let P=0;P=0&&B++;if(B===0)return 0;B!==A.length&&(v=!1)}if(v)return 2;for(let S=0;S<3;S++){let P=Number.MAX_VALUE,B=-Number.MAX_VALUE;for(let F=0;Fthis.max[S]-this.min[S])return 0}return 1}}class Dd{constructor(l=0,A=0,v=0,S=0){if(isNaN(l)||l<0||isNaN(A)||A<0||isNaN(v)||v<0||isNaN(S)||S<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=l,this.bottom=A,this.left=v,this.right=S}interpolate(l,A,v){return A.top!=null&&l.top!=null&&(this.top=s.B.number(l.top,A.top,v)),A.bottom!=null&&l.bottom!=null&&(this.bottom=s.B.number(l.bottom,A.bottom,v)),A.left!=null&&l.left!=null&&(this.left=s.B.number(l.left,A.left,v)),A.right!=null&&l.right!=null&&(this.right=s.B.number(l.right,A.right,v)),this}getCenter(l,A){let v=s.ad((this.left+l-this.right)/2,0,l),S=s.ad((this.top+A-this.bottom)/2,0,A);return new s.P(v,S)}equals(l){return this.top===l.top&&this.bottom===l.bottom&&this.left===l.left&&this.right===l.right}clone(){return new Dd(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Od{constructor(l,A,v,S,P){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=P===void 0||!!P,this._minZoom=l||0,this._maxZoom=A||22,this._minPitch=v??0,this._maxPitch=S??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new s.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Dd,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){let l=new Od(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._minEleveationForCurrentTile=l._minEleveationForCurrentTile,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 A=-s.b5(l,-180,180)*Math.PI/180;this.angle!==A&&(this._unmodified=!1,this.angle=A,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,S,P){var B=S[0],F=S[1],U=S[2],H=S[3],Y=Math.sin(P),X=Math.cos(P);v[0]=B*X+U*Y,v[1]=F*X+H*Y,v[2]=B*-Y+U*X,v[3]=F*-Y+H*X}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(l){let A=s.ad(l,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==A&&(this._unmodified=!1,this._pitch=A,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 A=Math.min(Math.max(l,this.minZoom),this.maxZoom);this._zoom!==A&&(this._unmodified=!1,this._zoom=A,this.tileZoom=Math.max(0,Math.floor(A)),this.scale=this.zoomScale(A),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,A,v){this._unmodified=!1,this._edgeInsets.interpolate(l,A,v),this._constrain(),this._calcMatrices()}coveringZoomLevel(l){let A=(l.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/l.tileSize));return Math.max(0,A)}getVisibleUnwrappedCoordinates(l){let A=[new s.b6(0,l)];if(this._renderWorldCopies){let v=this.pointCoordinate(new s.P(0,0)),S=this.pointCoordinate(new s.P(this.width,0)),P=this.pointCoordinate(new s.P(this.width,this.height)),B=this.pointCoordinate(new s.P(0,this.height)),F=Math.floor(Math.min(v.x,S.x,P.x,B.x)),U=Math.floor(Math.max(v.x,S.x,P.x,B.x)),H=1;for(let Y=F-H;Y<=U+H;Y++)Y!==0&&A.push(new s.b6(Y,l))}return A}coveringTiles(l){var A,v;let S=this.coveringZoomLevel(l),P=S;if(l.minzoom!==void 0&&Sl.maxzoom&&(S=l.maxzoom);let B=this.pointCoordinate(this.getCameraPoint()),F=s.U.fromLngLat(this.center),U=Math.pow(2,S),H=[U*B.x,U*B.y,0],Y=[U*F.x,U*F.y,0],X=Zo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,S),se=l.minzoom||0;!l.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(se=S);let ge=l.terrain?2/Math.min(this.tileSize,l.tileSize)*this.tileSize:3,me=Me=>({aabb:new bf([Me*U,0,0],[(Me+1)*U,U,0]),zoom:0,x:0,y:0,wrap:Me,fullyVisible:!1}),we=[],Ae=[],ze=S,Qe=l.reparseOverscaled?P:S;if(this._renderWorldCopies)for(let Me=1;Me<=3;Me++)we.push(me(-Me)),we.push(me(Me));for(we.push(me(0));we.length>0;){let Me=we.pop(),Ve=Me.x,it=Me.y,tt=Me.fullyVisible;if(!tt){let rr=Me.aabb.intersects(X);if(rr===0)continue;tt=rr===2}let dt=l.terrain?H:Y,vt=Me.aabb.distanceX(dt),gt=Me.aabb.distanceY(dt),Mt=Math.max(Math.abs(vt),Math.abs(gt));if(Me.zoom===ze||Mt>ge+(1<=se){let rr=ze-Me.zoom,ci=H[0]-.5-(Ve<>1),mr=Me.zoom+1,ir=Me.aabb.quadrant(rr);if(l.terrain){let zi=new s.O(mr,Me.wrap,mr,ci,Ft),oi=l.terrain.getMinMaxElevation(zi),Gr=(A=oi.minElevation)!==null&&A!==void 0?A:this.elevation,ui=(v=oi.maxElevation)!==null&&v!==void 0?v:this.elevation;ir=new bf([ir.min[0],ir.min[1],Gr],[ir.max[0],ir.max[1],ui])}we.push({aabb:ir,zoom:mr,x:ci,y:Ft,wrap:Me.wrap,fullyVisible:tt})}}return Ae.sort((Me,Ve)=>Me.distanceSq-Ve.distanceSq).map(Me=>Me.tileID)}resize(l,A){this.width=l,this.height=A,this.pixelsToGLUnits=[2/l,-2/A],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 A=s.ad(l.lat,-this.maxValidLatitude,this.maxValidLatitude);return new s.P(s.G(l.lng)*this.worldSize,s.H(A)*this.worldSize)}unproject(l){return new s.U(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 A=this.pointLocation(this.centerPoint,l),v=l.getElevationForLngLatZoom(A,this.tileZoom);if(!(this.elevation-v))return;let S=this.getCameraPosition(),P=s.U.fromLngLat(S.lngLat,S.altitude),B=s.U.fromLngLat(A,v),F=P.x-B.x,U=P.y-B.y,H=P.z-B.z,Y=Math.sqrt(F*F+U*U+H*H),X=this.scaleZoom(this.cameraToCenterDistance/Y/this.tileSize);this._elevation=v,this._center=A,this.zoom=X}setLocationAtPoint(l,A){let v=this.pointCoordinate(A),S=this.pointCoordinate(this.centerPoint),P=this.locationCoordinate(l),B=new s.U(P.x-(v.x-S.x),P.y-(v.y-S.y));this.center=this.coordinateLocation(B),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(l,A){return A?this.coordinatePoint(this.locationCoordinate(l),A.getElevationForLngLatZoom(l,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(l))}pointLocation(l,A){return this.coordinateLocation(this.pointCoordinate(l,A))}locationCoordinate(l){return s.U.fromLngLat(l)}coordinateLocation(l){return l&&l.toLngLat()}pointCoordinate(l,A){if(A){let se=A.pointCoordinate(l);if(se!=null)return se}let v=[l.x,l.y,0,1],S=[l.x,l.y,1,1];s.ag(v,v,this.pixelMatrixInverse),s.ag(S,S,this.pixelMatrixInverse);let P=v[3],B=S[3],F=v[1]/P,U=S[1]/B,H=v[2]/P,Y=S[2]/B,X=H===Y?0:(0-H)/(Y-H);return new s.U(s.B.number(v[0]/P,S[0]/B,X)/this.worldSize,s.B.number(F,U,X)/this.worldSize)}coordinatePoint(l,A=0,v=this.pixelMatrix){let S=[l.x*this.worldSize,l.y*this.worldSize,A,1];return s.ag(S,S,v),new s.P(S[0]/S[3],S[1]/S[3])}getBounds(){let l=Math.max(0,this.height/2-this.getHorizon());return new Ci().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 Ci([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,A=!1){let v=l.key,S=A?this._alignedPosMatrixCache:this._posMatrixCache;if(S[v])return S[v];let P=l.canonical,B=this.worldSize/this.zoomScale(P.z),F=P.x+Math.pow(2,P.z)*l.wrap,U=s.ao(new Float64Array(16));return s.$(U,U,[F*B,P.y*B,0]),s.a0(U,U,[B/s.N,B/s.N,1]),s.a1(U,A?this.alignedProjMatrix:this.projMatrix,U),S[v]=new Float32Array(U),S[v]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let l,A,v,S,P=-90,B=90,F=-180,U=180,H=this.size,Y=this._unmodified;if(this.latRange){let ge=this.latRange;P=s.H(ge[1])*this.worldSize,B=s.H(ge[0])*this.worldSize,l=B-PB&&(S=B-me)}if(this.lngRange){let ge=(F+U)/2,me=s.b5(X.x,ge-this.worldSize/2,ge+this.worldSize/2),we=H.x/2;me-weU&&(v=U-we)}v===void 0&&S===void 0||(this.center=this.unproject(new s.P(v!==void 0?v:X.x,S!==void 0?S:X.y)).wrap()),this._unmodified=Y,this._constraining=!1}_calcMatrices(){if(!this.height)return;let l=this.centerOffset,A=this.point.x,v=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=s.b7(1,this.center.lat)*this.worldSize;let S=s.ao(new Float64Array(16));s.a0(S,S,[this.width/2,-this.height/2,1]),s.$(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.ao(new Float64Array(16)),s.a0(S,S,[1,-1,1]),s.$(S,S,[-1,-1,0]),s.a0(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S;let P=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),B=Math.min(this.elevation,this._minEleveationForCurrentTile),F=P-B*this._pixelPerMeter/Math.cos(this._pitch),U=B<0?F:P,H=Math.PI/2+this._pitch,Y=this._fov*(.5+l.y/this.height),X=Math.sin(Y)*U/Math.sin(s.ad(Math.PI-H-Y,.01,Math.PI-.01)),se=this.getHorizon(),ge=2*Math.atan(se/this.cameraToCenterDistance)*(.5+l.y/(2*se)),me=Math.sin(ge)*U/Math.sin(s.ad(Math.PI-H-ge,.01,Math.PI-.01)),we=Math.min(X,me),Ae=1.01*(Math.cos(Math.PI/2-this._pitch)*we+U),ze=this.height/50;S=new Float64Array(16),s.b8(S,this._fov,this.width/this.height,ze,Ae),S[8]=2*-l.x/this.width,S[9]=2*l.y/this.height,s.a0(S,S,[1,-1,1]),s.$(S,S,[0,0,-this.cameraToCenterDistance]),s.b9(S,S,this._pitch),s.ae(S,S,this.angle),s.$(S,S,[-A,-v,0]),this.mercatorMatrix=s.a0([],S,[this.worldSize,this.worldSize,this.worldSize]),s.a0(S,S,[1,1,this._pixelPerMeter]),this.pixelMatrix=s.a1(new Float64Array(16),this.labelPlaneMatrix,S),s.$(S,S,[0,0,-this.elevation]),this.projMatrix=S,this.invProjMatrix=s.as([],S),this.pixelMatrix3D=s.a1(new Float64Array(16),this.labelPlaneMatrix,S);let Qe=this.width%2/2,Me=this.height%2/2,Ve=Math.cos(this.angle),it=Math.sin(this.angle),tt=A-Math.round(A)+Ve*Qe+it*Me,dt=v-Math.round(v)+Ve*Me+it*Qe,vt=new Float64Array(S);if(s.$(vt,vt,[tt>.5?tt-1:tt,dt>.5?dt-1:dt,0]),this.alignedProjMatrix=vt,S=s.as(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");this.pixelMatrixInverse=S,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let l=this.pointCoordinate(new s.P(0,0)),A=[l.x*this.worldSize,l.y*this.worldSize,0,1];return s.ag(A,A,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 A=this.getCameraPoint();if(l.length===1)return[l[0],A];{let v=A.x,S=A.y,P=A.x,B=A.y;for(let F of l)v=Math.min(v,F.x),S=Math.min(S,F.y),P=Math.max(P,F.x),B=Math.max(B,F.y);return[new s.P(v,S),new s.P(P,S),new s.P(P,B),new s.P(v,B),new s.P(v,S)]}}}function Su(E,l){let A,v=!1,S=null,P=null,B=()=>{S=null,v&&(E.apply(P,A),S=setTimeout(B,l),v=!1)};return(...F)=>(v=!0,P=this,A=F,S||B(),S)}class wf{constructor(l){this._getCurrentHash=()=>{let A=window.location.hash.replace("#","");if(this._hashName){let v;return A.split("&").map(S=>S.split("=")).forEach(S=>{S[0]===this._hashName&&(v=S)}),(v&&v[1]||"").split("/")}return A.split("/")},this._onHashChange=()=>{let A=this._getCurrentHash();if(A.length>=3&&!A.some(v=>isNaN(v))){let v=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(A[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+A[2],+A[1]],zoom:+A[0],bearing:v,pitch:+(A[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let A=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,A)}catch{}},this._updateHash=Su(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 A=this._map.getCenter(),v=Math.round(100*this._map.getZoom())/100,S=Math.ceil((v*Math.LN2+Math.log(512/360/.5))/Math.LN10),P=Math.pow(10,S),B=Math.round(A.lng*P)/P,F=Math.round(A.lat*P)/P,U=this._map.getBearing(),H=this._map.getPitch(),Y="";if(Y+=l?`/${B}/${F}/${v}`:`${v}/${F}/${B}`,(U||H)&&(Y+="/"+Math.round(10*U)/10),H&&(Y+=`/${Math.round(H)}`),this._hashName){let X=this._hashName,se=!1,ge=window.location.hash.slice(1).split("&").map(me=>{let we=me.split("=")[0];return we===X?(se=!0,`${we}=${Y}`):me}).filter(me=>me);return se||ge.push(`${X}=${Y}`),`#${ge.join("&")}`}return`#${Y}`}}let Yo={linearity:.3,easing:s.ba(0,0,.3,1)},ps=s.e({deceleration:2500,maxSpeed:1400},Yo),rA=s.e({deceleration:20,maxSpeed:1400},Yo),v_=s.e({deceleration:1e3,maxSpeed:360},Yo),b_=s.e({deceleration:1e3,maxSpeed:90},Yo);class im{constructor(l){this._map=l,this.clear()}clear(){this._inertiaBuffer=[]}record(l){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.h.now(),settings:l})}_drainInertiaBuffer(){let l=this._inertiaBuffer,A=s.h.now();for(;l.length>0&&A-l[0].time>160;)l.shift()}_onMoveEnd(l){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let A={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:P}of this._inertiaBuffer)A.zoom+=P.zoomDelta||0,A.bearing+=P.bearingDelta||0,A.pitch+=P.pitchDelta||0,P.panDelta&&A.pan._add(P.panDelta),P.around&&(A.around=P.around),P.pinchAround&&(A.pinchAround=P.pinchAround);let v=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,S={};if(A.pan.mag()){let P=Bd(A.pan.mag(),v,s.e({},ps,l||{}));S.offset=A.pan.mult(P.amount/A.pan.mag()),S.center=this._map.transform.center,ql(S,P)}if(A.zoom){let P=Bd(A.zoom,v,rA);S.zoom=this._map.transform.zoom+P.amount,ql(S,P)}if(A.bearing){let P=Bd(A.bearing,v,v_);S.bearing=this._map.transform.bearing+s.ad(P.amount,-179,179),ql(S,P)}if(A.pitch){let P=Bd(A.pitch,v,b_);S.pitch=this._map.transform.pitch+P.amount,ql(S,P)}if(S.zoom||S.bearing){let P=A.pinchAround===void 0?A.around:A.pinchAround;S.around=P?this._map.unproject(P):this._map.getCenter()}return this.clear(),s.e(S,{noMoveStart:!0})}}function ql(E,l){(!E.duration||E.durationA.unproject(U)),F=P.reduce((U,H,Y,X)=>U.add(H.div(X.length)),new s.P(0,0));super(l,{points:P,point:F,lngLats:B,lngLat:A.unproject(F),originalEvent:v}),this._defaultPrevented=!1}}class iA extends s.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(l,A,v){super(l,{originalEvent:v}),this._defaultPrevented=!1}}class nm{constructor(l,A){this._map=l,this._clickTolerance=A.clickTolerance}reset(){delete this._mousedownPos}wheel(l){return this._firePreventable(new iA(l.type,this._map,l))}mousedown(l,A){return this._mousedownPos=A,this._firePreventable(new ha(l.type,this._map,l))}mouseup(l){this._map.fire(new ha(l.type,this._map,l))}click(l,A){this._mousedownPos&&this._mousedownPos.dist(A)>=this._clickTolerance||this._map.fire(new ha(l.type,this._map,l))}dblclick(l){return this._firePreventable(new ha(l.type,this._map,l))}mouseover(l){this._map.fire(new ha(l.type,this._map,l))}mouseout(l){this._map.fire(new ha(l.type,this._map,l))}touchstart(l){return this._firePreventable(new qi(l.type,this._map,l))}touchmove(l){this._map.fire(new qi(l.type,this._map,l))}touchend(l){this._map.fire(new qi(l.type,this._map,l))}touchcancel(l){this._map.fire(new qi(l.type,this._map,l))}_firePreventable(l){if(this._map.fire(l),l.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class w_{constructor(l){this._map=l}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(l){this._map.fire(new ha(l.type,this._map,l))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ha("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(l){this._delayContextMenu?this._contextMenuEvent=l:this._ignoreContextMenu||this._map.fire(new ha(l.type,this._map,l)),this._map.listens("contextmenu")&&l.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fc{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 S_{constructor(l,A){this._map=l,this._tr=new Fc(l),this._el=l.getCanvasContainer(),this._container=l.getContainer(),this._clickTolerance=A.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(l,A){this.isEnabled()&&l.shiftKey&&l.button===0&&(c.disableDrag(),this._startPos=this._lastPos=A,this._active=!0)}mousemoveWindow(l,A){if(!this._active)return;let v=A;if(this._lastPos.equals(v)||!this._box&&v.dist(this._startPos)P.fitScreenCoordinates(v,S,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&&(c.remove(this._box),this._box=null),c.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(l,A){return this._map.fire(new s.k(l,{originalEvent:A}))}}function fa(E,l){if(E.length!==l.length)throw new Error(`The number of touches and points are not equal - touches ${E.length}, points ${l.length}`);let A={};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(S){let P=new s.P(0,0);for(let B of S)P._add(B);return P.div(S.length)}(A),this.touches=fa(v,A)))}touchmove(l,A,v){if(this.aborted||!this.centroid)return;let S=fa(v,A);for(let P in this.touches){let B=S[P];(!B||B.dist(this.touches[P])>30)&&(this.aborted=!0)}}touchend(l,A,v){if((!this.centroid||l.timeStamp-this.startTime>500)&&(this.aborted=!0),v.length===0){let S=!this.aborted&&this.centroid;if(this.reset(),S)return S}}}class Sf{constructor(l){this.singleTap=new dl(l),this.numTaps=l.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(l,A,v){this.singleTap.touchstart(l,A,v)}touchmove(l,A,v){this.singleTap.touchmove(l,A,v)}touchend(l,A,v){let S=this.singleTap.touchend(l,A,v);if(S){let P=l.timeStamp-this.lastTime<500,B=!this.lastTap||this.lastTap.dist(S)<30;if(P&&B||this.reset(),this.count++,this.lastTime=l.timeStamp,this.lastTap=S,this.count===this.numTaps)return this.reset(),S}}}class Nc{constructor(l){this._tr=new Fc(l),this._zoomIn=new Sf({numTouches:1,numTaps:2}),this._zoomOut=new Sf({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(l,A,v){this._zoomIn.touchstart(l,A,v),this._zoomOut.touchstart(l,A,v)}touchmove(l,A,v){this._zoomIn.touchmove(l,A,v),this._zoomOut.touchmove(l,A,v)}touchend(l,A,v){let S=this._zoomIn.touchend(l,A,v),P=this._zoomOut.touchend(l,A,v),B=this._tr;return S?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:B.zoom+1,around:B.unproject(S)},{originalEvent:l})}):P?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:F=>F.easeTo({duration:300,zoom:B.zoom-1,around:B.unproject(P)},{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 zc{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 A=this._moveFunction(...l);if(A.bearingDelta||A.pitchDelta||A.around||A.panDelta)return this._active=!0,A}dragStart(l,A){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(l)&&(this._moveStateManager.startMove(l),this._lastPoint=A.length?A[0]:A,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(l,A){if(!this.isEnabled())return;let v=this._lastPoint;if(!v)return;if(l.preventDefault(),!this._moveStateManager.isValidMoveEvent(l))return void this.reset(l);let S=A.length?A[0]:A;return!this._moved&&S.dist(v){E.mousedown=E.dragStart,E.mousemoveWindow=E.dragMove,E.mouseup=E.dragEnd,E.contextmenu=function(l){l.preventDefault()}},Tf=({enable:E,clickTolerance:l,bearingDegreesPerPixelMoved:A=.8})=>{let v=new nA({checkCorrectEvent:S=>c.mouseButton(S)===0&&S.ctrlKey||c.mouseButton(S)===2});return new zc({clickTolerance:l,move:(S,P)=>({bearingDelta:(P.x-S.x)*A}),moveStateManager:v,enable:E,assignEvents:sA})},Uc=({enable:E,clickTolerance:l,pitchDegreesPerPixelMoved:A=-.5})=>{let v=new nA({checkCorrectEvent:S=>c.mouseButton(S)===0&&S.ctrlKey||c.mouseButton(S)===2});return new zc({clickTolerance:l,move:(S,P)=>({pitchDelta:(P.y-S.y)*A}),moveStateManager:v,enable:E,assignEvents:sA})};class Rt{constructor(l,A){this._minTouches=l.cooperativeGestures?2:1,this._clickTolerance=l.clickTolerance||1,this._map=A,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(l,A,v){return this._calculateTransform(l,A,v)}touchmove(l,A,v){if(this._map._cooperativeGestures&&(this._minTouches===2&&v.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(l,!1,v.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(v.length0&&(this._active=!0);let S=fa(v,A),P=new s.P(0,0),B=new s.P(0,0),F=0;for(let H in S){let Y=S[H],X=this._touches[H];X&&(P._add(Y),B._add(Y.sub(X)),F++,S[H]=Y)}if(this._touches=S,FMath.abs(E.x)}class Xx extends Gl{constructor(l){super(),this._map=l}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(l,A,v){super.touchstart(l,A,v),this._currentTouchCount=v.length}_start(l){this._lastPoints=l,lm(l[0].sub(l[1]))&&(this._valid=!1)}_move(l,A,v){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let S=l[0].sub(this._lastPoints[0]),P=l[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(S,P,v.timeStamp),this._valid?(this._lastPoints=l,this._active=!0,{pitchDelta:(S.y+P.y)/2*-.5}):void 0}gestureBeginsVertically(l,A,v){if(this._valid!==void 0)return this._valid;let S=l.mag()>=2,P=A.mag()>=2;if(!S&&!P)return;if(!S||!P)return this._firstMove===void 0&&(this._firstMove=v),v-this._firstMove<100&&void 0;let B=l.y>0==A.y>0;return lm(l)&&lm(A)&&B}}let oA={panStep:100,bearingStep:15,pitchStep:10};class Fd{constructor(l){this._tr=new Fc(l);let A=oA;this._panStep=A.panStep,this._bearingStep=A.bearingStep,this._pitchStep=A.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(l){if(l.altKey||l.ctrlKey||l.metaKey)return;let A=0,v=0,S=0,P=0,B=0;switch(l.keyCode){case 61:case 107:case 171:case 187:A=1;break;case 189:case 109:case 173:A=-1;break;case 37:l.shiftKey?v=-1:(l.preventDefault(),P=-1);break;case 39:l.shiftKey?v=1:(l.preventDefault(),P=1);break;case 38:l.shiftKey?S=1:(l.preventDefault(),B=-1);break;case 40:l.shiftKey?S=-1:(l.preventDefault(),B=1);break;default:return}return this._rotationDisabled&&(v=0,S=0),{cameraAnimation:F=>{let U=this._tr;F.easeTo({duration:300,easeId:"keyboardHandler",easing:Eu,zoom:A?Math.round(U.zoom)+A*(l.shiftKey?2:1):U.zoom,bearing:U.bearing+v*this._bearingStep,pitch:U.pitch+S*this._pitchStep,offset:[-P*this._panStep,-B*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 Eu(E){return E*(2-E)}let cm=4.000244140625;class E_{constructor(l,A){this._onTimeout=v=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(v)},this._map=l,this._tr=new Fc(l),this._el=l.getCanvasContainer(),this._triggerRenderFrame=A,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())return;if(this._map._cooperativeGestures){if(!l[this._map._metaKey])return;l.preventDefault()}let A=l.deltaMode===WheelEvent.DOM_DELTA_LINE?40*l.deltaY:l.deltaY,v=s.h.now(),S=v-(this._lastWheelEventTime||0);this._lastWheelEventTime=v,A!==0&&A%cm==0?this._type="wheel":A!==0&&Math.abs(A)<4?this._type="trackpad":S>400?(this._type=null,this._lastValue=A,this._timeout=setTimeout(this._onTimeout,40,l)):this._type||(this._type=Math.abs(S*A)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,A+=this._lastValue)),l.shiftKey&&A&&(A/=4),this._type&&(this._lastWheelEvent=l,this._delta-=A,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 A=c.mousePos(this._el,l),v=this._tr;this._around=s.L.convert(this._aroundCenter?v.center:v.unproject(A)),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)>cm?this._wheelZoomRate:this._defaultZoomRate,U=2/(1+Math.exp(-Math.abs(this._delta*F)));this._delta<0&&U!==0&&(U=1/U);let H=typeof this._targetZoom=="number"?l.zoomScale(this._targetZoom):l.scale;this._targetZoom=Math.min(l.maxZoom,Math.max(l.minZoom,l.scaleZoom(H*U))),this._type==="wheel"&&(this._startZoom=l.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let A=typeof this._targetZoom=="number"?this._targetZoom:l.zoom,v=this._startZoom,S=this._easing,P,B=!1;if(this._type==="wheel"&&v&&S){let F=Math.min((s.h.now()-this._lastWheelEventTime)/200,1),U=S(F);P=s.B.number(v,A,U),F<1?this._frameId||(this._frameId=!0):B=!0}else P=A,B=!0;return this._active=!0,B&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!B,zoomDelta:P-l.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(l){let A=s.bb;if(this._prevEase){let v=this._prevEase,S=(s.h.now()-v.start)/v.duration,P=v.easing(S+.01)-v.easing(S),B=.27/Math.sqrt(P*P+1e-4)*.01,F=Math.sqrt(.0729-B*B);A=s.ba(B,F,.25,1)}return this._prevEase={start:s.h.now(),duration:l,easing:A},A}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ef{constructor(l,A){this._clickZoom=l,this._tapZoom=A}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 Vc{constructor(l){this._tr=new Fc(l),this.reset()}reset(){this._active=!1}dblclick(l,A){return l.preventDefault(),{cameraAnimation:v=>{v.easeTo({duration:300,zoom:this._tr.zoom+(l.shiftKey?-1:1),around:this._tr.unproject(A)},{originalEvent:l})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zl{constructor(){this._tap=new Sf({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,A,v){if(!this._swipePoint)if(this._tapTime){let S=A[0],P=l.timeStamp-this._tapTime<500,B=this._tapPoint.dist(S)<30;P&&B?v.length>0&&(this._swipePoint=S,this._swipeTouch=v[0].identifier):this.reset()}else this._tap.touchstart(l,A,v)}touchmove(l,A,v){if(this._tapTime){if(this._swipePoint){if(v[0].identifier!==this._swipeTouch)return;let S=A[0],P=S.y-this._swipePoint.y;return this._swipePoint=S,l.preventDefault(),this._active=!0,{zoomDelta:P/128}}}else this._tap.touchmove(l,A,v)}touchend(l,A,v){if(this._tapTime)this._swipePoint&&v.length===0&&this.reset();else{let S=this._tap.touchend(l,A,v);S&&(this._tapTime=l.timeStamp,this._tapPoint=S)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class aA{constructor(l,A,v){this._el=l,this._mousePan=A,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 ko{constructor(l,A,v){this._pitchWithRotate=l.pitchWithRotate,this._mouseRotate=A,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 Yl{constructor(l,A,v,S){this._el=l,this._touchZoom=A,this._touchRotate=v,this._tapDragZoom=S,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()}}let Nd=E=>E.zoom||E.drag||E.pitch||E.rotate;class um extends s.k{}function Mf(E){return E.panDelta&&E.panDelta.mag()||E.zoomDelta||E.bearingDelta||E.pitchDelta}class hm{constructor(l,A){this.handleWindowEvent=S=>{this.handleEvent(S,`${S.type}Window`)},this.handleEvent=(S,P)=>{if(S.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let B=S.type==="renderFrame"?void 0:S,F={needsRenderFrame:!1},U={},H={},Y=S.touches,X=Y?this._getMapTouches(Y):void 0,se=X?c.touchPos(this._el,X):c.mousePos(this._el,S);for(let{handlerName:we,handler:Ae,allowed:ze}of this._handlers){if(!Ae.isEnabled())continue;let Qe;this._blockedByActive(H,ze,we)?Ae.reset():Ae[P||S.type]&&(Qe=Ae[P||S.type](S,se,X),this.mergeHandlerResult(F,U,Qe,we,B),Qe&&Qe.needsRenderFrame&&this._triggerRenderFrame()),(Qe||Ae.isActive())&&(H[we]=Ae)}let ge={};for(let we in this._previousActiveHandlers)H[we]||(ge[we]=B);this._previousActiveHandlers=H,(Object.keys(ge).length||Mf(F))&&(this._changes.push([F,U,ge]),this._triggerRenderFrame()),(Object.keys(H).length||Mf(F))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:me}=F;me&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],me(this._map))},this._map=l,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new im(l),this._bearingSnap=A.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(A);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[S,P,B]of this._listeners)c.addEventListener(S,P,S===document?this.handleWindowEvent:this.handleEvent,B)}destroy(){for(let[l,A,v]of this._listeners)c.removeEventListener(l,A,l===document?this.handleWindowEvent:this.handleEvent,v)}_addDefaultHandlers(l){let A=this._map,v=A.getCanvasContainer();this._add("mapEvent",new nm(A,l));let S=A.boxZoom=new S_(A,l);this._add("boxZoom",S),l.interactive&&l.boxZoom&&S.enable();let P=new Nc(A),B=new Vc(A);A.doubleClickZoom=new Ef(B,P),this._add("tapZoom",P),this._add("clickZoom",B),l.interactive&&l.doubleClickZoom&&A.doubleClickZoom.enable();let F=new Zl;this._add("tapDragZoom",F);let U=A.touchPitch=new Xx(A);this._add("touchPitch",U),l.interactive&&l.touchPitch&&A.touchPitch.enable(l.touchPitch);let H=Tf(l),Y=Uc(l);A.dragRotate=new ko(l,H,Y),this._add("mouseRotate",H,["mousePitch"]),this._add("mousePitch",Y,["mouseRotate"]),l.interactive&&l.dragRotate&&A.dragRotate.enable();let X=(({enable:ze,clickTolerance:Qe})=>{let Me=new nA({checkCorrectEvent:Ve=>c.mouseButton(Ve)===0&&!Ve.ctrlKey});return new zc({clickTolerance:Qe,move:(Ve,it)=>({around:it,panDelta:it.sub(Ve)}),activateOnStart:!0,moveStateManager:Me,enable:ze,assignEvents:sA})})(l),se=new Rt(l,A);A.dragPan=new aA(v,X,se),this._add("mousePan",X),this._add("touchPan",se,["touchZoom","touchRotate"]),l.interactive&&l.dragPan&&A.dragPan.enable(l.dragPan);let ge=new am,me=new om;A.touchZoomRotate=new Yl(v,me,ge,F),this._add("touchRotate",ge,["touchPan","touchZoom"]),this._add("touchZoom",me,["touchPan","touchRotate"]),l.interactive&&l.touchZoomRotate&&A.touchZoomRotate.enable(l.touchZoomRotate);let we=A.scrollZoom=new E_(A,()=>this._triggerRenderFrame());this._add("scrollZoom",we,["mousePan"]),l.interactive&&l.scrollZoom&&A.scrollZoom.enable(l.scrollZoom);let Ae=A.keyboard=new Fd(A);this._add("keyboard",Ae),l.interactive&&l.keyboard&&A.keyboard.enable(),this._add("blockableMapEvent",new w_(A))}_add(l,A,v){this._handlers.push({handlerName:l,handler:A,allowed:v}),this._handlersById[l]=A}stop(l){if(!this._updatingCamera){for(let{handler:A}of this._handlers)A.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!!Nd(this._eventsInProgress)||this.isZooming()}_blockedByActive(l,A,v){for(let S in l)if(S!==v&&(!A||A.indexOf(S)<0))return!0;return!1}_getMapTouches(l){let A=[];for(let v of l)this._el.contains(v.target)&&A.push(v);return A}mergeHandlerResult(l,A,v,S,P){if(!v)return;s.e(l,v);let B={handlerName:S,originalEvent:v.originalEvent||P};v.zoomDelta!==void 0&&(A.zoom=B),v.panDelta!==void 0&&(A.drag=B),v.pitchDelta!==void 0&&(A.pitch=B),v.bearingDelta!==void 0&&(A.rotate=B)}_applyChanges(){let l={},A={},v={};for(let[S,P,B]of this._changes)S.panDelta&&(l.panDelta=(l.panDelta||new s.P(0,0))._add(S.panDelta)),S.zoomDelta&&(l.zoomDelta=(l.zoomDelta||0)+S.zoomDelta),S.bearingDelta&&(l.bearingDelta=(l.bearingDelta||0)+S.bearingDelta),S.pitchDelta&&(l.pitchDelta=(l.pitchDelta||0)+S.pitchDelta),S.around!==void 0&&(l.around=S.around),S.pinchAround!==void 0&&(l.pinchAround=S.pinchAround),S.noInertia&&(l.noInertia=S.noInertia),s.e(A,P),s.e(v,B);this._updateMapTransform(l,A,v),this._changes=[]}_updateMapTransform(l,A,v){let S=this._map,P=S._getTransformForUpdate(),B=S.terrain;if(!(Mf(l)||B&&this._terrainMovement))return this._fireEvents(A,v,!0);let{panDelta:F,zoomDelta:U,bearingDelta:H,pitchDelta:Y,around:X,pinchAround:se}=l;se!==void 0&&(X=se),S._stop(!0),X=X||S.transform.centerPoint;let ge=P.pointLocation(F?X.sub(F):X);H&&(P.bearing+=H),Y&&(P.pitch+=Y),U&&(P.zoom+=U),B?this._terrainMovement||!A.drag&&!A.zoom?A.drag&&this._terrainMovement?P.center=P.pointLocation(P.centerPoint.sub(F)):P.setLocationAtPoint(ge,X):(this._terrainMovement=!0,this._map._elevationFreeze=!0,P.setLocationAtPoint(ge,X),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,P.recalculateZoom(S.terrain)})):P.setLocationAtPoint(ge,X),S._applyUpdatedTransform(P),this._map._update(),l.noInertia||this._inertia.record(l),this._fireEvents(A,v,!0)}_fireEvents(l,A,v){let S=Nd(this._eventsInProgress),P=Nd(l),B={};for(let Y in l){let{originalEvent:X}=l[Y];this._eventsInProgress[Y]||(B[`${Y}start`]=X),this._eventsInProgress[Y]=l[Y]}!S&&P&&this._fireEvent("movestart",P.originalEvent);for(let Y in B)this._fireEvent(Y,B[Y]);P&&this._fireEvent("move",P.originalEvent);for(let Y in l){let{originalEvent:X}=l[Y];this._fireEvent(Y,X)}let F={},U;for(let Y in this._eventsInProgress){let{handlerName:X,originalEvent:se}=this._eventsInProgress[Y];this._handlersById[X].isActive()||(delete this._eventsInProgress[Y],U=A[X]||se,F[`${Y}end`]=U)}for(let Y in F)this._fireEvent(Y,F[Y]);let H=Nd(this._eventsInProgress);if(v&&(S||P)&&!H){this._updatingCamera=!0;let Y=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),X=se=>se!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new um("renderFrame",{timeStamp:l})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class M_ extends s.E{constructor(l,A){super(),this._renderFrameCallback=()=>{let v=Math.min((s.h.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=A.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new s.L(this.transform.center.lng,this.transform.center.lat)}setCenter(l,A){return this.jumpTo({center:l},A)}panBy(l,A,v){return l=s.P.convert(l).mult(-1),this.panTo(this.transform.center,s.e({offset:l},A),v)}panTo(l,A,v){return this.easeTo(s.e({center:l},A),v)}getZoom(){return this.transform.zoom}setZoom(l,A){return this.jumpTo({zoom:l},A),this}zoomTo(l,A,v){return this.easeTo(s.e({zoom:l},A),v)}zoomIn(l,A){return this.zoomTo(this.getZoom()+1,l,A),this}zoomOut(l,A){return this.zoomTo(this.getZoom()-1,l,A),this}getBearing(){return this.transform.bearing}setBearing(l,A){return this.jumpTo({bearing:l},A),this}getPadding(){return this.transform.padding}setPadding(l,A){return this.jumpTo({padding:l},A),this}rotateTo(l,A,v){return this.easeTo(s.e({bearing:l},A),v)}resetNorth(l,A){return this.rotateTo(0,s.e({duration:1e3},l),A),this}resetNorthPitch(l,A){return this.easeTo(s.e({bearing:0,pitch:0,duration:1e3},l),A),this}snapToNorth(l,A){return Math.abs(this.getBearing()){if(this._zooming&&(v.zoom=s.B.number(S,U,tt)),this._rotating&&(v.bearing=s.B.number(P,H,tt)),this._pitching&&(v.pitch=s.B.number(B,Y,tt)),this._padding&&(v.interpolatePadding(F,X,tt),ge=v.centerPoint.add(se)),this.terrain&&!l.freezeElevation&&this._updateElevation(tt),Me)v.setLocationAtPoint(Me,Ve);else{let dt=v.zoomScale(v.zoom-S),vt=U>S?Math.min(2,Qe):Math.max(.5,Qe),gt=Math.pow(vt,1-tt),Mt=v.unproject(Ae.add(ze.mult(tt*gt)).mult(dt));v.setLocationAtPoint(v.renderWorldCopies?Mt.wrap():Mt,ge)}this._applyUpdatedTransform(v),this._fireMoveEvents(A)},tt=>{this.terrain&&this._finalizeElevation(),this._afterEase(A,tt)},l),this}_prepareEase(l,A,v={}){this._moving=!0,A||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._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let A=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(l<1&&A!==this._elevationTarget){let v=this._elevationTarget-this._elevationStart;this._elevationStart+=l*(v-(A-(v*l+this._elevationStart))/(1-l)),this._elevationTarget=A}this.transform.elevation=s.B.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 A=l.clone(),{center:v,zoom:S,pitch:P,bearing:B,elevation:F}=this.transformCameraUpdate(A);v&&(A.center=v),S!==void 0&&(A.zoom=S),P!==void 0&&(A.pitch=P),B!==void 0&&(A.bearing=B),F!==void 0&&(A.elevation=F),this.transform.apply(A)}_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,A){if(this._easeId&&A&&this._easeId===A)return;delete this._easeId;let v=this._zooming,S=this._rotating,P=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)),S&&this.fire(new s.k("rotateend",l)),P&&this.fire(new s.k("pitchend",l)),this.fire(new s.k("moveend",l))}flyTo(l,A){if(!l.essential&&s.h.prefersReducedMotion){let ir=s.F(l,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ir,A)}this.stop(),l=s.e({offset:[0,0],speed:1.2,curve:1.42,easing:s.bb},l);let v=this._getTransformForUpdate(),S=this.getZoom(),P=this.getBearing(),B=this.getPitch(),F=this.getPadding(),U="zoom"in l?s.ad(+l.zoom,v.minZoom,v.maxZoom):S,H="bearing"in l?this._normalizeBearing(l.bearing,P):P,Y="pitch"in l?+l.pitch:B,X="padding"in l?l.padding:v.padding,se=v.zoomScale(U-S),ge=s.P.convert(l.offset),me=v.centerPoint.add(ge),we=v.pointLocation(me),Ae=s.L.convert(l.center||we);this._normalizeCenter(Ae);let ze=v.project(we),Qe=v.project(Ae).sub(ze),Me=l.curve,Ve=Math.max(v.width,v.height),it=Ve/se,tt=Qe.mag();if("minZoom"in l){let ir=s.ad(Math.min(l.minZoom,S,U),v.minZoom,v.maxZoom),zi=Ve/v.zoomScale(ir-S);Me=Math.sqrt(zi/tt*2)}let dt=Me*Me;function vt(ir){let zi=(it*it-Ve*Ve+(ir?-1:1)*dt*dt*tt*tt)/(2*(ir?it:Ve)*dt*tt);return Math.log(Math.sqrt(zi*zi+1)-zi)}function gt(ir){return(Math.exp(ir)-Math.exp(-ir))/2}function Mt(ir){return(Math.exp(ir)+Math.exp(-ir))/2}let rr=vt(!1),ci=function(ir){return Mt(rr)/Mt(rr+Me*ir)},Ft=function(ir){return Ve*((Mt(rr)*(gt(zi=rr+Me*ir)/Mt(zi))-gt(rr))/dt)/tt;var zi},mr=(vt(!0)-rr)/Me;if(Math.abs(tt)<1e-6||!isFinite(mr)){if(Math.abs(Ve-it)<1e-6)return this.easeTo(l,A);let ir=itl.maxDuration&&(l.duration=0),this._zooming=!0,this._rotating=P!==H,this._pitching=Y!==B,this._padding=!v.isPaddingEqual(X),this._prepareEase(A,!1),this.terrain&&this._prepareElevation(Ae),this._ease(ir=>{let zi=ir*mr,oi=1/ci(zi);v.zoom=ir===1?U:S+v.scaleZoom(oi),this._rotating&&(v.bearing=s.B.number(P,H,ir)),this._pitching&&(v.pitch=s.B.number(B,Y,ir)),this._padding&&(v.interpolatePadding(F,X,ir),me=v.centerPoint.add(ge)),this.terrain&&!l.freezeElevation&&this._updateElevation(ir);let Gr=ir===1?Ae:v.unproject(ze.add(Qe.mult(Ft(zi))).mult(oi));v.setLocationAtPoint(v.renderWorldCopies?Gr.wrap():Gr,me),this._applyUpdatedTransform(v),this._fireMoveEvents(A)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(A)},l),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(l,A){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,A)}if(!l){let v=this.handlers;v&&v.stop(!1)}return this}_ease(l,A,v){v.animate===!1||v.duration===0?(l(1),A()):(this._easeStart=s.h.now(),this._easeOptions=v,this._onEaseFrame=l,this._onEaseEnd=A,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(l,A){l=s.b5(l,-180,180);let v=Math.abs(l-A);return Math.abs(l-360-A)180?-360:v<-180?360:0}queryTerrainElevation(l){return this.terrain?this.terrain.getElevationForLngLatZoom(s.L.convert(l),this.transform.tileZoom)-this.transform.elevation:null}}class da{constructor(l={}){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=A=>{!A||A.sourceDataType!=="metadata"&&A.sourceDataType!=="visibility"&&A.dataType!=="style"&&A.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&&this.options.compact,this._container=c.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=c.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=c.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(){c.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,A){let v=this._map._getUIString(`AttributionControl.${A}`);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(S=>typeof S!="string"?"":S)):typeof this.options.customAttribution=="string"&&l.push(this.options.customAttribution)),this._map.style.stylesheet){let S=this._map.style.stylesheet;this.styleOwner=S.owner,this.styleId=S.id}let A=this._map.style.sourceCaches;for(let S in A){let P=A[S];if(P.used||P.usedForTerrain){let B=P.getSource();B.attribution&&l.indexOf(B.attribution)<0&&l.push(B.attribution)}}l=l.filter(S=>String(S).trim()),l.sort((S,P)=>S.length-P.length),l=l.filter((S,P)=>{for(let B=P+1;B=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 gn{constructor(l={}){this._updateCompact=()=>{let A=this._container.children;if(A.length){let v=A[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=c.create("div","maplibregl-ctrl");let A=c.create("a","maplibregl-ctrl-logo");return A.target="_blank",A.rel="noopener nofollow",A.href="https://maplibre.org/",A.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),A.setAttribute("rel","noopener nofollow"),this._container.appendChild(A),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){c.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class lA{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(l){let A=++this._id;return this._queue.push({callback:l,id:A,cancelled:!1}),A}remove(l){let A=this._currentlyRunning,v=A?this._queue.concat(A):this._queue;for(let S of v)if(S.id===l)return void(S.cancelled=!0)}run(l=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let A=this._currentlyRunning=this._queue;this._queue=[];for(let v of A)if(!v.cancelled&&(v.callback(l),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let fm={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var P_=s.Q([{name:"a_pos3d",type:"Int16",components:3}]);class C_ 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,A){this.sourceCache.update(l,A),this._renderableTilesKeys=[];let v={};for(let S of l.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:A}))v[S.key]=!0,this._renderableTilesKeys.push(S.key),this._tiles[S.key]||(S.posMatrix=new Float64Array(16),s.aS(S.posMatrix,0,s.N,0,s.N,0,1),this._tiles[S.key]=new po(S,this.tileSize));for(let S in this._tiles)v[S]||delete this._tiles[S]}freeRtt(l){for(let A in this._tiles){let v=this._tiles[A];(!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 A={};for(let v of this._renderableTilesKeys){let S=this._tiles[v].tileID;if(S.canonical.equals(l.canonical)){let P=l.clone();P.posMatrix=new Float64Array(16),s.aS(P.posMatrix,0,s.N,0,s.N,0,1),A[v]=P}else if(S.canonical.isChildOf(l.canonical)){let P=l.clone();P.posMatrix=new Float64Array(16);let B=S.canonical.z-l.canonical.z,F=S.canonical.x-(S.canonical.x>>B<>B<>B;s.aS(P.posMatrix,0,H,0,H,0,1),s.$(P.posMatrix,P.posMatrix,[-F*H,-U*H,0]),A[v]=P}else if(l.canonical.isChildOf(S.canonical)){let P=l.clone();P.posMatrix=new Float64Array(16);let B=l.canonical.z-S.canonical.z,F=l.canonical.x-(l.canonical.x>>B<>B<>B;s.aS(P.posMatrix,0,s.N,0,s.N,0,1),s.$(P.posMatrix,P.posMatrix,[F*H,U*H,0]),s.a0(P.posMatrix,P.posMatrix,[1/2**B,1/2**B,0]),A[v]=P}}return A}getSourceTile(l,A){let v=this.sourceCache._source,S=l.overscaledZ-this.deltaZoom;if(S>v.maxzoom&&(S=v.maxzoom),S=v.minzoom&&(!P||!P.dem);)P=this.sourceCache.getTileByID(l.scaledTo(S--).key);return P}tilesAfterTime(l=Date.now()){return Object.values(this._tiles).filter(A=>A.timeAdded>=l)}}class zd{constructor(l,A,v){this.painter=l,this.sourceCache=new C_(A),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,A,v,S=s.N){var P;if(!(A>=0&&A=0&&vl.canonical.z&&(l.canonical.z>=S?P=l.canonical.z-S:s.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let B=l.canonical.x-(l.canonical.x>>P<>P<>8<<4|P>>8,A[B+3]=0;let v=new s.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(A.buffer)),S=new He(l,v,l.gl.RGBA,{premultiply:!1});return S.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._coordsTexture=S,S}pointCoordinate(l){let A=new Uint8Array(4),v=this.painter.context,S=v.gl;v.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),S.readPixels(l.x,this.painter.height/devicePixelRatio-l.y-1,1,1,S.RGBA,S.UNSIGNED_BYTE,A),v.bindFramebuffer.set(null);let P=A[0]+(A[2]>>4<<8),B=A[1]+((15&A[2])<<8),F=this.coordsIndex[255-A[3]],U=F&&this.sourceCache.getTileByID(F);if(!U)return null;let H=this._coordsTextureSize,Y=(1<0&&Math.sign(P)<0||!v&&Math.sign(S)<0&&Math.sign(P)>0?(S=360*Math.sign(P)+S,s.G(S)):A}}class Qx{constructor(l,A,v){this._context=l,this._size=A,this._tileSize=v,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let l of this._objects)l.texture.destroy(),l.fbo.destroy()}_createObject(l){let A=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),v=new He(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return v.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),A.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),A.colorAttachment.set(v.texture),{id:l,fbo:A,texture:v,stamp:-1,inUse:!1}}getObjectForId(l){return this._objects[l]}useObject(l){l.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(A=>l.id!==A),this._recentlyUsed.push(l.id)}stampObject(l){l.stamp=++this._stamp}getOrCreateFreeObject(){for(let A of this._recentlyUsed)if(!this._objects[A].inUse)return this._objects[A];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 Lo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class cA{constructor(l,A){this.painter=l,this.terrain=A,this.pool=new Qx(l.context,30,A.sourceCache.tileSize*A.qualityFactor)}destruct(){this.pool.destruct()}getTexture(l){return this.pool.getObjectForId(l.rtt[this._stacks.length-1].id).texture}prepareForRender(l,A){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=l._order.filter(v=>!l._layers[v].isHidden(A)),this._coordsDescendingInv={};for(let v in l.sourceCaches){this._coordsDescendingInv[v]={};let S=l.sourceCaches[v].getVisibleCoordinates();for(let P of S){let B=this.terrain.sourceCache.getTerrainCoords(P);for(let F in B)this._coordsDescendingInv[v][F]||(this._coordsDescendingInv[v][F]=[]),this._coordsDescendingInv[v][F].push(B[F])}}this._coordsDescendingInvStr={};for(let v of l._order){let S=l._layers[v],P=S.source;if(Lo[S.type]&&!this._coordsDescendingInvStr[P]){this._coordsDescendingInvStr[P]={};for(let B in this._coordsDescendingInv[P])this._coordsDescendingInvStr[P][B]=this._coordsDescendingInv[P][B].map(F=>F.key).sort().join()}}for(let v of this._renderableTiles)for(let S in this._coordsDescendingInvStr){let P=this._coordsDescendingInvStr[S][v.tileID.key];P&&P!==v.rttCoords[S]&&(v.rtt=[])}}renderLayer(l){if(l.isHidden(this.painter.transform.zoom))return!1;let A=l.type,v=this.painter,S=this._renderableLayerIds[this._renderableLayerIds.length-1]===l.id;if(Lo[A]&&(this._prevType&&Lo[this._prevType]||this._stacks.push([]),this._prevType=A,this._stacks[this._stacks.length-1].push(l.id),!S))return!0;if(Lo[this._prevType]||Lo[A]&&S){this._prevType=A;let P=this._stacks.length-1,B=this._stacks[P]||[];for(let F of this._renderableTiles){if(this.pool.isFull()&&(Ln(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(F),F.rtt[P]){let H=this.pool.getObjectForId(F.rtt[P].id);if(H.stamp===F.rtt[P].stamp){this.pool.useObject(H);continue}}let U=this.pool.getOrCreateFreeObject();this.pool.useObject(U),this.pool.stampObject(U),F.rtt[P]={id:U.id,stamp:U.stamp},v.context.bindFramebuffer.set(U.fbo.framebuffer),v.context.clear({color:s.aT.transparent,stencil:0}),v.currentStencilSource=void 0;for(let H=0;H{E.touchstart=E.dragStart,E.touchmoveWindow=E.dragMove,E.touchend=E.dragEnd},uA={showCompass:!0,showZoom:!0,visualizePitch:!1};class Mu{constructor(l,A,v=!1){this.mousedown=B=>{this.startMouse(s.e({},B,{ctrlKey:!0,preventDefault:()=>B.preventDefault()}),c.mousePos(this.element,B)),c.addEventListener(window,"mousemove",this.mousemove),c.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=B=>{this.moveMouse(B,c.mousePos(this.element,B))},this.mouseup=B=>{this.mouseRotate.dragEnd(B),this.mousePitch&&this.mousePitch.dragEnd(B),this.offTemp()},this.touchstart=B=>{B.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=c.touchPos(this.element,B.targetTouches)[0],this.startTouch(B,this._startPos),c.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),c.addEventListener(window,"touchend",this.touchend))},this.touchmove=B=>{B.targetTouches.length!==1?this.reset():(this._lastPos=c.touchPos(this.element,B.targetTouches)[0],this.moveTouch(B,this._lastPos))},this.touchend=B=>{B.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 S=l.dragRotate._mouseRotate.getClickTolerance(),P=l.dragRotate._mousePitch.getClickTolerance();this.element=A,this.mouseRotate=Tf({clickTolerance:S,enable:!0}),this.touchRotate=(({enable:B,clickTolerance:F,bearingDegreesPerPixelMoved:U=.8})=>{let H=new sm;return new zc({clickTolerance:F,move:(Y,X)=>({bearingDelta:(X.x-Y.x)*U}),moveStateManager:H,enable:B,assignEvents:wh})})({clickTolerance:S,enable:!0}),this.map=l,v&&(this.mousePitch=Uc({clickTolerance:P,enable:!0}),this.touchPitch=(({enable:B,clickTolerance:F,pitchDegreesPerPixelMoved:U=-.5})=>{let H=new sm;return new zc({clickTolerance:F,move:(Y,X)=>({pitchDelta:(X.y-Y.y)*U}),moveStateManager:H,enable:B,assignEvents:wh})})({clickTolerance:P,enable:!0})),c.addEventListener(A,"mousedown",this.mousedown),c.addEventListener(A,"touchstart",this.touchstart,{passive:!1}),c.addEventListener(A,"touchcancel",this.reset)}startMouse(l,A){this.mouseRotate.dragStart(l,A),this.mousePitch&&this.mousePitch.dragStart(l,A),c.disableDrag()}startTouch(l,A){this.touchRotate.dragStart(l,A),this.touchPitch&&this.touchPitch.dragStart(l,A),c.disableDrag()}moveMouse(l,A){let v=this.map,{bearingDelta:S}=this.mouseRotate.dragMove(l,A)||{};if(S&&v.setBearing(v.getBearing()+S),this.mousePitch){let{pitchDelta:P}=this.mousePitch.dragMove(l,A)||{};P&&v.setPitch(v.getPitch()+P)}}moveTouch(l,A){let v=this.map,{bearingDelta:S}=this.touchRotate.dragMove(l,A)||{};if(S&&v.setBearing(v.getBearing()+S),this.touchPitch){let{pitchDelta:P}=this.touchPitch.dragMove(l,A)||{};P&&v.setPitch(v.getPitch()+P)}}off(){let l=this.element;c.removeEventListener(l,"mousedown",this.mousedown),c.removeEventListener(l,"touchstart",this.touchstart,{passive:!1}),c.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),c.removeEventListener(window,"touchend",this.touchend),c.removeEventListener(l,"touchcancel",this.reset),this.offTemp()}offTemp(){c.enableDrag(),c.removeEventListener(window,"mousemove",this.mousemove),c.removeEventListener(window,"mouseup",this.mouseup),c.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),c.removeEventListener(window,"touchend",this.touchend)}}let Xn;function Ud(E,l,A){if(E=new s.L(E.lng,E.lat),l){let v=new s.L(E.lng-360,E.lat),S=new s.L(E.lng+360,E.lat),P=A.locationPoint(E).distSqr(l);A.locationPoint(v).distSqr(l)180;){let v=A.locationPoint(E);if(v.x>=0&&v.y>=0&&v.x<=A.width&&v.y<=A.height)break;E.lng>A.center.lng?E.lng-=360:E.lng+=360}return E}let pa={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 I_(E,l,A){let v=E.classList;for(let S in pa)v.remove(`maplibregl-${A}-anchor-${S}`);v.add(`maplibregl-${A}-anchor-${l}`)}class Pu extends s.E{constructor(l){if(super(),this._onKeyPress=A=>{let v=A.code,S=A.charCode||A.keyCode;v!=="Space"&&v!=="Enter"&&S!==32&&S!==13||this.togglePopup()},this._onMapClick=A=>{let v=A.originalEvent.target,S=this._element;this._popup&&(v===S||S.contains(v))&&this.togglePopup()},this._update=A=>{if(!this._map)return;let v=this._map.loaded()&&!this._map.isMoving();(A?.type==="terrain"||A?.type==="render"&&!v)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Ud(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let S="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?S=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(S=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let P="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?P="rotateX(0deg)":this._pitchAlignment==="map"&&(P=`rotateX(${this._map.getPitch()}deg)`),A&&A.type!=="moveend"||(this._pos=this._pos.round()),c.setTransform(this._element,`${pa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${P} ${S}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let B=this._map.unproject(this._pos),F=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=B.distanceTo(this._lngLat)>20*F?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=A=>{if(!this._isDragging){let v=this._clickTolerance||this._map._clickTolerance;this._isDragging=A.point.dist(this._pointerdownPos)>=v}this._isDragging&&(this._pos=A.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=A=>{this._element.contains(A.originalEvent.target)&&(A.preventDefault(),this._positionDelta=A.point.sub(this._pos).add(this._offset),this._pointerdownPos=A.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,l&&l.element)this._element=l.element,this._offset=s.P.convert(l&&l.offset||[0,0]);else{this._defaultMarker=!0,this._element=c.create("div"),this._element.setAttribute("aria-label","Map marker");let A=c.createNS("http://www.w3.org/2000/svg","svg"),v=41,S=27;A.setAttributeNS(null,"display","block"),A.setAttributeNS(null,"height",`${v}px`),A.setAttributeNS(null,"width",`${S}px`),A.setAttributeNS(null,"viewBox",`0 0 ${S} ${v}`);let P=c.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"stroke","none"),P.setAttributeNS(null,"stroke-width","1"),P.setAttributeNS(null,"fill","none"),P.setAttributeNS(null,"fill-rule","evenodd");let B=c.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"fill-rule","nonzero");let F=c.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 ze of U){let Qe=c.createNS("http://www.w3.org/2000/svg","ellipse");Qe.setAttributeNS(null,"opacity","0.04"),Qe.setAttributeNS(null,"cx","10.5"),Qe.setAttributeNS(null,"cy","5.80029008"),Qe.setAttributeNS(null,"rx",ze.rx),Qe.setAttributeNS(null,"ry",ze.ry),F.appendChild(Qe)}let H=c.createNS("http://www.w3.org/2000/svg","g");H.setAttributeNS(null,"fill",this._color);let Y=c.createNS("http://www.w3.org/2000/svg","path");Y.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),H.appendChild(Y);let X=c.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"opacity","0.25"),X.setAttributeNS(null,"fill","#000000");let se=c.createNS("http://www.w3.org/2000/svg","path");se.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(se);let ge=c.createNS("http://www.w3.org/2000/svg","g");ge.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ge.setAttributeNS(null,"fill","#FFFFFF");let me=c.createNS("http://www.w3.org/2000/svg","g");me.setAttributeNS(null,"transform","translate(8.0, 8.0)");let we=c.createNS("http://www.w3.org/2000/svg","circle");we.setAttributeNS(null,"fill","#000000"),we.setAttributeNS(null,"opacity","0.25"),we.setAttributeNS(null,"cx","5.5"),we.setAttributeNS(null,"cy","5.5"),we.setAttributeNS(null,"r","5.4999962");let Ae=c.createNS("http://www.w3.org/2000/svg","circle");Ae.setAttributeNS(null,"fill","#FFFFFF"),Ae.setAttributeNS(null,"cx","5.5"),Ae.setAttributeNS(null,"cy","5.5"),Ae.setAttributeNS(null,"r","5.4999962"),me.appendChild(we),me.appendChild(Ae),B.appendChild(F),B.appendChild(H),B.appendChild(X),B.appendChild(ge),B.appendChild(me),A.appendChild(B),A.setAttributeNS(null,"height",v*this._scale+"px"),A.setAttributeNS(null,"width",S*this._scale+"px"),this._element.appendChild(A),this._offset=s.P.convert(l&&l.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",A=>{A.preventDefault()}),this._element.addEventListener("mousedown",A=>{A.preventDefault()}),I_(this._element,this._anchor,"marker"),l&&l.className)for(let A of l.className.split(" "))this._element.classList.add(A);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),c.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=s.L.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 S=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":[S,-1*(38.1-13.5+S)],"bottom-right":[-S,-1*(38.1-13.5+S)],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}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}}let wn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},_n=0,jc=!1,Gi={maxWidth:100,unit:"metric"};function Vd(E,l,A){let v=A&&A.maxWidth||100,S=E._container.clientHeight/2,P=E.unproject([0,S]),B=E.unproject([v,S]),F=P.distanceTo(B);if(A&&A.unit==="imperial"){let U=3.2808*F;U>5280?Sh(l,v,U/5280,E._getUIString("ScaleControl.Miles")):Sh(l,v,U,E._getUIString("ScaleControl.Feet"))}else A&&A.unit==="nautical"?Sh(l,v,F/1852,E._getUIString("ScaleControl.NauticalMiles")):F>=1e3?Sh(l,v,F/1e3,E._getUIString("ScaleControl.Kilometers")):Sh(l,v,F,E._getUIString("ScaleControl.Meters"))}function Sh(E,l,A,v){let S=function(P){let B=Math.pow(10,`${Math.floor(P)}`.length-1),F=P/B;return F=F>=10?10:F>=5?5:F>=3?3:F>=2?2:F>=1?1:function(U){let H=Math.pow(10,Math.ceil(-Math.log(U)/Math.LN10));return Math.round(U*H)/H}(F),B*F}(A);E.style.width=l*(S/A)+"px",E.innerHTML=`${S} ${v}`}let dm={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},pm=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pf(E){if(E){if(typeof E=="number"){let l=Math.round(Math.abs(E)/Math.SQRT2);return{center:new s.P(0,0),top:new s.P(0,E),"top-left":new s.P(l,l),"top-right":new s.P(-l,l),bottom:new s.P(0,-E),"bottom-left":new s.P(l,-l),"bottom-right":new s.P(-l,-l),left:new s.P(E,0),right:new s.P(-E,0)}}if(E instanceof s.P||Array.isArray(E)){let l=s.P.convert(E);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(E.center||[0,0]),top:s.P.convert(E.top||[0,0]),"top-left":s.P.convert(E["top-left"]||[0,0]),"top-right":s.P.convert(E["top-right"]||[0,0]),bottom:s.P.convert(E.bottom||[0,0]),"bottom-left":s.P.convert(E["bottom-left"]||[0,0]),"bottom-right":s.P.convert(E["bottom-right"]||[0,0]),left:s.P.convert(E.left||[0,0]),right:s.P.convert(E.right||[0,0])}}return Pf(new s.P(0,0))}let Am={extend:(E,...l)=>s.e(E,...l),run(E){E()},logToElement(E,l=!1,A="log"){let v=window.document.getElementById(A);v&&(l&&(v.innerHTML=""),v.innerHTML+=`
${E}`)}},mm=o;class jr{static get version(){return mm}static get workerCount(){return Ao.workerCount}static set workerCount(l){Ao.workerCount=l}static get maxParallelImageRequests(){return s.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(l){s.c.MAX_PARALLEL_IMAGE_REQUESTS=l}static get workerUrl(){return s.c.WORKER_URL}static set workerUrl(l){s.c.WORKER_URL=l}static addProtocol(l,A){s.c.REGISTERED_PROTOCOLS[l]=A}static removeProtocol(l){delete s.c.REGISTERED_PROTOCOLS[l]}}return jr.Map=class extends M_{constructor(E){if(s.bg.mark(s.bh.create),(E=s.e({},yr,E)).minZoom!=null&&E.maxZoom!=null&&E.minZoom>E.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(E.minPitch!=null&&E.maxPitch!=null&&E.minPitch>E.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(E.minPitch!=null&&E.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(E.maxPitch!=null&&E.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Od(E.minZoom,E.maxZoom,E.minPitch,E.maxPitch,E.renderWorldCopies),{bearingSnap:E.bearingSnap}),this._cooperativeGesturesOnWheel=l=>{this._onCooperativeGesture(l,l[this._metaKey],1)},this._contextLost=l=>{l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=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=E.interactive,this._cooperativeGestures=E.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=E.maxTileCacheSize,this._maxTileCacheZoomLevels=E.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=E.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=E.preserveDrawingBuffer,this._antialias=E.antialias,this._trackResize=E.trackResize,this._bearingSnap=E.bearingSnap,this._refreshExpiredTiles=E.refreshExpiredTiles,this._fadeDuration=E.fadeDuration,this._crossSourceCollisions=E.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=E.collectResourceTiming,this._renderTaskQueue=new lA,this._controls=[],this._mapId=s.a2(),this._locale=s.e({},fm,E.locale),this._clickTolerance=E.clickTolerance,this._overridePixelRatio=E.pixelRatio,this._maxCanvasSize=E.maxCanvasSize,this.transformCameraUpdate=E.transformCameraUpdate,this._imageQueueHandle=V.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(E.transformRequest),typeof E.container=="string"){if(this._container=document.getElementById(E.container),!this._container)throw new Error(`Container '${E.container}' not found.`)}else{if(!(E.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=E.container}if(E.maxBounds&&this.setMaxBounds(E.maxBounds),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,A=Su(v=>{this._trackResize&&!this._removed&&this.resize(v)._update()},50);this._resizeObserver=new ResizeObserver(v=>{l?A(v):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new hm(this,E),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=E.hash&&new wf(typeof E.hash=="string"&&E.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:E.center,zoom:E.zoom,bearing:E.bearing,pitch:E.pitch}),E.bounds&&(this.resize(),this.fitBounds(E.bounds,s.e({},E.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=E.localIdeographFontFamily,this._validateStyle=E.validateStyle,E.style&&this.setStyle(E.style,{localIdeographFontFamily:E.localIdeographFontFamily}),E.attributionControl&&this.addControl(new da({customAttribution:E.customAttribution})),E.maplibreLogo&&this.addControl(new gn,E.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(E,l){if(l===void 0&&(l=E.getDefaultPosition?E.getDefaultPosition():"top-right"),!E||!E.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 A=E.onAdd(this);this._controls.push(E);let v=this._controlPositions[l];return l.indexOf("bottom")!==-1?v.insertBefore(A,v.firstChild):v.appendChild(A),this}removeControl(E){if(!E||!E.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(E);return l>-1&&this._controls.splice(l,1),E.onRemove(this),this}hasControl(E){return this._controls.indexOf(E)>-1}calculateCameraOptionsFromTo(E,l,A,v){return v==null&&this.terrain&&(v=this.terrain.getElevationForLngLatZoom(A,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(E,l,A,v)}resize(E){var l;let A=this._containerDimensions(),v=A[0],S=A[1],P=this._getClampedPixelRatio(v,S);if(this._resizeCanvas(v,S,P),this.painter.resize(v,S,P),this.painter.overLimit()){let F=this.painter.context.gl;this._maxCanvasSize=[F.drawingBufferWidth,F.drawingBufferHeight];let U=this._getClampedPixelRatio(v,S);this._resizeCanvas(v,S,U),this.painter.resize(v,S,U)}this.transform.resize(v,S),(l=this._requestedCameraState)===null||l===void 0||l.resize(v,S);let B=!this._moving;return B&&(this.stop(),this.fire(new s.k("movestart",E)).fire(new s.k("move",E))),this.fire(new s.k("resize",E)),B&&this.fire(new s.k("moveend",E)),this}_getClampedPixelRatio(E,l){let{0:A,1:v}=this._maxCanvasSize,S=this.getPixelRatio(),P=E*S,B=l*S;return Math.min(P>A?A/P:1,B>v?v/B:1)*S}getPixelRatio(){var E;return(E=this._overridePixelRatio)!==null&&E!==void 0?E:devicePixelRatio}setPixelRatio(E){this._overridePixelRatio=E,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(E){return this.transform.setMaxBounds(Ci.convert(E)),this._update()}setMinZoom(E){if((E=E??-2)>=-2&&E<=this.transform.maxZoom)return this.transform.minZoom=E,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=E,this._update(),this.getZoom()>E&&this.setZoom(E),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(E){if((E=E??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(E>=0&&E<=this.transform.maxPitch)return this.transform.minPitch=E,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(E>=this.transform.minPitch)return this.transform.maxPitch=E,this._update(),this.getPitch()>E&&this.setPitch(E),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(E){return this.transform.renderWorldCopies=E,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(E){return this._cooperativeGestures=E,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(E){return this.transform.locationPoint(s.L.convert(E),this.style&&this.terrain)}unproject(E){return this.transform.pointLocation(s.P.convert(E),this.terrain)}isMoving(){var E;return this._moving||((E=this.handlers)===null||E===void 0?void 0:E.isMoving())}isZooming(){var E;return this._zooming||((E=this.handlers)===null||E===void 0?void 0:E.isZooming())}isRotating(){var E;return this._rotating||((E=this.handlers)===null||E===void 0?void 0:E.isRotating())}_createDelegatedListener(E,l,A){if(E==="mouseenter"||E==="mouseover"){let v=!1;return{layer:l,listener:A,delegates:{mousemove:P=>{let B=this.getLayer(l)?this.queryRenderedFeatures(P.point,{layers:[l]}):[];B.length?v||(v=!0,A.call(this,new ha(E,this,P.originalEvent,{features:B}))):v=!1},mouseout:()=>{v=!1}}}}if(E==="mouseleave"||E==="mouseout"){let v=!1;return{layer:l,listener:A,delegates:{mousemove:B=>{(this.getLayer(l)?this.queryRenderedFeatures(B.point,{layers:[l]}):[]).length?v=!0:v&&(v=!1,A.call(this,new ha(E,this,B.originalEvent)))},mouseout:B=>{v&&(v=!1,A.call(this,new ha(E,this,B.originalEvent)))}}}}{let v=S=>{let P=this.getLayer(l)?this.queryRenderedFeatures(S.point,{layers:[l]}):[];P.length&&(S.features=P,A.call(this,S),delete S.features)};return{layer:l,listener:A,delegates:{[E]:v}}}}on(E,l,A){if(A===void 0)return super.on(E,l);let v=this._createDelegatedListener(E,l,A);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[E]=this._delegatedListeners[E]||[],this._delegatedListeners[E].push(v);for(let S in v.delegates)this.on(S,v.delegates[S]);return this}once(E,l,A){if(A===void 0)return super.once(E,l);let v=this._createDelegatedListener(E,l,A);for(let S in v.delegates)this.once(S,v.delegates[S]);return this}off(E,l,A){return A===void 0?super.off(E,l):(this._delegatedListeners&&this._delegatedListeners[E]&&(v=>{let S=this._delegatedListeners[E];for(let P=0;Pthis._updateStyle(E,l));let A=this.style&&l.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!E)),E?(this.style=new Yn(this,l||{}),this.style.setEventedParent(this,{style:this.style}),typeof E=="string"?this.style.loadURL(E,l,A):this.style.loadJSON(E,l,A),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Yn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(E,l){if(typeof E=="string"){let A=this._requestManager.transformRequest(E,$.Style);s.f(A,(v,S)=>{v?this.fire(new s.j(v)):S&&this._updateDiff(S,l)})}else typeof E=="object"&&this._updateDiff(E,l)}_updateDiff(E,l){try{this.style.setState(E,l)&&this._update(!0)}catch(A){s.w(`Unable to perform style diff: ${A.message||A.error||A}. Rebuilding the style from scratch.`),this._updateStyle(E,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(E,l){return this._lazyInitEmptyStyle(),this.style.addSource(E,l),this._update(!0)}isSourceLoaded(E){let l=this.style&&this.style.sourceCaches[E];if(l!==void 0)return l.loaded();this.fire(new s.j(new Error(`There is no source with ID '${E}'`)))}setTerrain(E){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),E){let l=this.style.sourceCaches[E.source];if(!l)throw new Error(`cannot load terrain, because there exists no source with ID: ${E.source}`);for(let A in this.style._layers){let v=this.style._layers[A];v.type==="hillshade"&&v.source===E.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 zd(this.painter,l,E),this.painter.renderToTexture=new cA(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=A=>{A.dataType==="style"?this.terrain.sourceCache.freeRtt():A.dataType==="source"&&A.tile&&(A.sourceId!==E.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=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(A.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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new s.k("terrain",{terrain:E})),this}getTerrain(){var E,l;return(l=(E=this.terrain)===null||E===void 0?void 0:E.options)!==null&&l!==void 0?l:null}areTilesLoaded(){let E=this.style&&this.style.sourceCaches;for(let l in E){let A=E[l]._tiles;for(let v in A){let S=A[v];if(S.state!=="loaded"&&S.state!=="errored")return!1}}return!0}addSourceType(E,l,A){return this._lazyInitEmptyStyle(),this.style.addSourceType(E,l,A)}removeSource(E){return this.style.removeSource(E),this._update(!0)}getSource(E){return this.style.getSource(E)}addImage(E,l,A={}){let{pixelRatio:v=1,sdf:S=!1,stretchX:P,stretchY:B,content:F}=A;if(this._lazyInitEmptyStyle(),!(l instanceof HTMLImageElement||s.a(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:H,data:Y}=l,X=l;return this.style.addImage(E,{data:new s.R({width:U,height:H},new Uint8Array(Y)),pixelRatio:v,stretchX:P,stretchY:B,content:F,sdf:S,version:0,userImage:X}),X.onAdd&&X.onAdd(this,E),this}}{let{width:U,height:H,data:Y}=s.h.getImageData(l);this.style.addImage(E,{data:new s.R({width:U,height:H},Y),pixelRatio:v,stretchX:P,stretchY:B,content:F,sdf:S,version:0})}}updateImage(E,l){let A=this.style.getImage(E);if(!A)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.a(l)?s.h.getImageData(l):l,{width:S,height:P,data:B}=v;if(S===void 0||P===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(S!==A.data.width||P!==A.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.a(l));return A.data.replace(B,F),this.style.updateImage(E,A),this}getImage(E){return this.style.getImage(E)}hasImage(E){return E?!!this.style.getImage(E):(this.fire(new s.j(new Error("Missing required image id"))),!1)}removeImage(E){this.style.removeImage(E)}loadImage(E,l){V.getImage(this._requestManager.transformRequest(E,$.Image),l)}listImages(){return this.style.listImages()}addLayer(E,l){return this._lazyInitEmptyStyle(),this.style.addLayer(E,l),this._update(!0)}moveLayer(E,l){return this.style.moveLayer(E,l),this._update(!0)}removeLayer(E){return this.style.removeLayer(E),this._update(!0)}getLayer(E){return this.style.getLayer(E)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(E,l,A){return this.style.setLayerZoomRange(E,l,A),this._update(!0)}setFilter(E,l,A={}){return this.style.setFilter(E,l,A),this._update(!0)}getFilter(E){return this.style.getFilter(E)}setPaintProperty(E,l,A,v={}){return this.style.setPaintProperty(E,l,A,v),this._update(!0)}getPaintProperty(E,l){return this.style.getPaintProperty(E,l)}setLayoutProperty(E,l,A,v={}){return this.style.setLayoutProperty(E,l,A,v),this._update(!0)}getLayoutProperty(E,l){return this.style.getLayoutProperty(E,l)}setGlyphs(E,l={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(E,l),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(E,l,A={}){return this._lazyInitEmptyStyle(),this.style.addSprite(E,l,A,v=>{v||this._update(!0)}),this}removeSprite(E){return this._lazyInitEmptyStyle(),this.style.removeSprite(E),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(E,l={}){return this._lazyInitEmptyStyle(),this.style.setSprite(E,l,A=>{A||this._update(!0)}),this}setLight(E,l={}){return this._lazyInitEmptyStyle(),this.style.setLight(E,l),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(E,l){return this.style.setFeatureState(E,l),this._update()}removeFeatureState(E,l){return this.style.removeFeatureState(E,l),this._update()}getFeatureState(E){return this.style.getFeatureState(E)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let E=0,l=0;return this._container&&(E=this._container.clientWidth||400,l=this._container.clientHeight||300),[E,l]}_setupContainer(){let E=this._container;E.classList.add("maplibregl-map");let l=this._canvasContainer=c.create("div","maplibregl-canvas-container",E);this._interactive&&l.classList.add("maplibregl-interactive"),this._canvas=c.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 A=this._containerDimensions(),v=this._getClampedPixelRatio(A[0],A[1]);this._resizeCanvas(A[0],A[1],v);let S=this._controlContainer=c.create("div","maplibregl-control-container",E),P=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(B=>{P[B]=c.create("div",`maplibregl-ctrl-${B} `,S)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=c.create("div","maplibregl-cooperative-gesture-screen",this._container);let E=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(E=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +
${E}
+
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
+ `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){c.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(E,l,A){this._canvas.width=Math.floor(A*E),this._canvas.height=Math.floor(A*l),this._canvas.style.width=`${E}px`,this._canvas.style.height=`${l}px`}_setupPainter(){let E={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:E},v&&(l.statusMessage=v.statusMessage,l.type=v.type)},{once:!0});let A=this._canvas.getContext("webgl2",E)||this._canvas.getContext("webgl",E);if(!A){let v="Failed to initialize WebGL";throw l?(l.message=v,new Error(JSON.stringify(l))):new Error(v)}this.painter=new bh(A,this.transform),f.testSupport(A)}_onCooperativeGesture(E,l,A){return!l&&A<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(E){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||E,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(E){return this._update(),this._renderTaskQueue.add(E)}_cancelRenderFrame(E){this._renderTaskQueue.remove(E)}_render(E){let l=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(E),this._removed)return;let A=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let S=this.transform.zoom,P=s.h.now();this.style.zoomHistory.update(S,P);let B=new s.a8(S,{now:P,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),F=B.crossFadingFactor();F===1&&F===this._crossFadingFactor||(A=!0,this._crossFadingFactor=F),this.style.update(B)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=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.bg.mark(s.bh.load),this.fire(new s.k("load"))),this.style&&(this.style.hasTransitions()||A)&&(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.bg.mark(s.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var E;this._hash&&this._hash.remove();for(let A of this._controls)A.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),V.removeThrottleControl(this._imageQueueHandle),(E=this._resizeObserver)===null||E===void 0||E.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),c.remove(this._canvasContainer),c.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),s.bg.clearMetrics(),this._removed=!0,this.fire(new s.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.h.frame(E=>{s.bg.frame(E),this._frame=null,this._render(E)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(E){this._showTileBoundaries!==E&&(this._showTileBoundaries=E,this._update())}get showPadding(){return!!this._showPadding}set showPadding(E){this._showPadding!==E&&(this._showPadding=E,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(E){this._showCollisionBoxes!==E&&(this._showCollisionBoxes=E,E?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(E){this._showOverdrawInspector!==E&&(this._showOverdrawInspector=E,this._update())}get repaint(){return!!this._repaint}set repaint(E){this._repaint!==E&&(this._repaint=E,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(E){this._vertices=E,this._update()}get version(){return tr}getCameraTargetElevation(){return this.transform.elevation}},jr.NavigationControl=class{constructor(E){this._updateZoomButtons=()=>{let l=this._map.getZoom(),A=l===this._map.getMaxZoom(),v=l===this._map.getMinZoom();this._zoomInButton.disabled=A,this._zoomOutButton.disabled=v,this._zoomInButton.setAttribute("aria-disabled",A.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,A)=>{let v=this._map._getUIString(`NavigationControl.${A}`);l.title=v,l.setAttribute("aria-label",v)},this.options=s.e({},uA,E),this._container=c.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})),c.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})),c.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=c.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(E){return this._map=E,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Mu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){c.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(E,l){let A=c.create("button",E,this._container);return A.type="button",A.addEventListener("click",l),A}},jr.GeolocateControl=class extends s.E{constructor(E){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 A=new s.L(l.coords.longitude,l.coords.latitude),v=l.coords.accuracy,S=this._map.getBearing(),P=s.e({bearing:S},this.options.fitBoundsOptions),B=Ci.fromLngLat(A,v);this._map.fitBounds(B,P,{geolocateSource:!0})},this._updateMarker=l=>{if(l){let A=new s.L(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(A).addTo(this._map),this._userLocationDotMarker.setLngLat(A).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 A=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=A,this._geolocateButton.setAttribute("aria-label",A),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&jc)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",A=>A.preventDefault()),this._geolocateButton=c.create("button","maplibregl-ctrl-geolocate",this._container),c.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 A=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=A,this._geolocateButton.setAttribute("aria-label",A)}else{let A=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=A,this._geolocateButton.setAttribute("aria-label",A)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=c.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pu({element:this._dotElement}),this._circleElement=c.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",A=>{A.geolocateSource||this._watchState!=="ACTIVE_LOCK"||A.originalEvent&&A.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({},wn,E)}onAdd(E){return this._map=E,this._container=c.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(l,A=!1){Xn===void 0||A?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(v=>{Xn=v.state!=="denied",l(Xn)}).catch(()=>{Xn=!!window.navigator.geolocation,l(Xn)}):(Xn=!!window.navigator.geolocation,l(Xn)):l(Xn)}(this._setupUI),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(),c.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,_n=0,jc=!1}_isOutOfMapMaxBounds(E){let l=this._map.getMaxBounds(),A=E.coords;return l&&(A.longitudel.getEast()||A.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 E=this._map.getBounds(),l=E.getSouthEast(),A=E.getNorthEast(),v=l.distanceTo(A),S=Math.ceil(this._accuracy/(v/this._map._container.clientHeight)*2);this._circleElement.style.width=`${S}px`,this._circleElement.style.height=`${S}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":_n--,jc=!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 E;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_n++,_n>1?(E={maximumAge:6e5,timeout:0},jc=!0):(E=this.options.positionOptions,jc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,E)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},jr.AttributionControl=da,jr.LogoControl=gn,jr.ScaleControl=class{constructor(E){this._onMove=()=>{Vd(this._map,this._container,this.options)},this.setUnit=l=>{this.options.unit=l,Vd(this._map,this._container,this.options)},this.options=s.e({},Gi,E)}getDefaultPosition(){return"bottom-left"}onAdd(E){return this._map=E,this._container=c.create("div","maplibregl-ctrl maplibregl-ctrl-scale",E.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){c.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},jr.FullscreenControl=class extends s.E{constructor(E={}){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,E&&E.container&&(E.container instanceof HTMLElement?this._container=E.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(E){return this._map=E,this._container||(this._container=this._map.getContainer()),this._controlContainer=c.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){c.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let E=this._fullscreenButton=c.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);c.create("span","maplibregl-ctrl-icon",E).setAttribute("aria-hidden","true"),E.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let E=this._getTitle();this._fullscreenButton.setAttribute("aria-label",E),this._fullscreenButton.title=E}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new s.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new s.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},jr.TerrainControl=class{constructor(E){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=E}onAdd(E){return this._map=E,this._container=c.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=c.create("button","maplibregl-ctrl-terrain",this._container),c.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(){c.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},jr.Popup=class extends s.E{constructor(E){super(),this.remove=()=>(this._content&&c.remove(this._content),this._container&&(c.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new 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=c.create("div","maplibregl-popup",this._map.getContainer()),this._tip=c.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let B of this.options.className.split(" "))this._container.classList.add(B);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=Ud(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l)return;let A=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat),v=this.options.anchor,S=Pf(this.options.offset);if(!v){let B=this._container.offsetWidth,F=this._container.offsetHeight,U;U=A.y+S.bottom.ythis._map.transform.height-F?["bottom"]:[],A.xthis._map.transform.width-B/2&&U.push("right"),v=U.length===0?"bottom":U.join("-")}let P=A.add(S[v]).round();c.setTransform(this._container,`${pa[v]} translate(${P.x}px,${P.y}px)`),I_(this._container,v,"popup")},this._onClose=()=>{this.remove()},this.options=s.e(Object.create(dm),E)}addTo(E){return this._map&&this.remove(),this._map=E,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new s.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(E){return this._lngLat=s.L.convert(E),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),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(E){return this.setDOMContent(document.createTextNode(E))}setHTML(E){let l=document.createDocumentFragment(),A=document.createElement("body"),v;for(A.innerHTML=E;v=A.firstChild,v;)l.appendChild(v);return this.setDOMContent(l)}getMaxWidth(){var E;return(E=this._container)===null||E===void 0?void 0:E.style.maxWidth}setMaxWidth(E){return this.options.maxWidth=E,this._update(),this}setDOMContent(E){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=c.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(E),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(E){this._container&&this._container.classList.add(E)}removeClassName(E){this._container&&this._container.classList.remove(E)}setOffset(E){return this.options.offset=E,this._update(),this}toggleClassName(E){if(this._container)return this._container.classList.toggle(E)}_createCloseButton(){this.options.closeButton&&(this._closeButton=c.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 E=this._container.querySelector(pm);E&&E.focus()}},jr.Marker=Pu,jr.Style=Yn,jr.LngLat=s.L,jr.LngLatBounds=Ci,jr.Point=s.P,jr.MercatorCoordinate=s.U,jr.Evented=s.E,jr.AJAXError=s.bi,jr.config=s.c,jr.CanvasSource=Wo,jr.GeoJSONSource=on,jr.ImageSource=Di,jr.RasterDEMTileSource=Lc,jr.RasterTileSource=kc,jr.VectorTileSource=ll,jr.VideoSource=ns,jr.setRTLTextPlugin=s.bj,jr.getRTLTextPluginStatus=s.bk,jr.prewarm=function(){Io().acquire(gi)},jr.clearPrewarmedResources=function(){let E=ul;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(gi),ul=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()"))},Am.extend(jr,{isSafari:s.ac,getPerformanceMetrics:s.bg.getPerformanceMetrics}),jr});var n=r;return n})});var H$=Hr((HUe,gP)=>{(function(t,e,r,i){"use strict";var n=["","webkit","Moz","MS","ms","o"],s=e.createElement("div"),o="function",c=Math.round,f=Math.abs,y=Date.now;function b(le,pe,De){return setTimeout(J(le,De),pe)}function M(le,pe,De){return Array.isArray(le)?(L(le,De[pe],De),!0):!1}function L(le,pe,De){var st;if(le)if(le.forEach)le.forEach(pe,De);else if(le.length!==i)for(st=0;st\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",li=t.console&&(t.console.warn||t.console.log);return li&&li.call(t.console,st,Jt),le.apply(this,arguments)}}var V;typeof Object.assign!="function"?V=function(pe){if(pe===i||pe===null)throw new TypeError("Cannot convert undefined or null to object");for(var De=Object(pe),st=1;st-1}function ot(le){return le.trim().split(/\s+/g)}function et(le,pe,De){if(le.indexOf&&!De)return le.indexOf(pe);for(var st=0;stZs[pe]}):st=st.sort()),st}function qt(le,pe){for(var De,st,St=pe[0].toUpperCase()+pe.slice(1),Jt=0;Jt1&&!De.firstMultiple?De.firstMultiple=Io(pe):St===1&&(De.firstMultiple=!1);var Jt=De.firstInput,li=De.firstMultiple,as=li?li.center:Jt.center,Is=pe.center=hl(st);pe.timeStamp=y(),pe.deltaTime=pe.timeStamp-Jt.timeStamp,pe.angle=Ho(as,Is),pe.distance=Tt(as,Is),vu(De,pe),pe.offsetDirection=Ro(pe.deltaX,pe.deltaY);var Zs=Da(pe.deltaTime,pe.deltaX,pe.deltaY);pe.overallVelocityX=Zs.x,pe.overallVelocityY=Zs.y,pe.overallVelocity=f(Zs.x)>f(Zs.y)?Zs.x:Zs.y,pe.scale=li?Ul(li.pointers,st):1,pe.rotation=li?bn(li.pointers,st):0,pe.maxPointers=De.prevInput?pe.pointers.length>De.prevInput.maxPointers?pe.pointers.length:De.prevInput.maxPointers:pe.pointers.length,ul(De,pe);var Na=le.element;Ze(pe.srcEvent.target,Na)&&(Na=pe.srcEvent.target),pe.target=Na}function vu(le,pe){var De=pe.center,st=le.offsetDelta||{},St=le.prevDelta||{},Jt=le.prevInput||{};(pe.eventType===on||Jt.eventType===Di)&&(St=le.prevDelta={x:Jt.deltaX||0,y:Jt.deltaY||0},st=le.offsetDelta={x:De.x,y:De.y}),pe.deltaX=St.x+(De.x-st.x),pe.deltaY=St.y+(De.y-st.y)}function ul(le,pe){var De=le.lastInterval||pe,st=pe.timeStamp-De.timeStamp,St,Jt,li,as;if(pe.eventType!=ns&&(st>Lc||De.velocity===i)){var Is=pe.deltaX-De.deltaX,Zs=pe.deltaY-De.deltaY,Na=Da(st,Is,Zs);Jt=Na.x,li=Na.y,St=f(Na.x)>f(Na.y)?Na.x:Na.y,as=Ro(Is,Zs),le.lastInterval=pe}else St=De.velocity,Jt=De.velocityX,li=De.velocityY,as=De.direction;pe.velocity=St,pe.velocityX=Jt,pe.velocityY=li,pe.direction=as}function Io(le){for(var pe=[],De=0;De=f(pe)?le<0?cl:Co:pe<0?La:la}function Tt(le,pe,De){De||(De=ct);var st=pe[De[0]]-le[De[0]],St=pe[De[1]]-le[De[1]];return Math.sqrt(st*st+St*St)}function Ho(le,pe,De){De||(De=ct);var st=pe[De[0]]-le[De[0]],St=pe[De[1]]-le[De[1]];return Math.atan2(St,st)*180/Math.PI}function bn(le,pe){return Ho(pe[1],pe[0],ds)+Ho(le[1],le[0],ds)}function Ul(le,pe){return Tt(pe[0],pe[1],ds)/Tt(le[0],le[1],ds)}var Oa={mousedown:on,mousemove:is,mouseup:Di},Ct="mousedown",Vr="mousemove mouseup";function br(){this.evEl=Ct,this.evWin=Vr,this.pressed=!1,vn.apply(this,arguments)}q(br,vn,{handler:function(pe){var De=Oa[pe.type];De&on&&pe.button===0&&(this.pressed=!0),De&is&&pe.which!==1&&(De=Di),this.pressed&&(De&Di&&(this.pressed=!1),this.callback(this.manager,De,{pointers:[pe],changedPointers:[pe],pointerType:ll,srcEvent:pe}))}});var Gs={pointerdown:on,pointermove:is,pointerup:Di,pointercancel:ns,pointerout:ns},Ba={2:Ci,3:qs,4:ll,5:kc},Rr="pointerdown",ca="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Rr="MSPointerDown",ca="MSPointerMove MSPointerUp MSPointerCancel");function be(){this.evEl=Rr,this.evWin=ca,vn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}q(be,vn,{handler:function(pe){var De=this.store,st=!1,St=pe.type.toLowerCase().replace("ms",""),Jt=Gs[St],li=Ba[pe.pointerType]||pe.pointerType,as=li==Ci,Is=et(De,pe.pointerId,"pointerId");Jt&on&&(pe.button===0||as)?Is<0&&(De.push(pe),Is=De.length-1):Jt&(Di|ns)&&(st=!0),!(Is<0)&&(De[Is]=pe,this.callback(this.manager,Jt,{pointers:De,changedPointers:[pe],pointerType:li,srcEvent:pe}),st&&De.splice(Is,1))}});var te={touchstart:on,touchmove:is,touchend:Di,touchcancel:ns},ne="touchstart",fe="touchstart touchmove touchend touchcancel";function Te(){this.evTarget=ne,this.evWin=fe,this.started=!1,vn.apply(this,arguments)}q(Te,vn,{handler:function(pe){var De=te[pe.type];if(De===on&&(this.started=!0),!!this.started){var st=Ee.call(this,pe,De);De&(Di|ns)&&st[0].length-st[1].length===0&&(this.started=!1),this.callback(this.manager,De,{pointers:st[0],changedPointers:st[1],pointerType:Ci,srcEvent:pe})}}});function Ee(le,pe){var De=Lt(le.touches),st=Lt(le.changedTouches);return pe&(Di|ns)&&(De=Gt(De.concat(st),"identifier",!0)),[De,st]}var xe={touchstart:on,touchmove:is,touchend:Di,touchcancel:ns},Be="touchstart touchmove touchend touchcancel";function Ce(){this.evTarget=Be,this.targetIds={},vn.apply(this,arguments)}q(Ce,vn,{handler:function(pe){var De=xe[pe.type],st=je.call(this,pe,De);st&&this.callback(this.manager,De,{pointers:st[0],changedPointers:st[1],pointerType:Ci,srcEvent:pe})}});function je(le,pe){var De=Lt(le.touches),st=this.targetIds;if(pe&(on|is)&&De.length===1)return st[De[0].identifier]=!0,[De,De];var St,Jt,li=Lt(le.changedTouches),as=[],Is=this.target;if(Jt=De.filter(function(Zs){return Ze(Zs.target,Is)}),pe===on)for(St=0;St-1&&st.splice(Jt,1)};setTimeout(St,ht)}}function er(le){for(var pe=le.srcEvent.clientX,De=le.srcEvent.clientY,st=0;st-1&&this.requireFail.splice(pe,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(le){return!!this.simultaneous[le.id]},emit:function(le){var pe=this,De=this.state;function st(St){pe.manager.emit(St,le)}De<_i&&st(pe.options.event+H0(De)),st(pe.options.event),le.additionalEvent&&st(le.additionalEvent),De>=_i&&st(pe.options.event+H0(De))},tryEmit:function(le){if(this.canEmit())return this.emit(le);this.state=An},canEmit:function(){for(var le=0;lepe.threshold&&St&pe.direction},attrTest:function(le){return mo.prototype.attrTest.call(this,le)&&(this.state&Cs||!(this.state&Cs)&&this.directionTest(le))},emit:function(le){this.pX=le.deltaX,this.pY=le.deltaY;var pe=$o(le.direction);pe&&(le.additionalEvent=this.options.event+pe),this._super.emit.call(this,le)}});function an(){mo.apply(this,arguments)}q(an,mo,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Xr]},attrTest:function(le){return this._super.attrTest.call(this,le)&&(Math.abs(le.scale-1)>this.options.threshold||this.state&Cs)},emit:function(le){if(le.scale!==1){var pe=le.scale<1?"in":"out";le.additionalEvent=this.options.event+pe}this._super.emit.call(this,le)}});function Ti(){Fn.apply(this,arguments),this._timer=null,this._input=null}q(Ti,Fn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ji]},process:function(le){var pe=this.options,De=le.pointers.length===pe.pointers,st=le.distancepe.time;if(this._input=le,!st||!De||le.eventType&(Di|ns)&&!St)this.reset();else if(le.eventType&on)this.reset(),this._timer=b(function(){this.state=Fa,this.tryEmit()},pe.time,this);else if(le.eventType&Di)return Fa;return An},reset:function(){clearTimeout(this._timer)},emit:function(le){this.state===Fa&&(le&&le.eventType&Di?this.manager.emit(this.options.event+"up",le):(this._input.timeStamp=y(),this.manager.emit(this.options.event,this._input)))}});function Wl(){mo.apply(this,arguments)}q(Wl,mo,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Xr]},attrTest:function(le){return this._super.attrTest.call(this,le)&&(Math.abs(le.rotation)>this.options.threshold||this.state&Cs)}});function mn(){mo.apply(this,arguments)}q(mn,mo,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:fs|po,pointers:1},getTouchAction:function(){return jl.prototype.getTouchAction.call(this)},attrTest:function(le){var pe=this.options.direction,De;return pe&(fs|po)?De=le.overallVelocity:pe&fs?De=le.overallVelocityX:pe&po&&(De=le.overallVelocityY),this._super.attrTest.call(this,le)&&pe&le.offsetDirection&&le.distance>this.options.threshold&&le.maxPointers==this.options.pointers&&f(De)>this.options.velocity&&le.eventType&Di},emit:function(le){var pe=$o(le.offsetDirection);pe&&this.manager.emit(this.options.event+pe,le),this.manager.emit(this.options.event,le)}});function bu(){Fn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}q(bu,Fn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[pi]},process:function(le){var pe=this.options,De=le.pointers.length===pe.pointers,st=le.distance{"use strict";t8.exports=XC;t8.exports.default=XC;function XC(t,e,r){r=r||2;var i=e&&e.length,n=i?e[0]*r:t.length,s=YY(t,0,n,r,!0),o=[];if(!s||s.next===s.prev)return o;var c,f,y,b,M,L,N;if(i&&(s=q_e(t,e,s,r)),t.length>80*r){c=y=t[0],f=b=t[1];for(var V=r;Vy&&(y=M),L>b&&(b=L);N=Math.max(y-c,b-f),N=N!==0?32767/N:0}return SS(s,o,r,c,f,N,0),o}function YY(t,e,r,i,n){var s,o;if(n===e8(t,e,r,i)>0)for(s=e;s=e;s-=i)o=ZY(s,t[s],t[s+1],o);return o&&QC(o,o.next)&&(ES(o),o=o.next),o}function Wg(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(QC(r,r.next)||ws(r.prev,r,r.next)===0)){if(ES(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function SS(t,e,r,i,n,s,o){if(t){!o&&s&&Q_e(t,i,n,s);for(var c=t,f,y;t.prev!==t.next;){if(f=t.prev,y=t.next,s?W_e(t,i,n,s):j_e(t)){e.push(f.i/r|0),e.push(t.i/r|0),e.push(y.i/r|0),ES(t),t=y.next,c=y.next;continue}if(t=y,t===c){o?o===1?(t=H_e(Wg(t),e,r),SS(t,e,r,i,n,s,2)):o===2&&$_e(t,e,r,i,n,s):SS(Wg(t),e,r,i,n,s,1);break}}}}function j_e(t){var e=t.prev,r=t,i=t.next;if(ws(e,r,i)>=0)return!1;for(var n=e.x,s=r.x,o=i.x,c=e.y,f=r.y,y=i.y,b=ns?n>o?n:o:s>o?s:o,N=c>f?c>y?c:y:f>y?f:y,V=i.next;V!==e;){if(V.x>=b&&V.x<=L&&V.y>=M&&V.y<=N&&tx(n,c,s,f,o,y,V.x,V.y)&&ws(V.prev,V,V.next)>=0)return!1;V=V.next}return!0}function W_e(t,e,r,i){var n=t.prev,s=t,o=t.next;if(ws(n,s,o)>=0)return!1;for(var c=n.x,f=s.x,y=o.x,b=n.y,M=s.y,L=o.y,N=cf?c>y?c:y:f>y?f:y,Q=b>M?b>L?b:L:M>L?M:L,q=KB(N,V,e,r,i),J=KB($,Q,e,r,i),ee=t.prevZ,oe=t.nextZ;ee&&ee.z>=q&&oe&&oe.z<=J;){if(ee.x>=N&&ee.x<=$&&ee.y>=V&&ee.y<=Q&&ee!==n&&ee!==o&&tx(c,b,f,M,y,L,ee.x,ee.y)&&ws(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,oe.x>=N&&oe.x<=$&&oe.y>=V&&oe.y<=Q&&oe!==n&&oe!==o&&tx(c,b,f,M,y,L,oe.x,oe.y)&&ws(oe.prev,oe,oe.next)>=0))return!1;oe=oe.nextZ}for(;ee&&ee.z>=q;){if(ee.x>=N&&ee.x<=$&&ee.y>=V&&ee.y<=Q&&ee!==n&&ee!==o&&tx(c,b,f,M,y,L,ee.x,ee.y)&&ws(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;oe&&oe.z<=J;){if(oe.x>=N&&oe.x<=$&&oe.y>=V&&oe.y<=Q&&oe!==n&&oe!==o&&tx(c,b,f,M,y,L,oe.x,oe.y)&&ws(oe.prev,oe,oe.next)>=0)return!1;oe=oe.nextZ}return!0}function H_e(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!QC(n,s)&&XY(n,i,i.next,s)&&TS(n,s)&&TS(s,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(s.i/r|0),ES(i),ES(i.next),i=t=s),i=i.next}while(i!==t);return Wg(i)}function $_e(t,e,r,i,n,s){var o=t;do{for(var c=o.next.next;c!==o.prev;){if(o.i!==c.i&&eye(o,c)){var f=QY(o,c);o=Wg(o,o.next),f=Wg(f,f.next),SS(o,e,r,i,n,s,0),SS(f,e,r,i,n,s,0);return}c=c.next}o=o.next}while(o!==t)}function q_e(t,e,r,i){var n=[],s,o,c,f,y;for(s=0,o=e.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>=y&&i!==r.x&&tx(no.x||r.x===o.x&&X_e(o,r)))&&(o=r,M=L)),r=r.next;while(r!==f);return o}function X_e(t,e){return ws(t.prev,t,e.prev)<0&&ws(e.next,t,t.next)<0}function Q_e(t,e,r,i){var n=t;do n.z===0&&(n.z=KB(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,K_e(n)}function K_e(t){var e,r,i,n,s,o,c,f,y=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,c=0,e=0;e0||f>0&&i;)c!==0&&(f===0||!i||r.z<=i.z)?(n=r,r=r.nextZ,c--):(n=i,i=i.nextZ,f--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,y*=2}while(o>1);return t}function KB(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function J_e(t){var e=t,r=t;do(e.x=(t-o)*(s-c)&&(t-o)*(i-c)>=(r-o)*(e-c)&&(r-o)*(s-c)>=(n-o)*(i-c)}function eye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!tye(t,e)&&(TS(t,e)&&TS(e,t)&&rye(t,e)&&(ws(t.prev,t,e.prev)||ws(t,e.prev,e))||QC(t,e)&&ws(t.prev,t,t.next)>0&&ws(e.prev,e,e.next)>0)}function ws(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function QC(t,e){return t.x===e.x&&t.y===e.y}function XY(t,e,r,i){var n=YC(ws(t,e,r)),s=YC(ws(t,e,i)),o=YC(ws(r,i,t)),c=YC(ws(r,i,e));return!!(n!==s&&o!==c||n===0&&ZC(t,r,e)||s===0&&ZC(t,i,e)||o===0&&ZC(r,t,i)||c===0&&ZC(r,e,i))}function ZC(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function YC(t){return t>0?1:t<0?-1:0}function tye(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&XY(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function TS(t,e){return ws(t.prev,t,t.next)<0?ws(t,e,t.next)>=0&&ws(t,t.prev,e)>=0:ws(t,e,t.prev)<0||ws(t,t.next,e)<0}function rye(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.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!==t);return i}function QY(t,e){var r=new JB(t.i,t.x,t.y),i=new JB(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function ZY(t,e,r,i){var n=new JB(t,e,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 ES(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function JB(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}XC.deviation=function(t,e,r,i){var n=e&&e.length,s=n?e[0]*r:t.length,o=Math.abs(e8(t,0,s,r));if(n)for(var c=0,f=e.length;c0&&(i+=t[n-1].length,r.holes.push(i))}return r}});var J8=Hr(Cx=>{"use strict";Object.defineProperty(Cx,"__esModule",{value:!0});Cx.DefaultSerializer=Cx.extendSerializer=void 0;function O2e(t,e){let r=t.deserialize.bind(t),i=t.serialize.bind(t);return{deserialize(n){return e.deserialize(n,r)},serialize(n){return e.serialize(n,i)}}}Cx.extendSerializer=O2e;var qJ={deserialize(t){return Object.assign(Error(t.message),{name:t.name,stack:t.stack})},serialize(t){return{__error_marker:"$$error",message:t.message,name:t.name,stack:t.stack}}},B2e=t=>t&&typeof t=="object"&&"__error_marker"in t&&t.__error_marker==="$$error";Cx.DefaultSerializer={deserialize(t){return B2e(t)?qJ.deserialize(t):t},serialize(t){return t instanceof Error?qJ.serialize(t):t}}});var Ix=Hr(L0=>{"use strict";Object.defineProperty(L0,"__esModule",{value:!0});L0.serialize=L0.deserialize=L0.registerSerializer=void 0;var GJ=J8(),ZI=GJ.DefaultSerializer;function F2e(t){ZI=GJ.extendSerializer(ZI,t)}L0.registerSerializer=F2e;function N2e(t){return ZI.deserialize(t)}L0.deserialize=N2e;function z2e(t){return ZI.serialize(t)}L0.serialize=z2e});var YJ=Hr(Rx=>{"use strict";Object.defineProperty(Rx,"__esModule",{value:!0});Rx.getBundleURL=Rx.getBaseURL=void 0;var eF;function U2e(){return eF||(eF=V2e()),eF}Rx.getBundleURL=U2e;function V2e(){try{throw new Error}catch(t){let e=(""+t.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(e)return ZJ(e[0])}return"/"}function ZJ(t){return(""+t).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}Rx.getBaseURL=ZJ});var rF=Hr(D0=>{"use strict";Object.defineProperty(D0,"__esModule",{value:!0});D0.isWorkerRuntime=D0.getWorkerImplementation=D0.defaultPoolSize=void 0;var XJ=YJ();D0.defaultPoolSize=typeof navigator<"u"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;var QJ=t=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t);function KJ(t){let e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function j2e(){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 t extends Worker{constructor(i,n){var s,o;typeof i=="string"&&n&&n._baseURL?i=new URL(i,n._baseURL):typeof i=="string"&&!QJ(i)&&XJ.getBundleURL().match(/^file:\/\//i)&&(i=new URL(i,XJ.getBundleURL().replace(/\/[^\/]+$/,"/")),(!((s=n?.CORSWorkaround)!==null&&s!==void 0)||s)&&(i=KJ(`importScripts(${JSON.stringify(i)});`))),typeof i=="string"&&QJ(i)&&(!((o=n?.CORSWorkaround)!==null&&o!==void 0)||o)&&(i=KJ(`importScripts(${JSON.stringify(i)});`)),super(i,n)}}class e extends t{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 e(s,n)}}return{blob:e,default:t}}var tF;function W2e(){return tF||(tF=j2e()),tF}D0.getWorkerImplementation=W2e;function H2e(){let t=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!t)}D0.isWorkerRuntime=H2e});var eee=Hr((Dft,JJ)=>{var kx=1e3,Lx=kx*60,Dx=Lx*60,t_=Dx*24,$2e=t_*7,q2e=t_*365.25;JJ.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return G2e(t);if(r==="number"&&isFinite(t))return e.long?Y2e(t):Z2e(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function G2e(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*q2e;case"weeks":case"week":case"w":return r*$2e;case"days":case"day":case"d":return r*t_;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Dx;case"minutes":case"minute":case"mins":case"min":case"m":return r*Lx;case"seconds":case"second":case"secs":case"sec":case"s":return r*kx;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Z2e(t){var e=Math.abs(t);return e>=t_?Math.round(t/t_)+"d":e>=Dx?Math.round(t/Dx)+"h":e>=Lx?Math.round(t/Lx)+"m":e>=kx?Math.round(t/kx)+"s":t+"ms"}function Y2e(t){var e=Math.abs(t);return e>=t_?YI(t,e,t_,"day"):e>=Dx?YI(t,e,Dx,"hour"):e>=Lx?YI(t,e,Lx,"minute"):e>=kx?YI(t,e,kx,"second"):t+" ms"}function YI(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var ree=Hr((Oft,tee)=>{function X2e(t){r.debug=r,r.default=r,r.coerce=f,r.disable=s,r.enable=n,r.enabled=o,r.humanize=eee(),r.destroy=y,Object.keys(t).forEach(b=>{r[b]=t[b]}),r.names=[],r.skips=[],r.formatters={};function e(b){let M=0;for(let L=0;L{if(Re==="%%")return"%";oe++;let He=r.formatters[Ze];if(typeof He=="function"){let ot=Q[oe];Re=He.call(q,ot),Q.splice(oe,1),oe--}return Re}),r.formatArgs.call(q,Q),(q.log||r.log).apply(q,Q)}return $.namespace=b,$.useColors=r.useColors(),$.color=r.selectColor(b),$.extend=i,$.destroy=r.destroy,Object.defineProperty($,"enabled",{enumerable:!0,configurable:!1,get:()=>L!==null?L:(N!==r.namespaces&&(N=r.namespaces,V=r.enabled(b)),V),set:Q=>{L=Q}}),typeof r.init=="function"&&r.init($),$}function i(b,M){let L=r(this.namespace+(typeof M>"u"?":":M)+b);return L.log=this.log,L}function n(b){r.save(b),r.namespaces=b,r.names=[],r.skips=[];let M,L=(typeof b=="string"?b:"").split(/[\s,]+/),N=L.length;for(M=0;M"-"+M)].join(",");return r.enable(""),b}function o(b){if(b[b.length-1]==="*")return!0;let M,L;for(M=0,L=r.skips.length;M{gu.formatArgs=K2e;gu.save=J2e;gu.load=eSe;gu.useColors=Q2e;gu.storage=tSe();gu.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();gu.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 Q2e(){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 K2e(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+XI.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}gu.log=console.debug||console.log||(()=>{});function J2e(t){try{t?gu.storage.setItem("debug",t):gu.storage.removeItem("debug")}catch{}}function eSe(){let t;try{t=gu.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function tSe(){try{return localStorage}catch{}}XI.exports=ree()(gu);var{formatters:rSe}=XI.exports;rSe.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var fT=Hr(Ox=>{"use strict";var iSe=Ox&&Ox.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.AsyncSerialScheduler=void 0;var iF=class{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(e=>this._baseObserver.error(e))}error(e){this._baseObserver.error(e)}schedule(e){let r=Promise.all(this._pendingPromises),i=[],n=o=>i.push(o),s=Promise.resolve().then(()=>iSe(this,void 0,void 0,function*(){yield r,yield e(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)}};Ox.AsyncSerialScheduler=iF});var nee=Hr(iee=>{"use strict";Object.defineProperty(iee,"__esModule",{value:!0})});var nF=Hr(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.registerObservableSymbol=Bl.getSymbol=Bl.hasSymbol=Bl.hasSymbols=void 0;var nSe=()=>typeof Symbol=="function";Bl.hasSymbols=nSe;var sSe=t=>Bl.hasSymbols()&&!!Symbol[t];Bl.hasSymbol=sSe;var oSe=t=>Bl.hasSymbol(t)?Symbol[t]:"@@"+t;Bl.getSymbol=oSe;function aSe(){Bl.hasSymbols()&&!Bl.hasSymbol("observable")&&(Symbol.observable=Symbol("observable"))}Bl.registerObservableSymbol=aSe;Bl.hasSymbol("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"))});var Sd=Hr(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});qp.Observable=qp.SubscriptionObserver=qp.Subscription=void 0;nee();var pT=nF(),lSe=pT.getSymbol("iterator"),oF=pT.getSymbol("observable"),see=pT.getSymbol("species");function JI(t,e){let r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function dT(t){let e=t.constructor;return e!==void 0&&(e=e[see],e===null&&(e=void 0)),e!==void 0?e:r_}function cSe(t){return t instanceof r_}function Bx(t){Bx.log?Bx.log(t):setTimeout(()=>{throw t},0)}function KI(t){Promise.resolve().then(()=>{try{t()}catch(e){Bx(e)}})}function oee(t){let e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{let r=JI(e,"unsubscribe");r&&r.call(e)}}catch(r){Bx(r)}}function aF(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function uSe(t){let e=t._queue;if(e){t._queue=void 0,t._state="ready";for(let r of e)if(aee(t,r.type,r.value),t._state==="closed")break}}function aee(t,e,r){t._state="running";let i=t._observer;try{let n=i?JI(i,e):void 0;switch(e){case"next":n&&n.call(i,r);break;case"error":if(aF(t),n)n.call(i,r);else throw r;break;case"complete":aF(t),n&&n.call(i);break}}catch(n){Bx(n)}t._state==="closed"?oee(t):t._state==="running"&&(t._state="ready")}function sF(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue=t._queue||[],t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],KI(()=>uSe(t));return}aee(t,e,r)}}var e4=class{constructor(e,r){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let i=new t4(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"&&(aF(this),oee(this))}};qp.Subscription=e4;var t4=class{constructor(e){this._subscription=e}get closed(){return this._subscription._state==="closed"}next(e){sF(this._subscription,"next",e)}error(e){sF(this._subscription,"error",e)}complete(){sF(this._subscription,"complete")}};qp.SubscriptionObserver=t4;var r_=class t{constructor(e){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,r,i){return(typeof e!="object"||e===null)&&(e={next:e,error:r,complete:i}),new e4(e,this._subscriber)}pipe(e,...r){let i=this;for(let n of[e,...r])i=n(i);return i}tap(e,r,i){let n=typeof e!="object"||e===null?{next:e,error:r,complete:i}:e;return new t(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(e){return new Promise((r,i)=>{if(typeof e!="function"){i(new TypeError(e+" is not a function"));return}function n(){s.unsubscribe(),r(void 0)}let s=this.subscribe({next(o){try{e(o,n)}catch(c){i(c),s.unsubscribe()}},error(o){i(o)},complete(){r(void 0)}})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let r=dT(this);return new r(i=>this.subscribe({next(n){let s=n;try{s=e(n)}catch(o){return i.error(o)}i.next(s)},error(n){i.error(n)},complete(){i.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let r=dT(this);return new r(i=>this.subscribe({next(n){try{if(!e(n))return}catch(s){return i.error(s)}i.next(n)},error(n){i.error(n)},complete(){i.complete()}}))}reduce(e,r){if(typeof e!="function")throw new TypeError(e+" is not a function");let i=dT(this),n=arguments.length>1,s=!1,o=r;return new i(c=>this.subscribe({next(f){let y=!s;if(s=!0,!y||n)try{o=e(o,f)}catch(b){return c.error(b)}else o=f},error(f){c.error(f)},complete(){if(!s&&!n)return c.error(new TypeError("Cannot reduce an empty sequence"));c.next(o),c.complete()}}))}concat(...e){let r=dT(this);return new r(i=>{let n,s=0;function o(c){n=c.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){s===e.length?(n=void 0,i.complete()):o(r.from(e[s++]))}})}return o(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let r=dT(this);return new r(i=>{let n=[],s=this.subscribe({next(c){let f;if(e)try{f=e(c)}catch(b){return i.error(b)}else f=c;let y=r.from(f).subscribe({next(b){i.next(b)},error(b){i.error(b)},complete(){let b=n.indexOf(y);b>=0&&n.splice(b,1),o()}});n.push(y)},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,oF)](){return this}static from(e){let r=typeof this=="function"?this:t;if(e==null)throw new TypeError(e+" is not an object");let i=JI(e,oF);if(i){let n=i.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return cSe(n)&&n.constructor===r?n:new r(s=>n.subscribe(s))}if(pT.hasSymbol("iterator")){let n=JI(e,lSe);if(n)return new r(s=>{KI(()=>{if(!s.closed){for(let o of n.call(e))if(s.next(o),s.closed)return;s.complete()}})})}if(Array.isArray(e))return new r(n=>{KI(()=>{if(!n.closed){for(let s of e)if(n.next(s),n.closed)return;n.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){let r=typeof this=="function"?this:t;return new r(i=>{KI(()=>{if(!i.closed){for(let n of e)if(i.next(n),i.closed)return;i.complete()}})})}static get[see](){return this}};qp.Observable=r_;pT.hasSymbols()&&Object.defineProperty(r_,Symbol("extensions"),{value:{symbol:oF,hostReportError:Bx},configurable:!0});qp.default=r_});var O0=Hr(lF=>{"use strict";Object.defineProperty(lF,"__esModule",{value:!0});function hSe(t){typeof t=="function"?t():t&&typeof t.unsubscribe=="function"&&t.unsubscribe()}lF.default=hSe});var lee=Hr(AT=>{"use strict";var fSe=AT&&AT.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})};Object.defineProperty(AT,"__esModule",{value:!0});var dSe=fT(),pSe=Sd(),ASe=O0();function mSe(t){return e=>new pSe.default(r=>{let i=new dSe.AsyncSerialScheduler(r),n=e.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>fSe(this,void 0,void 0,function*(){(yield t(s))&&o(s)}))}});return()=>ASe.default(n)})}AT.default=mSe});var uee=Hr(Fx=>{"use strict";Object.defineProperty(Fx,"__esModule",{value:!0});Fx.isIterator=Fx.isAsyncIterator=void 0;var cee=nF();function gSe(t){return t&&cee.hasSymbol("asyncIterator")&&t[Symbol.asyncIterator]}Fx.isAsyncIterator=gSe;function _Se(t){return t&&cee.hasSymbol("iterator")&&t[Symbol.iterator]}Fx.isIterator=_Se});var fee=Hr(i_=>{"use strict";var ySe=i_&&i_.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})},xSe=i_&&i_.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(c,f){o=t[s](o),n(c,f,o.done,o.value)})}}function n(s,o,c,f){Promise.resolve(f).then(function(y){s({value:y,done:c})},o)}};Object.defineProperty(i_,"__esModule",{value:!0});var vSe=fT(),hee=uee(),bSe=Sd(),wSe=O0();function SSe(t){return e=>new bSe.default(r=>{let i=new vSe.AsyncSerialScheduler(r),n=e.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>ySe(this,void 0,void 0,function*(){var c,f;let y=yield t(s);if(hee.isIterator(y)||hee.isAsyncIterator(y))try{for(var b=xSe(y),M;M=yield b.next(),!M.done;){let L=M.value;o(L)}}catch(L){c={error:L}}finally{try{M&&!M.done&&(f=b.return)&&(yield f.call(b))}finally{if(c)throw c.error}}else y.map(L=>o(L))}))}});return()=>wSe.default(n)})}i_.default=SSe});var dee=Hr(cF=>{"use strict";Object.defineProperty(cF,"__esModule",{value:!0});var TSe=Sd();function ESe(t){return new TSe.Observable(e=>{let r=0,i=setInterval(()=>{e.next(r++)},t);return()=>clearInterval(i)})}cF.default=ESe});var pee=Hr(mT=>{"use strict";var MSe=mT&&mT.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})};Object.defineProperty(mT,"__esModule",{value:!0});var PSe=fT(),CSe=Sd(),ISe=O0();function RSe(t){return e=>new CSe.default(r=>{let i=new PSe.AsyncSerialScheduler(r),n=e.subscribe({complete(){i.complete()},error(s){i.error(s)},next(s){i.schedule(o=>MSe(this,void 0,void 0,function*(){let c=yield t(s);o(c)}))}});return()=>ISe.default(n)})}mT.default=RSe});var mee=Hr(uF=>{"use strict";Object.defineProperty(uF,"__esModule",{value:!0});var Aee=Sd(),kSe=O0();function LSe(...t){return t.length===0?Aee.Observable.from([]):new Aee.Observable(e=>{let r=0,i=t.map(s=>s.subscribe({error(o){e.error(o),n()},next(o){e.next(o)},complete(){++r===t.length&&(e.complete(),n())}})),n=()=>{i.forEach(s=>kSe.default(s))};return n})}uF.default=LSe});var dF=Hr(fF=>{"use strict";Object.defineProperty(fF,"__esModule",{value:!0});var DSe=Sd(),hF=class extends DSe.default{constructor(){super(e=>(this._observers.add(e),()=>this._observers.delete(e))),this._observers=new Set}next(e){for(let r of this._observers)r.next(e)}error(e){for(let r of this._observers)r.error(e)}complete(){for(let e of this._observers)e.complete()}};fF.default=hF});var gee=Hr(pF=>{"use strict";Object.defineProperty(pF,"__esModule",{value:!0});var OSe=Sd(),BSe=dF(),FSe=O0();function NSe(t){let e=new BSe.default,r,i=0;return new OSe.default(n=>{r||(r=t.subscribe(e));let s=e.subscribe(n);return i++,()=>{i--,s.unsubscribe(),i===0&&(FSe.default(r),r=void 0)}})}pF.default=NSe});var _ee=Hr(gT=>{"use strict";var zSe=gT&&gT.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})};Object.defineProperty(gT,"__esModule",{value:!0});var USe=fT(),VSe=Sd(),jSe=O0();function WSe(t,e){return r=>new VSe.default(i=>{let n,s=0,o=new USe.AsyncSerialScheduler(i),c=r.subscribe({complete(){o.complete()},error(f){o.error(f)},next(f){o.schedule(y=>zSe(this,void 0,void 0,function*(){n=yield t(s===0?typeof e>"u"?f:e:n,f,s++),y(n)}))}});return()=>jSe.default(c)})}gT.default=WSe});var yee=Hr(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.unsubscribe=Ws.Subject=Ws.scan=Ws.Observable=Ws.multicast=Ws.merge=Ws.map=Ws.interval=Ws.flatMap=Ws.filter=void 0;var HSe=lee();Object.defineProperty(Ws,"filter",{enumerable:!0,get:function(){return HSe.default}});var $Se=fee();Object.defineProperty(Ws,"flatMap",{enumerable:!0,get:function(){return $Se.default}});var qSe=dee();Object.defineProperty(Ws,"interval",{enumerable:!0,get:function(){return qSe.default}});var GSe=pee();Object.defineProperty(Ws,"map",{enumerable:!0,get:function(){return GSe.default}});var ZSe=mee();Object.defineProperty(Ws,"merge",{enumerable:!0,get:function(){return ZSe.default}});var YSe=gee();Object.defineProperty(Ws,"multicast",{enumerable:!0,get:function(){return YSe.default}});var XSe=Sd();Object.defineProperty(Ws,"Observable",{enumerable:!0,get:function(){return XSe.default}});var QSe=_ee();Object.defineProperty(Ws,"scan",{enumerable:!0,get:function(){return QSe.default}});var KSe=dF();Object.defineProperty(Ws,"Subject",{enumerable:!0,get:function(){return KSe.default}});var JSe=O0();Object.defineProperty(Ws,"unsubscribe",{enumerable:!0,get:function(){return JSe.default}})});var _T=Hr((Qft,xee)=>{xee.exports=yee()});var vee=Hr(r4=>{"use strict";Object.defineProperty(r4,"__esModule",{value:!0});r4.allSettled=void 0;function eTe(t){return Promise.all(t.map(e=>{let r=s=>({status:"fulfilled",value:s}),i=s=>({status:"rejected",reason:s}),n=Promise.resolve(e);try{return n.then(r,i)}catch(s){return Promise.reject(s)}}))}r4.allSettled=eTe});var bee=Hr(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.PoolEventType=void 0;var tTe;(function(t){t.initialized="initialized",t.taskCanceled="taskCanceled",t.taskCompleted="taskCompleted",t.taskFailed="taskFailed",t.taskQueued="taskQueued",t.taskQueueDrained="taskQueueDrained",t.taskStart="taskStart",t.terminated="terminated"})(tTe=yT.PoolEventType||(yT.PoolEventType={}))});var xT=Hr(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.$worker=mh.$transferable=mh.$terminate=mh.$events=mh.$errors=void 0;mh.$errors=Symbol("thread.errors");mh.$events=Symbol("thread.events");mh.$terminate=Symbol("thread.terminate");mh.$transferable=Symbol("thread.transferable");mh.$worker=Symbol("thread.worker")});var mF=Hr(i4=>{"use strict";Object.defineProperty(i4,"__esModule",{value:!0});i4.Thread=void 0;var AF=xT();function wee(t){throw Error(t)}i4.Thread={errors(t){return t[AF.$errors]||wee("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},events(t){return t[AF.$events]||wee("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.")},terminate(t){return t[AF.$terminate]()}}});var Mee=Hr(gh=>{"use strict";var n_=gh&&gh.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})},rTe=gh&&gh.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gh,"__esModule",{value:!0});gh.Pool=gh.Thread=gh.PoolEventType=void 0;var iTe=rTe(QI()),gF=_T(),See=vee(),nTe=rF(),aa=bee();Object.defineProperty(gh,"PoolEventType",{enumerable:!0,get:function(){return aa.PoolEventType}});var Tee=mF();Object.defineProperty(gh,"Thread",{enumerable:!0,get:function(){return Tee.Thread}});var sTe=1;function oTe(t){let e=[];for(let r=0;rsetTimeout(e,t))}function lTe(t,e){return t.reduce((r,i)=>[...r,...e(i)],[])}function cTe(t){return t.replace(/\W/g," ").trim().replace(/\s+/g,"-")}function uTe(t,e){return oTe(e).map(()=>({init:t(),runningTasks:[]}))}var n4=class{constructor(e,r){this.eventSubject=new gF.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];let i=typeof r=="number"?{size:r}:r||{},{size:n=nTe.defaultPoolSize}=i;this.debug=iTe.default(`threads:pool:${cTe(i.name||String(sTe++))}`),this.options=i,this.workers=uTe(e,n),this.eventObservable=gF.multicast(gF.Observable.from(this.eventSubject)),Promise.all(this.workers.map(s=>s.init)).then(()=>this.eventSubject.next({type:aa.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:e=1}=this.options;return this.workers.find(r=>r.runningTasks.length{e.runningTasks=e.runningTasks.filter(s=>s!==i)};yield aTe(0);try{yield this.runPoolTask(e,r)}finally{n(),this.isClosing||this.scheduleWork()}});e.runningTasks.push(i)})}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");let e=this.findIdlingWorker();if(!e)return;let r=this.taskQueue.shift();if(!r){this.debug("Task queue is empty"),this.eventSubject.next({type:aa.PoolEventType.taskQueueDrained});return}this.run(e,r)}taskCompletion(e){return new Promise((r,i)=>{let n=this.events().subscribe(s=>{s.type===aa.PoolEventType.taskCompleted&&s.taskID===e?(n.unsubscribe(),r(s.returnValue)):s.type===aa.PoolEventType.taskFailed&&s.taskID===e?(n.unsubscribe(),i(s.error)):s.type===aa.PoolEventType.terminated&&(n.unsubscribe(),i(Error("Pool has been terminated before task was run.")))})})}settled(e=!1){return n_(this,void 0,void 0,function*(){let r=()=>lTe(this.workers,s=>s.runningTasks),i=[],n=this.eventObservable.subscribe(s=>{s.type===aa.PoolEventType.taskFailed&&i.push(s.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):e&&this.taskQueue.length===0?(yield See.allSettled(r()),i):(yield new Promise((s,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===aa.PoolEventType.taskQueueDrained&&(c.unsubscribe(),s(void 0))},error:o})}),yield See.allSettled(r()),n.unsubscribe(),i)})}completed(e=!1){return n_(this,void 0,void 0,function*(){let r=this.settled(e),i=new Promise((s,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===aa.PoolEventType.taskQueueDrained?(c.unsubscribe(),s(r)):f.type===aa.PoolEventType.taskFailed&&(c.unsubscribe(),o(f.error))},error:o})}),n=yield Promise.race([r,i]);if(n.length>0)throw n[0]})}events(){return this.eventObservable}queue(e){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:e,cancel:()=>{this.taskQueue.indexOf(s)!==-1&&(this.taskQueue=this.taskQueue.filter(o=>o!==s),this.eventSubject.next({type:aa.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. +This 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:aa.PoolEventType.taskQueued,taskID:s.id}),this.scheduleWork(),s}terminate(e){return n_(this,void 0,void 0,function*(){this.isClosing=!0,e||(yield this.completed(!0)),this.eventSubject.next({type:aa.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(r=>n_(this,void 0,void 0,function*(){return Tee.Thread.terminate(yield r.init)})))})}};n4.EventType=aa.PoolEventType;function Eee(t,e){return new n4(t,e)}Eee.EventType=aa.PoolEventType;gh.Pool=Eee});var Pee=Hr(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});s4.createPromiseWithResolver=void 0;var hTe=()=>{};function fTe(){let t=!1,e,r=hTe;return[new Promise(s=>{t?s(e):r=s}),s=>{t=!0,e=s,r(e)}]}s4.createPromiseWithResolver=fTe});var Cee=Hr(vT=>{"use strict";Object.defineProperty(vT,"__esModule",{value:!0});vT.WorkerEventType=void 0;var ndt=xT(),dTe;(function(t){t.internalError="internalError",t.message="message",t.termination="termination"})(dTe=vT.WorkerEventType||(vT.WorkerEventType={}))});var Ree=Hr(o4=>{"use strict";Object.defineProperty(o4,"__esModule",{value:!0});o4.ObservablePromise=void 0;var pTe=_T(),ATe=()=>{},mTe=t=>t,Iee=t=>Promise.resolve().then(t);function gTe(t){throw t}function _Te(t){return t&&typeof t.then=="function"}var _F=class t extends pTe.Observable{constructor(e){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,e(n)}catch(s){n.error(s)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(e){this.firstValueSet||(this.firstValue=e,this.firstValueSet=!0)}onError(e){this.state="rejected",this.rejection=e;for(let r of this.rejectionCallbacks)Iee(()=>r(e))}onCompletion(){this.state="fulfilled";for(let e of this.fulfillmentCallbacks)Iee(()=>e(this.firstValue))}then(e,r){let i=e||mTe,n=r||gTe,s=!1;return new Promise((o,c)=>{let f=b=>{if(!s){s=!0;try{o(n(b))}catch(M){c(M)}}},y=b=>{try{o(i(b))}catch(M){f(M)}};if(this.initHasRun||this.subscribe({error:f}),this.state==="fulfilled")return o(i(this.firstValue));if(this.state==="rejected")return s=!0,o(n(this.rejection));this.fulfillmentCallbacks.push(y),this.rejectionCallbacks.push(f)})}catch(e){return this.then(void 0,e)}finally(e){let r=e||ATe;return this.then(i=>(r(),i),()=>r())}static from(e){return _Te(e)?new t(r=>{let i=s=>{r.next(s),r.complete()},n=s=>{r.error(s)};e.then(i,n)}):super.from(e)}};o4.ObservablePromise=_F});var bT=Hr(Nx=>{"use strict";Object.defineProperty(Nx,"__esModule",{value:!0});Nx.Transfer=Nx.isTransferDescriptor=void 0;var kee=xT();function yTe(t){return!(!t||typeof t!="object")}function xTe(t){return t&&typeof t=="object"&&t[kee.$transferable]}Nx.isTransferDescriptor=xTe;function vTe(t,e){if(!e){if(!yTe(t))throw Error();e=[t]}return{[kee.$transferable]:!0,send:t,transferables:e}}Nx.Transfer=vTe});var yF=Hr(B0=>{"use strict";Object.defineProperty(B0,"__esModule",{value:!0});B0.WorkerMessageType=B0.MasterMessageType=void 0;var bTe;(function(t){t.cancel="cancel",t.run="run"})(bTe=B0.MasterMessageType||(B0.MasterMessageType={}));var wTe;(function(t){t.error="error",t.init="init",t.result="result",t.running="running",t.uncaughtError="uncaughtError"})(wTe=B0.WorkerMessageType||(B0.WorkerMessageType={}))});var Fee=Hr(F0=>{"use strict";var STe=F0&&F0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(F0,"__esModule",{value:!0});F0.createProxyModule=F0.createProxyFunction=void 0;var TTe=STe(QI()),Dee=_T(),wT=Ix(),Lee=Ree(),ETe=bT(),ST=yF(),Oee=TTe.default("threads:master:messages"),MTe=1,PTe=t=>Array.from(new Set(t)),CTe=t=>t&&t.type===ST.WorkerMessageType.error,ITe=t=>t&&t.type===ST.WorkerMessageType.result,RTe=t=>t&&t.type===ST.WorkerMessageType.running;function kTe(t,e){return new Dee.Observable(r=>{let i,n=s=>{if(Oee("Message from worker:",s.data),!(!s.data||s.data.uid!==e)){if(RTe(s.data))i=s.data.resultType;else if(ITe(s.data))i==="promise"?(typeof s.data.payload<"u"&&r.next(wT.deserialize(s.data.payload)),r.complete(),t.removeEventListener("message",n)):(s.data.payload&&r.next(wT.deserialize(s.data.payload)),s.data.complete&&(r.complete(),t.removeEventListener("message",n)));else if(CTe(s.data)){let o=wT.deserialize(s.data.error);r.error(o),t.removeEventListener("message",n)}}};return t.addEventListener("message",n),()=>{if(i==="observable"||!i){let s={type:ST.MasterMessageType.cancel,uid:e};t.postMessage(s)}t.removeEventListener("message",n)}})}function LTe(t){if(t.length===0)return{args:[],transferables:[]};let e=[],r=[];for(let i of t)ETe.isTransferDescriptor(i)?(e.push(wT.serialize(i.send)),r.push(...i.transferables)):e.push(wT.serialize(i));return{args:e,transferables:r.length===0?r:PTe(r)}}function Bee(t,e){return(...r)=>{let i=MTe++,{args:n,transferables:s}=LTe(r),o={type:ST.MasterMessageType.run,uid:i,method:e,args:n};Oee("Sending command to run function to worker:",o);try{t.postMessage(o,s)}catch(c){return Lee.ObservablePromise.from(Promise.reject(c))}return Lee.ObservablePromise.from(Dee.multicast(kTe(t,i)))}}F0.createProxyFunction=Bee;function DTe(t,e){let r={};for(let i of e)r[i]=Bee(t,i);return r}F0.createProxyModule=DTe});var Vee=Hr(N0=>{"use strict";var xF=N0&&N0.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})},OTe=N0&&N0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N0,"__esModule",{value:!0});N0.spawn=void 0;var vF=OTe(QI()),BTe=_T(),FTe=Ix(),NTe=Pee(),a4=xT(),l4=Cee(),Nee=Fee(),zTe=vF.default("threads:master:messages"),UTe=vF.default("threads:master:spawn"),Uee=vF.default("threads:master:thread-utils"),VTe=t=>t&&t.type==="init",jTe=t=>t&&t.type==="uncaughtError",WTe=typeof process<"u"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function HTe(t,e,r){return xF(this,void 0,void 0,function*(){let i,n=new Promise((o,c)=>{i=setTimeout(()=>c(Error(r)),e)}),s=yield Promise.race([t,n]);return clearTimeout(i),s})}function $Te(t){return new Promise((e,r)=>{let i=n=>{zTe("Message from worker before finishing initialization:",n.data),VTe(n.data)?(t.removeEventListener("message",i),e(n.data)):jTe(n.data)&&(t.removeEventListener("message",i),r(FTe.deserialize(n.data.error)))};t.addEventListener("message",i)})}function qTe(t,e){return new BTe.Observable(r=>{let i=s=>{let o={type:l4.WorkerEventType.message,data:s.data};r.next(o)},n=s=>{Uee("Unhandled promise rejection event in thread:",s);let o={type:l4.WorkerEventType.internalError,error:Error(s.reason)};r.next(o)};t.addEventListener("message",i),t.addEventListener("unhandledrejection",n),e.then(()=>{let s={type:l4.WorkerEventType.termination};t.removeEventListener("message",i),t.removeEventListener("unhandledrejection",n),r.next(s),r.complete()})})}function GTe(t){let[e,r]=NTe.createPromiseWithResolver();return{terminate:()=>xF(this,void 0,void 0,function*(){Uee("Terminating worker"),yield t.terminate(),r()}),termination:e}}function zee(t,e,r,i){let n=r.filter(s=>s.type===l4.WorkerEventType.internalError).map(s=>s.error);return Object.assign(t,{[a4.$errors]:n,[a4.$events]:r,[a4.$terminate]:i,[a4.$worker]:e})}function ZTe(t,e){return xF(this,void 0,void 0,function*(){UTe("Initializing new thread");let r=e&&e.timeout?e.timeout:WTe,n=(yield HTe($Te(t),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:s,terminate:o}=GTe(t),c=qTe(t,s);if(n.type==="function"){let f=Nee.createProxyFunction(t);return zee(f,t,c,o)}else if(n.type==="module"){let f=Nee.createProxyModule(t,n.methods);return zee(f,t,c,o)}else{let f=n.type;throw Error(`Worker init message states unexpected type of expose(): ${f}`)}})}N0.spawn=ZTe});var jee=Hr(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.Worker=Ic.BlobWorker=Ic.isWorkerRuntime=Ic.Thread=Ic.spawn=Ic.Pool=void 0;var bF=rF();Object.defineProperty(Ic,"isWorkerRuntime",{enumerable:!0,get:function(){return bF.isWorkerRuntime}});var YTe=Mee();Object.defineProperty(Ic,"Pool",{enumerable:!0,get:function(){return YTe.Pool}});var XTe=Vee();Object.defineProperty(Ic,"spawn",{enumerable:!0,get:function(){return XTe.spawn}});var QTe=mF();Object.defineProperty(Ic,"Thread",{enumerable:!0,get:function(){return QTe.Thread}});Ic.BlobWorker=bF.getWorkerImplementation().blob;Ic.Worker=bF.getWorkerImplementation().default});var Hee=Hr((fdt,Wee)=>{"use strict";Wee.exports=t=>t?typeof Symbol.observable=="symbol"&&typeof t[Symbol.observable]=="function"?t===t[Symbol.observable]():typeof t["@@observable"]=="function"?t===t["@@observable"]():!1:!1});var $ee=Hr(wF=>{"use strict";Object.defineProperty(wF,"__esModule",{value:!0});var KTe=function(){let e=typeof self<"u"&&typeof Window<"u"&&self instanceof Window;return!!(typeof self<"u"&&self.postMessage&&!e)},JTe=function(e,r){self.postMessage(e,r)},e3e=function(e){let r=n=>{e(n.data)},i=()=>{self.removeEventListener("message",r)};return self.addEventListener("message",r),i};wF.default={isWorkerRuntime:KTe,postMessageToMaster:JTe,subscribeToMasterMessages:e3e}});var Kee=Hr(Rc=>{"use strict";var t3e=Rc&&Rc.__awaiter||function(t,e,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(b){try{y(i.next(b))}catch(M){o(M)}}function f(b){try{y(i.throw(b))}catch(M){o(M)}}function y(b){b.done?s(b.value):n(b.value).then(c,f)}y((i=i.apply(t,e||[])).next())})},Xee=Rc&&Rc.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rc,"__esModule",{value:!0});Rc.expose=Rc.isWorkerRuntime=Rc.Transfer=Rc.registerSerializer=void 0;var r3e=Xee(Hee()),z0=Ix(),i3e=bT(),U0=yF(),_u=Xee($ee()),n3e=Ix();Object.defineProperty(Rc,"registerSerializer",{enumerable:!0,get:function(){return n3e.registerSerializer}});var s3e=bT();Object.defineProperty(Rc,"Transfer",{enumerable:!0,get:function(){return s3e.Transfer}});Rc.isWorkerRuntime=_u.default.isWorkerRuntime;var qee=!1,TT=new Map,o3e=t=>t&&t.type===U0.MasterMessageType.cancel,Gee=t=>t&&t.type===U0.MasterMessageType.run,Zee=t=>r3e.default(t)||a3e(t);function a3e(t){return t&&typeof t=="object"&&typeof t.subscribe=="function"}function Qee(t){return i3e.isTransferDescriptor(t)?{payload:t.send,transferables:t.transferables}:{payload:t,transferables:void 0}}function l3e(){let t={type:U0.WorkerMessageType.init,exposed:{type:"function"}};_u.default.postMessageToMaster(t)}function c3e(t){let e={type:U0.WorkerMessageType.init,exposed:{type:"module",methods:t}};_u.default.postMessageToMaster(e)}function SF(t,e){let{payload:r,transferables:i}=Qee(e),n={type:U0.WorkerMessageType.error,uid:t,error:z0.serialize(r)};_u.default.postMessageToMaster(n,i)}function TF(t,e,r){let{payload:i,transferables:n}=Qee(r),s={type:U0.WorkerMessageType.result,uid:t,complete:e?!0:void 0,payload:i};_u.default.postMessageToMaster(s,n)}function u3e(t,e){let r={type:U0.WorkerMessageType.running,uid:t,resultType:e};_u.default.postMessageToMaster(r)}function c4(t){try{let e={type:U0.WorkerMessageType.uncaughtError,error:z0.serialize(t)};_u.default.postMessageToMaster(e)}catch(e){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already. +Latest error:`,e,` +Original error:`,t)}}function Yee(t,e,r){return t3e(this,void 0,void 0,function*(){let i;try{i=e(...r)}catch(s){return SF(t,s)}let n=Zee(i)?"observable":"promise";if(u3e(t,n),Zee(i)){let s=i.subscribe(o=>TF(t,!1,z0.serialize(o)),o=>{SF(t,z0.serialize(o)),TT.delete(t)},()=>{TF(t,!0),TT.delete(t)});TT.set(t,s)}else try{let s=yield i;TF(t,!0,z0.serialize(s))}catch(s){SF(t,z0.serialize(s))}})}function h3e(t){if(!_u.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(qee)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(qee=!0,typeof t=="function")_u.default.subscribeToMasterMessages(e=>{Gee(e)&&!e.method&&Yee(e.uid,t,e.args.map(z0.deserialize))}),l3e();else if(typeof t=="object"&&t){_u.default.subscribeToMasterMessages(r=>{Gee(r)&&r.method&&Yee(r.uid,t[r.method],r.args.map(z0.deserialize))});let e=Object.keys(t).filter(r=>typeof t[r]=="function");c3e(e)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${t}`);_u.default.subscribeToMasterMessages(e=>{if(o3e(e)){let r=e.uid,i=TT.get(r);i&&(i.unsubscribe(),TT.delete(r))}})}Rc.expose=h3e;typeof self<"u"&&typeof self.addEventListener=="function"&&_u.default.isWorkerRuntime()&&(self.addEventListener("error",t=>{setTimeout(()=>c4(t.error||t),250)}),self.addEventListener("unhandledrejection",t=>{let e=t.reason;e&&typeof e.message=="string"&&setTimeout(()=>c4(e),250)}));typeof process<"u"&&typeof process.on=="function"&&_u.default.isWorkerRuntime()&&(process.on("uncaughtException",t=>{setTimeout(()=>c4(t),250)}),process.on("unhandledRejection",t=>{t&&typeof t.message=="string"&&setTimeout(()=>c4(t),250)}))});var Jee=Hr(Fl=>{"use strict";var f3e=Fl&&Fl.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),d3e=Fl&&Fl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f3e(e,t,r)};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.Transfer=Fl.DefaultSerializer=Fl.expose=Fl.registerSerializer=void 0;var p3e=Ix();Object.defineProperty(Fl,"registerSerializer",{enumerable:!0,get:function(){return p3e.registerSerializer}});d3e(jee(),Fl);var A3e=Kee();Object.defineProperty(Fl,"expose",{enumerable:!0,get:function(){return A3e.expose}});var m3e=J8();Object.defineProperty(Fl,"DefaultSerializer",{enumerable:!0,get:function(){return m3e.DefaultSerializer}});var g3e=bT();Object.defineProperty(Fl,"Transfer",{enumerable:!0,get:function(){return g3e.Transfer}})});var W4=Ei(Zi(),1),j0=Ei(Zi(),1);var nc=Ei(Zi(),1),j9=Ei(qk(),1),W9=nc.createContext(null);function Fse(){let t=nc.useContext(W9);if(!t)throw new Error("RenderContext not found");return t}function lb(){return Fse().model}function Vh(t){let e=lb(),[r,i]=nc.useState(e.get(t));return nc.useEffect(()=>{let n=()=>i(e.get(t));return e.on(`change:${t}`,n),()=>e.off(`change:${t}`,n)},[e,t]),[r,n=>{e.set(t,n),e.save_changes()}]}function H9(t){return({el:e,model:r,experimental:i})=>{let n=j9.createRoot(e);return n.render(nc.createElement(nc.StrictMode,null,nc.createElement(W9.Provider,{value:{model:r,experimental:i}},nc.createElement(t)))),()=>n.unmount()}}var nV=Ei(Zi());var yy=Ei(Zi()),tu=Ei(Zi());var Gk=Ei(Zi()),ME=Ei(Zi());var $9=Gk.createContext(null);function q9(t,e){let r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0,n=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0;return r===n&&i===s}function sc(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r{let n=null;"interactive"in i&&(n=Object.assign({},i),delete n.interactive);let s=e[i.ref];if(s){n=n||Object.assign({},i),delete n.ref;for(let o of Nse)o in s&&(n[o]=s[o])}return n||i});return{...t,layers:r}}var Z9={version:8,sources:{},layers:[]},Y9={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"},X9={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"},zse=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Use=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"],Nm=class t{constructor(e,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[X9[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[Y9[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=e,this.props=r,this._initialize(i)}get map(){return this._map}get transform(){return this._renderTransform}setProps(e){let r=this.props;this.props=e;let i=this._updateSettings(e,r);i&&this._createShadowTransform(this._map);let n=this._updateSize(e),s=this._updateViewState(e,!0);this._updateStyle(e,r),this._updateStyleComponents(e,r),this._updateHandlers(e,r),(i||n||s&&!this._map.isMoving())&&this.redraw()}static reuse(e,r){let i=t.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({...e,styleDiffing:!1}),n.resize();let{initialViewState:c}=e;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(e){let{props:r}=this,{mapStyle:i=Z9}=r,n={...r,...r.initialViewState,accessToken:r.mapboxAccessToken||Vse()||null,container:e,style:Qk(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 b=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=b,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=b=>{this._inRender=!0,c.call(o,b),this._inRender=!1};let f=o._renderTaskQueue.run;o._renderTaskQueue.run=b=>{f.call(o._renderTaskQueue,b),this._onBeforeRepaint()},o.on("render",()=>this._onAfterRepaint());let y=o.fire;o.fire=this._fireEvent.bind(this,y),o.on("resize",()=>{this._renderTransform.resize(o.transform.width,o.transform.height)}),o.on("styledata",()=>{this._updateStyleComponents(this.props,{}),Zk(o.transform,this._renderTransform)}),o.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(let b in Y9)o.on(b,this._onPointerEvent);for(let b in Kk)o.on(b,this._onCameraEvent);for(let b in X9)o.on(b,this._onEvent);this._map=o}recycle(){let r=this.map.getContainer().querySelector("[mapboxgl-children]");r?.remove(),t.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let e=this._map;!this._inRender&&e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}_createShadowTransform(e){let r=G9(e.transform);e.painter.transform=r,this._renderTransform=r}_updateSize(e){let{viewState:r}=e;if(r){let i=this._map;if(r.width!==i.transform.width||r.height!==i.transform.height)return i.resize(),!0}return!1}_updateViewState(e,r){if(this._internalUpdate)return!1;let i=this._map,n=this._renderTransform,{zoom:s,pitch:o,bearing:c}=n,f=i.isMoving();f&&(n.cameraElevationReference="sea");let y=Xk(n,{...Yk(i.transform),...e});if(f&&(n.cameraElevationReference="ground"),y&&r){let b=this._deferredEvents;b.move=!0,b.zoom||(b.zoom=s!==n.zoom),b.rotate||(b.rotate=c!==n.bearing),b.pitch||(b.pitch=o!==n.pitch)}return f||Xk(i.transform,e),y}_updateSettings(e,r){let i=this._map,n=!1;for(let s of zse)if(s in e&&!sc(e[s],r[s])){n=!0;let o=i[`set${s[0].toUpperCase()}${s.slice(1)}`];o?.call(i,e[s])}return n}_updateStyle(e,r){if(e.cursor!==r.cursor&&(this._map.getCanvas().style.cursor=e.cursor||""),e.mapStyle!==r.mapStyle){let{mapStyle:i=Z9,styleDiffing:n=!0}=e,s={diff:n};return"localIdeographFontFamily"in e&&(s.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(Qk(i),s),!0}return!1}_updateStyleComponents(e,r){let i=this._map,n=!1;return i.isStyleLoaded()&&("light"in e&&i.setLight&&!sc(e.light,r.light)&&(n=!0,i.setLight(e.light)),"fog"in e&&i.setFog&&!sc(e.fog,r.fog)&&(n=!0,i.setFog(e.fog)),"terrain"in e&&i.setTerrain&&!sc(e.terrain,r.terrain)&&(!e.terrain||i.getSource(e.terrain.source))&&(n=!0,i.setTerrain(e.terrain))),n}_updateHandlers(e,r){var i,n;let s=this._map,o=!1;for(let c of Use){let f=(i=e[c])!==null&&i!==void 0?i:!0,y=(n=r[c])!==null&&n!==void 0?n:!0;sc(f,y)||(o=!0,f?s[c].enable(f):s[c].disable())}return o}_queryRenderedFeatures(e){let r=this._map,i=r.transform,{interactiveLayerIds:n=[]}=this.props;try{return r.transform=this._renderTransform,r.queryRenderedFeatures(e,{layers:n.filter(r.getLayer.bind(r))})}catch{return[]}finally{r.transform=i}}_updateHover(e){var r;let{props:i}=this;if(i.interactiveLayerIds&&(i.onMouseMove||i.onMouseEnter||i.onMouseLeave)){let s=e.type,o=((r=this._hoveredFeatures)===null||r===void 0?void 0:r.length)>0,c=this._queryRenderedFeatures(e.point),f=c.length>0;!f&&o&&(e.type="mouseleave",this._onPointerEvent(e)),this._hoveredFeatures=c,f&&!o&&(e.type="mouseenter",this._onPointerEvent(e)),e.type=s}else this._hoveredFeatures=null}_fireEvent(e,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=Yk(s)),this._map.isMoving())?(n.transform=this._renderTransform,e.call(n,r,i),n.transform=s,n):(e.call(n,r,i),n)}_onBeforeRepaint(){let e=this._map;this._internalUpdate=!0;for(let i in this._deferredEvents)this._deferredEvents[i]&&e.fire(i);this._internalUpdate=!1;let r=this._map.transform;e.transform=this._renderTransform,this._onAfterRepaint=()=>{Zk(this._renderTransform,r),e.transform=r}}};Nm.savedMaps=[];function Vse(){let t=null;if(typeof location<"u"){let e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||process.env.MapboxAccessToken}catch{}try{t=t||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return t}var jse=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Jk(t){if(!t)return null;let e=t.map,r={getMap:()=>e,getCenter:()=>t.transform.center,getZoom:()=>t.transform.zoom,getBearing:()=>t.transform.bearing,getPitch:()=>t.transform.pitch,getPadding:()=>t.transform.padding,getBounds:()=>t.transform.getBounds(),project:i=>{let n=e.transform;e.transform=t.transform;let s=e.project(i);return e.transform=n,s},unproject:i=>{let n=e.transform;e.transform=t.transform;let s=e.unproject(i);return e.transform=n,s},queryTerrainElevation:(i,n)=>{let s=e.transform;e.transform=t.transform;let o=e.queryTerrainElevation(i,n);return e.transform=s,o},queryRenderedFeatures:(i,n)=>{let s=e.transform;e.transform=t.transform;let o=e.queryRenderedFeatures(i,n);return e.transform=s,o}};for(let i of Wse(e))!(i in r)&&!jse.includes(i)&&(r[i]=e[i].bind(e));return r}function Wse(t){let e=new Set,r=t;for(;r;){for(let i of Object.getOwnPropertyNames(r))i[0]!=="_"&&typeof t[i]=="function"&&i!=="fire"&&i!=="setEventedParent"&&e.add(i);r=Object.getPrototypeOf(r)}return Array.from(e)}var PE=Ei(Zi()),Hse=typeof document<"u"?PE.useLayoutEffect:PE.useEffect,Q9=Hse;var $se=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function eL(t,e){for(let i of $se)i in e&&(t[i]=e[i]);let{RTLTextPlugin:r="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=e;r&&t.getRTLTextPluginStatus&&t.getRTLTextPluginStatus()==="unavailable"&&t.setRTLTextPlugin(r,i=>{i&&console.error(i)},!0)}var jf=yy.createContext(null);function tL(t,e,r){let i=(0,tu.useContext)($9),[n,s]=(0,tu.useState)(null),o=(0,tu.useRef)(),{current:c}=(0,tu.useRef)({mapLib:null,map:null});(0,tu.useEffect)(()=>{let b=t.mapLib,M=!0,L;return Promise.resolve(b||r).then(N=>{if(!M)return;if(!N)throw new Error("Invalid mapLib");let V="Map"in N?N:N.default;if(!V.Map)throw new Error("Invalid mapLib");if(eL(V,t),!V.supported||V.supported(t))t.reuseMaps&&(L=Nm.reuse(t,o.current)),L||(L=new Nm(V.Map,t,o.current)),c.map=Jk(L),c.mapLib=V,s(L),i?.onMapMount(c.map,t.id);else throw new Error("Map is not supported by this browser")}).catch(N=>{let{onError:V}=t;V?V({type:"error",target:null,originalEvent:null,error:N}):console.error(N)}),()=>{M=!1,L&&(i?.onMapUnmount(t.id),t.reuseMaps?L.recycle():L.destroy())}},[]),Q9(()=>{n&&n.setProps(t)}),(0,tu.useImperativeHandle)(e,()=>c.map,[n]);let f=(0,tu.useMemo)(()=>({position:"relative",width:"100%",height:"100%",...t.style}),[t.style]),y={height:"100%"};return yy.createElement("div",{id:t.id,ref:o,style:f},n&&yy.createElement(jf.Provider,{value:c},yy.createElement("div",{"mapboxgl-children":"",style:y},t.children)))}var K9=Ei(Zi()),J9=Ei(EE()),Tl=Ei(Zi());var qse=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function oc(t,e){if(!t||!e)return;let r=t.style;for(let i in e){let n=e[i];Number.isFinite(n)&&!qse.test(i)?r[i]=`${n}px`:r[i]=n}}function Gse(t,e){let{map:r,mapLib:i}=(0,Tl.useContext)(jf),n=(0,Tl.useRef)({props:t});n.current.props=t;let s=(0,Tl.useMemo)(()=>{let $=!1;K9.Children.forEach(t.children,J=>{J&&($=!0)});let Q={...t,element:$?document.createElement("div"):null},q=new i.Marker(Q);return q.setLngLat([t.longitude,t.latitude]),q.getElement().addEventListener("click",J=>{var ee,oe;(oe=(ee=n.current.props).onClick)===null||oe===void 0||oe.call(ee,{type:"click",target:q,originalEvent:J})}),q.on("dragstart",J=>{var ee,oe;let ve=J;ve.lngLat=s.getLngLat(),(oe=(ee=n.current.props).onDragStart)===null||oe===void 0||oe.call(ee,ve)}),q.on("drag",J=>{var ee,oe;let ve=J;ve.lngLat=s.getLngLat(),(oe=(ee=n.current.props).onDrag)===null||oe===void 0||oe.call(ee,ve)}),q.on("dragend",J=>{var ee,oe;let ve=J;ve.lngLat=s.getLngLat(),(oe=(ee=n.current.props).onDragEnd)===null||oe===void 0||oe.call(ee,ve)}),q},[]);(0,Tl.useEffect)(()=>(s.addTo(r.getMap()),()=>{s.remove()}),[]);let{longitude:o,latitude:c,offset:f,style:y,draggable:b=!1,popup:M=null,rotation:L=0,rotationAlignment:N="auto",pitchAlignment:V="auto"}=t;return(0,Tl.useEffect)(()=>{oc(s.getElement(),y)},[y]),(0,Tl.useImperativeHandle)(e,()=>s,[]),(s.getLngLat().lng!==o||s.getLngLat().lat!==c)&&s.setLngLat([o,c]),f&&!q9(s.getOffset(),f)&&s.setOffset(f),s.isDraggable()!==b&&s.setDraggable(b),s.getRotation()!==L&&s.setRotation(L),s.getRotationAlignment()!==N&&s.setRotationAlignment(N),s.getPitchAlignment()!==V&&s.setPitchAlignment(V),s.getPopup()!==M&&s.setPopup(M),(0,J9.createPortal)(t.children,s.getElement())}var Zse=(0,Tl.memo)((0,Tl.forwardRef)(Gse));var tV=Ei(EE()),Xa=Ei(Zi());function eV(t){return new Set(t?t.trim().split(/\s+/):[])}function Yse(t,e){let{map:r,mapLib:i}=(0,Xa.useContext)(jf),n=(0,Xa.useMemo)(()=>document.createElement("div"),[]),s=(0,Xa.useRef)({props:t});s.current.props=t;let o=(0,Xa.useMemo)(()=>{let c={...t},f=new i.Popup(c);return f.setLngLat([t.longitude,t.latitude]),f.once("open",y=>{var b,M;(M=(b=s.current.props).onOpen)===null||M===void 0||M.call(b,y)}),f},[]);if((0,Xa.useEffect)(()=>{let c=f=>{var y,b;(b=(y=s.current.props).onClose)===null||b===void 0||b.call(y,f)};return o.on("close",c),o.setDOMContent(n).addTo(r.getMap()),()=>{o.off("close",c),o.isOpen()&&o.remove()}},[]),(0,Xa.useEffect)(()=>{oc(o.getElement(),t.style)},[t.style]),(0,Xa.useImperativeHandle)(e,()=>o,[]),o.isOpen()&&((o.getLngLat().lng!==t.longitude||o.getLngLat().lat!==t.latitude)&&o.setLngLat([t.longitude,t.latitude]),t.offset&&!sc(o.options.offset,t.offset)&&o.setOffset(t.offset),(o.options.anchor!==t.anchor||o.options.maxWidth!==t.maxWidth)&&(o.options.anchor=t.anchor,o.setMaxWidth(t.maxWidth)),o.options.className!==t.className)){let c=eV(o.options.className),f=eV(t.className);for(let y of c)f.has(y)||o.removeClassName(y);for(let y of f)c.has(y)||o.addClassName(y);o.options.className=t.className}return(0,tV.createPortal)(t.children,n)}var Xse=(0,Xa.memo)((0,Xa.forwardRef)(Yse));var CE=Ei(Zi());var xy=Ei(Zi());function Qse(t,e,r,i){let n=(0,xy.useContext)(jf),s=(0,xy.useMemo)(()=>t(n),[]);return(0,xy.useEffect)(()=>{let o=i||r||e,c=typeof e=="function"&&typeof r=="function"?e:null,f=typeof r=="function"?r:typeof e=="function"?e:null,{map:y}=n;return y.hasControl(s)||(y.addControl(s,o?.position),c&&c(n)),()=>{f&&f(n),y.hasControl(s)&&y.removeControl(s)}},[]),s}var jh=Qse;function Kse(t){let e=jh(({mapLib:r})=>new r.AttributionControl(t),{position:t.position});return(0,CE.useEffect)(()=>{oc(e._container,t.style)},[t.style]),null}var Jse=(0,CE.memo)(Kse);var IE=Ei(Zi());function eoe(t){let e=jh(({mapLib:r})=>new r.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)}),{position:t.position});return(0,IE.useEffect)(()=>{oc(e._controlContainer,t.style)},[t.style]),null}var toe=(0,IE.memo)(eoe);var Wf=Ei(Zi());function roe(t,e){let r=(0,Wf.useRef)({props:t}),i=jh(({mapLib:n})=>{let s=new n.GeolocateControl(t),o=s._setupUI;return s._setupUI=c=>{s._container.hasChildNodes()||o(c)},s.on("geolocate",c=>{var f,y;(y=(f=r.current.props).onGeolocate)===null||y===void 0||y.call(f,c)}),s.on("error",c=>{var f,y;(y=(f=r.current.props).onError)===null||y===void 0||y.call(f,c)}),s.on("outofmaxbounds",c=>{var f,y;(y=(f=r.current.props).onOutOfMaxBounds)===null||y===void 0||y.call(f,c)}),s.on("trackuserlocationstart",c=>{var f,y;(y=(f=r.current.props).onTrackUserLocationStart)===null||y===void 0||y.call(f,c)}),s.on("trackuserlocationend",c=>{var f,y;(y=(f=r.current.props).onTrackUserLocationEnd)===null||y===void 0||y.call(f,c)}),s},{position:t.position});return r.current.props=t,(0,Wf.useImperativeHandle)(e,()=>i,[]),(0,Wf.useEffect)(()=>{oc(i._container,t.style)},[t.style]),null}var ioe=(0,Wf.memo)((0,Wf.forwardRef)(roe));var RE=Ei(Zi());function noe(t){let e=jh(({mapLib:r})=>new r.NavigationControl(t),{position:t.position});return(0,RE.useEffect)(()=>{oc(e._container,t.style)},[t.style]),null}var soe=(0,RE.memo)(noe);var vy=Ei(Zi());function ooe(t){let e=jh(({mapLib:s})=>new s.ScaleControl(t),{position:t.position}),r=(0,vy.useRef)(t),i=r.current;r.current=t;let{style:n}=t;return t.maxWidth!==void 0&&t.maxWidth!==i.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==i.unit&&e.setUnit(t.unit),(0,vy.useEffect)(()=>{oc(e._container,n)},[n]),null}var aoe=(0,vy.memo)(ooe);var cb=Ei(Zi());var coe=Ei(Zi()),ub=Ei(Zi()),uoe=Ei(Zi());var hoe=Promise.resolve().then(()=>Ei(iV())),foe=nV.forwardRef(function(e,r){return tL(e,r,hoe)});var sV=foe;var Uq=Ei(Zi(),1),Ta=Ei(Zi(),1);function jA(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var Hf={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},doe=Hf.self||Hf.window||Hf.global||{},poe=Hf.window||Hf.self||Hf.global||{},Aoe=Hf.global||Hf.self||Hf.window||{},moe=Hf.document||{};var zm=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser);var oV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),goe=oV&&parseFloat(oV[1])||0;var kE=globalThis,_oe=globalThis.document||{},LE=globalThis.process||{},yoe=globalThis.console,aV=globalThis.navigator||{};function DE(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function Qa(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||DE()}function nL(t){return!t&&!Qa()?"Node":DE(t)?"Electron":(t||aV.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var sL="4.0.7";function voe(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var OE=class{constructor(e,r,i="sessionStorage"){this.storage=voe(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function lV(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function cV(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var BE;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(BE||(BE={}));var boe=10;function uV(t){return typeof t!="string"?t:(t=t.toUpperCase(),BE[t]||BE.WHITE)}function hV(t,e,r){return!Qa&&typeof t=="string"&&(e&&(t=`\x1B[${uV(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${uV(r)+boe}m${t}\x1B[49m`)),t}function fV(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let s of i){let o=n[s];typeof o=="function"&&(e.find(c=>s===c)||(n[s]=o.bind(t)))}}function hb(t,e){if(!t)throw new Error(e||"Assertion failed")}function Um(){let t;if(Qa()&&kE.performance)t=kE?.performance?.now?.();else if("hrtime"in LE){let e=LE?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var by={debug:Qa()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},woe={enabled:!0,level:0};function wy(){}var dV={},pV={once:!0},ac=class{constructor({id:e}={id:""}){this.VERSION=sL,this._startTs=Um(),this._deltaTs=Um(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new OE(`__probe-${this.id}__`,woe),this.timeStamp(`${this.id} started`),fV(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Um()-this._startTs).toPrecision(10))}getDelta(){return Number((Um()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,by.warn,arguments,pV)}error(e){return this._getLogFunction(0,e,by.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,by.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,by.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,by.debug||by.info,arguments,pV)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||wy,i&&[i],{tag:Toe(r)}):wy}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||wy)}group(e,r,i={collapsed:!1}){let n=AV({logLevel:e,message:r,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||wy)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=mV(e)}_getLogFunction(e,r,i,n,s){if(this._shouldLog(e)){s=AV({logLevel:e,message:r,args:n,opts:s}),i=i||s.method,hb(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=Um();let o=s.tag||s.message;if(s.once&&o)if(!dV[o])dV[o]=Um();else return wy;return r=Soe(this.id,s.message,s),i.bind(console,r,...s.args)}return wy}};ac.VERSION=sL;function mV(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return hb(Number.isFinite(e)&&e>=0),e}function AV(t){let{logLevel:e,message:r}=t;t.logLevel=mV(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return hb(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function Soe(t,e,r){if(typeof e=="string"){let i=r.time?cV(lV(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=hV(e,r.color,r.background)}return e}function Toe(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var aCe=new ac({id:"@probe.gl/log"});function oL(t,e){return gV(t||{},e)}function gV(t,e,r=0){if(r>3)return e;let i={...t};for(let[n,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?i[n]=gV(i[n]||{},e[n],r+1):i[n]=e[n];return i}var _V="latest";function Eoe(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var aL=Eoe();function El(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var $f={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},pCe=$f.self||$f.window||$f.global||{},ACe=$f.window||$f.self||$f.global||{},mCe=$f.global||$f.self||$f.window||{},gCe=$f.document||{};var Vu=typeof process!="object"||String(process)!=="[object process]"||process.browser;var xV=typeof window<"u"&&typeof window.orientation<"u",yV=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),_Ce=yV&&parseFloat(yV[1])||0;var fb=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,r){this.name=e,this.workerThread=r,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(e,r){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:r})}done(e){El(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){El(this.isRunning),this.isRunning=!1,this._reject(e)}};var Sy=class{terminate(){}};var lL=new Map;function vV(t){El(t.source&&!t.url||!t.source&&t.url);let e=lL.get(t.source||t.url);return e||(t.url&&(e=Moe(t.url),lL.set(t.url,e)),t.source&&(e=bV(t.source),lL.set(t.source,e))),El(e),e}function Moe(t){if(!t.startsWith("http"))return t;let e=Poe(t);return bV(e)}function bV(t){let e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function Poe(t){return`try { + importScripts('${t}'); +} catch (error) { + console.error(error); + throw error; +}`}function cL(t,e=!0,r){let i=r||new Set;if(t){if(wV(t))i.add(t);else if(wV(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)cL(t[n],e,i)}}return r===void 0?Array.from(i):[]}function wV(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var uL=()=>{},WA=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Vu||typeof Sy<"u"&&!Vu}constructor(e){let{name:r,source:i,url:n}=e;El(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=uL,this.onError=s=>console.log(s),this.worker=Vu?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=uL,this.onError=uL,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,r){r=r||cL(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=vV({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new Sy(i,{eval:!1})}else if(this.source)e=new Sy(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var db=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return WA.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,s,o)=>n.done(o),i=(n,s)=>n.error(s)){let n=new Promise(s=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:s}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new fb(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Vu||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}},Vm=class t{props;workerPools=new Map;static _workerFarm;static isSupported(){return WA.isSupported()}static getWorkerFarm(e={}){return t._workerFarm=t._workerFarm||new t({}),t._workerFarm.setProps(e),t._workerFarm}constructor(e){this.props={...Coe},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,s=this.workerPools.get(r);return s||(s=new db({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}}};function hL(t,e={}){let r=e[t.id]||{},i=Vu?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Vu?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let s=t.version;s==="latest"&&(s=_V);let o=s?`@${s}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${o}/dist/${i}`}return El(n),n}function fL(t,e=aL){El(t,"no worker provided");let r=t.version;return!(!e||!r)}function dL(t,e){return!Vm.isSupported()||!Vu&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function pL(t,e,r,i,n){let s=t.id,o=hL(t,r),f=Vm.getWorkerFarm(r).getWorkerPool({name:s,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let y=await f.startJob("process-on-worker",Ioe.bind(null,n));return y.postMessage("process",{input:e,options:r,context:i}),await(await y.result).result}async function Ioe(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:s,options:o}=i;try{let c=await t(s,o);e.postMessage("done",{id:n,result:c})}catch(c){let f=c instanceof Error?c.message:"unknown error";e.postMessage("error",{id:n,error:f})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function AL(t,e,r){if(r=r||t.byteLength,t.byteLengths instanceof ArrayBuffer?new Uint8Array(s):s),r=e.reduce((s,o)=>s+o.byteLength,0),i=new Uint8Array(r),n=0;for(let s of e)i.set(s,n),n+=s.byteLength;return i.buffer}async function gL(t){let e=[];for await(let r of t)e.push(r);return mL(...e)}function pb(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var jm=class{constructor(e,r){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=e,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=pb(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(pb()-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 lc=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof jm?n=e:n=new jm(r,i),this.stats[r]=n),n}};var Roe="Queued Requests",koe="Active Requests",Loe="Cancelled Requests",Doe="Queued Requests Ever",Ooe="Active Requests Ever",Boe={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Ty=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...Boe,...e},this.stats=new lc({id:this.props.id}),this.stats.get(Roe),this.stats.get(koe),this.stats.get(Loe),this.stats.get(Doe),this.stats.get(Ooe)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(s=>(i.resolve=s,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,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.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;rr.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Foe="",TV={};function _L(t){for(let e in TV)if(t.startsWith(e)){let r=TV[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Foe}${t}`),t}function EV(t){return t&&typeof t=="object"&&t.isBuffer}function FE(t){if(EV(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Wm={};Zc(Wm,{dirname:()=>zoe,filename:()=>Noe,join:()=>Uoe,resolve:()=>Voe});function MV(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function Noe(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function zoe(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function Uoe(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function Voe(...t){let e=[];for(let s=0;s=-1&&!i;s--){let o;s>=0?o=e[s]:(n===void 0&&(n=MV()),o=n),o.length!==0&&(r=`${o}/${r}`,i=o.charCodeAt(0)===Ab)}return r=joe(r,!i),i?`/${r}`:r.length>0?r:"."}var Ab=47,yL=46;function joe(t,e){let r="",i=-1,n=0,s,o=!1;for(let c=0;c<=t.length;++c){if(c2){let f=r.length-1,y=f;for(;y>=0&&r.charCodeAt(y)!==Ab;--y);if(y!==f){r=y===-1?"":r.slice(0,y),i=c,n=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",i=c,n=0,o=!1;continue}}e&&(r.length>0?r+="/..":r="..",o=!0)}else{let f=t.slice(i+1,c);r.length>0?r+=`/${f}`:r=f,o=!1}i=c,n=0}else s===yL&&n!==-1?++n:n=-1}return r}var Woe=t=>typeof t=="boolean",mb=t=>typeof t=="function",Hm=t=>t!==null&&typeof t=="object",xL=t=>Hm(t)&&t.constructor==={}.constructor;var PV=t=>!!t&&typeof t[Symbol.iterator]=="function",CV=t=>t&&typeof t[Symbol.asyncIterator]=="function";var ju=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Wu=t=>typeof Blob<"u"&&t instanceof Blob,IV=t=>t&&typeof t=="object"&&t.isBuffer;var Hoe=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||Hm(t)&&mb(t.tee)&&mb(t.cancel)&&mb(t.getReader);var $oe=t=>Hm(t)&&mb(t.read)&&mb(t.pipe)&&Woe(t.readable),NE=t=>Hoe(t)||$oe(t);var zE=class extends Error{constructor(e,r){super(e),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var qoe=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Goe=/^([-\w.]+\/[-\w.+]+)/;function vL(t,e){return t.toLowerCase()===e.toLowerCase()}function RV(t){let e=Goe.exec(t);return e?e[1]:t}function bL(t){let e=qoe.exec(t);return e?e[1]:""}var kV=/\?.*/;function LV(t){let e=t.match(kV);return e&&e[0]}function Ey(t){return t.replace(kV,"")}function DV(t){if(t.length<50)return t;let e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function $m(t){return ju(t)?t.url:Wu(t)?t.name||"":typeof t=="string"?t:""}function gb(t){if(ju(t)){let e=t,r=e.headers.get("content-type")||"",i=Ey(e.url);return RV(r)||bL(i)}return Wu(t)?t.type||"":typeof t=="string"?bL(t):""}function OV(t){return ju(t)?t.headers["content-length"]||-1:Wu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function UE(t){if(ju(t))return t;let e={},r=OV(t);r>=0&&(e["content-length"]=String(r));let i=$m(t),n=gb(t);n&&(e["content-type"]=n);let s=await Yoe(t);s&&(e["x-first-bytes"]=s),typeof t=="string"&&(t=new TextEncoder().encode(t));let o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:i}),o}async function BV(t){if(!t.ok)throw await Zoe(t)}async function Zoe(t){let e=DV(t.url),r=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;r=r.length>100?`${r.slice(0,100)}...`:r;let i={reason:t.statusText,url:t.url,response:t};try{let n=t.headers.get("Content-Type");i.reason=n?.includes("application/json")?await t.json():t.text()}catch{}return new zE(r,i)}async function Yoe(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=s=>i(s?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${Xoe(r)}`}return null}function Xoe(t){let e="",r=new Uint8Array(t);for(let i=0;i{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},jE=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var TL={fetch:null,mimeType:void 0,nothrow:!1,log:new jE,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:zm,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},FV={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function EL(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function ML(){let t=EL();return t.globalOptions=t.globalOptions||{...TL},t.globalOptions}function UV(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],eae(t,r),rae(e,t,i)}function eae(t,e){NV(t,null,TL,FV,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},s=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};NV(i,r.id,n,s,e)}}function NV(t,e,r,i,n){let s=e||"Top level",o=e?`${e}.`:"";for(let c in t){let f=!e&&Hm(t[c]),y=c==="baseUri"&&!e,b=c==="workerUrl"&&e;if(!(c in r)&&!y&&!b){if(c in i)SL.warn(`${s} loader option '${o}${c}' no longer supported, use '${i[c]}'`)();else if(!f){let M=tae(c,n);SL.warn(`${s} loader option '${o}${c}' not recognized. ${M}`)()}}}}function tae(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let s in n.options){if(t===s)return`Did you mean '${n.id}.${s}'?`;let o=s.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||`Did you mean '${n.id}.${s}'?`)}return i}function rae(t,e,r){let n={...t.options||{}};return iae(n,r),n.log===null&&(n.log=new VE),zV(n,ML()),zV(n,e),n}function zV(t,e){for(let r in e)if(r in e){let i=e[r];xL(i)&&xL(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function iae(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function _b(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function yb(t){jA(t,"null loader"),jA(_b(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var VV=()=>{let t=EL();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function PL(t){let e=VV();t=Array.isArray(t)?t:[t];for(let r of t){let i=yb(r);e.find(n=>i===n)||e.unshift(i)}}function jV(){return VV()}var WV=new ac({id:"loaders.gl"});var nae=/\.([^.]+)$/;async function qV(t,e=[],r,i){if(!GV(t))return null;let n=HV(t,e,{...r,nothrow:!0},i);if(n)return n;if(Wu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=HV(t,e,r,i)),!n&&!r?.nothrow)throw new Error(ZV(t));return n}function HV(t,e=[],r,i){if(!GV(t))return null;if(e&&!Array.isArray(e))return yb(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...jV()),oae(n);let s=sae(t,n,r,i);if(!s&&!r?.nothrow)throw new Error(ZV(t));return s}function sae(t,e,r,i){let n=$m(t),s=gb(t),o=Ey(n)||i?.url,c=null,f="";return r?.mimeType&&(c=CL(e,r?.mimeType),f=`match forced by supplied MIME type ${r?.mimeType}`),c=c||aae(e,o),f=f||(c?`matched url ${o}`:""),c=c||CL(e,s),f=f||(c?`matched MIME type ${s}`:""),c=c||cae(e,t),f=f||(c?`matched initial data ${YV(t)}`:""),r?.fallbackMimeType&&(c=c||CL(e,r?.fallbackMimeType),f=f||(c?`matched fallback MIME type ${s}`:"")),f&&WV.log(1,`selectLoader selected ${c?.name}: ${f}.`),c}function GV(t){return!(t instanceof Response&&t.status===204)}function ZV(t){let e=$m(t),r=gb(t),i="No valid loader found (";i+=e?`${Wm.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?YV(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function oae(t){for(let e of t)yb(e)}function aae(t,e){let r=e&&nae.exec(e),i=r&&r[1];return i?lae(t,i):null}function lae(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function CL(t,e){for(let r of t)if(r.mimeTypes?.some(i=>vL(e,i))||vL(e,`application/x.${r.id}`))return r;return null}function cae(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(uae(e,r))return r}else if(ArrayBuffer.isView(e)){if($V(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&$V(e,0,r))return r;return null}function uae(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function $V(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>hae(t,e,r,n))}function hae(t,e,r,i){if(i instanceof ArrayBuffer)return AL(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=IL(t,e,i.length);return i===n;default:return!1}}function YV(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?IL(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?IL(t,0,e):""}function IL(t,e,r){if(t.byteLengthwL(n,i.fetch):e?.fetch?e?.fetch:wL}function rj(t,e,r){if(r)return r;let i={fetch:WE(e,t),...t};if(i.url){let n=Ey(i.url);i.baseUrl=n,i.queryString=LV(i.url),i.filename=Wm.filename(n),i.baseUrl=Wm.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function ij(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function xb(t,e,r,i){e&&!Array.isArray(e)&&!_b(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=$m(t),o=ij(e,i),c=await qV(t,o,r);return c?(r=UV(r,c,o,n),i=rj({url:n,_parse:xb,loaders:o},r,i||null),await Aae(c,t,r,i)):null}async function Aae(t,e,r,i){if(fL(t),r=oL(t.options,r),ju(e)){let s=e,{ok:o,redirected:c,status:f,statusText:y,type:b,url:M}=s,L=Object.fromEntries(s.headers.entries());i.response={headers:L,ok:o,redirected:c,status:f,statusText:y,type:b,url:M}}e=await tj(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(dL(t,r))return await pL(t,e,r,i,xb);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw El(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function HA(t,e,r,i){let n,s;!Array.isArray(e)&&!_b(e)?(n=[],s=e,i=void 0):(n=e,s=r);let o=WE(s),c=t;return typeof t=="string"&&(c=await o(t)),Wu(t)&&(c=await o(t)),Array.isArray(n)?await xb(c,n,s):await xb(c,n,s)}var nj="4.2.1";var mae=globalThis.loaders?.parseImageNode,kL=typeof Image<"u",LL=typeof ImageBitmap<"u",gae=!!mae,DL=zm?!0:gae;function sj(t){switch(t){case"auto":return LL||kL||DL;case"imagebitmap":return LL;case"image":return kL;case"data":return DL;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function oj(){if(LL)return"imagebitmap";if(kL)return"image";if(DL)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function _ae(t){let e=yae(t);if(!e)throw new Error("Not an image");return e}function aj(t){switch(_ae(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function yae(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var xae=/^data:image\/svg\+xml/,vae=/\.svg((\?|#).*)?$/;function HE(t){return t&&(xae.test(t)||vae.test(t))}function lj(t,e){if(HE(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(s){throw new Error(s.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return OL(t,e)}function OL(t,e){if(HE(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function $E(t,e,r){let i=lj(t,r),n=self.URL||self.webkitURL,s=typeof i!="string"&&n.createObjectURL(i);try{return await bae(s||i,e)}finally{s&&n.revokeObjectURL(s)}}async function bae(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=s=>{let o=s instanceof Error?s.message:"error";n(new Error(o))}}catch(s){n(s)}})}var wae={},cj=!0;async function uj(t,e,r){let i;HE(r)?i=await $E(t,e,r):i=OL(t,r);let n=e&&e.imagebitmap;return await Sae(i,n)}async function Sae(t,e=null){if((Tae(e)||!cj)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),cj=!1}return await createImageBitmap(t)}function Tae(t){for(let e in t||wae)return!1;return!0}function hj(t){return!Cae(t,"ftyp",4)||!(t[8]&96)?null:Eae(t)}function Eae(t){switch(Mae(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Mae(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Pae(t){return[...t].map(e=>e.charCodeAt(0))}function Cae(t,e,r=0){let i=Pae(e);for(let n=0;n=24&&e.getUint32(0,qf)===2303741511?{mimeType:"image/png",width:e.getUint32(16,qf),height:e.getUint32(20,qf)}:null}function kae(t){let e=bb(t);return e.byteLength>=10&&e.getUint32(0,qf)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,vb),height:e.getUint16(8,vb)}:null}function Lae(t){let e=bb(t);return e.byteLength>=14&&e.getUint16(0,qf)===16973&&e.getUint32(2,vb)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,vb),height:e.getUint32(22,vb)}:null}function Dae(t){let e=bb(t);if(!(e.byteLength>=3&&e.getUint16(0,qf)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Oae(),s=2;for(;s+9!!qE(new DataView(t))],options:zae};var Uae=new ac({id:"deck"}),dr=Uae;var FL={};function pj(t){FL=t}function Os(t,e,r,i){dr.level>0&&FL[t]&&FL[t].call(null,e,r,i)}function Vae(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var Aj={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:Vae,parseTextSync:JSON.parse};function jae(){let t="9.0.16",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(dr.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:dr,_registerLoggers:pj},PL([Aj,[BL,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var mj=jae();function Gf(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var NL={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function _j(t){let e={};for(let[r,i]of Object.entries(t))e[r]=Wae(i);return e}function yj(t,e,r){let i={};for(let[n,s]of Object.entries(e))t&&n in t&&!s.private?(s.validate&&Gf(s.validate(t[n],s),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=s.value;return i}function Wae(t){let e=gj(t);if(e!=="object")return{value:t,...NL[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...NL[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=gj(t.value),{...t,...NL[e],type:e}):{type:"object",value:null};throw new Error("props")}function gj(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var xj=`#ifdef MODULE_LOGDEPTH +logdepth_adjustPosition(gl_Position); +#endif +`,vj=`#ifdef MODULE_MATERIAL +gl_FragColor = material_filterColor(gl_FragColor); +#endif +#ifdef MODULE_LIGHTING +gl_FragColor = lighting_filterColor(gl_FragColor); +#endif +#ifdef MODULE_FOG +gl_FragColor = fog_filterColor(gl_FragColor); +#endif +#ifdef MODULE_PICKING +gl_FragColor = picking_filterHighlightColor(gl_FragColor); +gl_FragColor = picking_filterPickingColor(gl_FragColor); +#endif +#ifdef MODULE_LOGDEPTH +logdepth_setFragDepth(); +#endif +`;var Hae={vertex:xj,fragment:vj},bj=/void\s+main\s*\([^)]*\)\s*\{\n?/,wj=/}\n?[^{}]*$/,zL=[],wb="__LUMA_INJECT_DECLARATIONS__";function Sj(t){let e={vertex:{},fragment:{}};for(let r in t){let i=t[r],n=$ae(r);typeof i=="string"&&(i={order:0,injection:i}),e[n][r]=i}return e}function $ae(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function Sb(t,e,r,i=!1){let n=e==="vertex";for(let s in r){let o=r[s];o.sort((f,y)=>f.order-y.order),zL.length=o.length;for(let f=0,y=o.length;ff+c));break;case"vs:#main-end":n&&(t=t.replace(wj,f=>c+f));break;case"fs:#decl":n||(t=t.replace(wb,c));break;case"fs:#main-start":n||(t=t.replace(bj,f=>f+c));break;case"fs:#main-end":n||(t=t.replace(wj,f=>c+f));break;default:t=t.replace(s,f=>f+c)}}return t=t.replace(wb,""),i&&(t=t.replace(/\}\s*$/,s=>s+Hae[e])),t}var qae=1,My=class t{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map(r=>{if(r instanceof t)return r;Gf(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${qae++}`);let i=new t(r);return i.dependencies=t.instantiateModules(r.dependencies||[]),i})}constructor(e){let{name:r,vs:i,fs:n,dependencies:s=[],uniformTypes:o={},uniformPropTypes:c={},getUniforms:f,deprecations:y=[],defines:b={},inject:M={}}=e;Gf(typeof r=="string"),this.name=r,this.vs=i,this.fs=n,this.getModuleUniforms=f,this.dependencies=t.instantiateModules(s),this.deprecations=this._parseDeprecationDefinitions(y),this.defines=b,this.injections=Sj(M),this.uniformTypes=o,c&&(this.uniforms=_j(c))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:Gf(!1)}let i=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} --------------- + +#define MODULE_${i} +${r} + +`}getUniforms(e,r){return this.getModuleUniforms?this.getModuleUniforms(e,r):yj(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,r){this.deprecations.forEach(i=>{i.regex?.test(e)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(e){return e.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),e}_defaultGetUniforms(e={}){let r={},i=this.uniforms;for(let n in i){let s=i[n];n in e&&!s.private?(s.validate&&Gf(s.validate(e[n],s),`${this.name}: invalid ${n}`),r[n]=e[n]):r[n]=s.value}return r}};function UL(t){if(t.source&&t.platformInfo.type==="webgpu")return{...t,vs:void 0,fs:void 0};if(!t.vs)throw new Error("no vertex shader");let e=Tj(t.platformInfo,t.vs),r;return t.fs&&(r=Tj(t.platformInfo,t.fs)),{...t,vs:e,fs:r}}function Tj(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e?.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e?.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}function qm(t){let e=My.instantiateModules(t);return Gae(e)}function Gae(t){let e={},r={};return Ej({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((i,n)=>r[n]-r[i]).map(i=>e[i])}function Ej(t){let{modules:e,level:r,moduleMap:i,moduleDepth:n}=t;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let s of e)i[s.name]=s,(n[s.name]===void 0||n[s.name]o.order-c.order);for(let o of s)r+=` ${o.injection} +`}n.footer&&(r+=` ${n.footer}`),r+=`} +`}return r}function WL(t){let e={vertex:{},fragment:{}};for(let r of t){let i,n;typeof r!="string"?(i=r,n=i.hook):(i={},n=r),n=n.trim();let[s,o]=n.split(":"),c=n.replace(/\(.+/,""),f=Object.assign(i,{signature:o});switch(s){case"vs":e.vertex[c]=f;break;case"fs":e.fragment[c]=f;break;default:throw new Error(s)}}return e}function Rj(t,e){return{name:Xae(t,e),language:"glsl",version:Qae(t)}}function Xae(t,e="unnamed"){let i=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return i?i[1]:e}function Qae(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}var Lj=` + +${wb} +`,Kae=`precision highp float; +`;function Dj(t){let e=qm(t.modules||[]);return{source:HL(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e}),getUniforms:$L(e)}}function Oj(t){let e=qm(t.modules||[]);return{vs:HL(t.platformInfo,{...t,source:t.vs,stage:"vertex",modules:e}),fs:HL(t.platformInfo,{...t,source:t.fs,stage:"fragment",modules:e}),getUniforms:$L(e)}}function Bj(t){let{vs:e,fs:r}=t,i=qm(t.modules||[]);return{vs:kj(t.platformInfo,{...t,source:e,stage:"vertex",modules:i}),fs:kj(t.platformInfo,{...t,source:r,stage:"fragment",modules:i}),getUniforms:$L(i)}}function HL(t,e){let{source:r,stage:i,modules:n,hookFunctions:s=[],inject:o={},log:c}=e;Gf(typeof r=="string","shader source must be a string");let f=r,y="",b=WL(s),M={},L={},N={};for(let $ in o){let Q=typeof o[$]=="string"?{injection:o[$],order:0}:o[$],q=/^(v|f)s:(#)?([\w-]+)$/.exec($);if(q){let J=q[2],ee=q[3];J?ee==="decl"?L[$]=[Q]:N[$]=[Q]:M[$]=[Q]}else N[$]=[Q]}let V=t.type!=="webgpu"?n:[];for(let $ of V){c&&$.checkDeprecations(f,c);let Q=$.getModuleSource(i,"wgsl");y+=Q;let q=$.injections[i];for(let J in q){let ee=/^(v|f)s:#([\w-]+)$/.exec(J);if(ee){let ve=ee[2]==="decl"?L:N;ve[J]=ve[J]||[],ve[J].push(q[J])}else M[J]=M[J]||[],M[J].push(q[J])}}return y+=Lj,y=Sb(y,i,L),y+=jL(b[i],M),y+=f,y=Sb(y,i,N),y}function kj(t,e){let{id:r,source:i,stage:n,language:s="glsl",modules:o,defines:c={},hookFunctions:f=[],inject:y={},prologue:b=!0,log:M}=e;Gf(typeof i=="string","shader source must be a string");let L=s==="glsl"?Rj(i).version:-1,N=t.shaderLanguageVersion,V=L===100?"#version 100":"#version 300 es",Q=i.split(` +`).slice(1).join(` +`),q={};o.forEach(Ze=>{Object.assign(q,Ze.getDefines())}),Object.assign(q,c);let J="";switch(s){case"wgsl":break;case"glsl":J=b?`${V} + +// ----- PROLOGUE ------------------------- +${Jae({id:r,source:i,stage:n})} +${`#define SHADER_TYPE_${n.toUpperCase()}`} +${Mj(t)} +${n==="fragment"?Kae:""} + +// ----- APPLICATION DEFINES ------------------------- + +${ele(q)} + +`:`${V} +`;break}let ee=WL(f),oe={},ve={},Re={};for(let Ze in y){let He=typeof y[Ze]=="string"?{injection:y[Ze],order:0}:y[Ze],ot=/^(v|f)s:(#)?([\w-]+)$/.exec(Ze);if(ot){let et=ot[2],Lt=ot[3];et?Lt==="decl"?ve[Ze]=[He]:Re[Ze]=[He]:oe[Ze]=[He]}else Re[Ze]=[He]}for(let Ze of o){M&&Ze.checkDeprecations(Q,M);let He=Ze.getModuleSource(n);J+=He;let ot=Ze.injections[n];for(let et in ot){let Lt=/^(v|f)s:#([\w-]+)$/.exec(et);if(Lt){let qt=Lt[2]==="decl"?ve:Re;qt[et]=qt[et]||[],qt[et].push(ot[et])}else oe[et]=oe[et]||[],oe[et].push(ot[et])}}return J+="// ----- MAIN SHADER SOURCE -------------------------",J+=Lj,J=Sb(J,n,ve),J+=jL(ee[n],oe),J+=Q,J=Sb(J,n,Re),s==="glsl"&&L!==N&&(J=Cj(J,n)),J.trim()}function $L(t){return function(r){let i={};for(let n of t){let s=n.getUniforms(r,i);Object.assign(i,s)}return i}}function Jae(t){let{id:e,source:r,stage:i}=t;return e&&r.indexOf("SHADER_NAME")===-1?` +#define SHADER_NAME ${e}_${i} + +`:""}function ele(t={}){let e="";for(let r in t){let i=t[r];(i||Number.isFinite(i))&&(e+=`#define ${r.toUpperCase()} ${t[r]} +`)}return e}var Gm=class t{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return t.defaultShaderAssembler=t.defaultShaderAssembler||new t,t.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(r=>r.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let r=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r)}addShaderHook(e,r){r&&(e=Object.assign(r,{hook:e})),this._hookFunctions.push(e)}assembleShader(e){let r=this._getModuleList(e.modules),i=this._hookFunctions,n=UL(e);return{...Dj({platformInfo:e.platformInfo,...n,modules:r,hookFunctions:i}),modules:r}}assembleShaderPair(e){let r=UL(e),i=this._getModuleList(e.modules),n=this._hookFunctions,{platformInfo:s}=e;return{...e.platformInfo.shaderLanguage==="wgsl"?Oj({platformInfo:s,...r,modules:i,hookFunctions:n}):Bj({platformInfo:s,...r,modules:i,hookFunctions:n}),modules:i}}_getModuleList(e=[]){let r=new Array(this._defaultModules.length+e.length),i={},n=0;for(let s=0,o=this._defaultModules.length;st.startsWith(e))}function ZE(t){let e=ule.exec(t);if(e){let[,r,i,n,s,o]=e;if(r){let c=`${n}${i}`,f=GE(c);return{format:r,components:r.length,srgb:s==="-srgb",unsized:o==="-unsized",webgl:o==="-webgl",...f}}}return fle(t)}var hle={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function fle(t){let e=hle[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var Eb=class{},Mb=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},np=class t{static defaultProps={id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:!!xt.get("debug"),spector:!!(xt.get("spector")||xt.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>xt.error(e.message)};get[Symbol.toStringTag](){return"Device"}static VERSION=Nj;constructor(e){this.props={...t.defaultProps,...e},this.id=this.props.id||Ml(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=Py;_lumaData={};isTextureFormatCompressed(e){return Uj(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Yi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":xt.warn("indices buffer content must be of integer type")()),r}};function bi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var Pb=new Map,sp=class t{static defaultProps={...np.defaultProps,type:"best-available",devices:void 0};static stats=Py;static log=xt;static registerDevices(e){for(let r of e)bi(r.type&&r.isSupported&&r.create),Pb.set(r.type,r)}static getAvailableDevices(){return Array.from(Pb).map(e=>e.type)}static getSupportedDevices(){return Array.from(Pb).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(np.defaultProps,e)}static async attachDevice(e){let r=Vj(e.devices)||Pb;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...t.defaultProps,...e},e.gl&&(e.type="webgl");let r=Vj(e.devices)||Pb;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let s=r.get("unknown");if(s)return await s.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(e=!0){let r=HTMLCanvasElement.prototype;if(!e&&r.originalGetContext){r.getContext=r.originalGetContext,r.originalGetContext=void 0;return}r.originalGetContext=r.getContext,r.getContext=function(i,n){return i==="webgl"||i==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(i,n)}}};function Vj(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var dle=Qa()&&typeof document<"u",YE=()=>dle&&document.readyState==="complete",ple={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Zm=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return YE()}static pageLoaded=Ale();constructor(e){if(this.props={...ple,...e},e=this.props,!Qa()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=gle(e.canvas):this.canvas=e.canvas;else{let r=_le(e),i=mle(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return yle(e,i,n,s,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(xt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==i||s.clientHeight!==n||s.devicePixelRatio!==e){let o=e,c=Math.floor(i*o),f=Math.floor(n*o);this.htmlCanvas.width=c,this.htmlCanvas.height=f;let[y,b]=this.getDrawingBufferSize();(y!==c||b!==f)&&(o=Math.min(y/i,b/n),this.htmlCanvas.width=Math.floor(i*o),this.htmlCanvas.height=Math.floor(n*o),xt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};function Ale(){return YE()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function mle(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!YE())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function gle(t){let e=document.getElementById(t);if(!e&&!YE())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function _le(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function yle(t,e,r,i,n){let s=t,o=jj(s[0],e,r),c=Wj(s[1],e,i,n),f=jj(s[0]+1,e,r),y=f===r-1?f:f-1;f=Wj(s[1]+1,e,i,n);let b;return n?(f=f===0?f:f+1,b=c,c=f):b=f===i-1?f:f-1,{x:o,y:c,width:Math.max(y-o+1,1),height:Math.max(b-c+1,1)}}function jj(t,e,r){return Math.min(Math.round(t*e),r-1)}function Wj(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var yo=class t extends fi{static defaultProps={...fi.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0};static COPY_SRC=1;static COPY_DST=2;static TEXTURE_BINDING=4;static STORAGE_BINDING=8;static RENDER_ATTACHMENT=16;get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=t.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}};var Ym=class t extends fi{static defaultProps={...fi.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0};get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,t.defaultProps)}};function $j(t,e,r){let i="",n=e.split(/\r?\n/),s=t.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(r?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=n.length;c++)for(i+=qj(n[c-1],c,r);s.length>o&&s[o].lineNum===c;){let f=s[o++];i+=Hj(f,n,f.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let c of t)i+=Hj(c,n,c.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function Hj(t,e,r,i){if(i?.inlineSource){let n=xle(e,r),s=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^ +`:"";return` +${n}${s}${t.type.toUpperCase()}: ${t.message} + +`}return i?.html?`
${t.type.toUpperCase()}: ${t.message}
`:`${t.type.toUpperCase()}: ${t.message}`}function xle(t,e,r){let i="";for(let n=e-2;n<=e;n++){let s=t[n-1];s!==void 0&&(i+=qj(s,e,r))}return i}function qj(t,e,r){let i=r?.html?ble(t):t;return`${vle(String(e),4)}: ${i}${r?.html?"
":` +`}`}function vle(t,e){let r="";for(let i=t.length;i",">").replaceAll('"',""").replaceAll("'","'")}function ZL(t,e){return{name:wle(t,e),language:"glsl",version:Sle(t)}}function wle(t,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return i?i[1]:e}function Sle(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}return e}var Xm=class t extends fi{static defaultProps={...fi.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"};get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,r){super(e,{id:Tle(r),...r},t.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let r=await this.getCompilationInfo();this.props.debug==="warnings"&&r?.length===0||this._displayShaderLog(r)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let r=ZL(this.source).name,i=`${this.stage} ${r}`,n=$j(e,this.source,{showSourceCode:"all",html:!0}),s=this.getTranslatedSource();s&&(n+=`

Translated Source



${s}
`);let o=document.createElement("Button");o.innerHTML=` +

Shader Compilation Error in ${i}



+
+${n}
+
`,o.style.top="10px",o.style.left="10px",o.style.position="absolute",o.style.zIndex="9999",o.style.width="100%",o.style.textAlign="left",document.body.appendChild(o);let c=document.getElementsByClassName("luma-compiler-log-error");c[0]?.scrollIntoView&&c[0].scrollIntoView(),o.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}};function Tle(t){return ZL(t.source).name||t.id||Ml(`unnamed ${t.stage}-shader`)}var Qm=class t extends fi{static defaultProps={...fi.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,t.defaultProps)}};var Km=class t extends fi{static defaultProps={...fi.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null};get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,t.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(xt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof yo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof yo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:yo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:yo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},Ple={f32:4,f16:2,i32:4,u32:4};function YL(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,s=i?parseInt(i):1,o=GE(n),c={type:n,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function XE(t,e){let r={};for(let i of t.attributes)r[i.name]=Cle(t,e,i.name);return r}function Zj(t,e,r=16){let i=XE(t,e),n=new Array(r).fill(null);for(let s of Object.values(i))n[s.location]=s;return n}function Cle(t,e,r){let i=Ile(t,r),n=Rle(e,r);if(!i)return null;let s=Gj(i.type),o=n?.vertexFormat||s.defaultVertexFormat,c=YL(o);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:o,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:s.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Ile(t,e){let r=t.attributes.find(i=>i.name===e);return r||xt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function Rle(t,e){kle(t);let r=Lle(t,e);return r||(r=Dle(t,e),r)?r:(xt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function kle(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&xt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Lle(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function Dle(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let s of r.attributes||[]){let o=YL(s.format);i+=o.byteLength}let n=r.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function XL(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(s=>s.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):xt.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var kb=class t extends fi{static defaultProps={...fi.defaultProps,renderPipeline:null};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,t.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=Zj(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}};var Lb=class t extends fi{static defaultProps={...fi.defaultProps,layout:void 0,buffers:{}};get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,t.defaultProps)}};var Db=class t extends fi{static defaultProps={...fi.defaultProps,type:void 0,count:void 0};get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,t.defaultProps)}};var Ole={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16}};function Yj(t){let e=Ole[t];return bi(t),e}function Xj(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var QE;function KE(t){return(!QE||QE.byteLengthn.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){Kj(this.uniforms[e],r)||(this.uniforms[e]=Jj(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Ob=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,s=new JE(i.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let o=new eM({name:r});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),s=e.createBuffer({usage:Yi.UNIFORM|Yi.COPY_DST,byteLength:n}),o=this.getUniformBufferData(r);return s.write(o),s}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:Yi.UNIFORM|Yi.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&xt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let s=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(s);let c=this.uniformBlocks.get(e).getAllUniforms();xt.log(4,`Writing to uniform buffer ${String(e)}`,s,c)()}return n}};function tM(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function Bb(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function JL(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=tM(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function eW(t){return $A(t)!==null||typeof t=="number"||typeof t=="boolean"}function Fb(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];eW(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function eD(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:s={}}=r;for(let c in i)if(c in e){let y=i[c]?`${t}.${i[c]}`:"N/A";xt.removed(`${t}.${c}`,y)()}for(let c in n)if(c in e){let f=n[c];xt.deprecated(`${t}.${c}`,`${t}.${f}`)()}let o=null;for(let[c,f]of Object.entries(s))c in e&&(xt.deprecated(`${t}.${c}`,`${t}.${f}`)(),o=o||Object.assign({},e),o[f]=e[c],delete o[c]);return o||e}var Ble="";async function tD(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:Ble+t}catch(n){i(n)}})}async function Nb(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,s)=>{i.onload=n,i.onerror=o=>s(new Error(`Unable to load script '${t}': ${o}`)),r.appendChild(i)})}function zb(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i":return this.left.evaluate(e)>this.right.evaluate(e)?1:0;case"<=":return this.left.evaluate(e)<=this.right.evaluate(e)?1:0;case">=":return this.left.evaluate(e)>=this.right.evaluate(e)?1:0;case"&&":return this.left.evaluate(e)&&this.right.evaluate(e)?1:0;case"||":return this.left.evaluate(e)||this.right.evaluate(e)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}},pM=class extends ap{constructor(){super()}},ED=class extends pM{constructor(e,r){super(),this.selector=e,this.body=r}get astNodeType(){return"case"}},MD=class extends pM{constructor(e){super(),this.body=e}get astNodeType(){return"default"}},PD=class extends ap{constructor(e,r,i){super(),this.name=e,this.type=r,this.attributes=i}get astNodeType(){return"argument"}},CD=class extends ap{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"elseif"}},ID=class extends ap{constructor(e,r,i){super(),this.name=e,this.type=r,this.attributes=i}get astNodeType(){return"member"}},AM=class extends ap{constructor(e,r){super(),this.name=e,this.value=r}get astNodeType(){return"attribute"}},yt,Ge;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(Ge||(Ge={}));var qe=class{constructor(e,r,i){this.name=e,this.type=r,this.rule=i}toString(){return this.name}},Se=class{};yt=Se;Se.none=new qe("",Ge.reserved,"");Se.eof=new qe("EOF",Ge.token,"");Se.reserved={asm:new qe("asm",Ge.reserved,"asm"),bf16:new qe("bf16",Ge.reserved,"bf16"),do:new qe("do",Ge.reserved,"do"),enum:new qe("enum",Ge.reserved,"enum"),f16:new qe("f16",Ge.reserved,"f16"),f64:new qe("f64",Ge.reserved,"f64"),handle:new qe("handle",Ge.reserved,"handle"),i8:new qe("i8",Ge.reserved,"i8"),i16:new qe("i16",Ge.reserved,"i16"),i64:new qe("i64",Ge.reserved,"i64"),mat:new qe("mat",Ge.reserved,"mat"),premerge:new qe("premerge",Ge.reserved,"premerge"),regardless:new qe("regardless",Ge.reserved,"regardless"),typedef:new qe("typedef",Ge.reserved,"typedef"),u8:new qe("u8",Ge.reserved,"u8"),u16:new qe("u16",Ge.reserved,"u16"),u64:new qe("u64",Ge.reserved,"u64"),unless:new qe("unless",Ge.reserved,"unless"),using:new qe("using",Ge.reserved,"using"),vec:new qe("vec",Ge.reserved,"vec"),void:new qe("void",Ge.reserved,"void")};Se.keywords={array:new qe("array",Ge.keyword,"array"),atomic:new qe("atomic",Ge.keyword,"atomic"),bool:new qe("bool",Ge.keyword,"bool"),f32:new qe("f32",Ge.keyword,"f32"),i32:new qe("i32",Ge.keyword,"i32"),mat2x2:new qe("mat2x2",Ge.keyword,"mat2x2"),mat2x3:new qe("mat2x3",Ge.keyword,"mat2x3"),mat2x4:new qe("mat2x4",Ge.keyword,"mat2x4"),mat3x2:new qe("mat3x2",Ge.keyword,"mat3x2"),mat3x3:new qe("mat3x3",Ge.keyword,"mat3x3"),mat3x4:new qe("mat3x4",Ge.keyword,"mat3x4"),mat4x2:new qe("mat4x2",Ge.keyword,"mat4x2"),mat4x3:new qe("mat4x3",Ge.keyword,"mat4x3"),mat4x4:new qe("mat4x4",Ge.keyword,"mat4x4"),ptr:new qe("ptr",Ge.keyword,"ptr"),sampler:new qe("sampler",Ge.keyword,"sampler"),sampler_comparison:new qe("sampler_comparison",Ge.keyword,"sampler_comparison"),struct:new qe("struct",Ge.keyword,"struct"),texture_1d:new qe("texture_1d",Ge.keyword,"texture_1d"),texture_2d:new qe("texture_2d",Ge.keyword,"texture_2d"),texture_2d_array:new qe("texture_2d_array",Ge.keyword,"texture_2d_array"),texture_3d:new qe("texture_3d",Ge.keyword,"texture_3d"),texture_cube:new qe("texture_cube",Ge.keyword,"texture_cube"),texture_cube_array:new qe("texture_cube_array",Ge.keyword,"texture_cube_array"),texture_multisampled_2d:new qe("texture_multisampled_2d",Ge.keyword,"texture_multisampled_2d"),texture_storage_1d:new qe("texture_storage_1d",Ge.keyword,"texture_storage_1d"),texture_storage_2d:new qe("texture_storage_2d",Ge.keyword,"texture_storage_2d"),texture_storage_2d_array:new qe("texture_storage_2d_array",Ge.keyword,"texture_storage_2d_array"),texture_storage_3d:new qe("texture_storage_3d",Ge.keyword,"texture_storage_3d"),texture_depth_2d:new qe("texture_depth_2d",Ge.keyword,"texture_depth_2d"),texture_depth_2d_array:new qe("texture_depth_2d_array",Ge.keyword,"texture_depth_2d_array"),texture_depth_cube:new qe("texture_depth_cube",Ge.keyword,"texture_depth_cube"),texture_depth_cube_array:new qe("texture_depth_cube_array",Ge.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new qe("texture_depth_multisampled_2d",Ge.keyword,"texture_depth_multisampled_2d"),texture_external:new qe("texture_external",Ge.keyword,"texture_external"),u32:new qe("u32",Ge.keyword,"u32"),vec2:new qe("vec2",Ge.keyword,"vec2"),vec3:new qe("vec3",Ge.keyword,"vec3"),vec4:new qe("vec4",Ge.keyword,"vec4"),bitcast:new qe("bitcast",Ge.keyword,"bitcast"),block:new qe("block",Ge.keyword,"block"),break:new qe("break",Ge.keyword,"break"),case:new qe("case",Ge.keyword,"case"),continue:new qe("continue",Ge.keyword,"continue"),continuing:new qe("continuing",Ge.keyword,"continuing"),default:new qe("default",Ge.keyword,"default"),discard:new qe("discard",Ge.keyword,"discard"),else:new qe("else",Ge.keyword,"else"),enable:new qe("enable",Ge.keyword,"enable"),fallthrough:new qe("fallthrough",Ge.keyword,"fallthrough"),false:new qe("false",Ge.keyword,"false"),fn:new qe("fn",Ge.keyword,"fn"),for:new qe("for",Ge.keyword,"for"),function:new qe("function",Ge.keyword,"function"),if:new qe("if",Ge.keyword,"if"),let:new qe("let",Ge.keyword,"let"),const:new qe("const",Ge.keyword,"const"),loop:new qe("loop",Ge.keyword,"loop"),while:new qe("while",Ge.keyword,"while"),private:new qe("private",Ge.keyword,"private"),read:new qe("read",Ge.keyword,"read"),read_write:new qe("read_write",Ge.keyword,"read_write"),return:new qe("return",Ge.keyword,"return"),storage:new qe("storage",Ge.keyword,"storage"),switch:new qe("switch",Ge.keyword,"switch"),true:new qe("true",Ge.keyword,"true"),alias:new qe("alias",Ge.keyword,"alias"),type:new qe("type",Ge.keyword,"type"),uniform:new qe("uniform",Ge.keyword,"uniform"),var:new qe("var",Ge.keyword,"var"),override:new qe("override",Ge.keyword,"override"),workgroup:new qe("workgroup",Ge.keyword,"workgroup"),write:new qe("write",Ge.keyword,"write"),r8unorm:new qe("r8unorm",Ge.keyword,"r8unorm"),r8snorm:new qe("r8snorm",Ge.keyword,"r8snorm"),r8uint:new qe("r8uint",Ge.keyword,"r8uint"),r8sint:new qe("r8sint",Ge.keyword,"r8sint"),r16uint:new qe("r16uint",Ge.keyword,"r16uint"),r16sint:new qe("r16sint",Ge.keyword,"r16sint"),r16float:new qe("r16float",Ge.keyword,"r16float"),rg8unorm:new qe("rg8unorm",Ge.keyword,"rg8unorm"),rg8snorm:new qe("rg8snorm",Ge.keyword,"rg8snorm"),rg8uint:new qe("rg8uint",Ge.keyword,"rg8uint"),rg8sint:new qe("rg8sint",Ge.keyword,"rg8sint"),r32uint:new qe("r32uint",Ge.keyword,"r32uint"),r32sint:new qe("r32sint",Ge.keyword,"r32sint"),r32float:new qe("r32float",Ge.keyword,"r32float"),rg16uint:new qe("rg16uint",Ge.keyword,"rg16uint"),rg16sint:new qe("rg16sint",Ge.keyword,"rg16sint"),rg16float:new qe("rg16float",Ge.keyword,"rg16float"),rgba8unorm:new qe("rgba8unorm",Ge.keyword,"rgba8unorm"),rgba8unorm_srgb:new qe("rgba8unorm_srgb",Ge.keyword,"rgba8unorm_srgb"),rgba8snorm:new qe("rgba8snorm",Ge.keyword,"rgba8snorm"),rgba8uint:new qe("rgba8uint",Ge.keyword,"rgba8uint"),rgba8sint:new qe("rgba8sint",Ge.keyword,"rgba8sint"),bgra8unorm:new qe("bgra8unorm",Ge.keyword,"bgra8unorm"),bgra8unorm_srgb:new qe("bgra8unorm_srgb",Ge.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new qe("rgb10a2unorm",Ge.keyword,"rgb10a2unorm"),rg11b10float:new qe("rg11b10float",Ge.keyword,"rg11b10float"),rg32uint:new qe("rg32uint",Ge.keyword,"rg32uint"),rg32sint:new qe("rg32sint",Ge.keyword,"rg32sint"),rg32float:new qe("rg32float",Ge.keyword,"rg32float"),rgba16uint:new qe("rgba16uint",Ge.keyword,"rgba16uint"),rgba16sint:new qe("rgba16sint",Ge.keyword,"rgba16sint"),rgba16float:new qe("rgba16float",Ge.keyword,"rgba16float"),rgba32uint:new qe("rgba32uint",Ge.keyword,"rgba32uint"),rgba32sint:new qe("rgba32sint",Ge.keyword,"rgba32sint"),rgba32float:new qe("rgba32float",Ge.keyword,"rgba32float"),static_assert:new qe("static_assert",Ge.keyword,"static_assert")};Se.tokens={decimal_float_literal:new qe("decimal_float_literal",Ge.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new qe("hex_float_literal",Ge.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new qe("int_literal",Ge.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new qe("uint_literal",Ge.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new qe("ident",Ge.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new qe("and",Ge.token,"&"),and_and:new qe("and_and",Ge.token,"&&"),arrow:new qe("arrow ",Ge.token,"->"),attr:new qe("attr",Ge.token,"@"),attr_left:new qe("attr_left",Ge.token,"[["),attr_right:new qe("attr_right",Ge.token,"]]"),forward_slash:new qe("forward_slash",Ge.token,"/"),bang:new qe("bang",Ge.token,"!"),bracket_left:new qe("bracket_left",Ge.token,"["),bracket_right:new qe("bracket_right",Ge.token,"]"),brace_left:new qe("brace_left",Ge.token,"{"),brace_right:new qe("brace_right",Ge.token,"}"),colon:new qe("colon",Ge.token,":"),comma:new qe("comma",Ge.token,","),equal:new qe("equal",Ge.token,"="),equal_equal:new qe("equal_equal",Ge.token,"=="),not_equal:new qe("not_equal",Ge.token,"!="),greater_than:new qe("greater_than",Ge.token,">"),greater_than_equal:new qe("greater_than_equal",Ge.token,">="),shift_right:new qe("shift_right",Ge.token,">>"),less_than:new qe("less_than",Ge.token,"<"),less_than_equal:new qe("less_than_equal",Ge.token,"<="),shift_left:new qe("shift_left",Ge.token,"<<"),modulo:new qe("modulo",Ge.token,"%"),minus:new qe("minus",Ge.token,"-"),minus_minus:new qe("minus_minus",Ge.token,"--"),period:new qe("period",Ge.token,"."),plus:new qe("plus",Ge.token,"+"),plus_plus:new qe("plus_plus",Ge.token,"++"),or:new qe("or",Ge.token,"|"),or_or:new qe("or_or",Ge.token,"||"),paren_left:new qe("paren_left",Ge.token,"("),paren_right:new qe("paren_right",Ge.token,")"),semicolon:new qe("semicolon",Ge.token,";"),star:new qe("star",Ge.token,"*"),tilde:new qe("tilde",Ge.token,"~"),underscore:new qe("underscore",Ge.token,"_"),xor:new qe("xor",Ge.token,"^"),plus_equal:new qe("plus_equal",Ge.token,"+="),minus_equal:new qe("minus_equal",Ge.token,"-="),times_equal:new qe("times_equal",Ge.token,"*="),division_equal:new qe("division_equal",Ge.token,"/="),modulo_equal:new qe("modulo_equal",Ge.token,"%="),and_equal:new qe("and_equal",Ge.token,"&="),or_equal:new qe("or_equal",Ge.token,"|="),xor_equal:new qe("xor_equal",Ge.token,"^="),shift_right_equal:new qe("shift_right_equal",Ge.token,">>="),shift_left_equal:new qe("shift_left_equal",Ge.token,"<<=")};Se.storage_class=[yt.keywords.function,yt.keywords.private,yt.keywords.workgroup,yt.keywords.uniform,yt.keywords.storage];Se.access_mode=[yt.keywords.read,yt.keywords.write,yt.keywords.read_write];Se.sampler_type=[yt.keywords.sampler,yt.keywords.sampler_comparison];Se.sampled_texture_type=[yt.keywords.texture_1d,yt.keywords.texture_2d,yt.keywords.texture_2d_array,yt.keywords.texture_3d,yt.keywords.texture_cube,yt.keywords.texture_cube_array];Se.multisampled_texture_type=[yt.keywords.texture_multisampled_2d];Se.storage_texture_type=[yt.keywords.texture_storage_1d,yt.keywords.texture_storage_2d,yt.keywords.texture_storage_2d_array,yt.keywords.texture_storage_3d];Se.depth_texture_type=[yt.keywords.texture_depth_2d,yt.keywords.texture_depth_2d_array,yt.keywords.texture_depth_cube,yt.keywords.texture_depth_cube_array,yt.keywords.texture_depth_multisampled_2d];Se.texture_external_type=[yt.keywords.texture_external];Se.any_texture_type=[...yt.sampled_texture_type,...yt.multisampled_texture_type,...yt.storage_texture_type,...yt.depth_texture_type,...yt.texture_external_type];Se.texel_format=[yt.keywords.r8unorm,yt.keywords.r8snorm,yt.keywords.r8uint,yt.keywords.r8sint,yt.keywords.r16uint,yt.keywords.r16sint,yt.keywords.r16float,yt.keywords.rg8unorm,yt.keywords.rg8snorm,yt.keywords.rg8uint,yt.keywords.rg8sint,yt.keywords.r32uint,yt.keywords.r32sint,yt.keywords.r32float,yt.keywords.rg16uint,yt.keywords.rg16sint,yt.keywords.rg16float,yt.keywords.rgba8unorm,yt.keywords.rgba8unorm_srgb,yt.keywords.rgba8snorm,yt.keywords.rgba8uint,yt.keywords.rgba8sint,yt.keywords.bgra8unorm,yt.keywords.bgra8unorm_srgb,yt.keywords.rgb10a2unorm,yt.keywords.rg11b10float,yt.keywords.rg32uint,yt.keywords.rg32sint,yt.keywords.rg32float,yt.keywords.rgba16uint,yt.keywords.rgba16sint,yt.keywords.rgba16float,yt.keywords.rgba32uint,yt.keywords.rgba32sint,yt.keywords.rgba32float];Se.const_literal=[yt.tokens.int_literal,yt.tokens.uint_literal,yt.tokens.decimal_float_literal,yt.tokens.hex_float_literal,yt.keywords.true,yt.keywords.false];Se.literal_or_ident=[yt.tokens.ident,yt.tokens.int_literal,yt.tokens.uint_literal,yt.tokens.decimal_float_literal,yt.tokens.hex_float_literal];Se.element_count_expression=[yt.tokens.int_literal,yt.tokens.uint_literal,yt.tokens.ident];Se.template_types=[yt.keywords.vec2,yt.keywords.vec3,yt.keywords.vec4,yt.keywords.mat2x2,yt.keywords.mat2x3,yt.keywords.mat2x4,yt.keywords.mat3x2,yt.keywords.mat3x3,yt.keywords.mat3x4,yt.keywords.mat4x2,yt.keywords.mat4x3,yt.keywords.mat4x4,yt.keywords.atomic,yt.keywords.bitcast,...yt.any_texture_type];Se.attribute_name=[yt.tokens.ident,yt.keywords.block];Se.assignment_operators=[yt.tokens.equal,yt.tokens.plus_equal,yt.tokens.minus_equal,yt.tokens.times_equal,yt.tokens.division_equal,yt.tokens.modulo_equal,yt.tokens.and_equal,yt.tokens.or_equal,yt.tokens.xor_equal,yt.tokens.shift_right_equal,yt.tokens.shift_left_equal];Se.increment_operators=[yt.tokens.plus_plus,yt.tokens.minus_minus];var mM=class{constructor(e,r,i){this.type=e,this.lexeme=r,this.line=i}toString(){return this.lexeme}isTemplateType(){return Se.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==Se.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}},RD=class{constructor(e){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=e??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new mM(Se.eof,"",this._line)),this._tokens}scanToken(){let e=this._advance();if(e==` +`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=` +`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let i=1;for(;i>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==` +`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),i--,i==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),i++)}return!0}}let r=Se.none;for(;;){let i=this._findType(e),n=this._peekAhead();if(e==">"&&(n==">"||n=="=")){let s=!1,o=this._tokens.length-1;for(let c=0;c<5&&o>=0;++c,--o)if(this._tokens[o].type===Se.tokens.less_than){o>0&&this._tokens[o-1].isArrayOrTemplateType()&&(s=!0);break}if(s)return this._addToken(i),!0}if(i===Se.none){let s=e,o=0,c=2;for(let f=0;f=this._source.length}_isWhitespace(e){return e==" "||e==" "||e=="\r"}_advance(e=0){let r=this._source[this._current];return e=e||0,e++,this._current+=e,r}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){let r=this._source.substring(this._start,this._current);this._tokens.push(new mM(e,r,this._line))}},kD=class{constructor(){this._tokens=[],this._current=0,this._context=new nD}parse(e){this._initialize(e);let r=[];for(;!this._isAtEnd();){let i=this._global_decl_or_directive();if(!i)break;r.push(i)}return r}_initialize(e){if(e)if(typeof e=="string"){let r=new RD(e);this._tokens=r.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,r){return console.error(e,r),{token:e,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==Se.eof}_match(e){if(e instanceof qe)return this._check(e)?(this._advance(),!0):!1;for(let r=0,i=e.length;r'.");let n=this._paren_expression();return new wD(i,n)}let e=this._type_decl(),r=this._argument_expression_list();return new SD(e,r)}_argument_expression_list(){if(!this._match(Se.tokens.paren_left))return null;let e=[];do{if(this._check(Se.tokens.paren_right))break;let r=this._short_circuit_or_expression();e.push(r)}while(this._match(Se.tokens.comma));return this._consume(Se.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(Se.tokens.paren_left);let e=this._short_circuit_or_expression();return this._match(Se.tokens.paren_right),new fM([e])}_paren_expression(){this._consume(Se.tokens.paren_left,"Expected '('.");let e=this._short_circuit_or_expression();return this._consume(Se.tokens.paren_right,"Expected ')'."),new fM([e])}_struct_decl(){if(!this._match(Se.keywords.struct))return null;let e=this._consume(Se.tokens.ident,"Expected name for struct.").toString();this._consume(Se.tokens.brace_left,"Expected '{' for struct body.");let r=[];for(;!this._check(Se.tokens.brace_right);){let n=this._attribute(),s=this._consume(Se.tokens.ident,"Expected variable name.").toString();this._consume(Se.tokens.colon,"Expected ':' for struct member type.");let o=this._attribute(),c=this._type_decl();c!=null&&(c.attributes=o),this._check(Se.tokens.brace_right)?this._match(Se.tokens.comma):this._consume(Se.tokens.comma,"Expected ',' for struct member."),r.push(new ID(s,c,n))}this._consume(Se.tokens.brace_right,"Expected '}' after struct body.");let i=new op(e,r);return this._context.structs.set(e,i),i}_global_variable_decl(){let e=this._variable_decl();return e&&this._match(Se.tokens.equal)&&(e.value=this._const_expression()),e}_override_variable_decl(){let e=this._override_decl();return e&&this._match(Se.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){if(!this._match(Se.keywords.const))return null;let e=this._consume(Se.tokens.ident,"Expected variable name"),r=null;if(this._match(Se.tokens.colon)){let s=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=s)}let i=null;if(this._match(Se.tokens.equal)){let s=this._short_circuit_or_expression();if(s instanceof eg)i=s;else if(s instanceof uM&&s.initializer instanceof eg)i=s.initializer;else try{let o=s.evaluate(this._context);i=new hM(o)}catch{i=s}}let n=new sM(e.toString(),r,"","",i);return this._context.constants.set(n.name,n),n}_global_let_decl(){if(!this._match(Se.keywords.let))return null;let e=this._consume(Se.tokens.ident,"Expected variable name"),r=null;if(this._match(Se.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}let i=null;return this._match(Se.tokens.equal)&&(i=this._const_expression()),new nM(e.toString(),r,"","",i)}_const_expression(){if(this._match(Se.const_literal))return new cM(this._previous().toString());let e=this._type_decl();this._consume(Se.tokens.paren_left,"Expected '('.");let r=[];for(;!this._check(Se.tokens.paren_right)&&(r.push(this._const_expression()),!!this._check(Se.tokens.comma));)this._advance();return this._consume(Se.tokens.paren_right,"Expected ')'."),new eg(e,r)}_variable_decl(){if(!this._match(Se.keywords.var))return null;let e="",r="";this._match(Se.tokens.less_than)&&(e=this._consume(Se.storage_class,"Expected storage_class.").toString(),this._match(Se.tokens.comma)&&(r=this._consume(Se.access_mode,"Expected access_mode.").toString()),this._consume(Se.tokens.greater_than,"Expected '>'."));let i=this._consume(Se.tokens.ident,"Expected variable name"),n=null;if(this._match(Se.tokens.colon)){let s=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=s)}return new ZA(i.toString(),n,e,r,null)}_override_decl(){if(!this._match(Se.keywords.override))return null;let e=this._consume(Se.tokens.ident,"Expected variable name"),r=null;if(this._match(Se.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}return new iM(e.toString(),r,null)}_enable_directive(){let e=this._consume(Se.tokens.ident,"identity expected.");return new mD(e.toString())}_type_alias(){let e=this._consume(Se.tokens.ident,"identity expected.");this._consume(Se.tokens.equal,"Expected '=' for type alias.");let r=this._type_decl();if(r===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let i=new oM(e.toString(),r);return this._context.aliases.set(i.name,i),i}_type_decl(){if(this._check([Se.tokens.ident,...Se.texel_format,Se.keywords.bool,Se.keywords.f32,Se.keywords.i32,Se.keywords.u32])){let i=this._advance(),n=i.toString();return this._context.structs.has(n)?this._context.structs.get(n):this._context.aliases.has(n)?this._context.aliases.get(n).type:new lp(i.toString())}let e=this._texture_sampler_types();if(e)return e;if(this._check(Se.template_types)){let i=this._advance().toString(),n=null,s=null;return this._match(Se.tokens.less_than)&&(n=this._type_decl(),s=null,this._match(Se.tokens.comma)&&(s=this._consume(Se.access_mode,"Expected access_mode for pointer").toString()),this._consume(Se.tokens.greater_than,"Expected '>' for type.")),new aM(i,n,s)}if(this._match(Se.keywords.ptr)){let i=this._previous().toString();this._consume(Se.tokens.less_than,"Expected '<' for pointer.");let n=this._consume(Se.storage_class,"Expected storage_class for pointer");this._consume(Se.tokens.comma,"Expected ',' for pointer.");let s=this._type_decl(),o=null;return this._match(Se.tokens.comma)&&(o=this._consume(Se.access_mode,"Expected access_mode for pointer").toString()),this._consume(Se.tokens.greater_than,"Expected '>' for pointer."),new xD(i,n.toString(),s,o)}let r=this._attribute();if(this._match(Se.keywords.array)){let i=null,n=-1,s=this._previous();if(this._match(Se.tokens.less_than)){i=this._type_decl(),this._context.aliases.has(i.name)&&(i=this._context.aliases.get(i.name).type);let o="";this._match(Se.tokens.comma)&&(o=this._shift_expression().evaluate(this._context).toString()),this._consume(Se.tokens.greater_than,"Expected '>' for array."),n=o?parseInt(o):0}return new lM(s.toString(),r,i,n)}return null}_texture_sampler_types(){if(this._match(Se.sampler_type))return new Jm(this._previous().toString(),null,null);if(this._match(Se.depth_texture_type))return new Jm(this._previous().toString(),null,null);if(this._match(Se.sampled_texture_type)||this._match(Se.multisampled_texture_type)){let e=this._previous();this._consume(Se.tokens.less_than,"Expected '<' for sampler type.");let r=this._type_decl();return this._consume(Se.tokens.greater_than,"Expected '>' for sampler type."),new Jm(e.toString(),r,null)}if(this._match(Se.storage_texture_type)){let e=this._previous();this._consume(Se.tokens.less_than,"Expected '<' for sampler type.");let r=this._consume(Se.texel_format,"Invalid texel format.").toString();this._consume(Se.tokens.comma,"Expected ',' after texel format.");let i=this._consume(Se.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(Se.tokens.greater_than,"Expected '>' for sampler type."),new Jm(e.toString(),r,i)}return null}_attribute(){let e=[];for(;this._match(Se.tokens.attr);){let r=this._consume(Se.attribute_name,"Expected attribute name"),i=new AM(r.toString(),null);if(this._match(Se.tokens.paren_left)){if(i.value=this._consume(Se.literal_or_ident,"Expected attribute value").toString(),this._check(Se.tokens.comma)){this._advance();do{let n=this._consume(Se.literal_or_ident,"Expected attribute value").toString();i.value instanceof Array||(i.value=[i.value]),i.value.push(n)}while(this._match(Se.tokens.comma))}this._consume(Se.tokens.paren_right,"Expected ')'")}e.push(i)}for(;this._match(Se.tokens.attr_left);){if(!this._check(Se.tokens.attr_right))do{let r=this._consume(Se.attribute_name,"Expected attribute name"),i=new AM(r.toString(),null);if(this._match(Se.tokens.paren_left)){if(i.value=[this._consume(Se.literal_or_ident,"Expected attribute value").toString()],this._check(Se.tokens.comma)){this._advance();do{let n=this._consume(Se.literal_or_ident,"Expected attribute value").toString();i.value.push(n)}while(this._match(Se.tokens.comma))}this._consume(Se.tokens.paren_right,"Expected ')'")}e.push(i)}while(this._match(Se.tokens.comma));this._consume(Se.tokens.attr_right,"Expected ']]' after attribute declarations")}return e.length==0?null:e}},YA=class{constructor(e,r){this.name=e,this.attributes=r,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}},gM=class{constructor(e,r,i){this.name=e,this.type=r,this.attributes=i,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},Iy=class extends YA{constructor(e,r){super(e,r),this.members=[],this.align=0}get isStruct(){return!0}},Ub=class extends YA{constructor(e,r){super(e,r),this.count=0,this.stride=0}get isArray(){return!0}},_M=class extends YA{constructor(e,r,i,n){super(e,i),this.format=r,this.access=n}get isTemplate(){return!0}},GA;(function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"})(GA||(GA={}));var Ry=class{constructor(e,r,i,n,s,o,c){this.name=e,this.type=r,this.group=i,this.binding=n,this.attributes=s,this.resourceType=o,this.access=c}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},LD=class{constructor(e,r){this.name=e,this.type=r}},ky=class{constructor(e,r){this.align=e,this.size=r}},DD=class{constructor(e,r,i,n){this.name=e,this.type=r,this.locationType=i,this.location=n,this.interpolation=null}},yM=class{constructor(e,r,i,n){this.name=e,this.type=r,this.locationType=i,this.location=n}},OD=class{constructor(e,r=null){this.stage=null,this.inputs=[],this.outputs=[],this.name=e,this.stage=r}},BD=class{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}},FD=class{constructor(e,r,i,n){this.name=e,this.type=r,this.attributes=i,this.id=n}},tg=class t{constructor(e){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new BD,this._types=new Map,e&&this.update(e)}_isStorageTexture(e){return e.name=="texture_storage_1d"||e.name=="texture_storage_2d"||e.name=="texture_storage_2d_array"||e.name=="texture_storage_3d"}update(e){let i=new kD().parse(e);for(let n of i){if(n instanceof op){let s=this._getTypeInfo(n,null);s instanceof Iy&&this.structs.push(s);continue}if(n instanceof oM){this.aliases.push(this._getAliasInfo(n));continue}if(n instanceof iM){let s=n,o=this._getAttributeNum(s.attributes,"id",0),c=s.type!=null?this._getTypeInfo(s.type,s.attributes):null;this.overrides.push(new FD(s.name,c,s.attributes,o));continue}if(this._isUniformVar(n)){let s=n,o=this._getAttributeNum(s.attributes,"group",0),c=this._getAttributeNum(s.attributes,"binding",0),f=this._getTypeInfo(s.type,s.attributes),y=new Ry(s.name,f,o,c,s.attributes,GA.Uniform,s.access);this.uniforms.push(y);continue}if(this._isStorageVar(n)){let s=n,o=this._getAttributeNum(s.attributes,"group",0),c=this._getAttributeNum(s.attributes,"binding",0),f=this._getTypeInfo(s.type,s.attributes),y=this._isStorageTexture(f),b=new Ry(s.name,f,o,c,s.attributes,y?GA.StorageTexture:GA.Storage,s.access);this.storage.push(b);continue}if(this._isTextureVar(n)){let s=n,o=this._getAttributeNum(s.attributes,"group",0),c=this._getAttributeNum(s.attributes,"binding",0),f=this._getTypeInfo(s.type,s.attributes),y=this._isStorageTexture(f),b=new Ry(s.name,f,o,c,s.attributes,y?GA.StorageTexture:GA.Texture,s.access);y?this.storage.push(b):this.textures.push(b);continue}if(this._isSamplerVar(n)){let s=n,o=this._getAttributeNum(s.attributes,"group",0),c=this._getAttributeNum(s.attributes,"binding",0),f=this._getTypeInfo(s.type,s.attributes),y=new Ry(s.name,f,o,c,s.attributes,GA.Sampler,s.access);this.samplers.push(y);continue}if(n instanceof rM){let s=this._getAttribute(n,"vertex"),o=this._getAttribute(n,"fragment"),c=this._getAttribute(n,"compute"),f=s||o||c;if(f){let y=new OD(n.name,f.name);y.inputs=this._getInputs(n.args),y.outputs=this._getOutputs(n.returnType),this.entry[f.name].push(y)}continue}}}getBindGroups(){let e=[];function r(i,n){i>=e.length&&(e.length=i+1),e[i]===void 0&&(e[i]=[]),n>=e[i].length&&(e[i].length=n+1)}for(let i of this.uniforms){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.storage){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.textures){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.samplers){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}return e}_getOutputs(e,r=void 0){if(r===void 0&&(r=[]),e instanceof op)this._getStructOutputs(e,r);else{let i=this._getOutputInfo(e);i!==null&&r.push(i)}return r}_getStructOutputs(e,r){for(let i of e.members)if(i.type instanceof op)this._getStructOutputs(i.type,r);else{let n=this._getAttribute(i,"location")||this._getAttribute(i,"builtin");if(n!==null){let s=this._getTypeInfo(i.type,i.type.attributes),o=this._parseInt(n.value),c=new yM(i.name,s,n.name,o);r.push(c)}}}_getOutputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let i=this._getTypeInfo(e,e.attributes),n=this._parseInt(r.value);return new yM("",i,r.name,n)}return null}_getInputs(e,r=void 0){r===void 0&&(r=[]);for(let i of e)if(i.type instanceof op)this._getStructInputs(i.type,r);else{let n=this._getInputInfo(i);n!==null&&r.push(n)}return r}_getStructInputs(e,r){for(let i of e.members)if(i.type instanceof op)this._getStructInputs(i.type,r);else{let n=this._getInputInfo(i);n!==null&&r.push(n)}}_getInputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let i=this._getAttribute(e,"interpolation"),n=this._getTypeInfo(e.type,e.attributes),s=this._parseInt(r.value),o=new DD(e.name,n,r.name,s);return i!==null&&(o.interpolation=this._parseString(i.value)),o}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);let r=parseInt(e);return isNaN(r)?e:r}_getAlias(e){for(let r of this.aliases)if(r.name==e)return r.type;return null}_getAliasInfo(e){return new LD(e.name,this._getTypeInfo(e.type,null))}_getTypeInfo(e,r){if(this._types.has(e))return this._types.get(e);if(e instanceof lM){let n=e,s=this._getTypeInfo(n.format,n.attributes),o=new Ub(n.name,r);return o.format=s,o.count=n.count,this._types.set(e,o),this._updateTypeInfo(o),o}if(e instanceof op){let n=e,s=new Iy(n.name,r);for(let o of n.members){let c=this._getTypeInfo(o.type,o.attributes);s.members.push(new gM(o.name,c,o.attributes))}return this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof Jm){let n=e,s=n.format instanceof lp,o=n.format?s?this._getTypeInfo(n.format,null):new YA(n.format,null):null,c=new _M(n.name,o,r,n.access);return this._types.set(e,c),this._updateTypeInfo(c),c}if(e instanceof aM){let n=e,s=n.format?this._getTypeInfo(n.format,null):null,o=new _M(n.name,s,r,n.access);return this._types.set(e,o),this._updateTypeInfo(o),o}let i=new YA(e.name,r);return this._types.set(e,i),this._updateTypeInfo(i),i}_updateTypeInfo(e){var r,i;let n=this._getTypeSize(e);if(e.size=(r=n?.size)!==null&&r!==void 0?r:0,e instanceof Ub){let s=this._getTypeSize(e.format);e.stride=(i=s?.size)!==null&&i!==void 0?i:0,this._updateTypeInfo(e.format)}e instanceof Iy&&this._updateStructInfo(e)}_updateStructInfo(e){var r;let i=0,n=0,s=0,o=0;for(let c=0,f=e.members.length;ct.name);tg._samplerTypes=Se.sampler_type.map(t=>t.name);function ND(t){let e={attributes:[],bindings:[]},r;try{r=Fle(t)}catch(s){return xt.error(s.message)(),e}for(let s of r.uniforms){let o=[];for(let c of s.type.members)o.push({name:c.name,type:tW(c.type)});e.bindings.push({type:"uniform",name:s.name,location:s.binding,group:s.group,members:o})}let i=r.entry.vertex[0],n=i?.inputs.length||0;for(let s=0;s`:t.name}function Fle(t){try{return new tg(t)}catch(e){if(e instanceof Error)throw e;let r="WGSL parse error";throw typeof e=="object"&&e?.message&&(r+=`: ${e.message} `),typeof e=="object"&&e?.token&&(r+=e.token.line||""),new Error(r,{cause:e})}}var Nle=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND +const float TWO_PI = 6.2831854820251465; +const float PI_2 = 1.5707963705062866; +const float PI_16 = 0.1963495463132858; +const float SIN_TABLE_0 = 0.19509032368659973; +const float SIN_TABLE_1 = 0.3826834261417389; +const float SIN_TABLE_2 = 0.5555702447891235; +const float SIN_TABLE_3 = 0.7071067690849304; +const float COS_TABLE_0 = 0.9807852506637573; +const float COS_TABLE_1 = 0.9238795042037964; +const float COS_TABLE_2 = 0.8314695954322815; +const float COS_TABLE_3 = 0.7071067690849304; +const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; +const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; +const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; +const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; +float sin_taylor_fp32(float a) { +float r, s, t, x; +if (a == 0.0) { +return 0.0; +} +x = -a * a; +s = a; +r = a; +r = r * x; +t = r * INVERSE_FACTORIAL_3; +s = s + t; +r = r * x; +t = r * INVERSE_FACTORIAL_5; +s = s + t; +r = r * x; +t = r * INVERSE_FACTORIAL_7; +s = s + t; +r = r * x; +t = r * INVERSE_FACTORIAL_9; +s = s + t; +return s; +} +void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) { +if (a == 0.0) { +sin_t = 0.0; +cos_t = 1.0; +} +sin_t = sin_taylor_fp32(a); +cos_t = sqrt(1.0 - sin_t * sin_t); +} +float tan_taylor_fp32(float a) { +float sin_a; +float cos_a; +if (a == 0.0) { +return 0.0; +} +float z = floor(a / TWO_PI); +float r = a - TWO_PI * z; +float t; +float q = floor(r / PI_2 + 0.5); +int j = int(q); +if (j < -2 || j > 2) { +return 1.0 / 0.0; +} +t = r - PI_2 * q; +q = floor(t / PI_16 + 0.5); +int k = int(q); +int abs_k = int(abs(float(k))); +if (abs_k > 4) { +return 1.0 / 0.0; +} else { +t = t - PI_16 * q; +} +float u = 0.0; +float v = 0.0; +float sin_t, cos_t; +float s, c; +sincos_taylor_fp32(t, sin_t, cos_t); +if (k == 0) { +s = sin_t; +c = cos_t; +} else { +if (abs(float(abs_k) - 1.0) < 0.5) { +u = COS_TABLE_0; +v = SIN_TABLE_0; +} else if (abs(float(abs_k) - 2.0) < 0.5) { +u = COS_TABLE_1; +v = SIN_TABLE_1; +} else if (abs(float(abs_k) - 3.0) < 0.5) { +u = COS_TABLE_2; +v = SIN_TABLE_2; +} else if (abs(float(abs_k) - 4.0) < 0.5) { +u = COS_TABLE_3; +v = SIN_TABLE_3; +} +if (k > 0) { +s = u * sin_t + v * cos_t; +c = u * cos_t - v * sin_t; +} else { +s = u * sin_t - v * cos_t; +c = u * cos_t + v * sin_t; +} +} +if (j == 0) { +sin_a = s; +cos_a = c; +} else if (j == 1) { +sin_a = c; +cos_a = -s; +} else if (j == -1) { +sin_a = -c; +cos_a = s; +} else { +sin_a = -s; +cos_a = -c; +} +return sin_a / cos_a; +} +#endif +float tan_fp32(float a) { +#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND +return tan_taylor_fp32(a); +#else +return tan(a); +#endif +} +`,zD={name:"fp32",vs:Nle};var zle=new Float32Array([0,1,1,1]),Ule=`uniform pickingUniforms { +float isActive; +float isAttribute; +float isHighlightActive; +float useFloatColors; +vec3 highlightedObjectColor; +vec4 highlightColor; +} picking; +out vec4 picking_vRGBcolor_Avalid; +vec3 picking_normalizeColor(vec3 color) { +return picking.useFloatColors > 0.5 ? color : color / 255.0; +} +vec4 picking_normalizeColor(vec4 color) { +return picking.useFloatColors > 0.5 ? color : color / 255.0; +} +bool picking_isColorZero(vec3 color) { +return dot(color, vec3(1.0)) < 0.00001; +} +bool picking_isColorValid(vec3 color) { +return dot(color, vec3(1.0)) > 0.00001; +} +bool isVertexHighlighted(vec3 vertexColor) { +vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); +return +bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); +} +void picking_setPickingColor(vec3 pickingColor) { +pickingColor = picking_normalizeColor(pickingColor); +if (bool(picking.isActive)) { +picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); +if (!bool(picking.isAttribute)) { +picking_vRGBcolor_Avalid.rgb = pickingColor; +} +} else { +picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); +} +} +void picking_setPickingAttribute(float value) { +if (bool(picking.isAttribute)) { +picking_vRGBcolor_Avalid.r = value; +} +} +void picking_setPickingAttribute(vec2 value) { +if (bool(picking.isAttribute)) { +picking_vRGBcolor_Avalid.rg = value; +} +} +void picking_setPickingAttribute(vec3 value) { +if (bool(picking.isAttribute)) { +picking_vRGBcolor_Avalid.rgb = value; +} +} +`,Vle=`uniform pickingUniforms { +float isActive; +float isAttribute; +float isHighlightActive; +float useFloatColors; +vec3 highlightedObjectColor; +vec4 highlightColor; +} picking; +in vec4 picking_vRGBcolor_Avalid; +vec4 picking_filterHighlightColor(vec4 color) { +if (picking.isActive > 0.5) { +return color; +} +bool selected = bool(picking_vRGBcolor_Avalid.a); +if (selected) { +float highLightAlpha = picking.highlightColor.a; +float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); +float highLightRatio = highLightAlpha / blendedAlpha; +vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); +return vec4(blendedRGB, blendedAlpha); +} else { +return color; +} +} +vec4 picking_filterPickingColor(vec4 color) { +if (bool(picking.isActive)) { +if (picking_vRGBcolor_Avalid.a == 0.0) { +discard; +} +return picking_vRGBcolor_Avalid; +} +return color; +} +vec4 picking_filterColor(vec4 color) { +vec4 highlightColor = picking_filterHighlightColor(color); +return picking_filterPickingColor(highlightColor); +} +`,xM={name:"picking",vs:Ule,fs:Vle,uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3",highlightColor:"vec4"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:new Float32Array([0,0,0]),highlightColor:zle},getUniforms:jle};function jle(t={},e){let r={};if(t.highlightedObjectColor!==void 0)if(t.highlightedObjectColor===null)r.isHighlightActive=!1;else{r.isHighlightActive=!0;let i=t.highlightedObjectColor.slice(0,3);r.highlightedObjectColor=i}if(t.highlightColor){let i=Array.from(t.highlightColor,n=>n/255);Number.isFinite(i[3])||(i[3]=1),r.highlightColor=i}return t.isActive!==void 0&&(r.isActive=!!t.isActive,r.isAttribute=!!t.isAttribute),t.useFloatColors!==void 0&&(r.useFloatColors=!!t.useFloatColors),r}function UD(t,e=[],r=0){let i=Math.fround(t),n=t-i;return e[r]=i,e[r+1]=n,e}function rW(t){return t-Math.fround(t)}function iW(t){let e=new Float32Array(32);for(let r=0;r<4;++r)for(let i=0;i<4;++i){let n=r*4+i;UD(t[i*4+r],e,n*2)}return e}var nW=`uniform float ONE; +vec2 split(float a) { +const float SPLIT = 4097.0; +float t = a * SPLIT; +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +float a_hi = t * ONE - (t - a); +float a_lo = a * ONE - a_hi; +#else +float a_hi = t - (t - a); +float a_lo = a - a_hi; +#endif +return vec2(a_hi, a_lo); +} +vec2 split2(vec2 a) { +vec2 b = split(a.x); +b.y += a.y; +return b; +} +vec2 quickTwoSum(float a, float b) { +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +float sum = (a + b) * ONE; +float err = b - (sum - a) * ONE; +#else +float sum = a + b; +float err = b - (sum - a); +#endif +return vec2(sum, err); +} +vec2 twoSum(float a, float b) { +float s = (a + b); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +float v = (s * ONE - a) * ONE; +float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v); +#else +float v = s - a; +float err = (a - (s - v)) + (b - v); +#endif +return vec2(s, err); +} +vec2 twoSub(float a, float b) { +float s = (a - b); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +float v = (s * ONE - a) * ONE; +float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v); +#else +float v = s - a; +float err = (a - (s - v)) - (b + v); +#endif +return vec2(s, err); +} +vec2 twoSqr(float a) { +float prod = a * a; +vec2 a_fp64 = split(a); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x * +a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE; +#else +float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; +#endif +return vec2(prod, err); +} +vec2 twoProd(float a, float b) { +float prod = a * b; +vec2 a_fp64 = split(a); +vec2 b_fp64 = split(b); +float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y + +a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y; +return vec2(prod, err); +} +vec2 sum_fp64(vec2 a, vec2 b) { +vec2 s, t; +s = twoSum(a.x, b.x); +t = twoSum(a.y, b.y); +s.y += t.x; +s = quickTwoSum(s.x, s.y); +s.y += t.y; +s = quickTwoSum(s.x, s.y); +return s; +} +vec2 sub_fp64(vec2 a, vec2 b) { +vec2 s, t; +s = twoSub(a.x, b.x); +t = twoSub(a.y, b.y); +s.y += t.x; +s = quickTwoSum(s.x, s.y); +s.y += t.y; +s = quickTwoSum(s.x, s.y); +return s; +} +vec2 mul_fp64(vec2 a, vec2 b) { +vec2 prod = twoProd(a.x, b.x); +prod.y += a.x * b.y; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) +prod = split2(prod); +#endif +prod = quickTwoSum(prod.x, prod.y); +prod.y += a.y * b.x; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) +prod = split2(prod); +#endif +prod = quickTwoSum(prod.x, prod.y); +return prod; +} +vec2 div_fp64(vec2 a, vec2 b) { +float xn = 1.0 / b.x; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) +vec2 yn = mul_fp64(a, vec2(xn, 0)); +#else +vec2 yn = a * xn; +#endif +float diff = (sub_fp64(a, mul_fp64(b, yn))).x; +vec2 prod = twoProd(xn, diff); +return sum_fp64(yn, prod); +} +vec2 sqrt_fp64(vec2 a) { +if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); +if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); +float x = 1.0 / sqrt(a.x); +float yn = a.x * x; +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) +vec2 yn_sqr = twoSqr(yn) * ONE; +#else +vec2 yn_sqr = twoSqr(yn); +#endif +float diff = sub_fp64(a, yn_sqr).x; +vec2 prod = twoProd(x * 0.5, diff); +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) +return sum_fp64(split(yn), prod); +#else +return sum_fp64(vec2(yn, 0.0), prod); +#endif +} +`;var Wle={ONE:1};function Hle(){return Wle}var VD={name:"fp64-arithmetic",vs:nW,getUniforms:Hle,fp64ify:UD,fp64LowPart:rW,fp64ifyMatrix4:iW};var fDe=1/Math.PI*180,dDe=1/180*Math.PI,$le={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...$le}};var so=globalThis.mathgl.config;function jD(t,{precision:e=so.precision}={}){return t=qle(t),`${parseFloat(t.toPrecision(e))}`}function ru(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function qu(t,e,r){return Zle(t,i=>Math.max(e,Math.min(r,i)))}function Ka(t,e,r){return ru(t)?t.map((i,n)=>Ka(i,e[n],r)):r*e+(1-r)*t}function oo(t,e,r){let i=so.EPSILON;r&&(so.EPSILON=r);try{if(t===e)return!0;if(ru(t)&&ru(e)){if(t.length!==e.length)return!1;for(let n=0;n0?", ":"")+jD(this[i],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r=0&&e=0&&eece,angle:()=>_ce,ceil:()=>tce,clone:()=>Xle,copy:()=>Kle,create:()=>sW,cross:()=>fce,dist:()=>Mce,distance:()=>cW,div:()=>Ece,divide:()=>lW,dot:()=>hce,equals:()=>bce,exactEquals:()=>vce,floor:()=>rce,forEach:()=>Ice,fromValues:()=>Qle,inverse:()=>cce,len:()=>wce,length:()=>hW,lerp:()=>dce,max:()=>nce,min:()=>ice,mul:()=>Tce,multiply:()=>aW,negate:()=>lce,normalize:()=>uce,random:()=>pce,rotate:()=>gce,round:()=>sce,scale:()=>oce,scaleAndAdd:()=>ace,set:()=>Jle,sqrDist:()=>Pce,sqrLen:()=>Cce,squaredDistance:()=>uW,squaredLength:()=>fW,str:()=>xce,sub:()=>Sce,subtract:()=>oW,transformMat2:()=>Ace,transformMat2d:()=>mce,transformMat3:()=>WD,transformMat4:()=>HD,zero:()=>yce});var Pn=typeof Float32Array<"u"?Float32Array:Array,Xf=Math.random;function Gu(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var SDe=Math.PI/180;function sW(){let t=new Pn(2);return Pn!=Float32Array&&(t[0]=0,t[1]=0),t}function Xle(t){let e=new Pn(2);return e[0]=t[0],e[1]=t[1],e}function Qle(t,e){let r=new Pn(2);return r[0]=t,r[1]=e,r}function Kle(t,e){return t[0]=e[0],t[1]=e[1],t}function Jle(t,e,r){return t[0]=e,t[1]=r,t}function ece(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function oW(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function aW(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function lW(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function tce(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function rce(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function ice(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function nce(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function sce(t,e){return t[0]=Gu(e[0]),t[1]=Gu(e[1]),t}function oce(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function ace(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t}function cW(t,e){let r=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(r*r+i*i)}function uW(t,e){let r=e[0]-t[0],i=e[1]-t[1];return r*r+i*i}function hW(t){let e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function fW(t){let e=t[0],r=t[1];return e*e+r*r}function lce(t,e){return t[0]=-e[0],t[1]=-e[1],t}function cce(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function uce(t,e){let r=e[0],i=e[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t}function hce(t,e){return t[0]*e[0]+t[1]*e[1]}function fce(t,e,r){let i=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=i,t}function dce(t,e,r,i){let n=e[0],s=e[1];return t[0]=n+i*(r[0]-n),t[1]=s+i*(r[1]-s),t}function pce(t,e){e=e===void 0?1:e;let r=Xf()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function Ace(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t}function mce(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n+r[4],t[1]=r[1]*i+r[3]*n+r[5],t}function WD(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[3]*n+r[6],t[1]=r[1]*i+r[4]*n+r[7],t}function HD(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t}function gce(t,e,r,i){let n=e[0]-r[0],s=e[1]-r[1],o=Math.sin(i),c=Math.cos(i);return t[0]=n*c-s*o+r[0],t[1]=n*o+s*c+r[1],t}function _ce(t,e){let r=t[0],i=t[1],n=e[0],s=e[1],o=Math.sqrt((r*r+i*i)*(n*n+s*s)),c=o&&(r*n+i*s)/o;return Math.acos(Math.min(Math.max(c,-1),1))}function yce(t){return t[0]=0,t[1]=0,t}function xce(t){return`vec2(${t[0]}, ${t[1]})`}function vce(t,e){return t[0]===e[0]&&t[1]===e[1]}function bce(t,e){let r=t[0],i=t[1],n=e[0],s=e[1];return Math.abs(r-n)<=1e-6*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))}var wce=hW,Sce=oW,Tce=aW,Ece=lW,Mce=cW,Pce=uW,Cce=fW,Ice=function(){let t=sW();return function(e,r,i,n,s,o){let c,f;for(r||(r=2),i||(i=0),n?f=Math.min(n*r+i,e.length):f=e.length,c=i;cDce,angle:()=>YD,bezier:()=>Gce,ceil:()=>Oce,clone:()=>Rce,copy:()=>kce,create:()=>wM,cross:()=>rg,dist:()=>rue,distance:()=>xW,div:()=>tue,divide:()=>yW,dot:()=>jb,equals:()=>Kce,exactEquals:()=>Qce,floor:()=>Bce,forEach:()=>sue,fromValues:()=>SM,hermite:()=>qce,inverse:()=>Wce,len:()=>XD,length:()=>mW,lerp:()=>Hce,max:()=>Nce,min:()=>Fce,mul:()=>eue,multiply:()=>_W,negate:()=>jce,normalize:()=>$D,random:()=>Zce,rotateX:()=>qD,rotateY:()=>GD,rotateZ:()=>ZD,round:()=>zce,scale:()=>Uce,scaleAndAdd:()=>Vce,set:()=>Lce,slerp:()=>$ce,sqrDist:()=>iue,sqrLen:()=>nue,squaredDistance:()=>vW,squaredLength:()=>bW,str:()=>Xce,sub:()=>Jce,subtract:()=>gW,transformMat3:()=>Wb,transformMat4:()=>ig,transformQuat:()=>Hb,zero:()=>Yce});function wM(){let t=new Pn(3);return Pn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Rce(t){let e=new Pn(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function mW(t){let e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function SM(t,e,r){let i=new Pn(3);return i[0]=t,i[1]=e,i[2]=r,i}function kce(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Lce(t,e,r,i){return t[0]=e,t[1]=r,t[2]=i,t}function Dce(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function gW(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function _W(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function yW(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function Oce(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Bce(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function Fce(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function Nce(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function zce(t,e){return t[0]=Gu(e[0]),t[1]=Gu(e[1]),t[2]=Gu(e[2]),t}function Uce(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Vce(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t}function xW(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return Math.sqrt(r*r+i*i+n*n)}function vW(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return r*r+i*i+n*n}function bW(t){let e=t[0],r=t[1],i=t[2];return e*e+r*r+i*i}function jce(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Wce(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function $D(t,e){let r=e[0],i=e[1],n=e[2],s=r*r+i*i+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function jb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function rg(t,e,r){let i=e[0],n=e[1],s=e[2],o=r[0],c=r[1],f=r[2];return t[0]=n*f-s*c,t[1]=s*o-i*f,t[2]=i*c-n*o,t}function Hce(t,e,r,i){let n=e[0],s=e[1],o=e[2];return t[0]=n+i*(r[0]-n),t[1]=s+i*(r[1]-s),t[2]=o+i*(r[2]-o),t}function $ce(t,e,r,i){let n=Math.acos(Math.min(Math.max(jb(e,r),-1),1)),s=Math.sin(n),o=Math.sin((1-i)*n)/s,c=Math.sin(i*n)/s;return t[0]=o*e[0]+c*r[0],t[1]=o*e[1]+c*r[1],t[2]=o*e[2]+c*r[2],t}function qce(t,e,r,i,n,s){let o=s*s,c=o*(2*s-3)+1,f=o*(s-2)+s,y=o*(s-1),b=o*(3-2*s);return t[0]=e[0]*c+r[0]*f+i[0]*y+n[0]*b,t[1]=e[1]*c+r[1]*f+i[1]*y+n[1]*b,t[2]=e[2]*c+r[2]*f+i[2]*y+n[2]*b,t}function Gce(t,e,r,i,n,s){let o=1-s,c=o*o,f=s*s,y=c*o,b=3*s*c,M=3*f*o,L=f*s;return t[0]=e[0]*y+r[0]*b+i[0]*M+n[0]*L,t[1]=e[1]*y+r[1]*b+i[1]*M+n[1]*L,t[2]=e[2]*y+r[2]*b+i[2]*M+n[2]*L,t}function Zce(t,e){e=e===void 0?1:e;let r=Xf()*2*Math.PI,i=Xf()*2-1,n=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t[2]=i*e,t}function ig(t,e,r){let i=e[0],n=e[1],s=e[2],o=r[3]*i+r[7]*n+r[11]*s+r[15];return o=o||1,t[0]=(r[0]*i+r[4]*n+r[8]*s+r[12])/o,t[1]=(r[1]*i+r[5]*n+r[9]*s+r[13])/o,t[2]=(r[2]*i+r[6]*n+r[10]*s+r[14])/o,t}function Wb(t,e,r){let i=e[0],n=e[1],s=e[2];return t[0]=i*r[0]+n*r[3]+s*r[6],t[1]=i*r[1]+n*r[4]+s*r[7],t[2]=i*r[2]+n*r[5]+s*r[8],t}function Hb(t,e,r){let i=r[0],n=r[1],s=r[2],o=r[3],c=e[0],f=e[1],y=e[2],b=n*y-s*f,M=s*c-i*y,L=i*f-n*c,N=n*L-s*M,V=s*b-i*L,$=i*M-n*b,Q=o*2;return b*=Q,M*=Q,L*=Q,N*=2,V*=2,$*=2,t[0]=c+b+N,t[1]=f+M+V,t[2]=y+L+$,t}function qD(t,e,r,i){let n=[],s=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[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),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t}function GD(t,e,r,i){let n=[],s=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[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),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t}function ZD(t,e,r,i){let n=[],s=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[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],t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t}function YD(t,e){let r=t[0],i=t[1],n=t[2],s=e[0],o=e[1],c=e[2],f=Math.sqrt((r*r+i*i+n*n)*(s*s+o*o+c*c)),y=f&&jb(t,e)/f;return Math.acos(Math.min(Math.max(y,-1),1))}function Yce(t){return t[0]=0,t[1]=0,t[2]=0,t}function Xce(t){return`vec3(${t[0]}, ${t[1]}, ${t[2]})`}function Qce(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Kce(t,e){let r=t[0],i=t[1],n=t[2],s=e[0],o=e[1],c=e[2];return Math.abs(r-s)<=1e-6*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-c)<=1e-6*Math.max(1,Math.abs(n),Math.abs(c))}var Jce=gW,eue=_W,tue=yW,rue=xW,iue=vW,XD=mW,nue=bW,sue=function(){let t=wM();return function(e,r,i,n,s,o){let c,f;for(r||(r=3),i||(i=0),n?f=Math.min(n*r+i,e.length):f=e.length,c=i;c0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(oue)}fromObject(e){return this.check()}fromQuaternion(e){return CW(this,e),this.check()}set(e,r,i,n,s,o,c,f,y){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this[4]=s,this[5]=o,this[6]=c,this[7]=f,this[8]=y,this.check()}setRowMajor(e,r,i,n,s,o,c,f,y){return this[0]=e,this[1]=n,this[2]=c,this[3]=r,this[4]=s,this[5]=f,this[6]=i,this[7]=o,this[8]=y,this.check()}determinant(){return EW(this)}transpose(){return SW(this,this),this.check()}invert(){return TW(this,this),this.check()}multiplyLeft(e){return KD(this,e,this),this.check()}multiplyRight(e){return KD(this,this,e),this.check()}rotate(e){return PW(this,this,e),this.check()}scale(e){return Array.isArray(e)?JD(this,this,e):JD(this,this,[e,e]),this.check()}translate(e){return MW(this,this,e),this.check()}transform(e,r){let i;switch(e.length){case 2:i=WD(r||[-0,-0],e,this);break;case 3:i=Wb(r||[-0,-0,-0],e,this);break;case 4:i=bM(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return QA(i,e.length),i}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},PM,CM=null;function aue(){return PM||(PM=new vs([0,0,0,0,0,0,0,0,0]),Object.freeze(PM)),PM}function lue(){return CM||(CM=new vs,Object.freeze(CM)),CM}var ao={};Zc(ao,{add:()=>Lue,adjoint:()=>pue,clone:()=>uue,copy:()=>hue,create:()=>cue,decompose:()=>Sue,determinant:()=>iO,equals:()=>Fue,exactEquals:()=>Bue,frob:()=>kue,fromQuat:()=>uO,fromQuat2:()=>vue,fromRotation:()=>gue,fromRotationTranslation:()=>kW,fromRotationTranslationScale:()=>Tue,fromRotationTranslationScaleOrigin:()=>Eue,fromScaling:()=>mue,fromTranslation:()=>Aue,fromValues:()=>fue,fromXRotation:()=>_ue,fromYRotation:()=>yue,fromZRotation:()=>xue,frustum:()=>hO,getRotation:()=>wue,getScaling:()=>LW,getTranslation:()=>bue,identity:()=>RW,invert:()=>rO,lookAt:()=>pO,mul:()=>Nue,multiply:()=>$b,multiplyScalar:()=>Due,multiplyScalarAndAdd:()=>Oue,ortho:()=>dO,orthoNO:()=>OW,orthoZO:()=>Cue,perspective:()=>fO,perspectiveFromFieldOfView:()=>Pue,perspectiveNO:()=>DW,perspectiveZO:()=>Mue,rotate:()=>oO,rotateX:()=>aO,rotateY:()=>lO,rotateZ:()=>cO,scale:()=>sO,set:()=>due,str:()=>Rue,sub:()=>zue,subtract:()=>BW,targetTo:()=>Iue,translate:()=>nO,transpose:()=>tO});function cue(){let t=new Pn(16);return Pn!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function uue(t){let e=new Pn(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function hue(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function fue(t,e,r,i,n,s,o,c,f,y,b,M,L,N,V,$){let Q=new Pn(16);return Q[0]=t,Q[1]=e,Q[2]=r,Q[3]=i,Q[4]=n,Q[5]=s,Q[6]=o,Q[7]=c,Q[8]=f,Q[9]=y,Q[10]=b,Q[11]=M,Q[12]=L,Q[13]=N,Q[14]=V,Q[15]=$,Q}function due(t,e,r,i,n,s,o,c,f,y,b,M,L,N,V,$,Q){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=s,t[5]=o,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=M,t[11]=L,t[12]=N,t[13]=V,t[14]=$,t[15]=Q,t}function RW(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tO(t,e){if(t===e){let r=e[1],i=e[2],n=e[3],s=e[6],o=e[7],c=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=s,t[11]=e[14],t[12]=n,t[13]=o,t[14]=c}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function rO(t,e){let r=e[0],i=e[1],n=e[2],s=e[3],o=e[4],c=e[5],f=e[6],y=e[7],b=e[8],M=e[9],L=e[10],N=e[11],V=e[12],$=e[13],Q=e[14],q=e[15],J=r*c-i*o,ee=r*f-n*o,oe=r*y-s*o,ve=i*f-n*c,Re=i*y-s*c,Ze=n*y-s*f,He=b*$-M*V,ot=b*Q-L*V,et=b*q-N*V,Lt=M*Q-L*$,Gt=M*q-N*$,qt=L*q-N*Q,Ar=J*qt-ee*Gt+oe*Lt+ve*et-Re*ot+Ze*He;return Ar?(Ar=1/Ar,t[0]=(c*qt-f*Gt+y*Lt)*Ar,t[1]=(n*Gt-i*qt-s*Lt)*Ar,t[2]=($*Ze-Q*Re+q*ve)*Ar,t[3]=(L*Re-M*Ze-N*ve)*Ar,t[4]=(f*et-o*qt-y*ot)*Ar,t[5]=(r*qt-n*et+s*ot)*Ar,t[6]=(Q*oe-V*Ze-q*ee)*Ar,t[7]=(b*Ze-L*oe+N*ee)*Ar,t[8]=(o*Gt-c*et+y*He)*Ar,t[9]=(i*et-r*Gt-s*He)*Ar,t[10]=(V*Re-$*oe+q*J)*Ar,t[11]=(M*oe-b*Re-N*J)*Ar,t[12]=(c*ot-o*Lt-f*He)*Ar,t[13]=(r*Lt-i*ot+n*He)*Ar,t[14]=($*ee-V*ve-Q*J)*Ar,t[15]=(b*ve-M*ee+L*J)*Ar,t):null}function pue(t,e){let r=e[0],i=e[1],n=e[2],s=e[3],o=e[4],c=e[5],f=e[6],y=e[7],b=e[8],M=e[9],L=e[10],N=e[11],V=e[12],$=e[13],Q=e[14],q=e[15],J=r*c-i*o,ee=r*f-n*o,oe=r*y-s*o,ve=i*f-n*c,Re=i*y-s*c,Ze=n*y-s*f,He=b*$-M*V,ot=b*Q-L*V,et=b*q-N*V,Lt=M*Q-L*$,Gt=M*q-N*$,qt=L*q-N*Q;return t[0]=c*qt-f*Gt+y*Lt,t[1]=n*Gt-i*qt-s*Lt,t[2]=$*Ze-Q*Re+q*ve,t[3]=L*Re-M*Ze-N*ve,t[4]=f*et-o*qt-y*ot,t[5]=r*qt-n*et+s*ot,t[6]=Q*oe-V*Ze-q*ee,t[7]=b*Ze-L*oe+N*ee,t[8]=o*Gt-c*et+y*He,t[9]=i*et-r*Gt-s*He,t[10]=V*Re-$*oe+q*J,t[11]=M*oe-b*Re-N*J,t[12]=c*ot-o*Lt-f*He,t[13]=r*Lt-i*ot+n*He,t[14]=$*ee-V*ve-Q*J,t[15]=b*ve-M*ee+L*J,t}function iO(t){let e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],o=t[5],c=t[6],f=t[7],y=t[8],b=t[9],M=t[10],L=t[11],N=t[12],V=t[13],$=t[14],Q=t[15],q=e*o-r*s,J=e*c-i*s,ee=r*c-i*o,oe=y*V-b*N,ve=y*$-M*N,Re=b*$-M*V,Ze=e*Re-r*ve+i*oe,He=s*Re-o*ve+c*oe,ot=y*ee-b*J+M*q,et=N*ee-V*J+$*q;return f*Ze-n*He+Q*ot-L*et}function $b(t,e,r){let i=e[0],n=e[1],s=e[2],o=e[3],c=e[4],f=e[5],y=e[6],b=e[7],M=e[8],L=e[9],N=e[10],V=e[11],$=e[12],Q=e[13],q=e[14],J=e[15],ee=r[0],oe=r[1],ve=r[2],Re=r[3];return t[0]=ee*i+oe*c+ve*M+Re*$,t[1]=ee*n+oe*f+ve*L+Re*Q,t[2]=ee*s+oe*y+ve*N+Re*q,t[3]=ee*o+oe*b+ve*V+Re*J,ee=r[4],oe=r[5],ve=r[6],Re=r[7],t[4]=ee*i+oe*c+ve*M+Re*$,t[5]=ee*n+oe*f+ve*L+Re*Q,t[6]=ee*s+oe*y+ve*N+Re*q,t[7]=ee*o+oe*b+ve*V+Re*J,ee=r[8],oe=r[9],ve=r[10],Re=r[11],t[8]=ee*i+oe*c+ve*M+Re*$,t[9]=ee*n+oe*f+ve*L+Re*Q,t[10]=ee*s+oe*y+ve*N+Re*q,t[11]=ee*o+oe*b+ve*V+Re*J,ee=r[12],oe=r[13],ve=r[14],Re=r[15],t[12]=ee*i+oe*c+ve*M+Re*$,t[13]=ee*n+oe*f+ve*L+Re*Q,t[14]=ee*s+oe*y+ve*N+Re*q,t[15]=ee*o+oe*b+ve*V+Re*J,t}function nO(t,e,r){let i=r[0],n=r[1],s=r[2],o,c,f,y,b,M,L,N,V,$,Q,q;return e===t?(t[12]=e[0]*i+e[4]*n+e[8]*s+e[12],t[13]=e[1]*i+e[5]*n+e[9]*s+e[13],t[14]=e[2]*i+e[6]*n+e[10]*s+e[14],t[15]=e[3]*i+e[7]*n+e[11]*s+e[15]):(o=e[0],c=e[1],f=e[2],y=e[3],b=e[4],M=e[5],L=e[6],N=e[7],V=e[8],$=e[9],Q=e[10],q=e[11],t[0]=o,t[1]=c,t[2]=f,t[3]=y,t[4]=b,t[5]=M,t[6]=L,t[7]=N,t[8]=V,t[9]=$,t[10]=Q,t[11]=q,t[12]=o*i+b*n+V*s+e[12],t[13]=c*i+M*n+$*s+e[13],t[14]=f*i+L*n+Q*s+e[14],t[15]=y*i+N*n+q*s+e[15]),t}function sO(t,e,r){let i=r[0],n=r[1],s=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function oO(t,e,r,i){let n=i[0],s=i[1],o=i[2],c=Math.sqrt(n*n+s*s+o*o),f,y,b,M,L,N,V,$,Q,q,J,ee,oe,ve,Re,Ze,He,ot,et,Lt,Gt,qt,Ar,ri;return c<1e-6?null:(c=1/c,n*=c,s*=c,o*=c,y=Math.sin(r),f=Math.cos(r),b=1-f,M=e[0],L=e[1],N=e[2],V=e[3],$=e[4],Q=e[5],q=e[6],J=e[7],ee=e[8],oe=e[9],ve=e[10],Re=e[11],Ze=n*n*b+f,He=s*n*b+o*y,ot=o*n*b-s*y,et=n*s*b-o*y,Lt=s*s*b+f,Gt=o*s*b+n*y,qt=n*o*b+s*y,Ar=s*o*b-n*y,ri=o*o*b+f,t[0]=M*Ze+$*He+ee*ot,t[1]=L*Ze+Q*He+oe*ot,t[2]=N*Ze+q*He+ve*ot,t[3]=V*Ze+J*He+Re*ot,t[4]=M*et+$*Lt+ee*Gt,t[5]=L*et+Q*Lt+oe*Gt,t[6]=N*et+q*Lt+ve*Gt,t[7]=V*et+J*Lt+Re*Gt,t[8]=M*qt+$*Ar+ee*ri,t[9]=L*qt+Q*Ar+oe*ri,t[10]=N*qt+q*Ar+ve*ri,t[11]=V*qt+J*Ar+Re*ri,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function aO(t,e,r){let i=Math.sin(r),n=Math.cos(r),s=e[4],o=e[5],c=e[6],f=e[7],y=e[8],b=e[9],M=e[10],L=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*n+y*i,t[5]=o*n+b*i,t[6]=c*n+M*i,t[7]=f*n+L*i,t[8]=y*n-s*i,t[9]=b*n-o*i,t[10]=M*n-c*i,t[11]=L*n-f*i,t}function lO(t,e,r){let i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],c=e[2],f=e[3],y=e[8],b=e[9],M=e[10],L=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n-y*i,t[1]=o*n-b*i,t[2]=c*n-M*i,t[3]=f*n-L*i,t[8]=s*i+y*n,t[9]=o*i+b*n,t[10]=c*i+M*n,t[11]=f*i+L*n,t}function cO(t,e,r){let i=Math.sin(r),n=Math.cos(r),s=e[0],o=e[1],c=e[2],f=e[3],y=e[4],b=e[5],M=e[6],L=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n+y*i,t[1]=o*n+b*i,t[2]=c*n+M*i,t[3]=f*n+L*i,t[4]=y*n-s*i,t[5]=b*n-o*i,t[6]=M*n-c*i,t[7]=L*n-f*i,t}function Aue(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function mue(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function gue(t,e,r){let i=r[0],n=r[1],s=r[2],o=Math.sqrt(i*i+n*n+s*s),c,f,y;return o<1e-6?null:(o=1/o,i*=o,n*=o,s*=o,f=Math.sin(e),c=Math.cos(e),y=1-c,t[0]=i*i*y+c,t[1]=n*i*y+s*f,t[2]=s*i*y-n*f,t[3]=0,t[4]=i*n*y-s*f,t[5]=n*n*y+c,t[6]=s*n*y+i*f,t[7]=0,t[8]=i*s*y+n*f,t[9]=n*s*y-i*f,t[10]=s*s*y+c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function _ue(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function yue(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function xue(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function kW(t,e,r){let i=e[0],n=e[1],s=e[2],o=e[3],c=i+i,f=n+n,y=s+s,b=i*c,M=i*f,L=i*y,N=n*f,V=n*y,$=s*y,Q=o*c,q=o*f,J=o*y;return t[0]=1-(N+$),t[1]=M+J,t[2]=L-q,t[3]=0,t[4]=M-J,t[5]=1-(b+$),t[6]=V+Q,t[7]=0,t[8]=L+q,t[9]=V-Q,t[10]=1-(b+N),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function vue(t,e){let r=new Pn(3),i=-e[0],n=-e[1],s=-e[2],o=e[3],c=e[4],f=e[5],y=e[6],b=e[7],M=i*i+n*n+s*s+o*o;return M>0?(r[0]=(c*o+b*i+f*s-y*n)*2/M,r[1]=(f*o+b*n+y*i-c*s)*2/M,r[2]=(y*o+b*s+c*n-f*i)*2/M):(r[0]=(c*o+b*i+f*s-y*n)*2,r[1]=(f*o+b*n+y*i-c*s)*2,r[2]=(y*o+b*s+c*n-f*i)*2),kW(t,e,r),t}function bue(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function LW(t,e){let r=e[0],i=e[1],n=e[2],s=e[4],o=e[5],c=e[6],f=e[8],y=e[9],b=e[10];return t[0]=Math.sqrt(r*r+i*i+n*n),t[1]=Math.sqrt(s*s+o*o+c*c),t[2]=Math.sqrt(f*f+y*y+b*b),t}function wue(t,e){let r=new Pn(3);LW(r,e);let i=1/r[0],n=1/r[1],s=1/r[2],o=e[0]*i,c=e[1]*n,f=e[2]*s,y=e[4]*i,b=e[5]*n,M=e[6]*s,L=e[8]*i,N=e[9]*n,V=e[10]*s,$=o+b+V,Q=0;return $>0?(Q=Math.sqrt($+1)*2,t[3]=.25*Q,t[0]=(M-N)/Q,t[1]=(L-f)/Q,t[2]=(c-y)/Q):o>b&&o>V?(Q=Math.sqrt(1+o-b-V)*2,t[3]=(M-N)/Q,t[0]=.25*Q,t[1]=(c+y)/Q,t[2]=(L+f)/Q):b>V?(Q=Math.sqrt(1+b-o-V)*2,t[3]=(L-f)/Q,t[0]=(c+y)/Q,t[1]=.25*Q,t[2]=(M+N)/Q):(Q=Math.sqrt(1+V-o-b)*2,t[3]=(c-y)/Q,t[0]=(L+f)/Q,t[1]=(M+N)/Q,t[2]=.25*Q),t}function Sue(t,e,r,i){e[0]=i[12],e[1]=i[13],e[2]=i[14];let n=i[0],s=i[1],o=i[2],c=i[4],f=i[5],y=i[6],b=i[8],M=i[9],L=i[10];r[0]=Math.sqrt(n*n+s*s+o*o),r[1]=Math.sqrt(c*c+f*f+y*y),r[2]=Math.sqrt(b*b+M*M+L*L);let N=1/r[0],V=1/r[1],$=1/r[2],Q=n*N,q=s*V,J=o*$,ee=c*N,oe=f*V,ve=y*$,Re=b*N,Ze=M*V,He=L*$,ot=Q+oe+He,et=0;return ot>0?(et=Math.sqrt(ot+1)*2,t[3]=.25*et,t[0]=(ve-Ze)/et,t[1]=(Re-J)/et,t[2]=(q-ee)/et):Q>oe&&Q>He?(et=Math.sqrt(1+Q-oe-He)*2,t[3]=(ve-Ze)/et,t[0]=.25*et,t[1]=(q+ee)/et,t[2]=(Re+J)/et):oe>He?(et=Math.sqrt(1+oe-Q-He)*2,t[3]=(Re-J)/et,t[0]=(q+ee)/et,t[1]=.25*et,t[2]=(ve+Ze)/et):(et=Math.sqrt(1+He-Q-oe)*2,t[3]=(q-ee)/et,t[0]=(Re+J)/et,t[1]=(ve+Ze)/et,t[2]=.25*et),t}function Tue(t,e,r,i){let n=e[0],s=e[1],o=e[2],c=e[3],f=n+n,y=s+s,b=o+o,M=n*f,L=n*y,N=n*b,V=s*y,$=s*b,Q=o*b,q=c*f,J=c*y,ee=c*b,oe=i[0],ve=i[1],Re=i[2];return t[0]=(1-(V+Q))*oe,t[1]=(L+ee)*oe,t[2]=(N-J)*oe,t[3]=0,t[4]=(L-ee)*ve,t[5]=(1-(M+Q))*ve,t[6]=($+q)*ve,t[7]=0,t[8]=(N+J)*Re,t[9]=($-q)*Re,t[10]=(1-(M+V))*Re,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Eue(t,e,r,i,n){let s=e[0],o=e[1],c=e[2],f=e[3],y=s+s,b=o+o,M=c+c,L=s*y,N=s*b,V=s*M,$=o*b,Q=o*M,q=c*M,J=f*y,ee=f*b,oe=f*M,ve=i[0],Re=i[1],Ze=i[2],He=n[0],ot=n[1],et=n[2],Lt=(1-($+q))*ve,Gt=(N+oe)*ve,qt=(V-ee)*ve,Ar=(N-oe)*Re,ri=(1-(L+q))*Re,Bn=(Q+J)*Re,fo=(V+ee)*Ze,$s=(Q-J)*Ze,Nl=(1-(L+$))*Ze;return t[0]=Lt,t[1]=Gt,t[2]=qt,t[3]=0,t[4]=Ar,t[5]=ri,t[6]=Bn,t[7]=0,t[8]=fo,t[9]=$s,t[10]=Nl,t[11]=0,t[12]=r[0]+He-(Lt*He+Ar*ot+fo*et),t[13]=r[1]+ot-(Gt*He+ri*ot+$s*et),t[14]=r[2]+et-(qt*He+Bn*ot+Nl*et),t[15]=1,t}function uO(t,e){let r=e[0],i=e[1],n=e[2],s=e[3],o=r+r,c=i+i,f=n+n,y=r*o,b=i*o,M=i*c,L=n*o,N=n*c,V=n*f,$=s*o,Q=s*c,q=s*f;return t[0]=1-M-V,t[1]=b+q,t[2]=L-Q,t[3]=0,t[4]=b-q,t[5]=1-y-V,t[6]=N+$,t[7]=0,t[8]=L+Q,t[9]=N-$,t[10]=1-y-M,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function hO(t,e,r,i,n,s,o){let c=1/(r-e),f=1/(n-i),y=1/(s-o);return t[0]=s*2*c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s*2*f,t[6]=0,t[7]=0,t[8]=(r+e)*c,t[9]=(n+i)*f,t[10]=(o+s)*y,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*y,t[15]=0,t}function DW(t,e,r,i,n){let s=1/Math.tan(e/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0){let o=1/(i-n);t[10]=(n+i)*o,t[14]=2*n*i*o}else t[10]=-1,t[14]=-2*i;return t}var fO=DW;function Mue(t,e,r,i,n){let s=1/Math.tan(e/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0){let o=1/(i-n);t[10]=n*o,t[14]=n*i*o}else t[10]=-1,t[14]=-i;return t}function Pue(t,e,r,i){let n=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),c=Math.tan(e.rightDegrees*Math.PI/180),f=2/(o+c),y=2/(n+s);return t[0]=f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=y,t[6]=0,t[7]=0,t[8]=-((o-c)*f*.5),t[9]=(n-s)*y*.5,t[10]=i/(r-i),t[11]=-1,t[12]=0,t[13]=0,t[14]=i*r/(r-i),t[15]=0,t}function OW(t,e,r,i,n,s,o){let c=1/(e-r),f=1/(i-n),y=1/(s-o);return t[0]=-2*c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*y,t[11]=0,t[12]=(e+r)*c,t[13]=(n+i)*f,t[14]=(o+s)*y,t[15]=1,t}var dO=OW;function Cue(t,e,r,i,n,s,o){let c=1/(e-r),f=1/(i-n),y=1/(s-o);return t[0]=-2*c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=y,t[11]=0,t[12]=(e+r)*c,t[13]=(n+i)*f,t[14]=s*y,t[15]=1,t}function pO(t,e,r,i){let n,s,o,c,f,y,b,M,L,N,V=e[0],$=e[1],Q=e[2],q=i[0],J=i[1],ee=i[2],oe=r[0],ve=r[1],Re=r[2];return Math.abs(V-oe)<1e-6&&Math.abs($-ve)<1e-6&&Math.abs(Q-Re)<1e-6?RW(t):(M=V-oe,L=$-ve,N=Q-Re,n=1/Math.sqrt(M*M+L*L+N*N),M*=n,L*=n,N*=n,s=J*N-ee*L,o=ee*M-q*N,c=q*L-J*M,n=Math.sqrt(s*s+o*o+c*c),n?(n=1/n,s*=n,o*=n,c*=n):(s=0,o=0,c=0),f=L*c-N*o,y=N*s-M*c,b=M*o-L*s,n=Math.sqrt(f*f+y*y+b*b),n?(n=1/n,f*=n,y*=n,b*=n):(f=0,y=0,b=0),t[0]=s,t[1]=f,t[2]=M,t[3]=0,t[4]=o,t[5]=y,t[6]=L,t[7]=0,t[8]=c,t[9]=b,t[10]=N,t[11]=0,t[12]=-(s*V+o*$+c*Q),t[13]=-(f*V+y*$+b*Q),t[14]=-(M*V+L*$+N*Q),t[15]=1,t)}function Iue(t,e,r,i){let n=e[0],s=e[1],o=e[2],c=i[0],f=i[1],y=i[2],b=n-r[0],M=s-r[1],L=o-r[2],N=b*b+M*M+L*L;N>0&&(N=1/Math.sqrt(N),b*=N,M*=N,L*=N);let V=f*L-y*M,$=y*b-c*L,Q=c*M-f*b;return N=V*V+$*$+Q*Q,N>0&&(N=1/Math.sqrt(N),V*=N,$*=N,Q*=N),t[0]=V,t[1]=$,t[2]=Q,t[3]=0,t[4]=M*Q-L*$,t[5]=L*V-b*Q,t[6]=b*$-M*V,t[7]=0,t[8]=b,t[9]=M,t[10]=L,t[11]=0,t[12]=n,t[13]=s,t[14]=o,t[15]=1,t}function Rue(t){return`mat4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]}, ${t[6]}, ${t[7]}, ${t[8]}, ${t[9]}, ${t[10]}, ${t[11]}, ${t[12]}, ${t[13]}, ${t[14]}, ${t[15]})`}function kue(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Lue(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function BW(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Due(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function Oue(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t[4]=e[4]+r[4]*i,t[5]=e[5]+r[5]*i,t[6]=e[6]+r[6]*i,t[7]=e[7]+r[7]*i,t[8]=e[8]+r[8]*i,t[9]=e[9]+r[9]*i,t[10]=e[10]+r[10]*i,t[11]=e[11]+r[11]*i,t[12]=e[12]+r[12]*i,t[13]=e[13]+r[13]*i,t[14]=e[14]+r[14]*i,t[15]=e[15]+r[15]*i,t}function Bue(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function Fue(t,e){let r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],c=t[5],f=t[6],y=t[7],b=t[8],M=t[9],L=t[10],N=t[11],V=t[12],$=t[13],Q=t[14],q=t[15],J=e[0],ee=e[1],oe=e[2],ve=e[3],Re=e[4],Ze=e[5],He=e[6],ot=e[7],et=e[8],Lt=e[9],Gt=e[10],qt=e[11],Ar=e[12],ri=e[13],Bn=e[14],fo=e[15];return Math.abs(r-J)<=1e-6*Math.max(1,Math.abs(r),Math.abs(J))&&Math.abs(i-ee)<=1e-6*Math.max(1,Math.abs(i),Math.abs(ee))&&Math.abs(n-oe)<=1e-6*Math.max(1,Math.abs(n),Math.abs(oe))&&Math.abs(s-ve)<=1e-6*Math.max(1,Math.abs(s),Math.abs(ve))&&Math.abs(o-Re)<=1e-6*Math.max(1,Math.abs(o),Math.abs(Re))&&Math.abs(c-Ze)<=1e-6*Math.max(1,Math.abs(c),Math.abs(Ze))&&Math.abs(f-He)<=1e-6*Math.max(1,Math.abs(f),Math.abs(He))&&Math.abs(y-ot)<=1e-6*Math.max(1,Math.abs(y),Math.abs(ot))&&Math.abs(b-et)<=1e-6*Math.max(1,Math.abs(b),Math.abs(et))&&Math.abs(M-Lt)<=1e-6*Math.max(1,Math.abs(M),Math.abs(Lt))&&Math.abs(L-Gt)<=1e-6*Math.max(1,Math.abs(L),Math.abs(Gt))&&Math.abs(N-qt)<=1e-6*Math.max(1,Math.abs(N),Math.abs(qt))&&Math.abs(V-Ar)<=1e-6*Math.max(1,Math.abs(V),Math.abs(Ar))&&Math.abs($-ri)<=1e-6*Math.max(1,Math.abs($),Math.abs(ri))&&Math.abs(Q-Bn)<=1e-6*Math.max(1,Math.abs(Q),Math.abs(Bn))&&Math.abs(q-fo)<=1e-6*Math.max(1,Math.abs(q),Math.abs(fo))}var Nue=$b,zue=BW;var uc={};Zc(uc,{add:()=>AO,ceil:()=>Uue,clone:()=>NW,copy:()=>UW,create:()=>FW,cross:()=>Zue,dist:()=>rhe,distance:()=>$W,div:()=>the,divide:()=>HW,dot:()=>_O,equals:()=>Kue,exactEquals:()=>GW,floor:()=>Vue,forEach:()=>ohe,fromValues:()=>zW,inverse:()=>Gue,len:()=>nhe,length:()=>IM,lerp:()=>yO,max:()=>Wue,min:()=>jue,mul:()=>ehe,multiply:()=>WW,negate:()=>que,normalize:()=>gO,random:()=>Yue,round:()=>Hue,scale:()=>mO,scaleAndAdd:()=>$ue,set:()=>VW,sqrDist:()=>ihe,sqrLen:()=>she,squaredDistance:()=>qW,squaredLength:()=>RM,str:()=>Que,sub:()=>Jue,subtract:()=>jW,transformMat4:()=>xO,transformQuat:()=>vO,zero:()=>Xue});function FW(){let t=new Pn(4);return Pn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function NW(t){let e=new Pn(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function zW(t,e,r,i){let n=new Pn(4);return n[0]=t,n[1]=e,n[2]=r,n[3]=i,n}function UW(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function VW(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}function AO(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function jW(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function WW(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function HW(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function Uue(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function Vue(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function jue(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function Wue(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function Hue(t,e){return t[0]=Gu(e[0]),t[1]=Gu(e[1]),t[2]=Gu(e[2]),t[3]=Gu(e[3]),t}function mO(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function $ue(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t}function $W(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(r*r+i*i+n*n+s*s)}function qW(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return r*r+i*i+n*n+s*s}function IM(t){let e=t[0],r=t[1],i=t[2],n=t[3];return Math.sqrt(e*e+r*r+i*i+n*n)}function RM(t){let e=t[0],r=t[1],i=t[2],n=t[3];return e*e+r*r+i*i+n*n}function que(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function Gue(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function gO(t,e){let r=e[0],i=e[1],n=e[2],s=e[3],o=r*r+i*i+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=i*o,t[2]=n*o,t[3]=s*o,t}function _O(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Zue(t,e,r,i){let n=r[0]*i[1]-r[1]*i[0],s=r[0]*i[2]-r[2]*i[0],o=r[0]*i[3]-r[3]*i[0],c=r[1]*i[2]-r[2]*i[1],f=r[1]*i[3]-r[3]*i[1],y=r[2]*i[3]-r[3]*i[2],b=e[0],M=e[1],L=e[2],N=e[3];return t[0]=M*y-L*f+N*c,t[1]=-(b*y)+L*o-N*s,t[2]=b*f-M*o+N*n,t[3]=-(b*c)+M*s-L*n,t}function yO(t,e,r,i){let n=e[0],s=e[1],o=e[2],c=e[3];return t[0]=n+i*(r[0]-n),t[1]=s+i*(r[1]-s),t[2]=o+i*(r[2]-o),t[3]=c+i*(r[3]-c),t}function Yue(t,e){e=e===void 0?1:e;let r,i,n,s,o,c;do r=Xf()*2-1,i=Xf()*2-1,o=r*r+i*i;while(o>=1);do n=Xf()*2-1,s=Xf()*2-1,c=n*n+s*s;while(c>=1);let f=Math.sqrt((1-o)/c);return t[0]=e*r,t[1]=e*i,t[2]=e*n*f,t[3]=e*s*f,t}function xO(t,e,r){let i=e[0],n=e[1],s=e[2],o=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*s+r[12]*o,t[1]=r[1]*i+r[5]*n+r[9]*s+r[13]*o,t[2]=r[2]*i+r[6]*n+r[10]*s+r[14]*o,t[3]=r[3]*i+r[7]*n+r[11]*s+r[15]*o,t}function vO(t,e,r){let i=e[0],n=e[1],s=e[2],o=r[0],c=r[1],f=r[2],y=r[3],b=y*i+c*s-f*n,M=y*n+f*i-o*s,L=y*s+o*n-c*i,N=-o*i-c*n-f*s;return t[0]=b*y+N*-o+M*-f-L*-c,t[1]=M*y+N*-c+L*-o-b*-f,t[2]=L*y+N*-f+b*-c-M*-o,t[3]=e[3],t}function Xue(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Que(t){return`vec4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`}function GW(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Kue(t,e){let r=t[0],i=t[1],n=t[2],s=t[3],o=e[0],c=e[1],f=e[2],y=e[3];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-c)<=1e-6*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-f)<=1e-6*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))}var Jue=jW,ehe=WW,the=HW,rhe=$W,ihe=qW,nhe=IM,she=RM,ohe=function(){let t=FW();return function(e,r,i,n,s,o){let c,f;for(r||(r=4),i||(i=0),n?f=Math.min(n*r+i,e.length):f=e.length,c=i;cMath.PI*2)throw Error("expected radians")}function fhe(t,e,r,i,n,s){let o=2*s/(r-e),c=2*s/(n-i),f=(r+e)/(r-e),y=(n+i)/(n-i),b=-1,M=-1,L=-2*s;return t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=f,t[9]=y,t[10]=b,t[11]=M,t[12]=0,t[13]=0,t[14]=L,t[15]=0,t}function YW(){let t=new Pn(4);return Pn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function XW(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function TO(t,e,r){r=r*.5;let i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function EO(t,e,r){let i=e[0],n=e[1],s=e[2],o=e[3],c=r[0],f=r[1],y=r[2],b=r[3];return t[0]=i*b+o*c+n*y-s*f,t[1]=n*b+o*f+s*c-i*y,t[2]=s*b+o*y+i*f-n*c,t[3]=o*b-i*c-n*f-s*y,t}function QW(t,e,r){r*=.5;let i=e[0],n=e[1],s=e[2],o=e[3],c=Math.sin(r),f=Math.cos(r);return t[0]=i*f+o*c,t[1]=n*f+s*c,t[2]=s*f-n*c,t[3]=o*f-i*c,t}function KW(t,e,r){r*=.5;let i=e[0],n=e[1],s=e[2],o=e[3],c=Math.sin(r),f=Math.cos(r);return t[0]=i*f-s*c,t[1]=n*f+o*c,t[2]=s*f+i*c,t[3]=o*f-n*c,t}function JW(t,e,r){r*=.5;let i=e[0],n=e[1],s=e[2],o=e[3],c=Math.sin(r),f=Math.cos(r);return t[0]=i*f+n*c,t[1]=n*f-i*c,t[2]=s*f+o*c,t[3]=o*f-s*c,t}function eH(t,e){let r=e[0],i=e[1],n=e[2];return t[0]=r,t[1]=i,t[2]=n,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),t}function qb(t,e,r,i){let n=e[0],s=e[1],o=e[2],c=e[3],f=r[0],y=r[1],b=r[2],M=r[3],L,N,V,$,Q;return L=n*f+s*y+o*b+c*M,L<0&&(L=-L,f=-f,y=-y,b=-b,M=-M),1-L>1e-6?(N=Math.acos(L),Q=Math.sin(N),V=Math.sin((1-i)*N)/Q,$=Math.sin(i*N)/Q):(V=1-i,$=i),t[0]=V*n+$*f,t[1]=V*s+$*y,t[2]=V*o+$*b,t[3]=V*c+$*M,t}function tH(t,e){let r=e[0],i=e[1],n=e[2],s=e[3],o=r*r+i*i+n*n+s*s,c=o?1/o:0;return t[0]=-r*c,t[1]=-i*c,t[2]=-n*c,t[3]=s*c,t}function rH(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function MO(t,e){let r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);let s=(n+1)%3,o=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[s*3+s]-e[o*3+o]+1),t[n]=.5*i,i=.5/i,t[3]=(e[s*3+o]-e[o*3+s])*i,t[s]=(e[s*3+n]+e[n*3+s])*i,t[o]=(e[o*3+n]+e[n*3+o])*i}return t}var iH=AO;var nH=mO,sH=_O,oH=yO,aH=IM;var lH=RM;var cH=gO;var uH=function(){let t=wM(),e=SM(1,0,0),r=SM(0,1,0);return function(i,n,s){let o=jb(n,s);return o<-.999999?(rg(t,e,n),XD(t)<1e-6&&rg(t,r,n),$D(t,t),TO(i,t,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(rg(t,n,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+o,cH(i,i))}}(),iOe=function(){let t=YW(),e=YW();return function(r,i,n,s,o,c){return qb(t,i,o,c),qb(e,n,s,c),qb(r,t,e,2*c*(1-c)),r}}(),nOe=function(){let t=wW();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],cH(e,MO(e,t))}}();var phe=[0,0,0,1],Fy=class extends XA{constructor(e=0,r=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,i,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,i,n){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return MO(this,e),this.check()}fromAxisRotation(e,r){return TO(this,e,r),this.check()}identity(){return XW(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=nn(e)}get y(){return this[1]}set y(e){this[1]=nn(e)}get z(){return this[2]}set z(e){this[2]=nn(e)}get w(){return this[3]}set w(e){this[3]=nn(e)}len(){return aH(this)}lengthSquared(){return lH(this)}dot(e){return sH(this,e)}rotationTo(e,r){return uH(this,e,r),this.check()}add(e){return iH(this,this,e),this.check()}calculateW(){return eH(this,this),this.check()}conjugate(){return rH(this,this),this.check()}invert(){return tH(this,this),this.check()}lerp(e,r,i){return i===void 0?this.lerp(this,e,r):(oH(this,e,r,i),this.check())}multiplyRight(e){return EO(this,this,e),this.check()}multiplyLeft(e){return EO(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return QW(this,this,e),this.check()}rotateY(e){return KW(this,this,e),this.check()}rotateZ(e){return JW(this,this,e),this.check()}scale(e){return nH(this,this,e),this.check()}slerp(e,r,i){let n,s,o;switch(arguments.length){case 1:({start:n=phe,target:s,ratio:o}=e);break;case 2:n=this,s=e,o=r;break;default:n=e,s=r,o=i}return qb(this,n,s,o),this.check()}transformVector4(e,r=new MM){return vO(r,e,this),QA(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var Gb={};Zc(Gb,{EPSILON1:()=>Ahe,EPSILON10:()=>She,EPSILON11:()=>The,EPSILON12:()=>Ehe,EPSILON13:()=>Mhe,EPSILON14:()=>Phe,EPSILON15:()=>Che,EPSILON16:()=>Ihe,EPSILON17:()=>Rhe,EPSILON18:()=>khe,EPSILON19:()=>Lhe,EPSILON2:()=>mhe,EPSILON20:()=>Dhe,EPSILON3:()=>ghe,EPSILON4:()=>_he,EPSILON5:()=>yhe,EPSILON6:()=>xhe,EPSILON7:()=>vhe,EPSILON8:()=>bhe,EPSILON9:()=>whe,PI_OVER_FOUR:()=>Bhe,PI_OVER_SIX:()=>Fhe,PI_OVER_TWO:()=>Ohe,TWO_PI:()=>Nhe});var Ahe=.1,mhe=.01,ghe=.001,_he=1e-4,yhe=1e-5,xhe=1e-6,vhe=1e-7,bhe=1e-8,whe=1e-9,She=1e-10,The=1e-11,Ehe=1e-12,Mhe=1e-13,Phe=1e-14,Che=1e-15,Ihe=1e-16,Rhe=1e-17,khe=1e-18,Lhe=1e-19,Dhe=1e-20,Ohe=Math.PI/2,Bhe=Math.PI/4,Fhe=Math.PI/6,Nhe=Math.PI*2;var PO=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) +struct AmbientLight { +vec3 color; +}; +struct PointLight { +vec3 color; +vec3 position; +vec3 attenuation; +}; +struct DirectionalLight { +vec3 color; +vec3 direction; +}; +uniform AmbientLight lighting_uAmbientLight; +uniform PointLight lighting_uPointLight[MAX_LIGHTS]; +uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS]; +uniform int lighting_uPointLightCount; +uniform int lighting_uDirectionalLightCount; +uniform bool lighting_uEnabled; +float getPointLightAttenuation(PointLight pointLight, float distance) { +return pointLight.attenuation.x ++ pointLight.attenuation.y * distance ++ pointLight.attenuation.z * distance * distance; +} +#endif +`;var zhe={lightSources:{}};function CO(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(i=>i*r/255)}function Uhe({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let i={};return t?i["lighting_uAmbientLight.color"]=CO(t):i["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((n,s)=>{i[`lighting_uPointLight[${s}].color`]=CO(n),i[`lighting_uPointLight[${s}].position`]=n.position,i[`lighting_uPointLight[${s}].attenuation`]=n.attenuation||[1,0,0]}),i.lighting_uPointLightCount=e.length,r.forEach((n,s)=>{i[`lighting_uDirectionalLight[${s}].color`]=CO(n),i[`lighting_uDirectionalLight[${s}].direction`]=n.direction}),i.lighting_uDirectionalLightCount=r.length,i}function hH(t=zhe){if("lightSources"in t){let{ambientLight:e,pointLights:r,directionalLights:i}=t.lightSources||{};return e||r&&r.length>0||i&&i.length>0?Object.assign({},Uhe({ambientLight:e,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let r of t.lights||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return hH({lightSources:e})}return{}}var IO={name:"lights",vs:PO,fs:PO,getUniforms:hH,defines:{MAX_LIGHTS:3}};var RO=`uniform float lighting_uAmbient; +uniform float lighting_uDiffuse; +uniform float lighting_uShininess; +uniform vec3 lighting_uSpecularColor; +vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) { +vec3 halfway_direction = normalize(light_direction + view_direction); +float lambertian = dot(light_direction, normal_worldspace); +float specular = 0.0; +if (lambertian > 0.0) { +float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); +specular = pow(specular_angle, lighting_uShininess); +} +lambertian = max(lambertian, 0.0); +return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color; +} +vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { +vec3 lightColor = surfaceColor; +if (lighting_uEnabled) { +vec3 view_direction = normalize(cameraPosition - position_worldspace); +lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color; +for (int i = 0; i < MAX_LIGHTS; i++) { +if (i >= lighting_uPointLightCount) { +break; +} +PointLight pointLight = lighting_uPointLight[i]; +vec3 light_position_worldspace = pointLight.position; +vec3 light_direction = normalize(light_position_worldspace - position_worldspace); +lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); +} +for (int i = 0; i < MAX_LIGHTS; i++) { +if (i >= lighting_uDirectionalLightCount) { +break; +} +DirectionalLight directionalLight = lighting_uDirectionalLight[i]; +lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); +} +} +return lightColor; +} +vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { +vec3 lightColor = vec3(0, 0, 0); +vec3 surfaceColor = vec3(0, 0, 0); +if (lighting_uEnabled) { +vec3 view_direction = normalize(cameraPosition - position_worldspace); +for (int i = 0; i < MAX_LIGHTS; i++) { +if (i >= lighting_uPointLightCount) { +break; +} +PointLight pointLight = lighting_uPointLight[i]; +vec3 light_position_worldspace = pointLight.position; +vec3 light_direction = normalize(light_position_worldspace - position_worldspace); +lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); +} +for (int i = 0; i < MAX_LIGHTS; i++) { +if (i >= lighting_uDirectionalLightCount) { +break; +} +DirectionalLight directionalLight = lighting_uDirectionalLight[i]; +lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); +} +} +return lightColor; +} +`;var Vhe={};function jhe(t){let{ambient:e=.35,diffuse:r=.6,shininess:i=32,specularColor:n=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:n.map(s=>s/255)}}function fH(t=Vhe){if(!("material"in t))return{};let{material:e}=t;return e?jhe(e):{lighting_uEnabled:!1}}var cp={name:"gouraud-lighting",dependencies:[IO],vs:RO,defines:{LIGHTING_VERTEX:1},getUniforms:fH},Zb={name:"phong-lighting",dependencies:[IO],fs:RO,defines:{LIGHTING_FRAGMENT:1},getUniforms:fH};var dH="#define SMOOTH_EDGE_RADIUS 0.5",Whe=` +${dH} + +struct VertexGeometry { + vec4 position; + vec3 worldPosition; + vec3 worldPositionAlt; + vec3 normal; + vec2 uv; + vec3 pickingColor; +} geometry = VertexGeometry( + vec4(0.0, 0.0, 1.0, 0.0), + vec3(0.0), + vec3(0.0), + vec3(0.0), + vec2(0.0), + vec3(0.0) +); +`,Hhe=` +${dH} + +struct FragmentGeometry { + vec2 uv; +} geometry; + +float smoothedge(float edge, float x) { + return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); +} +`,pH={name:"geometry",vs:Whe,fs:Hhe};var Kr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Kr,"IDENTITY",{get:()=>(dr.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var Ja={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},xo={common:0,meters:1,pixels:2},Yb={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}};var $he=Object.keys(Kr).map(t=>`const int COORDINATE_SYSTEM_${t} = ${Kr[t]};`).join(""),qhe=Object.keys(Ja).map(t=>`const int PROJECTION_MODE_${t} = ${Ja[t]};`).join(""),Ghe=Object.keys(xo).map(t=>`const int UNIT_${t.toUpperCase()} = ${xo[t]};`).join(""),AH=`${$he} +${qhe} +${Ghe} +uniform int project_uCoordinateSystem; +uniform int project_uProjectionMode; +uniform float project_uScale; +uniform bool project_uWrapLongitude; +uniform vec3 project_uCommonUnitsPerMeter; +uniform vec3 project_uCommonUnitsPerWorldUnit; +uniform vec3 project_uCommonUnitsPerWorldUnit2; +uniform vec4 project_uCenter; +uniform mat4 project_uModelMatrix; +uniform mat4 project_uViewProjectionMatrix; +uniform vec2 project_uViewportSize; +uniform float project_uDevicePixelRatio; +uniform float project_uFocalDistance; +uniform vec3 project_uCameraPosition; +uniform vec3 project_uCoordinateOrigin; +uniform vec3 project_uCommonOrigin; +uniform bool project_uPseudoMeters; +const float TILE_SIZE = 512.0; +const float PI = 3.1415926536; +const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); +const vec3 ZERO_64_LOW = vec3(0.0); +const float EARTH_RADIUS = 6370972.0; +const float GLOBE_RADIUS = 256.0; +float project_size_at_latitude(float lat) { +float y = clamp(lat, -89.9, 89.9); +return 1.0 / cos(radians(y)); +} +float project_size() { +if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR && +project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT && +project_uPseudoMeters == false) { +if (geometry.position.w == 0.0) { +return project_size_at_latitude(geometry.worldPosition.y); +} +float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0; +float y2 = y * y; +float y4 = y2 * y2; +float y6 = y4 * y2; +return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; +} +return 1.0; +} +float project_size_at_latitude(float meters, float lat) { +return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat); +} +float project_size(float meters) { +return meters * project_uCommonUnitsPerMeter.z * project_size(); +} +vec2 project_size(vec2 meters) { +return meters * project_uCommonUnitsPerMeter.xy * project_size(); +} +vec3 project_size(vec3 meters) { +return meters * project_uCommonUnitsPerMeter * project_size(); +} +vec4 project_size(vec4 meters) { +return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w); +} +mat3 project_get_orientation_matrix(vec3 up) { +vec3 uz = normalize(up); +vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); +vec3 uy = cross(uz, ux); +return mat3(ux, uy, uz); +} +bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { +if (project_uProjectionMode == PROJECTION_MODE_GLOBE) { +transform = project_get_orientation_matrix(commonPosition); +return true; +} +return false; +} +vec3 project_normal(vec3 vector) { +vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0); +vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter); +mat3 rotation; +if (project_needs_rotation(geometry.position.xyz, rotation)) { +n = rotation * n; +} +return n; +} +vec4 project_offset_(vec4 offset) { +float dy = offset.y; +vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy; +return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); +} +vec2 project_mercator_(vec2 lnglat) { +float x = lnglat.x; +if (project_uWrapLongitude) { +x = mod(x + 180., 360.0) - 180.; +} +float y = clamp(lnglat.y, -89.9, 89.9); +return vec2( +radians(x) + PI, +PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) +) * WORLD_SCALE; +} +vec3 project_globe_(vec3 lnglatz) { +float lambda = radians(lnglatz.x); +float phi = radians(lnglatz.y); +float cosPhi = cos(phi); +float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; +return vec3( +sin(lambda) * cosPhi, +-cos(lambda) * cosPhi, +sin(phi) +) * D; +} +vec4 project_position(vec4 position, vec3 position64Low) { +vec4 position_world = project_uModelMatrix * position; +if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) { +if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +return vec4( +project_mercator_(position_world.xy), +project_size_at_latitude(position_world.z, position_world.y), +position_world.w +); +} +if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { +position_world.xyz += project_uCoordinateOrigin; +} +} +if (project_uProjectionMode == PROJECTION_MODE_GLOBE) { +if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +return vec4( +project_globe_(position_world.xyz), +position_world.w +); +} +} +if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { +if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) { +return vec4( +project_mercator_(position_world.xy) - project_uCommonOrigin.xy, +project_size(position_world.z), +position_world.w +); +} +} +} +if (project_uProjectionMode == PROJECTION_MODE_IDENTITY || +(project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && +(project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT || +project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { +position_world.xyz -= project_uCoordinateOrigin; +} +return project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0)); +} +vec4 project_position(vec4 position) { +return project_position(position, ZERO_64_LOW); +} +vec3 project_position(vec3 position, vec3 position64Low) { +vec4 projected_position = project_position(vec4(position, 1.0), position64Low); +return projected_position.xyz; +} +vec3 project_position(vec3 position) { +vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); +return projected_position.xyz; +} +vec2 project_position(vec2 position) { +vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); +return projected_position.xy; +} +vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { +return viewProjectionMatrix * position + center; +} +vec4 project_common_position_to_clipspace(vec4 position) { +return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter); +} +vec2 project_pixel_size_to_clipspace(vec2 pixels) { +vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0; +return offset * project_uFocalDistance; +} +float project_size_to_pixel(float meters) { +return project_size(meters) * project_uScale; +} +float project_size_to_pixel(float size, int unit) { +if (unit == UNIT_METERS) return project_size_to_pixel(size); +if (unit == UNIT_COMMON) return size * project_uScale; +return size; +} +float project_pixel_size(float pixels) { +return pixels / project_uScale; +} +vec2 project_pixel_size(vec2 pixels) { +return pixels / project_uScale; +} +`;function Zhe(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i{for(let n in i)if(!Zhe(i[n],e[n])){r=t(i),e=i;break}return r}}var mH=[0,0,0,0],Yhe=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],gH=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Xhe=[0,0,0],_H=[0,0,0],Qhe=Qf(Jhe);function kO(t,e,r=_H){r.length<3&&(r=[r[0],r[1],0]);let i=r,n,s=!0;switch(e===Kr.LNGLAT_OFFSETS||e===Kr.METER_OFFSETS?n=r:n=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Ja.WEB_MERCATOR:(e===Kr.LNGLAT||e===Kr.CARTESIAN)&&(n=[0,0,0],s=!1);break;case Ja.WEB_MERCATOR_AUTO_OFFSET:e===Kr.LNGLAT?i=n:e===Kr.CARTESIAN&&(i=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],n=t.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Ja.IDENTITY:i=t.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 Khe(t,e,r){let{viewMatrixUncentered:i,projectionMatrix:n}=t,{viewMatrix:s,viewProjectionMatrix:o}=t,c=mH,f=mH,y=t.cameraPosition,{geospatialOrigin:b,shaderCoordinateOrigin:M,offsetMode:L}=kO(t,e,r);return L&&(f=t.projectPosition(b||M),y=[y[0]-f[0],y[1]-f[1],y[2]-f[2]],f[3]=1,c=uc.transformMat4([],f,o),s=i||s,o=ao.multiply([],n,s),o=ao.multiply([],o,Yhe)),{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:c,originCommon:f,cameraPosCommon:y,shaderCoordinateOrigin:M,geospatialOrigin:b}}function yH({viewport:t,devicePixelRatio:e=1,modelMatrix:r=null,coordinateSystem:i=Kr.DEFAULT,coordinateOrigin:n=_H,autoWrapLongitude:s=!1}){i===Kr.DEFAULT&&(i=t.isGeospatial?Kr.LNGLAT:Kr.CARTESIAN);let o=Qhe({viewport:t,devicePixelRatio:e,coordinateSystem:i,coordinateOrigin:n});return o.project_uWrapLongitude=s,o.project_uModelMatrix=r||gH,o}function Jhe({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:n,viewProjectionMatrix:s,originCommon:o,cameraPosCommon:c,shaderCoordinateOrigin:f,geospatialOrigin:y}=Khe(t,r,i),b=t.getDistanceScales(),M=[t.width*e,t.height*e],L=uc.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,N={project_uCoordinateSystem:r,project_uProjectionMode:t.projectionMode,project_uCoordinateOrigin:f,project_uCommonOrigin:o.slice(0,3),project_uCenter:n,project_uPseudoMeters:!!t._pseudoMeters,project_uViewportSize:M,project_uDevicePixelRatio:e,project_uFocalDistance:L,project_uCommonUnitsPerMeter:b.unitsPerMeter,project_uCommonUnitsPerWorldUnit:b.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:Xhe,project_uScale:t.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:s,project_uModelMatrix:gH,project_uCameraPosition:c};if(y){let V=t.getDistanceScales(y);switch(r){case Kr.METER_OFFSETS:N.project_uCommonUnitsPerWorldUnit=V.unitsPerMeter,N.project_uCommonUnitsPerWorldUnit2=V.unitsPerMeter2;break;case Kr.LNGLAT:case Kr.LNGLAT_OFFSETS:t._pseudoMeters||(N.project_uCommonUnitsPerMeter=V.unitsPerMeter),N.project_uCommonUnitsPerWorldUnit=V.unitsPerDegree,N.project_uCommonUnitsPerWorldUnit2=V.unitsPerDegree2;break;case Kr.CARTESIAN:N.project_uCommonUnitsPerWorldUnit=[1,1,V.unitsPerMeter[2]],N.project_uCommonUnitsPerWorldUnit2=[0,0,V.unitsPerMeter2[2]];break;default:break}}return N}var efe={};function tfe(t=efe){return"viewport"in t?yH(t):{}}var Wh={name:"project",dependencies:[zD,pH],vs:AH,getUniforms:tfe};var rfe=` +vec4 project_position_to_clipspace( + vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition +) { + vec3 projectedPosition = project_position(position, position64Low); + mat3 rotation; + if (project_needs_rotation(projectedPosition, rotation)) { + // offset is specified as ENU + // when in globe projection, rotate offset so that the ground alighs with the surface of the globe + offset = rotation * offset; + } + commonPosition = vec4(projectedPosition + offset, 1.0); + return project_common_position_to_clipspace(commonPosition); +} + +vec4 project_position_to_clipspace( + vec3 position, vec3 position64Low, vec3 offset +) { + vec4 commonPosition; + return project_position_to_clipspace(position, position64Low, offset, commonPosition); +} +`,Bs={name:"project32",dependencies:[Wh],vs:rfe};function LO(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function KA(t,e){let r=uc.transformMat4([],e,t);return uc.scale(r,r,1/r[3]),r}function DO(t,e){let r=t%e;return r<0?e+r:r}function xH(t,e,r){return r*e+(1-r)*t}function Xb(t,e,r){return tr?r:t}function ife(t){return Math.log(t)*Math.LOG2E}var Ny=Math.log2||ife;function Hh(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var $h=Math.PI,vH=$h/4,Zu=$h/180,OO=180/$h,zy=512,DM=4003e4,Uy=85.051129,bH=1.5;function Qb(t){return Math.pow(2,t)}function OM(t){return Ny(t)}function Sa(t){let[e,r]=t;Hh(Number.isFinite(e)),Hh(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let i=e*Zu,n=r*Zu,s=zy*(i+$h)/(2*$h),o=zy*($h+Math.log(Math.tan(vH+n*.5)))/(2*$h);return[s,o]}function hc(t){let[e,r]=t,i=e/zy*(2*$h)-$h,n=2*(Math.atan(Math.exp(r/zy*(2*$h)-$h))-vH);return[i*OO,n*OO]}function BO(t){let{latitude:e}=t;Hh(Number.isFinite(e));let r=Math.cos(e*Zu);return OM(DM*r)-9}function Kb(t){let e=Math.cos(t*Zu);return zy/DM/e}function Vy(t){let{latitude:e,longitude:r,highPrecision:i=!1}=t;Hh(Number.isFinite(e)&&Number.isFinite(r));let n=zy,s=Math.cos(e*Zu),o=n/360,c=o/s,f=n/DM/s,y={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,c,f],degreesPerUnit:[1/o,1/c,1/f]};if(i){let b=Zu*Math.tan(e*Zu)/s,M=o*b/2,L=n/DM*b,N=L/c*f;y.unitsPerDegree2=[0,M,L],y.unitsPerMeter2=[N,0,N]}return y}function Jb(t,e){let[r,i,n]=t,[s,o,c]=e,{unitsPerMeter:f,unitsPerMeter2:y}=Vy({longitude:r,latitude:i,highPrecision:!0}),b=Sa(t);b[0]+=s*(f[0]+y[0]*o),b[1]+=o*(f[1]+y[1]*o);let M=hc(b),L=(n||0)+(c||0);return Number.isFinite(n)||Number.isFinite(c)?[M[0],M[1],L]:M}function BM(t){let{height:e,pitch:r,bearing:i,altitude:n,scale:s,center:o}=t,c=LO();ao.translate(c,c,[0,0,-n]),ao.rotateX(c,c,-r*Zu),ao.rotateZ(c,c,i*Zu);let f=s/e;return ao.scale(c,c,[f,f,f]),o&&ao.translate(c,c,cc.negate([],o)),c}function FO(t){let{width:e,height:r,altitude:i,pitch:n=0,offset:s,center:o,scale:c,nearZMultiplier:f=1,farZMultiplier:y=1}=t,{fovy:b=ng(bH)}=t;i!==void 0&&(b=ng(i));let M=b*Zu,L=n*Zu,N=ew(b),V=N;o&&(V+=o[2]*c/Math.cos(L)/r);let $=M*(.5+(s?s[1]:0)/r),Q=Math.sin($)*V/Math.sin(Xb(Math.PI/2-L-$,.01,Math.PI-.01)),q=Math.sin(L)*Q+V,J=V*10,ee=Math.min(q*y,J);return{fov:M,aspect:e/r,focalDistance:N,near:f,far:ee}}function ng(t){return 2*Math.atan(.5/t)*OO}function ew(t){return .5/Math.tan(.5*t*Zu)}function jy(t,e){let[r,i,n=0]=t;return Hh(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(n)),KA(e,[r,i,n,1])}function JA(t,e,r=0){let[i,n,s]=t;if(Hh(Number.isFinite(i)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(s))return KA(e,[i,n,s,1]);let o=KA(e,[i,n,0,1]),c=KA(e,[i,n,1,1]),f=o[2],y=c[2],b=f===y?0:((r||0)-f)/(y-f);return Pl.lerp([],o,c,b)}function FM(t){let{width:e,height:r,bounds:i,minExtent:n=0,maxZoom:s=24,offset:o=[0,0]}=t,[[c,f],[y,b]]=i,M=nfe(t.padding),L=Sa([c,Xb(b,-Uy,Uy)]),N=Sa([y,Xb(f,-Uy,Uy)]),V=[Math.max(Math.abs(N[0]-L[0]),n),Math.max(Math.abs(N[1]-L[1]),n)],$=[e-M.left-M.right-Math.abs(o[0])*2,r-M.top-M.bottom-Math.abs(o[1])*2];Hh($[0]>0&&$[1]>0);let Q=$[0]/V[0],q=$[1]/V[1],J=(M.right-M.left)/2/Q,ee=(M.top-M.bottom)/2/q,oe=[(N[0]+L[0])/2+J,(N[1]+L[1])/2+ee],ve=hc(oe),Re=Math.min(s,Ny(Math.abs(Math.min(Q,q))));return Hh(Number.isFinite(Re)),{longitude:ve[0],latitude:ve[1],zoom:Re}}function nfe(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:(Hh(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}var wH=Math.PI/180;function NM(t,e=0){let{width:r,height:i,unproject:n}=t,s={targetZ:e},o=n([0,i],s),c=n([r,i],s),f,y,b=t.fovy?.5*t.fovy*wH:Math.atan(.5/t.altitude),M=(90-t.pitch)*wH;return b>M-.01?(f=SH(t,0,e),y=SH(t,r,e)):(f=n([0,0],s),y=n([r,0],s)),[o,c,y,f]}function SH(t,e,r){let{pixelUnprojectionMatrix:i}=t,n=KA(i,[e,0,1,1]),s=KA(i,[e,t.height,1,1]),c=(r*t.distanceScales.unitsPerMeter[2]-n[2])/(s[2]-n[2]),f=Pl.lerp([],n,s,c),y=hc(f);return y.push(r),y}var TH=512;function NO(t){let{width:e,height:r,pitch:i=0}=t,{longitude:n,latitude:s,zoom:o,bearing:c=0}=t;(n<-180||n>180)&&(n=DO(n+180,360)-180),(c<-180||c>180)&&(c=DO(c+180,360)-180);let f=Ny(r/TH);if(o<=f)o=f,s=0;else{let y=r/2/Math.pow(2,o),b=hc([0,y])[1];if(sM&&(s=M)}}return{width:e,height:r,longitude:n,latitude:s,zoom:o,pitch:i,bearing:c}}var EH=.01,ofe=["longitude","latitude","zoom"],MH={curve:1.414,speed:1.2};function zO(t,e,r,i){let{startZoom:n,startCenterXY:s,uDelta:o,w0:c,u1:f,S:y,rho:b,rho2:M,r0:L}=PH(t,e,i);if(fo?0:b}function PH(t,e,r){r=Object.assign({},MH,r);let i=r.curve,n=t.zoom,s=[t.longitude,t.latitude],o=Qb(n),c=e.zoom,f=[e.longitude,e.latitude],y=Qb(c-n),b=Sa(s),M=Sa(f),L=Pl.sub([],M,b),N=Math.max(t.width,t.height),V=N/y,$=Pl.length(L)*o,Q=Math.max($,EH),q=i*i,J=(V*V-N*N+q*q*Q*Q)/(2*N*q*Q),ee=(V*V-N*N-q*q*Q*Q)/(2*V*q*Q),oe=Math.log(Math.sqrt(J*J+1)-J),ve=Math.log(Math.sqrt(ee*ee+1)-ee),Re=(ve-oe)/i;return{startZoom:n,startCenterXY:b,uDelta:L,w0:N,u1:$,S:Re,rho:i,rho2:q,r0:oe,r1:ve}}var lfe=` +const int max_lights = 2; +uniform mat4 shadow_uViewProjectionMatrices[max_lights]; +uniform vec4 shadow_uProjectCenters[max_lights]; +uniform bool shadow_uDrawShadowMap; +uniform bool shadow_uUseShadowMap; +uniform int shadow_uLightId; +uniform float shadow_uLightCount; + +out vec3 shadow_vPosition[max_lights]; + +vec4 shadow_setVertexPosition(vec4 position_commonspace) { + if (shadow_uDrawShadowMap) { + return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]); + } + if (shadow_uUseShadowMap) { + for (int i = 0; i < max_lights; i++) { + if(i < int(shadow_uLightCount)) { + vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]); + shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0; + } + } + } + return gl_Position; +} +`,cfe=` +const int max_lights = 2; +uniform bool shadow_uDrawShadowMap; +uniform bool shadow_uUseShadowMap; +uniform sampler2D shadow_uShadowMap0; +uniform sampler2D shadow_uShadowMap1; +uniform vec4 shadow_uColor; +uniform float shadow_uLightCount; + +in vec3 shadow_vPosition[max_lights]; + +const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0); +const vec4 bitUnpackShift = 1.0 / bitPackShift; +const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); + +float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) { + vec4 rgbaDepth = texture(shadowMap, position.xy); + + float z = dot(rgbaDepth, bitUnpackShift); + return smoothstep(0.001, 0.01, position.z - z); +} + +vec4 shadow_filterShadowColor(vec4 color) { + if (shadow_uDrawShadowMap) { + vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift); + rgbaDepth -= rgbaDepth.gbaa * bitMask; + return rgbaDepth; + } + if (shadow_uUseShadowMap) { + float shadowAlpha = 0.0; + shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0); + if(shadow_uLightCount > 1.0) { + shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1); + } + shadowAlpha *= shadow_uColor.a / shadow_uLightCount; + float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha); + + return vec4( + mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha), + blendedAlpha + ); + } + return color; +} +`,ufe=Qf(Afe),hfe=Qf(mfe),ffe=[0,0,0,1],dfe=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function pfe(t,e){let[r,i,n]=t,s=JA([r,i,n],e);return Number.isFinite(n)?s:[s[0],s[1],0]}function Afe({viewport:t,center:e}){return new Jn(t.viewProjectionMatrix).invert().transform(e)}function mfe({viewport:t,shadowMatrices:e}){let r=[],i=t.pixelUnprojectionMatrix,n=t.isGeospatial?void 0:1,s=[[0,0,n],[t.width,0,n],[0,t.height,n],[t.width,t.height,n],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(o=>pfe(o,i));for(let o of e){let c=o.clone().translate(new Xt(t.center).negate()),f=s.map(b=>c.transform(b)),y=new Jn().ortho({left:Math.min(...f.map(b=>b[0])),right:Math.max(...f.map(b=>b[0])),bottom:Math.min(...f.map(b=>b[1])),top:Math.max(...f.map(b=>b[1])),near:Math.min(...f.map(b=>-b[2])),far:Math.max(...f.map(b=>-b[2]))});r.push(y.multiplyRight(o))}return r}function gfe(t,e){let{shadowEnabled:r=!0}=t;if(!r||!t.shadowMatrices||!t.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};let i={shadow_uDrawShadowMap:!!t.drawToShadowMap,shadow_uUseShadowMap:t.shadowMaps?t.shadowMaps.length>0:!1,shadow_uColor:t.shadowColor||ffe,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},n=ufe({viewport:t.viewport,center:e.project_uCenter}),s=[],o=hfe({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice();for(let c=0;c"viewport"in t&&(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0)?gfe(t,e):{}};var vo={...xM,defaultUniforms:{...xM.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":` + // for picking depth values + picking_setPickingAttribute(position.z / position.w); + `,"vs:DECKGL_FILTER_COLOR":` + picking_setPickingColor(geometry.pickingColor); + `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` + // use highlight color if this fragment belongs to the selected object. + color = picking_filterHighlightColor(color); + + // use picking color if rendering to picking FBO. + color = picking_filterPickingColor(color); + `}}};var _fe=[Wh],yfe=["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 CH(){let t=Gm.getDefaultShaderAssembler();for(let e of _fe)t.addDefaultModule(e);for(let e of yfe)t.addShaderHook(e);return t}var xfe=[255,255,255],vfe=1,bfe=0,UM=class{constructor(e={}){this.type="ambient";let{color:r=xfe}=e,{intensity:i=vfe}=e;this.id=e.id||`ambient-${bfe++}`,this.color=r,this.intensity=i}};var wfe=[255,255,255],Sfe=1,Tfe=[0,0,-1],Efe=0,tw=class{constructor(e={}){this.type="directional";let{color:r=wfe}=e,{intensity:i=Sfe}=e,{direction:n=Tfe}=e,{_shadow:s=!1}=e;this.id=e.id||`directional-${Efe++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new Xt(n).normalize().toArray(),this.shadow=s}getProjectedLight(e){return this}};var rw=class{constructor(e,r={id:"pass"}){let{id:i}=r;this.id=i,this.device=e,this.props={...r}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}};var Yu=class extends rw{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){let[r,i]=this.device.canvasContext.getDrawingBufferSize(),n=e.clearCanvas??!0,s=e.clearColor??(n?[0,0,0,0]:!1),o=n?1:!1,c=n?0:!1,f=e.colorMask??15,y={viewport:[0,0,r,i]};e.colorMask&&(y.colorMask=f),e.scissorRect&&(y.scissorRect=e.scissorRect);let b=this.device.beginRenderPass({framebuffer:e.target,parameters:y,clearColor:s,clearDepth:o,clearStencil:c});try{return this._drawLayers(b,e)}finally{b.end()}}_drawLayers(e,r){let{target:i,moduleParameters:n,viewports:s,views:o,onViewportActive:c,clearStack:f=!0}=r;r.pass=r.pass||"unknown",f&&(this._lastRenderIndex=-1);let y=[];for(let b of s){let M=o&&o[b.id];c?.(b);let L=this._getDrawLayerParams(b,r),N=b.subViewports||[b];for(let V of N){let $=this._drawLayersInViewport(e,{target:i,moduleParameters:n,viewport:V,view:M,pass:r.pass,layers:r.layers},L);y.push($)}}return y}_getDrawLayerParams(e,{layers:r,pass:i,isPicking:n=!1,layerFilter:s,cullRect:o,effects:c,moduleParameters:f},y=!1){let b=[],M=IH(this._lastRenderIndex+1),L={layer:r[0],viewport:e,isPicking:n,renderPass:i,cullRect:o},N={};for(let V=0;Vthis.device.clearWebGL(M))}let b={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:y});for(let M=0;M{let o=n.props._offset,c=n.id,f=n.parent&&n.parent.id,y;if(f&&!(f in e)&&i(n.parent,!1),f in r){let b=r[f]=r[f]||IH(e[f],e);y=b(n,s),r[c]=b}else Number.isFinite(o)?(y=o+(e[f]||0),r[c]=null):y=t;return s&&y>=t&&(t=y+1),e[c]=y,y};return i}function Mfe(t,{moduleParameters:e,target:r,viewport:i}){let n=e&&e.devicePixelRatio||t.canvasContext.cssToDeviceRatio(),[,s]=t.canvasContext.getDrawingBufferSize(),o=r?r.height:s,c=i;return[c.x*n,o-(c.y+c.height)*n,c.width*n,c.height*n]}var iw=class extends Yu{constructor(e,r){super(e,r),this.shadowMap=e.createTexture({width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.depthBuffer=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1,dataFormat:6402,type:5125}),this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[this.shadowMap],depthStencilAttachment:this.depthBuffer})}render(e){let r=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),n=e.viewports[0],s=n.width*i,o=n.height*i,c=[1,1,1,1];(s!==r.width||o!==r.height)&&r.resize({width:s,height:o}),super.render({...e,clearColor:c,target:r,pass:"shadow"})}getLayerParameters(e,r,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.shadowMap&&(this.shadowMap.destroy(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.destroy(),this.depthBuffer=null)}};var Pfe={color:[255,255,255],intensity:1},RH=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],Cfe=[0,0,0,200/255],Wy=class{constructor(e={}){this.id="lighting-effect",this.shadowColor=Cfe,this.shadow=!1,this.ambientLight=null,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.shadowMaps=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;let{device:r,deck:i}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(r),i._addDefaultShaderModule(zM),this.dummyShadowMap=r.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in e){let i=e[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.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:s}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let o=0;oi.getProjectedLight({layer:e})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:e}))},r}cleanup(e){for(let r of this.shadowPasses)r.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(zM))}_calculateMatrices(){let e=[];for(let r of this.directionalLights){let i=new Jn().lookAt({eye:new Xt(r.direction).negate()});e.push(i)}return e}_createShadowPasses(e){for(let r=0;rn&&(s=n);let o=this._pool,c=e.BYTES_PER_ELEMENT*s,f=o.findIndex(y=>y.byteLength>=c);if(f>=0){let y=new e(o.splice(f,1)[0],0,s);return i&&y.fill(0),y}return new e(s)}_release(e){if(!ArrayBuffer.isView(e))return;let r=this._pool,{buffer:i}=e,{byteLength:n}=i,s=r.findIndex(o=>o.byteLength>=n);s<0?r.push(i):(s>0||r.lengththis.opts.poolSize&&r.shift()}},qh=new VO;function $y(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function LH(t){return[t[12],t[13],t[14]]}function DH(t){return{left:Hy(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:Hy(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:Hy(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:Hy(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:Hy(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:Hy(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}var kH=new Xt;function Hy(t,e,r,i){kH.set(t,e,r);let n=kH.len();return{distance:i/n,normal:new Xt(-t/n,-e/n,-r/n)}}function Ife(t){return t-Math.fround(t)}var nw;function VM(t,e){let{size:r=1,startIndex:i=0}=e,n=e.endIndex!==void 0?e.endIndex:t.length,s=(n-i)/r;nw=qh.allocate(nw,s,{type:Float32Array,size:r*2});let o=i,c=0;for(;o=r.delay+r.duration*r.repeat}getTime(e){if(e===void 0)return this.time;let r=this.channels.get(e);return r===void 0?-1:r.time}setTime(e){this.time=Math.max(0,e);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(e,r){let i=Ffe++;return this.animations.set(i,{animation:e,channel:r}),e.setTime(this.getTime(r)),i}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,r){let i=r-e.delay,n=e.duration*e.repeat;i>=n?e.time=e.duration*e.rate:(e.time=Math.max(0,i)%e.duration,e.time*=e.rate)}};var Nfe=0,zfe={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:sp.stats.get(`animation-loop-${Nfe++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},sw=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;constructor(e){if(this.props={...zfe,...e},e=this.props,!e.device)throw new Error("No device provided");let{useDevicePixels:r=!0}=this.props;this.stats=e.stats||new lc({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport,autoResizeDrawingBuffer:e.autoResizeDrawingBuffer,useDevicePixels:r}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),"autoResizeDrawingBuffer"in e&&(this.props.autoResizeDrawingBuffer=e.autoResizeDrawingBuffer||!1),"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let r=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(r),r}}stop(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=rD(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(iD(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:this.device?.canvasContext?.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:r,aspect:i}=this._getSizeAndAspect();(e!==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=e,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}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.canvasContext?.canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.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",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,r]=this.device?.canvasContext?.getPixelSize()||[1,1],i=1,n=this.device?.canvasContext?.canvas;return n&&n.clientHeight?i=n.clientWidth/n.clientHeight:e>0&&r>0&&(i=e/r),{width:e,height:r,aspect:i}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.props.autoResizeDrawingBuffer&&this.device?.canvasContext?.resize({useDevicePixels:this.props.useDevicePixels})}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}};var jM=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){this.id=e.id||Ml("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&bi(this.indices.usage===Yi.INDEX)}destroy(){this.indices?.destroy();for(let e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function zH(t,e){if(e instanceof jM)return e;let r=Ufe(t,e),{attributes:i,bufferLayout:n}=Vfe(t,e);return new jM({topology:e.topology||"triangle-list",bufferLayout:n,vertexCount:e.vertexCount,indices:r,attributes:i})}function Ufe(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:Yi.INDEX,data:r})}function Vfe(t,e){let r=[],i={};for(let[s,o]of Object.entries(e.attributes)){let c=s;switch(s){case"POSITION":c="positions";break;case"NORMAL":c="normals";break;case"TEXCOORD_0":c="texCoords";break;case"COLOR_0":c="colors";break}i[c]=t.createBuffer({data:o.value,id:`${s}-buffer`});let{value:f,size:y,normalized:b}=o;r.push({name:c,format:JL(f,y,b)})}let n=e._calculateVertexCount(e.attributes,e.indices);return{attributes:i,bufferLayout:r,vertexCount:n}}var WM=class{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(e){let r=qm(Object.values(e).filter(i=>i.dependencies));for(let i of r)e[i.name]=i;xt.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[i,n]of Object.entries(e)){let s=i;this.moduleUniforms[s]=n.defaultUniforms||{},this.moduleBindings[s]={}}}destroy(){}setProps(e){for(let r of Object.keys(e)){let i=r,n=e[i],s=this.modules[i];if(!s){xt.warn(`Module ${r} not found`)();continue}let o=this.moduleUniforms[i],c=s.getUniforms?.(n,this.moduleUniforms[i])||n;this.moduleUniforms[i]={...o,...c}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[r,i]of Object.entries(this.moduleUniforms))for(let[n,s]of Object.entries(i))e[`${r}.${n}`]={type:this.modules[r].uniformTypes?.[n],value:String(s)};return e}};var HM=class t{static defaultProps={...Zf.defaultProps};device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new t(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=e}createRenderPipeline(e){let r={...Zf.defaultProps,...e},i=this._hashRenderPipeline(r);if(!this._renderPipelineCache[i]){let n=this.device.createRenderPipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._renderPipelineCache[i]={pipeline:n,useCount:0}}return this._renderPipelineCache[i].useCount++,this._renderPipelineCache[i].pipeline}createComputePipeline(e){let r={...Cy.defaultProps,...e},i=this._hashComputePipeline(r);if(!this._computePipelineCache[i]){let n=this.device.createComputePipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._computePipelineCache[i]={pipeline:n,useCount:0}}return this._computePipelineCache[i].useCount++,this._computePipelineCache[i].pipeline}release(e){let r=e.hash,i=e instanceof Cy?this._computePipelineCache:this._renderPipelineCache;i[r].useCount--,i[r].useCount===0&&(i[r].pipeline.destroy(),delete i[r])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){let r=this._getHash(e.vs.source),i=e.fs?this._getHash(e.fs.source):0,n="-",s=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${r}/${i}V${n}BL${s}`;default:let o=this._getHash(JSON.stringify(e.parameters));return`${r}/${i}V${n}T${e.topology}P${o}BL${s}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}};var $M=class t{static defaultProps={...Xm.defaultProps};device;_cache={};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new t(e),e._lumaData.defaultShaderFactory}constructor(e){this.device=e}createShader(e){let r=this._hashShader(e),i=this._cache[r];if(!i){let n=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[r]=i={shader:n,useCount:0}}return i.useCount++,i.shader}release(e){let r=this._hashShader(e),i=this._cache[r];i&&(i.useCount--,i.useCount===0&&(delete this._cache[r],i.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}};function UH(t,e){let r={},i="Values";if(t.attributes.length===0&&!t.varyings?.length)return{"No attributes or varyings":{[i]:"N/A"}};for(let n of t.attributes)if(n){let s=`${n.location} ${n.name}: ${n.type}`;r[`in ${s}`]={[i]:n.stepMode||"vertex"}}for(let n of t.varyings||[]){let s=`${n.location} ${n.name}`;r[`out ${s}`]={[i]:JSON.stringify(n.accessor)}}return r}var ia=null,HO=null;function VH(t,{id:e,minimap:r,opaque:i,top:n="0",left:s="0",rgbaScale:o=1}){ia||(ia=document.createElement("canvas"),ia.id=e,ia.title=e,ia.style.zIndex="100",ia.style.position="absolute",ia.style.top=n,ia.style.left=s,ia.style.border="blue 1px solid",ia.style.transform="scaleY(-1)",document.body.appendChild(ia),HO=ia.getContext("2d")),(ia.width!==t.width||ia.height!==t.height)&&(ia.width=t.width/2,ia.height=t.height/2,ia.style.width="400px",ia.style.height="400px");let c=t.device.readPixelsToArrayWebGL(t),f=HO.createImageData(t.width,t.height),y=0;for(let b=0;b[c.name,c])||[]);this.setShaderInputs(r.shaderInputs||new WM(i));let n=Wfe(e),s=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){this.props.shaderLayout||=ND(this.props.source);let{source:c,getUniforms:f}=this.props.shaderAssembler.assembleShader({platformInfo:n,...this.props,modules:s});this.source=c,this._getModuleUniforms=f}else{let{vs:c,fs:f,getUniforms:y}=this.props.shaderAssembler.assembleShaderPair({platformInfo:n,...this.props,modules:s});this.vs=c,this.fs=f,this._getModuleUniforms=y}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&this.setGeometry(r.geometry),this.pipelineFactory=r.pipelineFactory||HM.getDefaultPipelineFactory(this.device),this.shaderFactory=r.shaderFactory||$M.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in r&&(this.isInstanced=r.isInstanced),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.vertexCount&&this.setVertexCount(r.vertexCount),r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&this.updateModuleSettings(r.moduleSettings),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){this.predraw();let r;try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),qA(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);let{indexBuffer:i}=this.vertexArray,n=i?i.byteLength/(i.indexType==="uint32"?4:2):void 0;r=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:n,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(e),r?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",r}setGeometry(e){this._gpuGeometry?.destroy();let r=e&&zH(this.device,e);r&&(this.setTopology(r.topology||"triangle-list"),this.bufferLayout=jH(r.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r)),this._gpuGeometry=r}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?jH(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){zb(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,this.isInstanced===void 0&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new Ob(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let i=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,r){e.indices&&xt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,n]of Object.entries(e)){let s=this.bufferLayout.find(f=>WH(f).includes(i));if(!s){xt.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let o=WH(s),c=!1;for(let f of o){let y=this._attributeInfos[f];y&&(this.vertexArray.setBuffer(y.location,n),c=!0)}!c&&!(r?.disableWarnings??this.props.disableWarnings)&&xt.warn(`Model(${this.id}): Ignoring buffer "${n.id}" for unknown attribute "${i}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,r){for(let[i,n]of Object.entries(e)){let s=this._attributeInfos[i];s?this.vertexArray.setConstantWebGL(s.location,n):(r?.disableWarnings??this.props.disableWarnings)||xt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){qA(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettings(e){let{bindings:r,uniforms:i}=Fb(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,i),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let e=0;for(let r of Object.values(this.bindings))r instanceof Ym?e=Math.max(e,r.texture.updateTimestamp):r instanceof Yi||r instanceof yo?e=Math.max(e,r.updateTimestamp):r instanceof Qm||(e=Math.max(e,r.buffer.updateTimestamp));return e}_setGeometryAttributes(e){let r={...e.attributes};for(let[i]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(n=>n.name===i)&&i!=="positions"&&delete r[i];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(r,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,r=null;this.pipeline&&(xt.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,r=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders}),n=null;this.source?n=i:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:i,fs:n}),this._attributeInfos=XE(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),r&&this.shaderFactory.release(r)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=xt.level>3?0:jfe;xt.level<2||Date.now()-this._lastLogTime>> DRAWING MODEL ${this.id}`,{collapsed:xt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=UH(this.pipeline.shaderLayout,this.id);xt.table(qy,e)();let r=this.shaderInputs.getDebugTable();for(let[n,s]of Object.entries(this.uniforms))r[n]={value:s};xt.table(qy,r)();let i=this._getAttributeDebugTable();xt.table(qy,this._attributeInfos)(),xt.table(qy,i)(),xt.groupEnd(qy)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let r=xt.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let i=e.props.framebuffer;i&&VH(i,{id:i.id,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[r,i]of Object.entries(this._attributeInfos))e[i.location]={name:r,type:i.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[i.location],i.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,i=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);e.indices={name:"indices",type:r.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,r){let i=Bb(r);return(e instanceof Yi?new i(e.debugData):e).toString()}};function jH(t,e){let r=[...t];for(let i of e){let n=r.findIndex(s=>s.name===i.name);n<0?r.push(i):r[n]=i}return r}function Wfe(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function WH(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}var e0=class t{device;model;transformFeedback;static isSupported(e){return e?.info?.type==="webgl"}constructor(e,r=en.defaultProps){bi(t.isSupported(e),"BufferTransform not yet implemented on WebGPU"),this.device=e,this.model=new en(this.device,{id:r.id||"buffer-transform-model",fs:r.fs||Tb(),topology:r.topology||"point-list",...r}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:r.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){let r=this.device.beginRenderPass(e);this.model.draw(r),r.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let r=this.getBuffer(e);if(r instanceof Yi)return r.readAsync();let{buffer:i,byteOffset:n=0,byteLength:s=i.byteLength}=r;return i.readAsync(n,s)}};var Hfe="transform_output",Gy=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,r){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new en(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Tb({input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Hfe}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(e){let{framebuffer:r}=this.bindings[this.currentIndex],i=this.device.beginRenderPass({framebuffer:r,...e});this.model.draw(i),i.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getData({packed:e=!1}={}){throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:e}=this.bindings[this.currentIndex];return e}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(e){this._updateBindings(e)}_updateBindings(e){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e)}_updateBinding(e,{sourceBuffers:r,sourceTextures:i,targetTexture:n}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,i),Object.assign(e.sourceBuffers,r),n){e.targetTexture=n;let{width:s,height:o}=n;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:s,height:o,colorAttachments:[n]}),e.framebuffer.resize({width:s,height:o})}return e}_setSourceTextureParameters(){let e=this.currentIndex,{sourceTextures:r}=this.bindings[e];for(let i in r)r[i].sampler=this.sampler}};var bo=class{id;topology;vertexCount;indices;attributes;userData={};constructor(e){let{attributes:r={},indices:i=null,vertexCount:n=null}=e;this.id=e.id||Ml("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={};for(let[s,o]of Object.entries(r)){let c=ArrayBuffer.isView(o)?{value:o}:o;bi(ArrayBuffer.isView(c.value),`${this._print(s)}: must be typed array or object with value as typed array`),(s==="POSITION"||s==="positions")&&!c.size&&(c.size=3),s==="indices"?(bi(!this.indices),this.indices=c):this.attributes[s]=c}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let i=1/0;for(let n of Object.values(e)){let{value:s,size:o,constant:c}=n;!c&&s&&o>=1&&(i=Math.min(i,s.length/o))}return bi(Number.isFinite(i)),i}};var $fe={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"},og=class extends Yu{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:s,pickingFBO:o,deviceRect:{x:c,y:f,width:y,height:b},cullRect:M,effects:L,pass:N="picking",pickZ:V,moduleParameters:$}){this.pickZ=V;let Q=this._resetColorEncoder(V),q=[c,f,y,b],J=super.render({target:o,layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:s,cullRect:M,effects:L?.filter(oe=>oe.useInPicking),pass:N,isPicking:!0,moduleParameters:$,clearColor:[0,0,0,0],colorMask:15,scissorRect:q});return this._colorEncoderState=null,{decodePickingColor:Q&&Gfe.bind(null,Q),stats:J}}shouldDrawLayer(e){let{pickable:r,operation:i}=e.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(e,r,i){let n={depthMask:!0,depthTest:!0,depthRange:[0,1],...e.props.parameters},{pickable:s,operation:o}=e.props;return!this._colorEncoderState||o.includes("terrain")?n.blend=!1:s&&o.includes("draw")&&(Object.assign(n,$fe),n.blend=!0,n.blendColor=qfe(this._colorEncoderState,e,i)),n}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function qfe(t,e,r){let{byLayer:i,byAlpha:n}=t,s,o=i.get(e);return o?(o.viewports.push(r),s=o.a):(s=i.size+1,s<=255?(o={a:s,layer:e,viewports:[r]},i.set(e,o),n[s]=o):(dr.warn("Too many pickable layers, only picking the first 255")(),s=0)),[0,0,0,s/255]}function Gfe(t,e){let r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}var t0={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"},Zy=Symbol.for("component"),Xu=Symbol.for("propTypes"),qM=Symbol.for("deprecatedProps"),hp=Symbol.for("asyncPropDefaults"),Kf=Symbol.for("asyncPropOriginal"),Gh=Symbol.for("asyncPropResolved");function fp(t,e=()=>!0){return Array.isArray(t)?HH(t,e,[]):e(t)?[t]:[]}function HH(t,e,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(e,r){if(e===this._data&&!r)return;this._data=e;let i=++this._loadCount,n=e;typeof e=="string"&&(n=HA(e)),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=e);for(let s of this._subscribers)s.onChange(this.getData())}};var aw=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:r,forceUpdate:i=!1,persistent:n=!0}){let s=this._resources[e];s?s.setData(r,i):(s=new ow(e,r,this._context),this._resources[e]=s),s.persistent=n}remove(e){let r=this._resources[e];r&&(r.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let r=this._consumers[e];if(r){for(let i in r){let n=r[i],s=this._resources[n.resourceId];s&&s.unsubscribe(n)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:r,consumerId:i,requestId:n="default"}){let{_resources:s,protocol:o}=this;e.startsWith(o)&&(e=e.replace(o,""),s[e]||this.add({resourceId:e,data:null,persistent:!1}));let c=s[e];if(this._track(i,n,c,r),c)return c.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,r,i,n){let s=this._consumers,o=s[e]=s[e]||{},c=o[r],f=c&&c.resourceId&&this._resources[c.resourceId];f&&(f.unsubscribe(c),this.prune()),i&&(c?(c.onChange=n,c.resourceId=i.id):c={onChange:n,resourceId:i.id},o[r]=c,i.subscribe(c))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let r=this._resources[e];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[e])}}};var Zfe="layerManager.setLayers",Yfe="layerManager.activateViewport",lw=class{constructor(e,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=c=>{Os(Yfe,this,c),c&&(this.context.viewport=c)};let{deck:i,stats:n,viewport:s,timeline:o}=r||{};this.layers=[],this.resourceManager=new aw({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:i,shaderAssembler:CH(),defaultShaderModules:[],renderPass:void 0,stats:n||new lc({id:"deck.gl"}),viewport:s||new up({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new sg,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let n=i.getNeedsRedraw(e);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(r=>e.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,r){Os(Zfe,this,r,e),this._lastRenderedLayers=e;let i=fp(e,Boolean);for(let n of i)n.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){let{defaultShaderModules:r}=this.context;r.find(i=>i.name===e.name)||(r.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){let{defaultShaderModules:r}=this.context,i=r.findIndex(n=>n.name===e.name);i>=0&&(r.splice(i,1),this._defaultShaderModulesChanged=!0)}_handleError(e,r,i){i.raiseError(r,`${e} of ${i}`)}_updateLayers(e,r){let i={};for(let o of e)i[o.id]?dr.warn(`Multiple old layers with same id ${o.id}`)():i[o.id]=o;if(this._defaultShaderModulesChanged){for(let o of e)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}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 ${o}`;break}this._needsUpdate=s,this.layers=n}_updateSublayersRecursively(e,r,i){for(let n of e){n.context=this.context;let s=r[n.id];s===null&&dr.warn(`Multiple new layers with same id ${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(e){for(let r in e){let i=e[r];i&&this._finalizeLayer(i)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=t0.INITIALIZED}catch(r){this._handleError("initialization",r,e)}}_transferLayerState(e,r){r._transferState(e),r.lifecycle=t0.MATCHED,r!==e&&(e.lifecycle=t0.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(r){this._handleError("update",r,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=t0.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=t0.FINALIZED}catch(r){this._handleError("finalization",r,e)}}};function qn(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;ir.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(r=>{e[r.id]=r}),e}getView(e){return this.views.find(r=>r.id===e)}getViewState(e){let r=typeof e=="string"?this.getView(e):e,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(e){return this._viewportMap[e]}unproject(e,r){let i=this.getViewports(),n={x:e[0],y:e[1]};for(let s=i.length-1;s>=0;--s){let o=i[s];if(o.containsPixel(n)){let c=e.slice();return c[0]-=o.x,c[1]-=o.y,o.unproject(c,r)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.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(e,r){(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(e){e=fp(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!qn(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):dr.warn("missing `viewState` or `initialViewState`")()}_createController(e,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:s=>this.getView(e.id)?.makeViewport({viewState:s,width:this.width,height:this.height})})}_updateController(e,r,i,n){let s=e.controller;if(s&&i){let o={...r,...s,id:e.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!n||n.constructor!==s.type)&&(n=this._createController(e,o)),n&&n.setProps(o),n}return null}_rebuildViewports(){let{views:e}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let n=e.length;n--;){let s=e[n],o=this.getViewState(s),c=s.makeViewport({viewState:o,width:this.width,height:this.height}),f=r[s.id],y=!!s.controller;y&&!f&&(i=!0),(i||!y)&&f&&(f.finalize(),f=null),this.controllers[s.id]=this._updateController(s,o,c,f),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(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,r){return e.length!==r.length?!0:e.some((i,n)=>!e[n].equals(r[n]))}};var Xfe=/([0-9]+\.?[0-9]*)(%|px)/;function dp(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":let e=Xfe.exec(t);if(e&&e.length>=3){let r=e[2]==="%",i=parseFloat(e[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(`Could not parse position string ${t}`)}}function pp(t,e){return t.relative?Math.round(t.position*e):t.position}var iu=class{constructor(e){let{id:r,x:i=0,y:n=0,width:s="100%",height:o="100%",padding:c=null}=e;this.id=r||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=dp(i),this._y=dp(n),this._width=dp(s),this._height=dp(o),this._padding=c&&{left:dp(c.left||0),right:dp(c.right||0),top:dp(c.top||0),bottom:dp(c.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.ViewportType===e.ViewportType&&qn(this.props,e.props,2)}makeViewport({width:e,height:r,viewState:i}){i=this.filterViewState(i);let n=this.getDimensions({width:e,height:r});return!n.height||!n.width?null:new this.ViewportType({...i,...this.props,...n})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...e};for(let i in this.props.viewState)i!=="id"&&(r[i]=this.props.viewState[i]);return r}return e}getDimensions({width:e,height:r}){let i={x:pp(this._x,e),y:pp(this._y,r),width:pp(this._width,e),height:pp(this._height,r)};return this._padding&&(i.padding={left:pp(this._padding.left,e),top:pp(this._padding.top,r),right:pp(this._padding.right,e),bottom:pp(this._padding.bottom,r)}),i}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var Zh=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:r}=this;this._handle=e.addChannel({delay:e.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var $H=()=>{},qO={BREAK:1,SNAP_TO_END:2,IGNORE:3},Qfe=t=>t,Kfe=qO.BREAK,uw=class{constructor(e){this._onTransitionUpdate=r=>{let{time:i,settings:{interpolator:n,startProps:s,endProps:o,duration:c,easing:f}}=r,y=f(i/c),b=n.interpolateProps(s,o,y);this.propsInTransition=this.getControllerState({...this.props,...b}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new Zh(e.timeline),this.onViewStateChange=e.onViewStateChange||$H,this.onStateChange=e.onStateChange||$H}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let r=!1,i=this.props;if(this.props=e,!i||this._shouldIgnoreViewportChange(i,e))return!1;if(this._isTransitionEnabled(e)){let n=i;if(this.transition.inProgress){let{interruption:s,endProps:o}=this.transition.settings;n={...i,...s===qO.SNAP_TO_END?o:this.propsInTransition||i}}this._triggerTransition(n,e),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:r,transitionInterpolator:i}=e;return(r>0||r==="auto")&&!!i}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,r){return this.transition.inProgress?this.transition.settings.interruption===qO.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(e,r):!0}_triggerTransition(e,r){let i=this.getControllerState(e),n=this.getControllerState(r).shortestPathFrom(i),s=r.transitionInterpolator,o=s.getDuration?s.getDuration(e,r):r.transitionDuration;if(o===0)return;let c=s.initializeProps(e,n);this.propsInTransition={};let f={duration:o,easing:r.transitionEasing||Qfe,interpolator:s,interruption:r.transitionInterruption||Kfe,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(f),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(r)}}};function Mr(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}var ag=class{constructor(e){let{compare:r,extract:i,required:n}=e;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(e,r){for(let i of this._propsToCompare)if(!(i in e)||!(i in r)||!oo(e[i],r[i]))return!1;return!0}initializeProps(e,r){let i={},n={};for(let s of this._propsToExtract)(s in e||s in r)&&(i[s]=e[s],n[s]=r[s]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(e,r){return r.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(r=>{let i=e[r];Mr(Number.isFinite(i)||Array.isArray(i),`${r} is required for transition`)})}};var Jfe=["longitude","latitude","zoom","bearing","pitch"],ede=["longitude","latitude","zoom"],lg=class extends ag{constructor(e={}){let r=Array.isArray(e)?e:e.transitionProps,i=Array.isArray(e)?{}:e;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:Jfe,required:ede},super(i.transitionProps),this.opts=i}initializeProps(e,r){let i=super.initializeProps(e,r),{makeViewport:n,around:s}=this.opts;if(n&&s){let o=n(e),c=n(r),f=o.unproject(s);i.start.around=s,Object.assign(i.end,{around:c.project(f),aroundPosition:f,width:r.width,height:r.height})}return i}interpolateProps(e,r,i){let n={};for(let s of this._propsToExtract)n[s]=Ka(e[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,Ka(e.around,r.around,i)))}return n}};var r0={transitionDuration:0},tde=300,GM=t=>1-(1-t)*(1-t),Yy={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},cg={},hw=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new uw({...e,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let r=this._eventStartBlocked;switch(e.type){case"panstart":return r?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return r?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"tripanstart":return r?!1:this._onTriplePanStart(e);case"tripanmove":return this._onTriplePan(e);case"tripanend":return this._onTriplePanEnd(e);case"doubletap":return this._onDoubleTap(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:r,y:i}=this.props,{offsetCenter:n}=e;return[n.x-r,n.y-i]}isPointInBounds(e,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let s=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=n;return s&&r&&r.stopPropagation(),s}isFunctionKeyPressed(e){let{srcEvent:r}=e;return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=r}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:r}=e;this.inertia=Number.isFinite(r)?r:r===!0?tde:0;let{scrollZoom:i=!0,dragPan:n=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:c=!0,touchRotate:f=!1,keyboard:y=!0}=e,b=!!this.onViewStateChange;this.toggleEvents(Yy.WHEEL,b&&i),this.toggleEvents(Yy.PAN,b),this.toggleEvents(Yy.PINCH,b&&(c||f)),this.toggleEvents(Yy.TRIPLE_PAN,b&&f),this.toggleEvents(Yy.DOUBLE_TAP,b&&o),this.toggleEvents(Yy.KEYBOARD,b&&y),this.scrollZoom=i,this.dragPan=n,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=c,this.touchRotate=f,this.keyboard=y}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,r){this.eventManager&&e.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(e,r=null,i={}){let n={...e.getViewportProps(),...r},s=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(i),s){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:o,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e)||e.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,r0,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let r=this.getCenter(e),i=this.controllerState.pan({pos:r});return this.updateViewport(i,r0,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:r}=this;if(this.dragPan&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],s=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:GM},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let r=this.getCenter(e),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,r0,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:r}=this;if(this.dragRotate&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],s=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:GM},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;e.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:s}=e,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(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,r0,{isDragging:!0}),!0}_onTriplePan(e){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(e);r[0]-=e.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,r0,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&e.velocityY){let i=this.getCenter(e),n=[i[0],i[1]+=e.velocityY*r/2],s=this.controllerState.rotate({pos:n});this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:GM},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return cg._startPinchRotation=e.rotation,cg._lastPinchEvent=e,this.updateViewport(i,r0,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=e,n=this.getCenter(e);r=r.zoom({pos:n,scale:i})}if(this.touchRotate){let{rotation:i}=e;r=r.rotate({deltaAngleX:cg._startPinchRotation-i})}return this.updateViewport(r,r0,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),cg._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=cg;if(this.touchZoom&&r&&i&&e.scale!==i.scale){let n=this.getCenter(e),s=this.controllerState.rotateEnd(),o=Math.log2(e.scale),c=(o-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),f=Math.pow(2,o+c*r/2);s=s.zoom({pos:n,scale:f}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:n}),transitionDuration:r,transitionEasing:GM},{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 cg._startPinchRotation=null,cg._lastPinchEvent=null,!0}_onDoubleTap(e){if(!this.doubleClickZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e),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(e){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(e),{zoomSpeed:i,moveSpeed:n,rotateSpeedX:s,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:c}=this,f,y={};switch(e.srcEvent.code){case"Minus":f=r?c.zoomOut(i).zoomOut(i):c.zoomOut(i),y.isZooming=!0;break;case"Equal":f=r?c.zoomIn(i).zoomIn(i):c.zoomIn(i),y.isZooming=!0;break;case"ArrowLeft":r?(f=c.rotateLeft(s),y.isRotating=!0):(f=c.moveLeft(n),y.isPanning=!0);break;case"ArrowRight":r?(f=c.rotateRight(s),y.isRotating=!0):(f=c.moveRight(n),y.isPanning=!0);break;case"ArrowUp":r?(f=c.rotateUp(o),y.isRotating=!0):(f=c.moveUp(n),y.isPanning=!0);break;case"ArrowDown":r?(f=c.rotateDown(o),y.isRotating=!0):(f=c.moveDown(n),y.isPanning=!0);break;default:return!1}return this.updateViewport(f,this._getTransitionProps(),y),!0}_getTransitionProps(e){let{transition:r}=this;return!r||!r.transitionInterpolator?r0:e?{...r,transitionInterpolator:new lg({...e,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var fw=class{constructor(e,r){this._viewportProps=this.applyConstraints(e),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var qH=5,rde=1.2,GO=class extends fw{constructor(e){let{width:r,height:i,latitude:n,longitude:s,zoom:o,bearing:c=0,pitch:f=0,altitude:y=1.5,position:b=[0,0,0],maxZoom:M=20,minZoom:L=0,maxPitch:N=60,minPitch:V=0,startPanLngLat:$,startZoomLngLat:Q,startRotatePos:q,startBearing:J,startPitch:ee,startZoom:oe,normalize:ve=!0}=e;Mr(Number.isFinite(s)),Mr(Number.isFinite(n)),Mr(Number.isFinite(o)),super({width:r,height:i,latitude:n,longitude:s,zoom:o,bearing:c,pitch:f,altitude:y,maxZoom:M,minZoom:L,maxPitch:N,minPitch:V,normalize:ve,position:b},{startPanLngLat:$,startZoomLngLat:Q,startRotatePos:q,startBearing:J,startPitch:ee,startZoom:oe}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let s=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(s)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,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 e?c=this._getNewRotation(e,n,o,s):c={bearing:s+r,pitch:o+i},this._getUpdatedState(c)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomLngLat:s}=this.getState();if(s||(n=this.getViewportProps().zoom,s=this._unproject(r)||this._unproject(e)),!s)return this;let{maxZoom:o,minZoom:c}=this.getViewportProps(),f=n+Math.log2(i);f=qu(f,c,o);let y=this.makeViewport({...this.getViewportProps(),zoom:f});return this._getUpdatedState({zoom:f,...y.panByPosition(s,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let r=e.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(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=qu(n,i,r);let{maxPitch:s,minPitch:o,pitch:c}=e;e.pitch=qu(c,o,s);let{normalize:f=!0}=e;return f&&Object.assign(e,NO(e)),e}_zoomFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:e})}_panFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_getNewRotation(e,r,i,n){let s=e[0]-r[0],o=e[1]-r[1],c=e[1],f=r[1],{width:y,height:b}=this.getViewportProps(),M=s/y,L=0;o>0?Math.abs(b-f)>qH&&(L=o/(f-b)*rde):o<0&&f>qH&&(L=1-c/f),L=qu(L,-1,1);let{minPitch:N,maxPitch:V}=this.getViewportProps(),$=n+180*M,Q=i;return L>0?Q=i+L*(V-i):L<0&&(Q=i-L*(N-i)),{pitch:Q,bearing:$}}},dw=class extends hw{constructor(){super(...arguments),this.ControllerState=GO,this.transition={transitionDuration:300,transitionInterpolator:new lg({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let r=this.props;super.setProps(e),(!r||r.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var i0=class extends iu{static{this.displayName="MapView"}constructor(e={}){super(e)}get ViewportType(){return el}get ControllerType(){return dw}};var ide=new Wy;function nde(t,e){let r=t.order??1/0,i=e.order??1/0;return r-i}var pw=class{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let r=this._defaultEffects;if(!r.find(i=>i.id===e.id)){let i=r.findIndex(n=>nde(n,e)>0);i<0?r.push(e):r.splice(i,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(qn(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(e){let r={};for(let n of this.effects)r[n.id]=n;let i=[];for(let n of e){let s=r[n.id],o=n;s&&s!==n?s.setProps?(s.setProps(n.props),o=s):s.cleanup(this._context):s||n.setup(this._context),i.push(o),delete r[n.id]}for(let n in r)r[n].cleanup(this._context);this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),e.some(n=>n instanceof Wy)||this._resolvedEffects.push(ide),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Aw=class extends Yu{shouldDrawLayer(e){let{operation:r}=e.props;return r.includes("draw")||r.includes("terrain")}};var sde="deckRenderer.renderLayers",mw=class{constructor(e){this.device=e,this.gl=e.gl,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Aw(e),this.pickLayersPass=new og(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0],i.clearCanvas=!0);let s=r.render({...i,target:n});i.effects&&this._postRender(i.effects,i),this.renderCount++,Os(sde,this,s,e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:e}=this;for(let r of e)r.delete();e.length=0}_preRender(e,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of e)r.preRenderStats[i.id]=i.preRender(r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,r=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(i=>{let n=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[n]}))});for(let i of e)i.resize(r)}_postRender(e,r){let{renderBuffers:i}=this,n={...r,inputBuffer:i[0],swapBuffer:i[1]};for(let s of e)if(s.postRender){n.target=s.id===this.lastPostProcessEffect?r.target:void 0;let o=s.postRender(n);n.inputBuffer=o,n.swapBuffer=o===i[0]?i[1]:i[0]}}};var ode={pickedColor:null,pickedObjectIndex:-1};function GH({pickedColors:t,decodePickingColor:e,deviceX:r,deviceY:i,deviceRadius:n,deviceRect:s}){let{x:o,y:c,width:f,height:y}=s,b=n*n,M=-1,L=0;for(let N=0;Nb)L+=4*f;else for(let Q=0;Q=0){let J=Q+o-r,ee=J*J+$;ee<=b&&(b=ee,M=L)}L+=4}}if(M>=0){let N=t.slice(M,M+4),V=e(N);if(V){let $=Math.floor(M/4/f),Q=M/4-$*f;return{...V,pickedColor:N,pickedX:o+Q,pickedY:c+$}}dr.error("Picked non-existent layer. Is picking buffer corrupt?")()}return ode}function ZH({pickedColors:t,decodePickingColor:e}){let r=new Map;if(t){for(let i=0;i=0){let s=t.slice(i,i+4),o=s.join(",");if(!r.has(o)){let c=e(s);c?r.set(o,{...c,color:s}):dr.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function ZO({pickInfo:t,viewports:e,pixelRatio:r,x:i,y:n,z:s}){let o=e[0];e.length>1&&(o=ade(t?.pickedViewports||e,{x:i,y:n}));let c;if(o){let f=[i-o.x,n-o.y];s!==void 0&&(f[2]=s),c=o.unproject(f)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:i,y:n,pixel:[i,n],coordinate:c,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:r}}function YH(t){let{pickInfo:e,lastPickedInfo:r,mode:i,layers:n}=t,{pickedColor:s,pickedLayer:o,pickedObjectIndex:c}=e,f=o?[o]:[];if(i==="hover"){let M=r.index,L=r.layerId,N=o?o.props.id:null;if(N!==L||c!==M){if(N!==L){let V=n.find($=>$.props.id===L);V&&f.unshift(V)}r.layerId=N,r.index=c,r.info=null}}let y=ZO(t),b=new Map;return b.set(null,y),f.forEach(M=>{let L={...y};M===o&&(L.color=s,L.index=c,L.picked=!0),L=YO({layer:M,info:L,mode:i});let N=L.layer;M===o&&i==="hover"&&(r.info=L),b.set(N.id,L),i==="hover"&&N.updateAutoHighlight(L)}),b}function YO({layer:t,info:e,mode:r}){for(;t&&e;){let i=e.layer||null;e.sourceLayer=i,e.layer=t,e=t.getPickingInfo({info:e,mode:r,sourceLayer:i}),t=t.parent}return e}function ade(t,e){for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.containsPixel(e))return i}return t[0]}var gw=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new og(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,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,f=o?i.find(L=>L.id===o):null,y=c&&n.find(L=>L.id===c)||n[0],b=y&&y.unproject([e-y.x,r-y.y]);return{...s,...{x:e,y:r,viewport:y,coordinate:b,layer:f}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=r}let e=this.device.gl;this.pickingFBO?.resize({width:e.canvas.width,height:e.canvas.height}),this.depthFBO?.resize({width:e.canvas.width,height:e.canvas.height})}_getPickable(e){if(this._pickable===!1)return null;let r=e.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:e,views:r,viewports:i,x:n,y:s,radius:o=0,depth:c=1,mode:f="query",unproject3D:y,onViewportActive:b,effects:M}){let L=this.device.canvasContext.cssToDeviceRatio(),N=this._getPickable(e);if(!N||i.length===0)return{result:[],emptyInfo:ZO({viewports:i,x:n,y:s,pixelRatio:L})};this._resizeBuffer();let V=this.device.canvasContext.cssToDevicePixels([n,s],!0),$=[V.x+Math.floor(V.width/2),V.y+Math.floor(V.height/2)],Q=Math.round(o*L),{width:q,height:J}=this.pickingFBO,ee=this._getPickingRect({deviceX:$[0],deviceY:$[1],deviceRadius:Q,deviceWidth:q,deviceHeight:J}),oe={x:n-o,y:s-o,width:o*2+1,height:o*2+1},ve,Re=[],Ze=new Set;for(let He=0;He=y);et++){let Lt=Re[et],Gt={color:Lt.pickedColor,layer:null,index:Lt.pickedObjectIndex,picked:!0,x:n,y:s,pixelRatio:N};Gt=YO({layer:Lt.pickedLayer,info:Gt,mode:f});let qt=Gt.layer.id;Ze.has(qt)||Ze.set(qt,new Set);let Ar=Ze.get(qt),ri=Gt.object??Gt.index;Ar.has(ri)||(Ar.add(ri),He.push(Gt))}return He}_drawAndSample({layers:e,views:r,viewports:i,onViewportActive:n,deviceRect:s,cullRect:o,effects:c,pass:f},y=!1){let b=y?this.depthFBO:this.pickingFBO,M={layers:e,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:b,deviceRect:s,cullRect:o,effects:c,pass:f,pickZ:y,preRenderStats:{}};for(let J of c)J.useInPicking&&(M.preRenderStats[J.id]=J.preRender(M));let{decodePickingColor:L}=this.pickLayersPass.render(M),{x:N,y:V,width:$,height:Q}=s,q=new(y?Float32Array:Uint8Array)($*Q*4);return this.device.readPixelsToArrayWebGL(b,{sourceX:N,sourceY:V,sourceWidth:$,sourceHeight:Q,target:q}),{pickedColors:q,decodePickingColor:L}}_getPickingRect({deviceX:e,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:s}){let o=Math.max(0,e-i),c=Math.max(0,r-i),f=Math.min(n,e+i+1)-o,y=Math.min(s,r+i+1)-c;return f<=0||y<=0?null:{x:o,y:c,width:f,height:y}}};var lde={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},cde="top-left",XH="__root",ZM=class{constructor({deck:e,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!qn(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(let e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(r=>r.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){let r={};for(let i of this.resolvedWidgets)r[i.id]=i;this.resolvedWidgets.length=0;for(let i of this.defaultWidgets)r[i.id]=null,this.resolvedWidgets.push(i);for(let i of e){let n=r[i.id];n?n.viewId!==i.viewId||n.placement!==i.placement?(this._remove(n),this._add(i)):i!==n&&(n.setProps(i.props),i=n):this._add(i),r[i.id]=null,this.resolvedWidgets.push(i)}for(let i in r){let n=r[i];n&&this._remove(n)}this.widgets=e}_add(e){let{viewId:r=null,placement:i=cde}=e,n=e.onAdd({deck:this.deck,viewId:r});n&&this._getContainer(r,i).append(n),e._element=n}_remove(e){e.onRemove(),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,r){let i=e||XH,n=this.containers[i];n||(n=document.createElement("div"),n.style.pointerEvents="none",n.style.position="absolute",n.style.overflow="hidden",this.parentElement?.append(n),this.containers[i]=n);let s=n.querySelector(`.${r}`);return s||(s=document.createElement("div"),s.className=r,s.style.position="absolute",s.style.zIndex="2",Object.assign(s.style,lde[r]),n.append(s)),s}_updateContainers(){let e=this.deck.width,r=this.deck.height;for(let i in this.containers){let n=this.lastViewports[i]||null,s=i===XH||n,o=this.containers[i];s?(o.style.display="block",o.style.left=`${n?n.x:0}px`,o.style.top=`${n?n.y:0}px`,o.style.width=`${n?n.width:e}px`,o.style.height=`${n?n.height:r}px`):o.style.display="none"}}onRedraw({viewports:e,layers:r}){let i=e.reduce((s,o)=>(s[o.id]=o,s),{}),{lastViewports:n}=this;for(let s of this.getWidgets()){let{viewId:o}=s;if(o){let c=i[o];c&&(s.onViewportChange&&!c.equals(n[o])&&s.onViewportChange(c),s.onRedraw?.({viewports:[c],layers:r}))}else{if(s.onViewportChange)for(let c of e)c.equals(n[c.id])||s.onViewportChange(c);s.onRedraw?.({viewports:e,layers:r})}}this.lastViewports=i,this._updateContainers()}onHover(e,r){for(let i of this.getWidgets()){let{viewId:n}=i;(!n||n===e.viewport?.id)&&i.onHover?.(e,r)}}onEvent(e,r){let i=Yb[r.type];if(i)for(let n of this.getWidgets()){let{viewId:s}=n;(!s||s===e.viewport?.id)&&n[i.handler]?.(e,r)}}};var ude={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},_w=class{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){let r=document.createElement("div");return r.className="deck-tooltip",Object.assign(r.style,ude),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:r}=this,i=r&&r.props.getTooltip;if(!i)return;let n=i(e);this.lastViewport=e.viewport,this.setTooltip(n,e.x,e.y)}setTooltip(e,r,i){let n=this.element;if(n){if(typeof e=="string")n.innerText=e;else if(e)e.text&&(n.innerText=e.text),e.html&&(n.innerHTML=e.html),e.className&&(n.className=e.className);else{this.isVisible=!1,n.style.display="none";return}this.isVisible=!0,n.style.display="block",n.style.transform=`translate(${r}px, ${i}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(n.style,e.style)}}};var n0;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(n0||(n0={}));var xw={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,35725:null,36006:null,36007:null,34229:null,34964:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32926:!1,32928:!1,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],36389:null,36662:null,36663:null,35053:null,35055:null,35723:4352,36010:null,35977:!1,3333:4,3317:4,37440:!1,37441:!1,37443:37444,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},wo=(t,e,r)=>e?t.enable(r):t.disable(r),QH=(t,e,r)=>t.hint(r,e),nu=(t,e,r)=>t.pixelStorei(r,e),KH=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},yw=(t,e,r)=>{let n={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[r];t.bindBuffer(n,e)};function XO(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var JH={3042:wo,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:wo,2885:(t,e)=>t.cullFace(e),2929:wo,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:wo,35723:QH,35725:(t,e)=>t.useProgram(e),36007:(t,e)=>t.bindRenderbuffer(36161,e),36389:(t,e)=>t.bindTransformFeedback?.(36386,e),34229:(t,e)=>t.bindVertexArray(e),36006:KH,36010:KH,34964:yw,36662:yw,36663:yw,35053:yw,35055:yw,2886:(t,e)=>t.frontFace(e),33170:QH,2849:(t,e)=>t.lineWidth(e),32823:wo,32824:"polygonOffset",10752:"polygonOffset",35977:wo,32926:wo,32928:wo,32938:"sampleCoverage",32939:"sampleCoverage",3089:wo,3088:(t,e)=>t.scissor(...e),2960:wo,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),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:(t,e)=>t.viewport(...e),34383:wo,10754:wo,12288:wo,12289:wo,12290:wo,12291:wo,12292:wo,12293:wo,12294:wo,12295:wo,3333:nu,3317:nu,37440:nu,37441:nu,37443:nu,3330:nu,3332:nu,3331:nu,3314:nu,32878:nu,3316:nu,3315:nu,32877:nu,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=XO(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=XO(e)&&e.length===3?[...e,...e]:e;let[r,i,n,s,o,c]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,s,o,c)},stencilOp:(t,e)=>{e=XO(e)&&e.length===3?[...e,...e]:e;let[r,i,n,s,o,c]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,s,o,c)},viewport:(t,e)=>t.viewport(...e)};function Fs(t,e,r){return e[t]!==void 0?e[t]:r[t]}var e$={blendEquation:(t,e,r)=>t.blendEquationSeparate(Fs(32777,e,r),Fs(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(Fs(32969,e,r),Fs(32968,e,r),Fs(32971,e,r),Fs(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(Fs(32824,e,r),Fs(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(Fs(32938,e,r),Fs(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,Fs(2962,e,r),Fs(2967,e,r),Fs(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,Fs(34816,e,r),Fs(36003,e,r),Fs(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,Fs(2964,e,r),Fs(2965,e,r),Fs(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,Fs(34817,e,r),Fs(34818,e,r),Fs(34819,e,r))},QO={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({35725:e}),bindRenderbuffer:(t,e,r)=>t({36007:r}),bindTransformFeedback:(t,e,r)=>t({36389:r}),bindVertexArray:(t,e)=>t({34229:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({36006:r,36010:r});case 36009:return t({36006:r});case 36008:return t({36010:r});default:return null}},bindBuffer:(t,e,r)=>{let i={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({32773:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,r)=>t({32777:e,34877:r}),blendFunc:(t,e,r)=>t({32969:e,32968:r,32971:e,32970:r}),blendFuncSeparate:(t,e,r,i,n)=>t({32969:e,32968:r,32971:i,32970:n}),clearColor:(t,e,r,i,n)=>t({3106:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,r,i,n)=>t({3107:[e,r,i,n]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,r)=>t({2928:new Float32Array([e,r])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,r)=>t({32824:e,10752:r}),sampleCoverage:(t,e,r)=>t({32938:e,32939:r}),scissor:(t,e,r,i,n)=>t({3088:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({2962:e,2967:r,2963:i,34816:e,36003:r,36004:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({2964:e,2965:r,2966:i,34817:e,34818:r,34819:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({2978:[e,r,i,n]})},Jf=(t,e)=>t.isEnabled(e),KO={3042:Jf,2884:Jf,2929:Jf,3024:Jf,32823:Jf,32926:Jf,32928:Jf,3089:Jf,2960:Jf,35977:Jf},t$=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Yh(t,e){if(hde(e))return;let r={};for(let n in e){let s=Number(n),o=JH[n];o&&(typeof o=="string"?r[o]=!0:o(t,e[n],s))}let i=t.state&&t.state.cache;if(i)for(let n in r){let s=e$[n];s(t,e,i)}}function YM(t,e=xw){if(typeof e=="number"){let n=e,s=KO[n];return s?s(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let s=KO[n];i[n]=s?s(t,Number(n)):t.getParameter(Number(n))}return i}function r$(t){Yh(t,xw)}function hde(t){for(let e in t)return!1;return!0}function i$(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n{}}={}){this.gl=e,this.cache=r?YM(e):Object.assign({},xw),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){bi(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];Yh(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let s in e){bi(s!==void 0);let o=e[s],c=this.cache[s];i$(o,c)||(r=!0,i=c,n&&!(s in n)&&(n[s]=c),this.cache[s]=o)}return{valueChanged:r,oldValue:i}}};function ug(t){return t.state}function e5(t,e){let{enable:r=!0,copyState:i}=e;if(bi(i!==void 0),!t.state){t.state=new JO(t,{copyState:i}),dde(t);for(let s in QO){let o=QO[s];fde(t,s,o)}n$(t,"getParameter"),n$(t,"isEnabled")}let n=ug(t);return n.enable=r,t}function s0(t){let e=ug(t);e||(e5(t,{copyState:!1}),e=ug(t)),e.push()}function Ap(t){let e=ug(t);bi(e),e.pop()}function n$(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||t$.has(n))return r(n);let s=ug(t);return n in s.cache||(s.cache[n]=r(n)),s.enable?s.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function fde(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...s){let o=ug(t),{valueChanged:c,oldValue:f}=r(o._updateCache,...s);return c&&i(...s),f},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function dde(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=ug(t);n.program!==i&&(e(i),n.program=i)}}var pde={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function s$(t,e){e={...pde,...e};let r=null,i=s=>r=s.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:s}=e;t.addEventListener("webglcontextlost",o=>s(o),!1)}if(e.onContextRestored){let{onContextRestored:s}=e;t.addEventListener("webglcontextrestored",o=>s(o),!1)}return n}function Qu(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function o$(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Qu(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,s=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),c=s||r,f=o||i,y=t.getParameter(7938),b=a$(c,f),M=Ade(c,f),L=mde(c,f);return{type:"webgl",gpu:b,gpuType:L,gpuBackend:M,vendor:c,renderer:f,version:y,shadingLanguage:"glsl",shadingLanguageVersion:300}}function a$(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function Ade(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function mde(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(a$(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function XM(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var tl="texture-compression-bc",Cn="texture-compression-astc",ed="texture-compression-etc2",gde="texture-compression-etc1-webgl",QM="texture-compression-pvrtc-webgl",t5="texture-compression-atc-webgl",vw="float32-renderable-webgl",r5="float16-renderable-webgl",_de="rgb9e5ufloat_renderable-webgl",i5="snorm8-renderable-webgl",bw="norm16-renderable-webgl",n5="snorm16-renderable-webgl",KM="float32-filterable",l$="float16-filterable-webgl",ww="WEBGL_compressed_texture_s3tc",Sw="WEBGL_compressed_texture_s3tc_srgb",Xy="EXT_texture_compression_rgtc",Qy="EXT_texture_compression_bptc",yde="WEBGL_compressed_texture_etc",xde="WEBGL_compressed_texture_astc",vde="WEBGL_compressed_texture_etc1",bde="WEBGL_compressed_texture_pvrtc",wde="WEBGL_compressed_texture_atc",c$="EXT_texture_norm16",u$="EXT_render_snorm",Sde="EXT_color_buffer_float",JM={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat_renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[u$],"norm16-renderable-webgl":[c$],"snorm16-renderable-webgl":[c$,u$],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[ww,Sw,Xy,Qy],"texture-compression-bc5-webgl":[Xy],"texture-compression-bc7-webgl":[Qy],"texture-compression-etc2":[yde],"texture-compression-astc":[xde],"texture-compression-etc1-webgl":[vde],"texture-compression-pvrtc-webgl":[bde],"texture-compression-atc-webgl":[wde]};function h$(t){return t in JM}function f$(t,e,r){return(JM[e]||[]).every(n=>Qu(t,n,r))}var eP={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:i5},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:i5},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:r5,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:bw,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:n5},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:i5},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:r5,filter:l$,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:bw},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:n5},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:vw,filter:KM},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:_de},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:vw,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:bw},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:bw},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:vw,filter:KM,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:r5,filter:l$},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:bw,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:n5},"rgb32float-webgl":{gl:34837,render:vw,filter:KM,gl2ext:Sde,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:vw,filter:KM,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:ww,f:tl},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Sw,f:tl},"bc1-rgba-unorm":{gl:33777,x:ww,f:tl},"bc1-rgba-unorm-srgb":{gl:35916,x:Sw,f:tl},"bc2-rgba-unorm":{gl:33778,x:ww,f:tl},"bc2-rgba-unorm-srgb":{gl:35918,x:Sw,f:tl},"bc3-rgba-unorm":{gl:33779,x:ww,f:tl},"bc3-rgba-unorm-srgb":{gl:35919,x:Sw,f:tl},"bc4-r-unorm":{gl:36283,x:Xy,f:tl},"bc4-r-snorm":{gl:36284,x:Xy,f:tl},"bc5-rg-unorm":{gl:36285,x:Xy,f:tl},"bc5-rg-snorm":{gl:36286,x:Xy,f:tl},"bc6h-rgb-ufloat":{gl:36495,x:Qy,f:tl},"bc6h-rgb-float":{gl:36494,x:Qy,f:tl},"bc7-rgba-unorm":{gl:36492,x:Qy,f:tl},"bc7-rgba-unorm-srgb":{gl:36493,x:Qy,f:tl},"etc2-rgb8unorm":{gl:37492,f:ed},"etc2-rgb8unorm-srgb":{gl:37494,f:ed},"etc2-rgb8a1unorm":{gl:37496,f:ed},"etc2-rgb8a1unorm-srgb":{gl:37497,f:ed},"etc2-rgba8unorm":{gl:37493,f:ed},"etc2-rgba8unorm-srgb":{gl:37495,f:ed},"eac-r11unorm":{gl:37488,f:ed},"eac-r11snorm":{gl:37489,f:ed},"eac-rg11unorm":{gl:37490,f:ed},"eac-rg11snorm":{gl:37491,f:ed},"astc-4x4-unorm":{gl:37808,f:Cn},"astc-4x4-unorm-srgb":{gl:37840,f:Cn},"astc-5x4-unorm":{gl:37809,f:Cn},"astc-5x4-unorm-srgb":{gl:37841,f:Cn},"astc-5x5-unorm":{gl:37810,f:Cn},"astc-5x5-unorm-srgb":{gl:37842,f:Cn},"astc-6x5-unorm":{gl:37811,f:Cn},"astc-6x5-unorm-srgb":{gl:37843,f:Cn},"astc-6x6-unorm":{gl:37812,f:Cn},"astc-6x6-unorm-srgb":{gl:37844,f:Cn},"astc-8x5-unorm":{gl:37813,f:Cn},"astc-8x5-unorm-srgb":{gl:37845,f:Cn},"astc-8x6-unorm":{gl:37814,f:Cn},"astc-8x6-unorm-srgb":{gl:37846,f:Cn},"astc-8x8-unorm":{gl:37815,f:Cn},"astc-8x8-unorm-srgb":{gl:37847,f:Cn},"astc-10x5-unorm":{gl:37819,f:Cn},"astc-10x5-unorm-srgb":{gl:37851,f:Cn},"astc-10x6-unorm":{gl:37817,f:Cn},"astc-10x6-unorm-srgb":{gl:37849,f:Cn},"astc-10x8-unorm":{gl:37818,f:Cn},"astc-10x8-unorm-srgb":{gl:37850,f:Cn},"astc-10x10-unorm":{gl:37819,f:Cn},"astc-10x10-unorm-srgb":{gl:37851,f:Cn},"astc-12x10-unorm":{gl:37820,f:Cn},"astc-12x10-unorm-srgb":{gl:37852,f:Cn},"astc-12x12-unorm":{gl:37821,f:Cn},"astc-12x12-unorm-srgb":{gl:37853,f:Cn},"pvrtc-rgb4unorm-webgl":{gl:35840,f:QM},"pvrtc-rgba4unorm-webgl":{gl:35842,f:QM},"pvrtc-rbg2unorm-webgl":{gl:35841,f:QM},"pvrtc-rgba2unorm-webgl":{gl:35843,f:QM},"etc1-rbg-unorm-webgl":{gl:36196,f:gde},"atc-rgb-unorm-webgl":{gl:35986,f:t5},"atc-rgba-unorm-webgl":{gl:35986,f:t5},"atc-rgbai-unorm-webgl":{gl:34798,f:t5}},Tde={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},Ede={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function tP(t,e,r){let i=eP[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?!!Qu(t,n,r):!0}function s5(t){let r=eP[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function d$(t,e,r){if(!tP(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(ZE(e).signed)return!1}catch{return!1}return e.endsWith("32float")?!!Qu(t,"OES_texture_float_linear, extensions",r):e.endsWith("16float")?!!Qu(t,"OES_texture_half_float_linear, extensions",r):!0}function p$(t,e,r){return!(!tP(t,e,r)||typeof e=="number")}function Ky(t){let e=eP[t],r=s5(t),i=ZE(t);return{format:r,dataFormat:e?.dataFormat||Mde(i.format,i.integer,i.normalized,r),type:i.dataType?XM(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function A$(t){let e=eP[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function o5(t){let e=Ky(t),r=Tde[e.dataFormat]||4,i=Ede[e.type]||1;return r*i}function Mde(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var m$={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},rP=class extends Mb{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Qu(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),h$(e)&&f$(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(m$),...Object.keys(JM)]}getWebGLFeature(e){let r=m$[e];return typeof r=="string"?!!Qu(this.gl,r,this.extensions):!!r}};var iP=class extends Eb{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Ku(t,e,r){if(Pde(e))return r(t);let{nocatch:i=!0}=e;s0(t),Yh(t,e);let n;if(i)n=r(t),Ap(t);else try{n=r(t)}finally{Ap(t)}return n}function Pde(t){for(let e in t)return!1;return!0}function _$(t,e,r,i){if(qA(e))return i(t);let n=t;s0(n.gl);try{return Cde(t,e),Yh(n.gl,r),i(t)}finally{Ap(n.gl)}}function Cde(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(hg("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&(i.enable(32823),i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let s=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=hg("provokingVertex",e.provokingVertex,{first:36429,last:36430});s?.provokingVertexWEBGL(o)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let s=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=hg("polygonMode",e.polygonMode,{fill:6914,line:6913});s?.polygonModeWEBGL(1028,o),s?.polygonModeWEBGL(1029,o)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(Rde("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(sP("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&xt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,s=sP("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,s,0,n),i.stencilFuncSeparate(1029,s,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=a5("stencilPassOperation",e.stencilPassOperation),s=a5("stencilFailOperation",e.stencilFailOperation),o=a5("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,s,o,n),i.stencilOpSeparate(1029,s,o,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=g$("blendColorOperation",e.blendColorOperation||"add"),s=g$("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,s);let o=nP("blendColorSrcFactor",e.blendColorSrcFactor||"one"),c=nP("blendColorDstFactor",e.blendColorDstFactor||"zero"),f=nP("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),y=nP("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(o,c,f,y)}}function sP(t,e){return hg(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function a5(t,e){return hg(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function g$(t,e){return hg(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function nP(t,e){return hg(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Ide(t,e){return`Illegal parameter ${e} for ${t}`}function hg(t,e,r){if(!(e in r))throw new Error(Ide(t,e));return r[e]}function Rde(t,e){return e}function oP(t){let e={};return t.addressModeU&&(e[10242]=l5(t.addressModeU)),t.addressModeV&&(e[10243]=l5(t.addressModeV)),t.addressModeW&&(e[32882]=l5(t.addressModeW)),t.magFilter&&(e[10240]=y$(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=kde(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=sP("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function l5(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function y$(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function kde(t,e){if(!e)return y$(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var Cl=class extends Yi{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Lde(this.props.usage),this.glUsage=Dde(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){bi(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function Lde(t){return t&Yi.INDEX?34963:t&Yi.VERTEX?34962:t&Yi.UNIFORM?35345:34962}function Dde(t){return t&Yi.INDEX||t&Yi.VERTEX?35044:t&Yi.UNIFORM?35048:35044}var fg=class extends Qm{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=oP(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var Xh=class extends Ym{device;gl;handle;texture;constructor(e,r){super(e,{...yo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Ode={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},fc=class t extends yo{static FACES=[34069,34070,34071,34072,34073,34074];MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Ode,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Bde(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:tD(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new Xh(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(Q=>this.initialize(Object.assign({},e,{pixels:Q,data:Q}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyStatethis.initialize(e)),this;let{parameters:n={}}=e,{pixels:s=null,pixelStore:o={},textureUnit:c=void 0,mipmaps:f=!0}=e;r||(r=s);let{width:y,height:b,dataFormat:M,type:L,compressed:N=!1}=e,{depth:V=0}=e,$=s5(e.format);return{width:y,height:b,compressed:N,dataFormat:M,type:L}=this._deduceParameters({format:e.format,type:L,dataFormat:M,compressed:N,data:r,width:y,height:b}),this.width=y,this.height=b,this.glFormat=$,this.type=L,this.dataFormat=M,this.textureUnit=c,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=f,this.setImageData({data:r,width:y,height:b,depth:V,format:$,type:L,dataFormat:M,parameters:o,compressed:N}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),f&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof fg?(this.sampler=e,r=e.props):(this.sampler=new fg(this.device,e),r=e);let i=oP(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:s=this.glFormat,offset:o=0,parameters:c={}}=e,{data:f=null,type:y=this.type,width:b=this.width,height:M=this.height,dataFormat:L=this.dataFormat,compressed:N=!1}=e;f||(f=i),{type:y,dataFormat:L,compressed:N,width:b,height:M}=this._deduceParameters({format:this.props.format,type:y,dataFormat:L,compressed:N,data:f,width:b,height:M});let{gl:V}=this;V.bindTexture(this.target,this.handle);let $=null;if({data:f,dataType:$}=this._getDataType({data:f,compressed:N}),Ku(this.gl,c,()=>{switch($){case"null":V.texImage2D(r,n,s,b,M,0,L,y,f);break;case"typed-array":V.texImage2D(r,n,s,b,M,0,L,y,f,o);break;case"buffer":this.device.gl.bindBuffer(35052,f.handle||f),this.device.gl.texImage2D(r,n,s,b,M,0,L,y,o),this.device.gl.bindBuffer(35052,null);break;case"browser-object":V.texImage2D(r,n,s,b,M,0,L,y,f);break;case"compressed":for(let[Q,q]of f.entries())V.compressedTexImage2D(r,Q,q.format,q.width,q.height,0,q.data);break;default:bi(!1,"Unknown image data type")}}),f&&f.byteLength)this.trackAllocatedMemory(f.byteLength,"Texture");else{let Q=o5(this.props.format);this.trackAllocatedMemory(this.width*this.height*Q,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:s=0,width:o=this.width,height:c=this.height,level:f=0,glFormat:y=this.glFormat,type:b=this.type,dataFormat:M=this.dataFormat,compressed:L=!1,offset:N=0,parameters:V={}}){if({type:b,dataFormat:M,compressed:L,width:o,height:c}=this._deduceParameters({format:this.props.format,type:b,dataFormat:M,compressed:L,data:i,width:o,height:c}),bi(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let $=i;i=$.data,o=$.shape[0],c=$.shape[1]}i instanceof Cl&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Ku(this.gl,V,()=>{L?this.gl.compressedTexSubImage2D(e,f,n,s,o,c,y,i):i===null?this.gl.texSubImage2D(e,f,n,s,o,c,M,b,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,f,n,s,o,c,M,b,i,N):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,f,n,s,o,c,M,b,N),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,f,n,s,o,c,M,b,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return xt.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof Cl?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:s,dataFormat:o,type:c,compressed:f}=e,y=Ky(r);return o=o||y.dataFormat,c=c||y.type,f=f||y.compressed,{width:n,height:s}=this._deduceImageSize(i,n,s),{dataFormat:o,type:c,compressed:f,width:n,height:s,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},bi(n,"Could not deduced texture size"),bi(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),bi(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:s,data:o,format:c=6408,type:f=5121}=e,y=s||o,b=await Promise.all(t.FACES.map(M=>{let L=y[M];return Promise.all(Array.isArray(L)?L:[L])}));this.bind(),t.FACES.forEach((M,L)=>{b[L].length>1&&this.props.mipmaps!==!1&&xt.warn(`${this.id} has mipmap and multiple LODs.`)(),b[L].forEach((N,V)=>{i&&n?r.texImage2D(M,V,c,i,n,0,c,f,N):r.texImage2D(M,V,c,c,f,N)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:s,data:o,format:c=6408,type:f=5121}=e,{gl:y}=this,b=s||o;return this.bind(),b instanceof Promise?b.then(M=>this.setImageDataForFace(Object.assign({},e,{face:r,data:M,pixels:M}))):this.width||this.height?y.texImage2D(r,0,c,i,n,0,c,f,b):y.texImage2D(r,0,c,c,f,b),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:s,width:o,height:c,depth:f=1,offset:y=0,data:b,parameters:M={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let L=Ky(n);if(Ku(this.gl,M,()=>{ArrayBuffer.isView(b)&&this.gl.texImage3D(this.target,r,L.format,o,c,f,0,L.dataFormat,L.type,b),b instanceof Cl&&(this.gl.bindBuffer(35052,b.handle),this.gl.texImage3D(this.target,r,i,o,c,f,0,n,s,y))}),b&&b.byteLength)this.trackAllocatedMemory(b.byteLength,"Texture");else{let N=o5(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*N,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!qA(e)){Fde(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),s=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,s);break;default:this.gl.texParameteri(this.target,n,s);break}}this.gl.bindTexture(this.target,null)}}};function Bde(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function Fde(t){xt.log(1,"texture sampler parameters",t)()}var td=class extends Km{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();let n=this.gl.bindFramebuffer(36160,this.handle);for(let s=0;sxt.info("Spector capture started:",e)()),dc?.onCapture.add(e=>{xt.info("Spector capture complete:",e)(),dc?.getResultUI(),dc?.resultView.display(),dc?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return dc;dc?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{xt.info("Spector capture stopped after 2 seconds")(),dc?.stopCapture()})}return dc}var Wde="https://unpkg.com/webgl-debug@2.0.1/index.js";function w$(t){return t.luma=t.luma||{},t.luma}async function S$(){Qa()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Nb(Wde))}function T$(t,e={}){return t?e.debug?$de(t,e):Hde(t):null}function Hde(t){let e=w$(t);return e.realContext?e.realContext:t}function $de(t,e){if(!globalThis.WebGLDebugUtils)return xt.warn("webgl-debug not loaded")(),t;let r=w$(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...n0,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,qde.bind(null,e),Gde.bind(null,e));for(let o in n0)!(o in i)&&typeof n0[o]=="number"&&(i[o]=n0[o]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let s=Object.create(n);return r.realContext=t,r.debugContext=s,s.debug=!0,s}function c5(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function qde(t,e,r,i){i=Array.from(i).map(c=>c===void 0?"undefined":c);let n=globalThis.WebGLDebugUtils.glEnumToString(e),s=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),o=`${n} in gl.${r}(${s})`;xt.error(o)();debugger;if(t.throwOnError)throw new Error(o)}function Gde(t,e,r){let i="";if(xt.level>=1&&(i=c5(e,r),xt.log(1,i)()),t.break&&t.break.length>0&&(i=i||c5(e,r),t.break.every(s=>i.indexOf(s)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||c5(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);xt.error(`Undefined argument: ${i}`)();debugger}}function M$(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[M,L]=n;r.push({message:L.trim(),type:E$(M),lineNum:0,linePos:0});continue}let[s,o,c,...f]=n,y=parseInt(c,10);isNaN(y)&&(y=0);let b=parseInt(o,10);isNaN(b)&&(b=0),r.push({message:f.join(":").trim(),type:E$(s),lineNum:y,linePos:b})}return r}function E$(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var lP=class extends Xm{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return M$(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100 +${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),xt.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}xt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),xt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(s=>setTimeout(s,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var Zde=256,Yde=1024,Xde=16384,u5=6144,Qde=[1,2,4,8],cP=class extends Cb{device;glParameters;constructor(e,r){super(e,r),this.device=e,s0(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ap(this.device.gl)}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=Qde.map(i=>!!(i&e.colorMask))),this.glParameters=r,Yh(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Xde,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Zde,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Yde,e.clearStencil=this.props.clearStencil),r!==0&&Ku(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Ku(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(u5,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(u5,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(u5,e,r);break}})}};var Kde="Failed to deduce GL constant from typed array";function P$(t){switch(ArrayBuffer.isView(t)?t.constructor:t){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(Kde)}}function Tw(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?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")}}var Jde={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},epe={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},uP=class t{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return Tw(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return bi(e.size),Tw(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new t(Jde,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return t.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return t.getBytesPerVertex(this)}_assign(e={}){return e=eD("Accessor",e,epe),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function C$(t){return tpe.includes(t)}var tpe=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],I$={5126:[5126,1,"float","f32","float32"],35664:[5126,2,"vec2","vec2","float32x2"],35665:[5126,3,"vec3","vec3","float32x3"],35666:[5126,4,"vec4","vec4","float32x4"],5124:[5124,1,"int","i32","sint32"],35667:[5124,2,"ivec2","vec2","sint32x2"],35668:[5124,3,"ivec3","vec3","sint32x3"],35669:[5124,4,"ivec4","vec4","sint32x4"],5125:[5125,1,"uint","u32","uint32"],36294:[5125,2,"uvec2","vec2","uint32x2"],36295:[5125,3,"uvec3","vec3","uint32x3"],36296:[5125,4,"uvec4","vec4","uint32x4"],35670:[5126,1,"bool","f32","float32"],35671:[5126,2,"bvec2","vec2","float32x2"],35672:[5126,3,"bvec3","vec3","float32x3"],35673:[5126,4,"bvec4","vec4","float32x4"],35674:[5126,8,"mat2","mat2x2"],35685:[5126,8,"mat2x3","mat2x3"],35686:[5126,8,"mat2x4","mat2x4"],35687:[5126,12,"mat3x2","mat3x2"],35675:[5126,12,"mat3","mat3x3"],35688:[5126,12,"mat3x4","mat3x4"],35689:[5126,16,"mat4x2","mat4x2"],35690:[5126,16,"mat4x3","mat4x3"],35676:[5126,16,"mat4","mat4x4"]};function h5(t){let e=I$[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function R$(t){let e=I$[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function k$(t,e){let r={attributes:[],bindings:[]};r.attributes=rpe(t,e);let i=spe(t,e);for(let c of i){let f=c.uniforms.map(y=>({name:y.name,format:y.format,byteOffset:y.byteOffset,byteStride:y.byteStride,arrayLength:y.arrayLength}));r.bindings.push({type:"uniform",name:c.name,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:f})}let n=npe(t,e),s=0;for(let c of n)if(C$(c.type)){let{viewDimension:f,sampleType:y}=ape(c.type);r.bindings.push({type:"texture",name:c.name,location:s,viewDimension:f,sampleType:y}),c.textureUnit=s,s+=1}n.length&&(r.uniforms=n);let o=ipe(t,e);return o?.length&&(r.varyings=o),r}function rpe(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n=0){let{attributeType:y}=R$(c),b=/instance/i.test(o)?"instance":"vertex";r.push({name:o,location:f,stepMode:b,type:y})}}return r.sort((n,s)=>n.location-s.location),r}function ipe(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;nn.location-s.location),r}function npe(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n1)for(let N=0;Nt.getActiveUniformBlockParameter(e,s,o),i=[],n=t.getProgramParameter(e,35382);for(let s=0;ss.location-o.location),i}var ope={35678:["2d","float"],35680:["cube","float"],35679:["3d","float"],35682:["3d","depth"],36289:["2d-array","float"],36292:["2d-array","depth"],36293:["cube","float"],36298:["2d","sint"],36299:["3d","sint"],36300:["cube","sint"],36303:["2d-array","uint"],36306:["2d","uint"],36307:["3d","uint"],36308:["cube","uint"],36311:["2d-array","uint"]};function ape(t){let e=ope[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function lpe(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:!!r[2]}}function L$(t,e,r,i){let n=t,s=i;s===!0&&(s=1),s===!1&&(s=0);let o=typeof s=="number"?[s]:s;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,o);case 35664:return t.uniform2fv(e,o);case 35665:return t.uniform3fv(e,o);case 35666:return t.uniform4fv(e,o);case 5124:return t.uniform1iv(e,o);case 35667:return t.uniform2iv(e,o);case 35668:return t.uniform3iv(e,o);case 35669:return t.uniform4iv(e,o);case 35670:return t.uniform1iv(e,o);case 35671:return t.uniform2iv(e,o);case 35672:return t.uniform3iv(e,o);case 35673:return t.uniform4iv(e,o);case 5125:return n.uniform1uiv(e,o,1);case 36294:return n.uniform2uiv(e,o,2);case 36295:return n.uniform3uiv(e,o,3);case 36296:return n.uniform4uiv(e,o,4);case 35674:return t.uniformMatrix2fv(e,!1,o);case 35675:return t.uniformMatrix3fv(e,!1,o);case 35676:return t.uniformMatrix4fv(e,!1,o);case 35685:return n.uniformMatrix2x3fv(e,!1,o);case 35686:return n.uniformMatrix2x4fv(e,!1,o);case 35687:return n.uniformMatrix3x2fv(e,!1,o);case 35688:return n.uniformMatrix3x4fv(e,!1,o);case 35689:return n.uniformMatrix4x2fv(e,!1,o);case 35690:return n.uniformMatrix4x3fv(e,!1,o)}throw new Error("Illegal uniform")}function D$(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function O$(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var B$=4,hP=class extends Zf{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),xt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=k$(this.device.gl,this.handle),xt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=XL(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":xt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let s=this.shaderLayout.bindings.find(o=>o.name===i)||this.shaderLayout.bindings.find(o=>o.name===`${i}Uniforms`);if(!s){let o=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");r?.disableWarnings||xt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||xt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),s.type){case"uniform":if(!(n instanceof Cl)&&!(n.buffer instanceof Cl))throw new Error("buffer value");break;case"texture":if(!(n instanceof Xh||n instanceof fc||n instanceof td))throw new Error("texture value");break;case"sampler":xt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(s.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:s,vertexCount:o,instanceCount:c,isInstanced:f=!1,firstVertex:y=0,transformFeedback:b}=e,M=D$(n),L=!!s.indexBuffer,N=s.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return xt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||o===0)return xt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(o===0)return xt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),s.bindBeforeRender(r),b&&b.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let V=r;return _$(this.device,i,V.glParameters,()=>{L&&f?this.device.gl.drawElementsInstanced(M,o||0,N,y,c||0):L?this.device.gl.drawElements(M,o||0,N,y):f?this.device.gl.drawArraysInstanced(M,y,o||0,c||0):this.device.gl.drawArrays(M,y,o||0),b&&b.end()}),s.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=Fb(e);Object.keys(r).forEach(i=>{xt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),xt.time(B$,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),xt.timeEnd(B$,`linkProgram for ${this.id}`)(),xt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}xt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),xt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(s=>setTimeout(s,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof fc&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let s=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!s)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:o}=n,c=e.getUniformBlockIndex(this.handle,o);if(c===4294967295)throw new Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,i,c),s instanceof Cl?e.bindBufferBase(35345,i,s.handle):e.bindBufferRange(35345,i,s.buffer.handle,s.offset||0,s.size||s.buffer.byteLength-s.offset),i+=1;break;case"texture":if(!(s instanceof Xh||s instanceof fc||s instanceof td))throw new Error("texture");let f;if(s instanceof Xh)f=s.texture;else if(s instanceof fc)f=s;else if(s instanceof td&&s.colorAttachments[0]instanceof Xh)xt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),f=s.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(f.target,f.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:s}=e,o=this.uniforms[r]??s;o!==void 0&&L$(this.device.gl,i,n,o)}}};var fP=class extends Rb{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":cpe(this.device,r.options);break;case"copy-buffer-to-texture":upe(this.device,r.options);break;case"copy-texture-to-buffer":hpe(this.device,r.options);break;case"copy-texture-to-texture":fpe(this.device,r.options);break}}};function cpe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function upe(t,e){throw new Error("Not implemented")}function hpe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:s=e.source.width,height:o=e.source.height,depthOrArrayLayers:c=0,origin:f=[0,0],destination:y,byteOffset:b=0,bytesPerRow:M,rowsPerImage:L}=e;if(n!=="all")throw new Error("not supported");if(i!==0||c!==0||M||L)throw new Error("not implemented");let{framebuffer:N,destroyFramebuffer:V}=F$(r),$;try{let Q=y,q=s||N.width,J=o||N.height,ee=Ky(N.texture.props.format),oe=ee.dataFormat,ve=ee.type;t.gl.bindBuffer(35051,Q.handle),$=t.gl.bindFramebuffer(36160,N.handle),t.gl.readPixels(f[0],f[1],q,J,oe,ve,b)}finally{t.gl.bindBuffer(35051,null),$!==void 0&&t.gl.bindFramebuffer(36160,$),V&&N.destroy()}}function fpe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:s=[0,0],destination:o}=e,{width:c=e.destination.width,height:f=e.destination.height}=e,{framebuffer:y,destroyFramebuffer:b}=F$(r),[M,L]=n,[N,V,$]=s,Q=t.gl.bindFramebuffer(36160,y.handle),q=null,J;if(o instanceof fc)q=o,c=Number.isFinite(c)?c:q.width,f=Number.isFinite(f)?f:q.height,q.bind(0),J=q.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,N,V,M,L,c,f);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,N,V,$,M,L,c,f);break;default:}q&&q.unbind(),t.gl.bindFramebuffer(36160,Q),b&&y.destroy()}function F$(t){if(t instanceof yo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var dP=class extends Ib{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new fP(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var pP=class t extends kb{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return nL()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:s,stride:o,offset:c,normalized:f,integer:y,divisor:b}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),y?this.device.gl.vertexAttribIPointer(e,n,s,o,c):this.device.gl.vertexAttribPointer(e,n,s,f,o,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,b||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:s,byteOffset:o}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,xt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:s,byteOffset:o},this.bindOnUse||this._bindBuffer(i,n,o,s)}getBuffer(e){if(N$(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Cl)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(N$(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let s=r&&r.handle;!s||n===void 0?this.gl.bindBufferBase(35982,e,s):this.gl.bindBufferRange(35982,e,s,i,n)}};function N$(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var mP=class extends Db{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=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++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(s)};requestAnimationFrame(s)}),this._pollingPromise}};function f5(t){switch(t){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 bi(!1),0}}function z$(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return bi(!1),0}}function U$(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:s=36064}=e||{},{target:o=null,sourceWidth:c,sourceHeight:f,sourceType:y}=e||{},{framebuffer:b,deleteFramebuffer:M}=j$(t);bi(b);let{gl:L,handle:N}=b;c=c||b.width,f=f||b.height;let V=s-36064;y=y||b.colorAttachments[V]?.texture?.type||5121,o=mpe(o,y,n,c,f),y=y||P$(o);let $=L.bindFramebuffer(36160,N);return L.readPixels(r,i,c,f,n,y,o),L.bindFramebuffer(36160,$||null),M&&b.destroy(),o}function V$(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:s=6408,targetByteOffset:o=0}=e||{},{sourceWidth:c,sourceHeight:f,sourceType:y}=e||{},{framebuffer:b,deleteFramebuffer:M}=j$(t);bi(b),c=c||b.width,f=f||b.height;let L=b;y=y||5121;let N=r;if(!N){let $=f5(s),Q=z$(y),q=o+c*f*$*Q;N=L.device.createBuffer({byteLength:q})}let V=t.device.createCommandEncoder();return V.copyTextureToBuffer({source:t,width:c,height:f,origin:[i,n],destination:N,byteOffset:o}),V.destroy(),M&&b.destroy(),N}function j$(t){return t instanceof Km?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:Ape(t),deleteFramebuffer:!0}}function Ape(t,e){let{device:r,width:i,height:n,id:s}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${s}`,width:i,height:n,colorAttachments:[t]})}function mpe(t,e,r,i,n){if(t)return t;e=e||5121;let s=Tw(e,{clamped:!1}),o=f5(r);return new s(i*n*o)}var gpe=256,_pe=1024,ype=16384;var xpe="clear: bad arguments";function W$(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:s=null}=e||{},o={};r&&(o.framebuffer=r);let c=0;i&&(c|=ype,i!==!0&&(o.clearColor=i)),n&&(c|=gpe,n!==!0&&(o.clearDepth=n)),s&&(c|=_pe,n!==!0&&(o.clearStencil=n)),bi(c!==0,xpe);let f=t.gl;Ku(f,o,()=>{f.clear(c)})}var Ew=1,dg=class t extends np{static type="webgl";type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof t)return e;if(e?.device instanceof np)return e.device;if(!vpe(e))throw new Error("Invalid WebGL2RenderingContext");return new t({gl:e})}static async create(e={}){xt.groupCollapsed(Ew,"WebGLDevice created")();let r=[];e.debug&&r.push(S$()),e.spector&&r.push(v$()),typeof e.canvas=="string"&&r.push(Zm.pageLoaded);let i=await Promise.allSettled(r);for(let o of i)o.status==="rejected"&&xt.error(`Failed to initialize debug libraries ${o.reason}`)();if(xt.probe(Ew+1,"DOM is loaded")(),e.gl?.device)return xt.warn("reattaching existing device")(),t.attach(e.gl);let n=new t(e),s=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return xt.probe(Ew,s)(),xt.table(Ew,n.info)(),xt.groupEnd(Ew)(),n}constructor(e){super({...e,id:e.id||Ml("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new aP(this,{...e,canvas:i}),this.lost=new Promise(c=>{this._resolveContextLost=c});let n=e.gl||null;if(n||=s$(this.canvasContext.canvas,{...e,onContextLost:c=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,e.spector&&(this.spectorJS=b$({...this.props,canvas:this.handle.canvas})),this.info=o$(this.gl,this._extensions),this.limits=new iP(this.gl),this.features=new rP(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:s=!0,copyState:o=!1}=e;e5(this.gl,{enable:s,copyState:o,log:(...c)=>xt.log(1,...c)()}),e.debug&&(this.gl=T$(this.gl,{...e,throwOnError:!0}),this.debug=!0,xt.level=Math.max(xt.level,1),xt.warn("WebGL debug mode activated. Performance reduced.")())}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return tP(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return d$(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return p$(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new Cl(this,r)}_createTexture(e){return new fc(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new fg(this,e)}createShader(e){return new lP(this,e)}createFramebuffer(e){return new td(this,e)}createVertexArray(e){return new pP(this,e)}createTransformFeedback(e){return new AP(this,e)}createQuerySet(e){return new mP(this,e)}createRenderPipeline(e){return new hP(this,e)}beginRenderPass(e){return new cP(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new dP(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return U$(e,r)}readPixelsToBufferWebGL(e,r){return V$(e,r)}setParametersWebGL(e){Yh(this.gl,e)}getParametersWebGL(e){return YM(this.gl,e)}withParametersWebGL(e,r){return Ku(this.gl,e,r)}clearWebGL(e){W$(this,e)}resetWebGL(){xt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),r$(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){s0(this.gl)}popState(){Ap(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&Tpe(n,r)&&xt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:bpe(this,e,r);break;case Int32Array:wpe(this,e,r);break;case Uint32Array:Spe(this,e,r);break;default:bi(!1)}}getExtension(e){return Qu(this.gl,e,this._extensions),this._extensions}};function vpe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:!!(t&&Number.isFinite(t._version))}function bpe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:bi(!1)}}function wpe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function Spe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function Tpe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r0&&i.type==="pointerdown"&&(Mpe(n,s=>s.pointerId===i.pointerId)||n.push(i)),e.call(this,i)}}function q$(t){t.prototype.handler=function(r){let i=Epe[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.buttons===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:"mouse",srcEvent:r}))}}$$(pg.PointerEventInput);q$(pg.MouseInput);var G$=pg.Manager,Qh=pg;var Kh=class{constructor(e,r,i){this.element=e,this.callback=r,this.options={enable:!0,...i}}};var Z$=Qh?[[Qh.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[Qh.Rotate,{enable:!1}],[Qh.Pinch,{enable:!1}],[Qh.Swipe,{enable:!1}],[Qh.Pan,{threshold:0,enable:!1}],[Qh.Press,{enable:!1}],[Qh.Tap,{event:"doubletap",taps:2,enable:!1}],[Qh.Tap,{event:"anytap",enable:!1}],[Qh.Tap,{enable:!1}]]:null,d5={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},Y$={doubletap:["tap"]},X$={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},Jy={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},Q$={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"},p5={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"};var K$=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",Ag=typeof window<"u"?window:global;var _P=!1;try{let t={get passive(){return _P=!0,!0}};Ag.addEventListener("test",null,t),Ag.removeEventListener("test",null)}catch{_P=!1}var Ppe=K$.indexOf("firefox")!==-1,{WHEEL_EVENTS:Cpe}=Jy,J$="wheel",eq=4.000244140625,Ipe=40,Rpe=.25,Mw=class extends Kh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{if(!this.options.enable)return;let s=n.deltaY;Ag.WheelEvent&&(Ppe&&n.deltaMode===Ag.WheelEvent.DOM_DELTA_PIXEL&&(s/=Ag.devicePixelRatio),n.deltaMode===Ag.WheelEvent.DOM_DELTA_LINE&&(s*=Ipe)),s!==0&&s%eq===0&&(s=Math.floor(s/eq)),n.shiftKey&&s&&(s=s*Rpe),this.callback({type:J$,center:{x:n.clientX,y:n.clientY},delta:-s,srcEvent:n,pointerType:"mouse",target:n.target})},this.events=(this.options.events||[]).concat(Cpe),this.events.forEach(n=>e.addEventListener(n,this.handleEvent,_P?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===J$&&(this.options.enable=r)}};var{MOUSE_EVENTS:kpe}=Jy,tq="pointermove",rq="pointerover",iq="pointerout",nq="pointerenter",sq="pointerleave",Pw=class extends Kh{constructor(e,r,i){super(e,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(kpe),this.events.forEach(s=>e.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===tq&&(this.enableMoveEvent=r),e===rq&&(this.enableOverEvent=r),e===iq&&(this.enableOutEvent=r),e===nq&&(this.enableEnterEvent=r),e===sq&&(this.enableLeaveEvent=r)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(rq,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(iq,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(nq,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(sq,e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit(tq,e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var{KEY_EVENTS:Lpe}=Jy,oq="keydown",aq="keyup",Cw=class extends Kh{constructor(e,r,i){super(e,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:oq,srcEvent:n,key:n.key,target:n.target}),this.enableUpEvent&&n.type==="keyup"&&this.callback({type:aq,srcEvent:n,key:n.key,target:n.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(Lpe),e.tabIndex=this.options.tabIndex||0,e.style.outline="none",this.events.forEach(n=>e.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===oq&&(this.enableDownEvent=r),e===aq&&(this.enableUpEvent=r)}};var lq="contextmenu",Iw=class extends Kh{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{this.options.enable&&this.callback({type:lq,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:"mouse",target:n.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e===lq&&(this.options.enable=r)}};var Dpe={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},Ope=0,Bpe=1,Fpe=2,Npe=1,zpe=2,Upe=4;function cq(t){let e=Dpe[t.srcEvent.type];if(!e)return null;let{buttons:r,button:i}=t.srcEvent,n=!1,s=!1,o=!1;return e===2?(n=!!(r&Npe),s=!!(r&Upe),o=!!(r&zpe)):(n=i===Ope,s=i===Bpe,o=i===Fpe),{leftButton:n,middleButton:s,rightButton:o}}function uq(t,e){let r=t.center;if(!r)return null;let i=e.getBoundingClientRect(),n=i.width/e.offsetWidth||1,s=i.height/e.offsetHeight||1,o={x:(r.x-i.left-e.clientLeft)/n,y:(r.y-i.top-e.clientTop)/s};return{center:r,offsetCenter:o}}var A5={srcElement:"root",priority:0},Rw=class{constructor(e){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=e,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,i,n=!1,s=!1){let{handlers:o,handlersByElement:c}=this,f=A5;typeof i=="string"||i&&i.addEventListener?f={...A5,srcElement:i}:i&&(f={...A5,...i});let y=c.get(f.srcElement);y||(y=[],c.set(f.srcElement,y));let b={type:e,handler:r,srcElement:f.srcElement,priority:f.priority};n&&(b.once=!0),s&&(b.passive=!0),o.push(b),this._active=this._active||!b.passive;let M=y.length-1;for(;M>=0&&!(y[M].priority>=b.priority);)M--;y.splice(M+1,0,b)}remove(e,r){let{handlers:i,handlersByElement:n}=this;for(let s=i.length-1;s>=0;s--){let o=i[s];if(o.type===e&&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(e,r){let i=this.handlersByElement.get(r);if(i){let n=!1,s=()=>{e.handled=!0},o=()=>{e.handled=!0,n=!0},c=[];for(let f=0;f{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var Vpe={events:null,recognizers:null,recognizerOptions:{},Manager:G$,touchAction:"none",tabIndex:0},e1=class{constructor(e=null,r){this._onBasicInput=n=>{let{srcEvent:s}=n,o=X$[s.type];o&&this.manager.emit(o,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={...Vpe,...r},this.events=new Map,this.setElement(e);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(e){if(this.element&&this.destroy(),this.element=e,!e)return;let{options:r}=this,i=r.Manager;this.manager=new i(e,{touchAction:r.touchAction,recognizers:r.recognizers||Z$}).on("hammer.input",this._onBasicInput),r.recognizers||Object.keys(d5).forEach(n=>{let s=this.manager.get(n);s&&d5[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 Mw(e,this._onOtherEvent,{enable:!1}),this.moveInput=new Pw(e,this._onOtherEvent,{enable:!1}),this.keyInput=new Cw(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new Iw(e,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(e,r,i){this._addEventHandler(e,r,i,!1)}once(e,r,i){this._addEventHandler(e,r,i,!0)}watch(e,r,i){this._addEventHandler(e,r,i,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:i}=this;if(!i)return;let n=i.get(e);if(n&&n.options.enable!==r){n.set({enable:r});let s=Y$[e];s&&!this.options.recognizers&&s.forEach(o=>{let c=i.get(o);r?(c.requireFailure(e),n.dropRequireFailure(o)):c.dropRequireFailure(e)})}this.wheelInput.enableEventType(e,r),this.moveInput.enableEventType(e,r),this.keyInput.enableEventType(e,r),this.contextmenuInput.enableEventType(e,r)}_addEventHandler(e,r,i,n,s){if(typeof e!="string"){i=r;for(let b in e)this._addEventHandler(b,e[b],i,n,s);return}let{manager:o,events:c}=this,f=p5[e]||e,y=c.get(f);y||(y=new Rw(this),c.set(f,y),y.recognizerName=Q$[f]||f,o&&o.on(f,y.handleEvent)),y.add(e,r,i,n,s),y.isEmpty()||this._toggleRecognizer(y.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let o in e)this._removeEventHandler(o,e[o]);return}let{events:i}=this,n=p5[e]||e,s=i.get(n);if(s&&(s.remove(e,r),s.isEmpty())){let{recognizerName:o}=s,c=!1;for(let f of i.values())if(f.recognizerName===o&&!f.isEmpty()){c=!0;break}c||this._toggleRecognizer(o,!1)}}};function o0(){}var jpe=({isDragging:t})=>t?"grabbing":"grab",hq={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,glOptions:{},canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:o0,onWebGLInitialized:o0,onResize:o0,onViewStateChange:o0,onInteractionStateChange:o0,onBeforeRender:o0,onAfterRender:o0,onLoad:o0,onError:t=>dr.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:jpe,getTooltip:null,debug:!1,drawPickingColors:!1},t1=class{static{this.defaultProps=hq}static{this.VERSION=mj}constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new lc({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._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=i=>{let{_pickRequest:n}=this;if(i.type==="pointerleave")n.x=-1,n.y=-1,n.radius=0;else{if(i.leftButton||i.rightButton)return;{let s=i.offsetCenter;if(!s)return;n.x=s.x,n.y=s.y,n.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:n.x,y:n.y}),n.event=i},this._onEvent=i=>{let n=Yb[i.type],s=i.offsetCenter;if(!n||!s||!this.layerManager)return;let o=this.layerManager.getLayers(),c=this.deckPicker.getLastPickedObject({x:s.x,y:s.y,layers:o,viewports:this.getViewports(s)},this._lastPointerDownInfo),{layer:f}=c,y=f&&(f[n.handler]||f.props[n.handler]),b=this.props[n.handler],M=!1;y&&(M=y.call(f,c,i)),M||(b?.(c,i),this.widgetManager.onEvent(c,i))},this._onPointerDown=i=>{let n=i.offsetCenter,s=this._pick("pickObject","pickObject Time",{x:n.x,y:n.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=s.result[0]||s.emptyInfo},this.props={...hq,...e},e=this.props,e.viewState&&e.initialViewState&&dr.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device?this.device=e.device:e.gl&&(e.gl instanceof WebGLRenderingContext&&dr.error("WebGL1 context not supported.")(),this.device=dg.attach(e.gl));let r=this.device;r||(sp.registerDevices([dg]),r=sp.createDevice({...e.deviceProps,canvas:this._createCanvas(e)})),this.animationLoop=this._createAnimationLoop(r,e),this.setProps(e),e._typedArrayManagerProps&&qh.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&dr.removed("onLayerHover","onHover")(),"onLayerClick"in e&&dr.removed("onLayerClick","onClick")(),e.initialViewState&&!qn(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),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.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(e),n=this.layerManager.needsRedraw(e),s=this.effectManager.needsRedraw(e),o=this.deckRenderer.needsRedraw(e);return r=r||i||n||s||o,r}redraw(e){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=e||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 Mr(this.viewManager),this.viewManager.views}getViewports(e){return Mr(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let r=this._pick("pickObject","pickObject Time",e).result;return r.length?r[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,r=!1){for(let i in e)this.layerManager.resourceManager.add({resourceId:i,data:e[i],forceUpdate:r})}_removeResources(e){for(let r of e)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_pick(e,r,i){Mr(this.deckPicker);let{stats:n}=this;n.get("Pick Count").incrementCount(),n.get(r).timeStart();let s=this.deckPicker[e]({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(e){let r=e.canvas;return typeof r=="string"&&(r=document.getElementById(r),Mr(r)),r||(r=document.createElement("canvas"),r.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(r)),Object.assign(r.style,e.style),r}_setCanvasSize(e){if(!this.canvas)return;let{width:r,height:i}=e;if(r||r===0){let n=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=n}if(i||i===0){let n=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=n}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let r=e.clientWidth??e.width,i=e.clientHeight??e.height;(r!==this.width||i!==this.height)&&(this.width=r,this.height=i,this.viewManager?.setProps({width:r,height:i}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:i}))}_createAnimationLoop(e,r){let{gl:i,onError:n,useDevicePixels:s}=r;return new sw({device:e,useDevicePixels:s,autoResizeDrawingBuffer:!i,autoResizeViewport:!1,onInitialize:o=>this._setDevice(o.device),onRender:this._onRenderFrame.bind(this),onError:n})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:e}=this.props,r=Array.isArray(e)?e:e?[e]:[new i0({id:"default-view"})];return r.length&&this.props.controller&&(r[0].props.controller=this.props.controller),r}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:e}=this;if(e.event){let{result:r,emptyInfo:i}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=r.length>0;let n=i,s=!1;for(let o of r)n=o,s=o.layer?.onHover(o,e.event)||s;s||(this.props.onHover?.(n,e.event),this.widgetManager.onHover(n,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas),this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof dg&&this.props.onWebGLInitialized(this.device.gl);let r=new sg;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new e1(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let n in Yb)this.eventManager.on(n,this._onEvent);this.viewManager=new cw({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 lw(this.device,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new pw({deck:this,device:this.device}),this.deckRenderer=new mw(this.device),this.deckPicker=new gw(this.device),this.widgetManager=new ZM({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new _w),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,r){let{device:i,gl:n}=this.layerManager.context;this.props.onBeforeRender({device:i,gl:n});let s={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.deckRenderer?.renderLayers(s),s.pass==="screen"&&this.widgetManager.onRedraw({viewports:s.viewports,layers:s.layers}),this.props.onAfterRender({device:i,gl:n})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),dr.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let r=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let r=this.animationLoop.stats;e.get("GPU Time").addTime(r.get("GPU Time").lastTiming),e.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:r}=this;e.fps=r.get("frameRate").getHz(),e.setPropsTime=r.get("setProps Time").time,e.updateAttributesTime=r.get("Update Attributes").time,e.framesRedrawn=r.get("Redraw Count").count,e.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,e.pickCount=r.get("Pick Count").count,e.gpuTime=r.get("GPU Time").time,e.cpuTime=r.get("CPU Time").time,e.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let i=sp.stats.get("Memory Usage");e.bufferMemory=i.get("Buffer Memory").count,e.textureMemory=i.get("Texture Memory").count,e.renderbufferMemory=i.get("Renderbuffer Memory").count,e.gpuMemory=i.get("GPU Memory").count}};function fq(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return Bb(t)}}var dq=tM;function kw(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function a0(t){return t.stride||t.size*t.bytesPerElement}function pq(t,e){return t.type===e.type&&t.size===e.size&&a0(t)===a0(e)&&(t.offset||0)===(e.offset||0)}function m5(t,e){e.offset&&dr.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=a0(t),i=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,n=e.elementOffset||0,s=i*r+n*t.bytesPerElement+(t.offset||0);return{...e,offset:s,stride:r}}function Wpe(t,e){let r=m5(t,e);return{high:r,low:{...r,offset:r.offset+t.size*4}}}var Lw=class{constructor(e,r,i){this._buffer=null,this.device=e,this.id=r.id||"",this.size=r.size||1;let n=r.logicalType||r.type,s=n==="float64",{defaultValue:o}=r;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let c;s?c="float32":!n&&r.isIndexed?c="uint32":c=n||"float32";let f=fq(n||c);this.doublePrecision=s,s&&r.fp64===!1&&(f=Float32Array),this.value=null,this.settings={...r,defaultType:f,defaultValue:o,logicalType:n,type:c,normalized:c.includes("norm"),size:this.size,bytesPerElement:f.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*a0(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),qh.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,r=null){let i={};if(this.state.constant){let n=this.value;if(r){let s=m5(this.getAccessor(),r),o=s.offset/n.BYTES_PER_ELEMENT,c=s.size||this.size;i[e]=n.subarray(o,o+c)}else i[e]=n}else i[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?i[`${e}64Low`]=i[e]:i[`${e}64Low`]=new Float32Array(this.size)),i}_getBufferLayout(e=this.id,r=null){let i=this.getAccessor(),n=[],s={name:this.id,byteStride:a0(i),attributes:n};if(this.doublePrecision){let o=Wpe(i,r||{});n.push(kw(e,{...i,...o.high}),kw(`${e}64Low`,{...i,...o.low}))}else if(r){let o=m5(i,r);n.push(kw(e,{...i,...o}))}else n.push(kw(e,i));return s}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let r=Array.from(this.value);e=[r,r]}else{let{value:r,numInstances:i,size:n}=this,s=i*n;if(r&&s&&r.length>=s){let o=new Array(n).fill(1/0),c=new Array(n).fill(-1/0);for(let f=0;fc[y]&&(c[y]=b)}e=[o,c]}}return this.state.bounds=e,e}setData(e){let{state:r}=this,i;ArrayBuffer.isView(e)?i={value:e}:e instanceof Yi?i={buffer:e}:i=e;let n={...this.settings,...i};if(ArrayBuffer.isView(i.value)){if(!i.type)if(this.doublePrecision&&i.value instanceof Float64Array)n.type="float32";else{let o=dq(i.value);n.type=n.normalized?o.replace("int","norm"):o}n.bytesPerElement=i.value.BYTES_PER_ELEMENT,n.stride=a0(n)}if(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=ArrayBuffer.isView(s)?s:new Float32Array(s)}else if(i.buffer){let s=i.buffer;r.externalBuffer=s,r.constant=!1,this.value=i.value||null}else if(i.value){this._checkExternalBuffer(i);let s=i.value;r.externalBuffer=null,r.constant=!1,this.value=s;let{buffer:o}=this,c=a0(n),f=(n.vertexOffset||0)*c;if(this.doublePrecision&&s instanceof Float64Array&&(s=VM(s,n)),this.settings.isIndexed){let b=this.settings.defaultType;s.constructor!==b&&(s=new b(s))}let y=s.byteLength+f+c*2;(!o||o.byteLength(r+128)/255*2-1);case"snorm16":return new Float32Array(e).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(r=>r/255);case"unorm16":return new Float32Array(e).map(r=>r/65535);default:return e}}_normalizeValue(e,r,i){let{defaultValue:n,size:s}=this.settings;if(Number.isFinite(e))return r[i]=e,r;if(!e){let o=s;for(;--o>=0;)r[i+o]=n[o];return r}switch(s){case 4:r[i+3]=Number.isFinite(e[3])?e[3]:n[3];case 3:r[i+2]=Number.isFinite(e[2])?e[2]:n[2];case 2:r[i+1]=Number.isFinite(e[1])?e[1]:n[1];case 1:r[i+0]=Number.isFinite(e[0])?e[0]:n[0];break;default:let o=s;for(;--o>=0;)r[i+o]=Number.isFinite(e[o])?e[o]:n[o]}return r}_areValuesEqual(e,r){if(!e||!r)return!1;let{size:i}=this;for(let n=0;n0&&(mq.length=t.length,i=mq):i=Aq,(e>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(e,r),n.index=e-1),{iterable:i,objectInfo:n}}function yP(t){return t&&t[Symbol.asyncIterator]}function xP(t,e){let{size:r,stride:i,offset:n,startIndices:s,nested:o}=e,c=t.BYTES_PER_ELEMENT,f=i?i/c:r,y=n?n/c:0,b=Math.floor((t.length-y)/f);return(M,{index:L,target:N})=>{if(!s){let q=L*f+y;for(let J=0;J=e[1]))return t;let r=[],i=t.length,n=0;for(let s=0;se[1]?r.push(o):e=[Math.min(o[0],e[0]),Math.max(o[1],e[1])]}return r.splice(n,0,e),r}var $pe={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function vP(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});let r=t.type||"interpolation";return{...$pe[r],...e,...t,type:r}}var mg=class extends Lw{constructor(e,r){super(e,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:Dw}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!e,r}layoutChanged(){return this.state.layoutChanged}setAccessor(e){this.state.layoutChanged||=!pq(e,this.getAccessor()),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:r}=this.settings,i=this.settings.transition,n=Array.isArray(r)?e[r.find(s=>e[s])]:e[r];return vP(n,i)}setNeedsUpdate(e=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),r){let{startRow:i=0,endRow:n=1/0}=r;this.state.updateRanges=_q(this.state.updateRanges,[i,n])}else this.state.updateRanges=Dw}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=gq}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(e,r.updateRanges!==Dw),!0):!1}updateBuffer({numInstances:e,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:s},settings:{update:o,noAlloc:c}}=this,f=!0;if(o){for(let[y,b]of s)o.call(n,this,{data:r,startRow:y,endRow:b,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLengthb?y.set(ee,$):(e._normalizeValue(ee,q.target,0),$O({target:y,source:q.target,start:$,count:oe}));$+=oe*b}else e._normalizeValue(ee,y,$),$+=b}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,r=Math.min(4,this.size);if(e&&e.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(e[3]);case 3:i=i&&Number.isFinite(e[2]);case 2:i=i&&Number.isFinite(e[1]);case 1:i=i&&Number.isFinite(e[0]);break;default:i=!1}if(!i)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function g5(t){let{source:e,target:r,start:i=0,size:n,getData:s}=t,o=t.end||r.length,c=e.length,f=o-i;if(c>f){r.set(e.subarray(0,f),i);return}if(r.set(e,i),!s)return;let y=c;for(;yi(b+c,M)),y=Math.min(n.length,s.length);for(let b=1;bc}){let c=r.doublePrecision&&r.value instanceof Float64Array?2:1,f=r.size*c,y=r.byteOffset,b=r.settings.bytesPerElement<4?y/r.settings.bytesPerElement*4:y,M=r.startIndices,L=s&&M,N=r.isConstant;if(!L&&e&&i>=n)return e;let V=r.value instanceof Float64Array?Float32Array:r.value.constructor,$=N?r.value:new V(r.getBuffer().readSyncWebGL(y,n*V.BYTES_PER_ELEMENT).buffer);if(r.settings.normalized&&!N){let ee=o;o=(oe,ve)=>r.normalizeConstant(ee(oe,ve))}let Q=N?(ee,oe)=>o($,oe):(ee,oe)=>o($.subarray(ee+y,ee+y+f),oe),q=e?new Float32Array(e.readSyncWebGL(b,i*4).buffer):new Float32Array(0),J=new Float32Array(n);return yq({source:q,target:J,sourceStartIndices:s,targetStartIndices:M,size:f,getData:Q}),(!e||e.byteLength0||n.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}},Ype=`#version 300 es +#define SHADER_NAME spring-transition-vertex-shader + +#define EPSILON 0.00001 + +uniform float stiffness; +uniform float damping; +in ATTRIBUTE_TYPE aPrev; +in ATTRIBUTE_TYPE aCur; +in ATTRIBUTE_TYPE aTo; +out ATTRIBUTE_TYPE vNext; +out float vIsTransitioningFlag; + +ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) { + ATTRIBUTE_TYPE velocity = cur - prev; + ATTRIBUTE_TYPE delta = dest - cur; + ATTRIBUTE_TYPE spring = delta * stiffness; + ATTRIBUTE_TYPE damper = velocity * -1.0 * damping; + return spring + damper + velocity + cur; +} + +void main(void) { + bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON; + vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0; + + vNext = getNextValue(aCur, aPrev, aTo); + gl_Position = vec4(0, 0, 0, 1); + gl_PointSize = 100.0; +} +`,Xpe=`#version 300 es +#define SHADER_NAME spring-transition-is-transitioning-fragment-shader + +in float vIsTransitioningFlag; + +out vec4 fragColor; + +void main(void) { + if (vIsTransitioningFlag == 0.0) { + discard; + } + fragColor = vec4(1.0); +}`;function Qpe(t,e){let r=bP(e.size),i=wP(e.size);return new e0(t,{vs:Ype,fs:Xpe,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function Kpe(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function Jpe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var eAe={interpolation:Ow,spring:Bw},Fw=class{constructor(e,{id:r,timeline:i}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in e){let s=e[n],o=s.getTransitionSetting(r);o&&this._updateAttribute(n,s,o)}for(let n in this.transitions){let s=e[n];(!s||!s.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(e[r]=i.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,i){let n=this.transitions[e],s=!n||n.type!==i.type;if(s){n&&this._removeTransition(e);let o=eAe[i.type];o?this.transitions[e]=new o({attribute:r,timeline:this.timeline,device:this.device}):(dr.error(`unsupported transition type '${i.type}'`)(),s=!1)}(s||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}};var wq="attributeManager.invalidate",tAe="attributeManager.updateStart",rAe="attributeManager.updateEnd",iAe="attribute.updateStart",nAe="attribute.allocate",sAe="attribute.updateEnd",rd=class{constructor(e,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=Qf(OH),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new Fw(e,{id:`${r}-transitions`,timeline:n}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let i=this._invalidateTrigger(e,r);Os(wq,this,e,i)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Os(wq,this,"all")}update({data:e,numInstances:r,startIndices:i=null,transitions:n,props:s={},buffers:o={},context:c={}}){let f=!1;Os(tAe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let y in this.attributes){let b=this.attributes[y],M=b.settings.accessor;b.startIndices=i,b.numInstances=r,s[y]&&dr.removed(`props.${y}`,`data.attributes.${y}`)(),b.setExternalBuffer(o[y])||b.setBinaryValue(typeof M=="string"?o[M]:void 0,e.startIndices)||typeof M=="string"&&!o[M]&&b.setConstantValue(s[M])||b.needsUpdate()&&(f=!0,this._updateAttribute({attribute:b,numInstances:r,data:e,props:s,context:c})),this.needsRedraw=this.needsRedraw||b.needsRedraw()}f&&Os(rAe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(i=>this.attributes[i]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let s in r){let o=r[s];o.needsRedraw(e)&&!i.hasAttribute(s)&&(n[s]=o)}return n}getBufferLayouts(e){return Object.values(this.getAttributes()).map(r=>r.getBufferLayout(e))}_add(e,r){for(let i in e){let n=e[i],s={...n,id:i,size:n.isIndexed&&1||n.size||1,...r};this.attributes[i]=new mg(this.device,s)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(n=>{e[n]||(e[n]=[]),e[n].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:i,updateTriggers:n}=this,s=n[e];return s&&s.forEach(o=>{let c=i[o];c&&c.setNeedsUpdate(c.id,r)}),s}_updateAttribute(e){let{attribute:r,numInstances:i}=e;if(Os(iAe,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Os(nAe,r,i),r.updateBuffer(e)&&(this.needsRedraw=!0,Os(sAe,r,i))}};var Nw=class extends Zh{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:i,duration:n,easing:s}}=this,o=s(e/n);this._value=Ka(r,i,o)}};var Sq=1e-5;function Tq(t,e,r,i,n){let s=e-t,c=(r-e)*n,f=-s*i;return c+f+s+e}function oAe(t,e,r,i,n){if(Array.isArray(r)){let s=[];for(let o=0;o0}add(e,r,i,n){let{transitions:s}=this;if(s.has(e)){let f=s.get(e),{value:y=f.settings.fromValue}=f;r=y,this.remove(e)}if(n=vP(n),!n)return;let o=aAe[n.type];if(!o){dr.error(`unsupported transition type '${n.type}'`)();return}let c=new o(this.timeline);c.start({...n,fromValue:r,toValue:i}),s.set(e,c)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,i]of this.transitions)i.update(),e[r]=i.value,i.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function Pq(t){let e=t[Xu];for(let r in e){let i=e[r],{validate:n}=i;if(n&&!n(t[r],i))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function Cq(t,e){let r=Vw({newProps:t,oldProps:e,propTypes:t[Xu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=cAe(t,e),n=!1;return i||(n=uAe(t,e)),{dataChanged:i,propsChanged:r,updateTriggersChanged:n,extensionsChanged:hAe(t,e),transitionsChanged:lAe(t,e)}}function lAe(t,e){if(!t.transitions)return!1;let r={},i=t[Xu],n=!1;for(let s in t.transitions){let o=i[s],c=o&&o.type;(c==="number"||c==="color"||c==="array")&&_5(t[s],e[s],o)&&(r[s]=!0,n=!0)}return n?r:!1}function Vw({newProps:t,oldProps:e,ignoreProps:r={},propTypes:i={},triggerName:n="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${n} changed shallowly`;if(typeof e!="object"||e===null)return`${n} changed shallowly`;for(let s of Object.keys(t))if(!(s in r)){if(!(s in e))return`${n}.${s} added`;let o=_5(t[s],e[s],i[s]);if(o)return`${n}.${s} ${o}`}for(let s of Object.keys(e))if(!(s in r)){if(!(s in t))return`${n}.${s} dropped`;if(!Object.hasOwnProperty.call(t,s)){let o=_5(t[s],e[s],i[s]);if(o)return`${n}.${s} ${o}`}}return!1}function _5(t,e,r){let i=r&&r.equal;return i&&!i(t,e,r)||!i&&(i=t&&e&&t.equals,i&&!i.call(t,e))?"changed deeply":!i&&e!==t?"changed shallowly":null}function cAe(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:i,_dataDiff:n}=t;return i?i(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&n&&(r=n(t.data,e.data)||r),r}function uAe(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&Mq(t,e,"all"))return{all:!0};let r={},i=!1;for(let n in t.updateTriggers)n!=="all"&&Mq(t,e,n)&&(r[n]=!0,i=!0);return i?r:!1}function hAe(t,e){if(e===null)return!0;let r=e.extensions,{extensions:i}=t;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 e)if(!t.inject)r.inject=e.inject;else{let i={...t.inject};for(let n in e.inject)i[n]=(i[n]||"")+e.inject[n];r.inject=i}return r}var mAe={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},x5={};function Rq(t,e,r,i){if(r instanceof yo)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let n=null;r.compressed&&(n={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let s=e.createTexture({...r,sampler:{...mAe,...n,...i}});return x5[s.id]=t,s}function kq(t,e){!e||!(e instanceof yo)||x5[e.id]===t&&(e.delete(),delete x5[e.id])}var gAe={boolean:{validate(t,e){return!0},equal(t,e,r){return!!t==!!e}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||v5(t)&&(t.length===3||t.length===4)},equal(t,e,r){return qn(t,e,1)}},accessor:{validate(t,e){let r=MP(t);return r==="function"||r===MP(e.value)},equal(t,e,r){return typeof e=="function"?!0:qn(t,e,1)}},array:{validate(t,e){return e.optional&&!t||v5(t)},equal(t,e,r){let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?qn(t,e,n):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?qn(t,e,n):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:i}=r.props;return i?i(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let i=r.context;return!i||!i.device?null:Rq(r.id,i.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{kq(r.id,t)}}};function Lq(t){let e={},r={},i={};for(let[n,s]of Object.entries(t)){let o=s?.deprecatedFor;if(o)i[n]=Array.isArray(o)?o:[o];else{let c=_Ae(n,s);e[n]=c,r[n]=c.value}}return{propTypes:e,defaultProps:r,deprecatedProps:i}}function _Ae(t,e){switch(MP(e)){case"object":return jw(t,e);case"array":return jw(t,{type:"array",value:e,compare:!1});case"boolean":return jw(t,{type:"boolean",value:e});case"number":return jw(t,{type:"number",value:e});case"function":return jw(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function jw(t,e){return"type"in e?{name:t,...gAe[e.type],...e}:"value"in e?{name:t,type:MP(e.value),...e}:{name:t,type:"object",value:e}}function v5(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function MP(t){return v5(t)?"array":t===null?"null":typeof t}function Dq(t,e){let r;for(let s=e.length-1;s>=0;s--){let o=e[s];"extensions"in o&&(r=o.extensions)}let i=b5(t.constructor,r),n=Object.create(i);n[Zy]=t,n[Kf]={},n[Gh]={};for(let s=0;s{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];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||MAe}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return!!(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[Zy]||this.component;let r=e[Gh]||{},i=e[Kf]||e,n=e[hp]||{};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(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(yP(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let i=this.asyncProps[e];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let i=this.asyncProps[e];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(e,r,i){let n=this.asyncProps[e];n&&i>=n.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let i=this.asyncProps[e];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(s=>{this.component&&(s=this._postProcessValue(i,s),this._setAsyncPropValue(e,s,n),this._onResolve(e,s))}).catch(s=>{this._onError(e,s)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let i=this.asyncProps[e];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,s=[],o=0;for await(let c of r){if(!this.component)return;let{dataTransform:f}=this.component.props;f?s=f(c,s):s=s.concat(c),Object.defineProperty(s,"__diff",{enumerable:!1,value:[{startRow:o,endRow:s.length}]}),o=s.length,this._setAsyncPropValue(e,s,n)}this._onResolve(e,s)}_postProcessValue(e,r){let i=e.type;return i&&this.component&&(i.release&&i.release(e.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let n=this.component&&this.component.props[Xu];this.asyncProps[e]={type:n&&n[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var $w=class extends Hw{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:e,layer:i}):super._fetch(e,r)}_onResolve(e,r){let i=this.layer;if(i){let n=i.props.onDataLoad;e==="data"&&n&&n(r,{propName:e,layer:i})}}_onError(e,r){let i=this.layer;i&&i.raiseError(r,`loading ${e} of ${this.layer}`)}};var PAe="layer.changeFlag",CAe="layer.initialize",IAe="layer.update",RAe="layer.finalize",kAe="layer.matched",Bq=2**24-1,LAe=Object.freeze([]),DAe=Qf(({oldViewport:t,viewport:e})=>t.equals(e)),id=new Uint8ClampedArray(0),OAe={data:{type:"data",value:LAe,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__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:(t,{propName:e,layer:r,loaders:i,loadOptions:n,signal:s})=>{let{resourceManager:o}=r.context;n=n||r.getLoadOptions(),i=i||r.props.loaders,s&&(n={...n,fetch:{...n?.fetch,signal:s}});let c=o.contains(t);return!c&&!n&&(o.add({resourceId:t,data:HA(t,i),persistent:!1}),c=!0),c?o.subscribe({resourceId:t,onChange:f=>r.internalState?.reloadAsyncProp(e,f),consumerId:r.id,requestId:e}):HA(t,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:Kr.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:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},In=class extends Ww{constructor(){super(...arguments),this.internalState=null,this.lifecycle=t0.NO_STATE,this.parent=null}static{this.defaultProps=OAe}static{this.layerName="Layer"}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){Mr(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=WO(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[n,s,o]=jy(i,r.pixelProjectionMatrix);return e.length===2?[n,s]:[n,s,o]}unproject(e){return Mr(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){Mr(this.internalState);let i=this.internalState.viewport||this.context.viewport;return NH(e,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),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(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setModuleParameters(e){for(let r of this.getModels())r.updateModuleSettings(e)}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Kr.DEFAULT||e===Kr.LNGLAT||e===Kr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){Mr(e instanceof Uint8Array);let[r,i,n]=e;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:Iq(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=y5(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=y5(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:i}=e.changeFlags;if(i&&r)if(Array.isArray(i))for(let n of i)r.invalidateAll(n);else r.invalidateAll();if(r){let{props:n}=e,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:f}=r.attributes,y=c||f;y&&(o&&y.constant&&(y.constant=!1,r.invalidate(y.id)),!y.value&&!o&&(y.constant=!0,y.value=[0,0,0]))}}}finalizeState(e){for(let i of this.getModels())i.destroy();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(e){for(let r of this.getModels())r.draw(e)}getPickingInfo({info:e,mode:r,sourceLayer:i}){let{index:n}=e;return n>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[n]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!DAe({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let i in e)e[i].layoutChanged()&&(r=!0);for(let i of this.getModels())this._setModelAttributes(i,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();e.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let s=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(s)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),i=Object.create(this.props);for(let n in r)Object.defineProperty(i,n,{value:r[n]});return i}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let i=Math.floor(id.length/4);if(this.internalState.usesPickingColorCache=!0,iBq&&dr.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),id=qh.allocate(id,r,{size:4,copy:!0,maxCount:Math.max(r,Bq)});let n=Math.floor(id.length/4),s=[];for(let o=i;o(dr.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new Uw(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(e){Os(kAe,this,this===e);let{state:r,internalState:i}=e;this!==e&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Os(IAe,this,e),!e)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(),f=this.getModels();if(i.device)this.updateState(c);else try{this.updateState(c)}catch{}for(let b of this.props.extensions)b.updateState.call(this,c,b);let y=this.getModels()[0]!==f[0];this._postUpdate(c,y)}finally{i.viewport=s,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){Os(RAe,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,moduleParameters:r=null,uniforms:i={},parameters:n={}}){this._updateAttributeTransition();let s=this.props,o=this.context;this.props=this.internalState.propsInTransition||s;let c=this.props.opacity;i.opacity=Math.pow(c,1/2.2);try{if(r){let{isActive:b,isAttribute:M}=r.picking;this.setModuleParameters(r),this.setShaderModuleProps({picking:{isActive:b,isAttribute:M}})}let{getPolygonOffset:f}=this.props,y=f&&f(i)||[0,0];o.device.setParametersWebGL({polygonOffset:y});for(let b of this.getModels())b.setParameters(n);o.device.withParametersWebGL(n,()=>{let b={renderPass:e,moduleParameters:r,uniforms:i,parameters:n,context:o};for(let M of this.props.extensions)M.draw.call(this,b,M);this.draw(b)})}finally{this.props=s}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let n in e)if(e[n]){let s=!1;switch(n){case"dataChanged":let o=e[n],c=r[n];o&&Array.isArray(c)&&(r.dataChanged=Array.isArray(o)?c.concat(o):o,s=!0);default:r[n]||(r[n]=e[n],s=!0)}s&&Os(PAe,this,n,e)}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(e,r){let i=Cq(e,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged)this.internalState.uniformTransitions.add(n,r[n],e[n],e.transitions?.[n]);return this.setChangeFlags(i)}validateProps(){Pq(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:i}=this.props;e.picked&&typeof i=="function"&&(r.highlightColor=i(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new rd(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:i,oldProps:n}=e;this.setNeedsRedraw(),this._updateAttributes();let s=this.state.model;s?.isInstanced&&s.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:c,highlightColor:f}=i;if(r||n.autoHighlight!==o||n.highlightedObjectIndex!==c||n.highlightColor!==f){let y={};o||(y.highlightedObjectColor=null),Array.isArray(f)&&(y.highlightColor=f),(r||c!==n.highlightedObjectIndex)&&(y.highlightedObjectColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setShaderModuleProps({picking:y})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=i?i.getNeedsRedraw(e):!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&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};var BAe="compositeLayer.renderLayers",Xi=class extends In{static{this.layerName="CompositeLayer"}get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:i}=this.props;return i&&i[e]&&i[e].type||r}getSubLayerRow(e,r,i){return e.__source={parent:this,object:r,index:i},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,e(i.__source.object,r)):e(i,n)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:i,visible:n,parameters:s,getPolygonOffset:o,highlightedObjectIndex:c,autoHighlight:f,highlightColor:y,coordinateSystem:b,coordinateOrigin:M,wrapLongitude:L,positionFormat:N,modelMatrix:V,extensions:$,fetch:Q,operation:q,_subLayerProps:J}=this.props,ee={id:"",updateTriggers:{},opacity:r,pickable:i,visible:n,parameters:s,getPolygonOffset:o,highlightedObjectIndex:c,autoHighlight:f,highlightColor:y,coordinateSystem:b,coordinateOrigin:M,wrapLongitude:L,positionFormat:N,modelMatrix:V,extensions:$,fetch:Q,operation:q},oe=J&&e.id&&J[e.id],ve=oe&&oe.updateTriggers,Re=e.id||"sublayer";if(oe){let Ze=this.props[Xu],He=e.type?e.type._propTypes:{};for(let ot in oe){let et=He[ot]||Ze[ot];et&&et.type==="accessor"&&(oe[ot]=this.getSubLayerAccessor(oe[ot]))}}Object.assign(ee,e,oe),ee.id=`${this.props.id}-${Re}`,ee.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...ve};for(let Ze of $){let He=Ze.getSubLayerProps.call(this,Ze);He&&Object.assign(ee,He,{updateTriggers:Object.assign(ee.updateTriggers,He.updateTriggers)})}return ee}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();if(n){let s=this.renderLayers();i=fp(s,Boolean),this.internalState.subLayers=i}Os(BAe,this,n,i);for(let s of i)s.parent=this}};var PP=Math.PI/180,Fq=180/Math.PI,CP=6370972,i1=256;function FAe(){let t=i1/CP,e=Math.PI/180*i1;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var l0=class extends up{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,nearZMultiplier:s=.1,farZMultiplier:o=2,resolution:c=10}=e,{height:f,altitude:y=1.5}=e;f=f||1,y=Math.max(.75,y);let b=new Jn().lookAt({eye:[0,-y,0],up:[0,0,1]}),M=Math.pow(2,n);b.rotateX(r*PP),b.rotateZ(-i*PP),b.scale(M/f);let L=Math.atan(.5/y),N=i1*2*M/f;super({...e,height:f,viewMatrix:b,longitude:i,latitude:r,zoom:n,distanceScales:FAe(),fovyRadians:L*2,focalDistance:y,near:s,far:Math.min(2,1/N+1)*y*o}),this.latitude=r,this.longitude=i,this.resolution=c}get projectionMode(){return Ja.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.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(e,{topLeft:r=!0,targetZ:i}={}){let[n,s,o]=e,c=r?s:this.height-s,{pixelUnprojectionMatrix:f}=this,y;if(Number.isFinite(o))y=S5(f,[n,c,o,1]);else{let N=S5(f,[n,c,-1,1]),V=S5(f,[n,c,1,1]),$=((i||0)/CP+1)*i1,Q=cc.sqrLen(cc.sub([],N,V)),q=cc.sqrLen(N),J=cc.sqrLen(V),oe=4*((4*q*J-(Q-q-J)**2)/16)/Q,ve=Math.sqrt(q-oe),Re=Math.sqrt(Math.max(0,$*$-oe)),Ze=(ve-Re)/Math.sqrt(Q);y=cc.lerp([],N,V,Ze)}let[b,M,L]=this.unprojectPosition(y);return Number.isFinite(o)?[b,M,L]:Number.isFinite(i)?[b,M,i]:[b,M]}projectPosition(e){let[r,i,n=0]=e,s=r*PP,o=i*PP,c=Math.cos(o),f=(n/CP+1)*i1;return[Math.sin(s)*c*f,-Math.cos(s)*c*f,Math.sin(o)*f]}unprojectPosition(e){let[r,i,n]=e,s=cc.len(e),o=Math.asin(n/s),f=Math.atan2(r,-i)*Fq,y=o*Fq,b=(s/i1-1)*CP;return[f,y,b]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let i=this.unproject(r);return{longitude:e[0]-i[0]+this.longitude,latitude:e[1]-i[1]+this.latitude}}};function S5(t,e){let r=uc.transformMat4([],e,t);return uc.scale(r,r,1/r[3]),r}var nd=class{static{this.defaultProps={}}static{this.extensionName="LayerExtension"}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&qn(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.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(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}};var T5={bearing:0,pitch:0,position:[0,0,0]},NAe={speed:1.2,curve:1.414},sd=class extends ag{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...NAe,...e}}interpolateProps(e,r,i){let n=zO(e,r,i,this.opts);for(let s in T5)n[s]=Ka(e[s]||T5[s],r[s]||T5[s],i);return n}getDuration(e,r){let{transitionDuration:i}=r;return i==="auto"&&(i=UO(e,r,this.opts)),i}};var c0=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=qh,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:s,positionFormat:o,dataChanged:c,normalize:f=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=s&&s.size||(o==="XY"?2:3),this.buffers=i,this.normalize=f,s&&(Mr(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(s),f||(i.vertexPositions=s)),this.geometryBuffer=i.vertexPositions,Array.isArray(c))for(let y of c)this._rebuildGeometry(y);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?xP(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,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 f=s[c];f.copy=r,i[c]=o.allocate(i[c],e,f)}}_forEachGeometry(e,r,i){let{data:n,getGeometry:s}=this,{iterable:o,objectInfo:c}=su(n,r,i);for(let f of o){c.index++;let y=s?s(f,c):null;e(y,c.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:s,geometryBuffer:o}=this,{startRow:c=0,endRow:f=1/0}=e||{},y={};if(e||(r=[0],i=[0]),this.normalize||!o)this._forEachGeometry((M,L)=>{let N=M&&this.normalizeGeometry(M);y[L]=N,i[L+1]=i[L]+(N?this.getGeometrySize(N):0)},c,f),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 Yi){let M=this.positionSize*4;n=n||o.byteLength/M}else if(o.buffer){let M=o.stride||this.positionSize*4;n=n||o.buffer.byteLength/M}else if(o.value){let M=o.value,L=o.stride/M.BYTES_PER_ELEMENT||this.positionSize;n=n||M.length/L}this._allocate(n,!!e),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let b={};this._forEachGeometry((M,L)=>{let N=y[L]||M;b.vertexStart=i[L],b.indexStart=r[L];let V=LRP(r,e));if(s1(t)){if(VAe(t))return e.style=UAe,(0,E5.cloneElement)(t,e);if(jAe(t))return(0,E5.cloneElement)(t,e)}return t}function s1(t){return t&&typeof t=="object"&&"type"in t||!1}function VAe(t){return t.props?.mapStyle}function jAe(t){let e=t.type;return e&&e.deckGLViewProps}function M5(t){if(typeof t=="function")return(0,zq.createElement)(iu,{},t);if(Array.isArray(t))return t.map(M5);if(s1(t)){if(t.type===kP.Fragment)return M5(t.props.children);if(n1(t.type,iu))return t}return t}function P5({children:t,layers:e=[],views:r=null}){let i=[],n=[],s={};return kP.Children.forEach(M5(t),o=>{if(s1(o)){let c=o.type;if(n1(c,In)){let f=WAe(c,o.props);n.push(f)}else i.push(o);if(n1(c,iu)&&c!==iu&&o.props.id){let f=new c(o.props);s[f.id]=f}}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)),e=n.length>0?[...n,...e]:e,{layers:e,children:i,views:r}}function WAe(t,e){let r={},i=t.defaultProps||{};for(let n in e)i[n]!==e[n]&&(r[n]=e[n]);return new t(r)}var C5=Ei(Zi(),1);function I5({children:t,deck:e,ContextProvider:r}){let{viewManager:i}=e||{};if(!i||!i.views.length)return[];let n={},s=i.views[0].id;for(let o of t){let c=s,f=o;s1(o)&&n1(o.type,iu)&&(c=o.props.id||s,f=o.props.children);let y=i.getViewport(c),b=i.getViewState(c);if(y){b.padding=y.padding;let{x:M,y:L,width:N,height:V}=y;f=RP(f,{x:M,y:L,width:N,height:V,viewport:y,viewState:b}),n[c]||(n[c]={viewport:y,children:[]}),n[c].children.push(f)}}return Object.keys(n).map(o=>{let{viewport:c,children:f}=n[o],{x:y,y:b,width:M,height:L}=c,N={position:"absolute",left:y,top:b,width:M,height:L},V=`view-${o}`,$=(0,C5.createElement)("div",{key:V,id:V,style:N},...f);if(r){let Q={viewport:c,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:q=>{q.viewId=o,e._onViewStateChange(q)}};return(0,C5.createElement)(r,{key:V,value:Q},$)}return $})}var HAe={mixBlendMode:null};function R5({width:t,height:e,style:r}){let i={position:"absolute",zIndex:0,left:0,top:0,width:t,height:e},n={left:0,top:0};if(r)for(let s in r)s in HAe?n[s]=r[s]:i[s]=r[s];return{containerStyle:i,canvasStyle:n}}function $Ae(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}function Vq(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}function qAe(t,e,r){let i=new e({...r,_customRender:n=>{t.redrawReason=n;let s=i.getViewports();t.lastRenderedViewports!==s?t.forceUpdate():Vq(t)}});return i}function GAe(t,e){let[r,i]=(0,Ta.useState)(0),s=(0,Ta.useRef)({control:null,version:r,forceUpdate:()=>i(ve=>ve+1)}).current,o=(0,Ta.useRef)(null),c=(0,Ta.useRef)(null),f=(0,Ta.useMemo)(()=>P5(t),[t.layers,t.views,t.children]),y=!0,b=ve=>y&&t.viewState?(s.viewStateUpdateRequested=ve,null):(s.viewStateUpdateRequested=null,t.onViewStateChange?.(ve)),M=ve=>{y?s.interactionStateUpdateRequested=ve:(s.interactionStateUpdateRequested=null,t.onInteractionStateChange?.(ve))},L=(0,Ta.useMemo)(()=>{let ve={...t,style:null,width:"100%",height:"100%",parent:o.current,canvas:c.current,layers:f.layers,views:f.views,onViewStateChange:b,onInteractionStateChange:M};return delete ve._customRender,s.deck&&s.deck.setProps(ve),ve},[t]);(0,Ta.useEffect)(()=>{let ve=t.Deck||t1;return s.deck=qAe(s,ve,{...L,parent:o.current,canvas:c.current}),()=>s.deck?.finalize()},[]),Nq(()=>{Vq(s);let{viewStateUpdateRequested:ve,interactionStateUpdateRequested:Re}=s;ve&&b(ve),Re&&M(Re)}),(0,Ta.useImperativeHandle)(e,()=>$Ae(s),[]);let N=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:V,width:$="100%",height:Q="100%",id:q,style:J}=t,{containerStyle:ee,canvasStyle:oe}=(0,Ta.useMemo)(()=>R5({width:$,height:Q,style:J}),[$,Q,J]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===N||s.version!==r){s.lastRenderedViewports=N,s.version=r;let ve=I5({children:f.children,deck:s.deck,ContextProvider:V}),Re=(0,Ta.createElement)("canvas",{key:"canvas",id:q||"deckgl-overlay",ref:c,style:oe});s.control=(0,Ta.createElement)("div",{id:`${q||"deckgl"}-wrapper`,ref:o,style:ee},[Re,ve])}return y=!1,s.control}var ZAe=Uq.forwardRef(GAe),k5=ZAe;var Ue,mp=new Array(128).fill(void 0);mp.push(void 0,null,!0,!1);var Qw=mp.length;function Qt(t){Qw===mp.length&&mp.push(mp.length+1);let e=Qw;return Qw=mp[e],mp[e]=t,e}function Et(t){return mp[t]}function YAe(t){t<132||(mp[t]=Qw,Qw=t)}function hn(t){let e=Et(t);return YAe(t),e}var rG=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&rG.decode();var qw=null;function o1(){return(qw===null||qw.byteLength===0)&&(qw=new Uint8Array(Ue.memory.buffer)),qw}function ou(t,e){return t=t>>>0,rG.decode(o1().subarray(t,t+e))}function pc(t){return t==null}var Gw=null;function XAe(){return(Gw===null||Gw.byteLength===0)&&(Gw=new Float64Array(Ue.memory.buffer)),Gw}var Zw=null;function $t(){return(Zw===null||Zw.byteLength===0)&&(Zw=new Int32Array(Ue.memory.buffer)),Zw}var Ac=0,LP=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},QAe=typeof LP.encodeInto=="function"?function(t,e){return LP.encodeInto(t,e)}:function(t,e){let r=LP.encode(t);return e.set(r),{read:t.length,written:r.length}};function gp(t,e,r){if(r===void 0){let c=LP.encode(t),f=e(c.length,1)>>>0;return o1().subarray(f,f+c.length).set(c),Ac=c.length,f}let i=t.length,n=e(i,1)>>>0,s=o1(),o=0;for(;o127)break;s[n+o]=c}if(o!==i){o!==0&&(t=t.slice(o)),n=r(n,i,i=o+t.length*3,1)>>>0;let c=o1().subarray(n+o,n+i),f=QAe(t,c);o+=f.written,n=r(n,i,o,1)>>>0}return Ac=o,n}var Yw=null;function KAe(){return(Yw===null||Yw.byteLength===0)&&(Yw=new BigInt64Array(Ue.memory.buffer)),Yw}function L5(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let n=t.description;return n==null?"Symbol":`Symbol(${n})`}if(e=="function"){let n=t.name;return typeof n=="string"&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(t)){let n=t.length,s="[";n>0&&(s+=L5(t[0]));for(let o=1;o1)i=r[1];else return toString.call(t);if(i=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:i}var jq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Ue.__wbindgen_export_2.get(t.dtor)(t.a,t.b)});function JAe(t,e,r,i){let n={a:t,b:e,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?(Ue.__wbindgen_export_2.get(n.dtor)(c,n.b),jq.unregister(n)):n.a=c}};return s.original=n,jq.register(s,n,n),s}function e0e(t,e,r){Ue._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1de40baa0df51db0(t,e,Qt(r))}function iG(t,e){let r=e(t.length*1,1)>>>0;return o1().set(t,r/1),Ac=t.length,r}function nG(t,e){try{let s=Ue.__wbindgen_add_to_stack_pointer(-16),o=iG(t,Ue.__wbindgen_malloc),c=Ac;Ue.readParquet(s,o,c,pc(e)?0:Qt(e));var r=$t()[s/4+0],i=$t()[s/4+1],n=$t()[s/4+2];if(n)throw hn(i);return UP.__wrap(r)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}function t0e(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`);return t.ptr}function U5(t,e){return t=t>>>0,o1().subarray(t/1,t/1+e)}var Xw=null;function sG(){return(Xw===null||Xw.byteLength===0)&&(Xw=new Uint32Array(Ue.memory.buffer)),Xw}function DP(t,e){t=t>>>0;let i=sG().subarray(t/4,t/4+e),n=[];for(let s=0;s>>0,sG().subarray(t/4,t/4+e)}function i0e(t,e,r,i){Ue.wasm_bindgen__convert__closures__invoke2_mut__h26b6dc7d05b06fdf(t,e,Qt(r),Qt(i))}var jje=Object.freeze({V1:0,0:"V1",V2:1,1:"V2"}),Wje=Object.freeze({None:0,0:"None",Chunk:1,1:"Chunk",Page:2,2:"Page"}),Hje=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"}),$je=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",LZO:7,7:"LZO"}),Wq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_columnchunkmetadata_free(t>>>0)),OP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Wq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Wq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_columnchunkmetadata_free(e)}filePath(){try{let i=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.columnchunkmetadata_filePath(i,this.__wbg_ptr);var e=$t()[i/4+0],r=$t()[i/4+1];let n;return e!==0&&(n=ou(e,r).slice(),Ue.__wbindgen_free(e,r*1,1)),n}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}fileOffset(){return Ue.columnchunkmetadata_fileOffset(this.__wbg_ptr)}columnPath(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.columnchunkmetadata_columnPath(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=DP(e,r).slice();return Ue.__wbindgen_free(e,r*4,4),i}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}encodings(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.columnchunkmetadata_encodings(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=DP(e,r).slice();return Ue.__wbindgen_free(e,r*4,4),i}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}numValues(){return Ue.columnchunkmetadata_numValues(this.__wbg_ptr)}compression(){return Ue.columnchunkmetadata_compression(this.__wbg_ptr)}compressedSize(){return Ue.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return Ue.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}},qje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffiarrowarray_free(t>>>0));var Hq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffiarrowschema_free(t>>>0)),BP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Hq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Hq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_ffiarrowschema_free(e)}addr(){return Ue.ffiarrowschema_addr(this.__wbg_ptr)>>>0}},Gje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffidata_free(t>>>0));var $q=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffirecordbatch_free(t>>>0)),FP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,$q.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,$q.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_ffirecordbatch_free(e)}arrayAddr(){return Ue.ffirecordbatch_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return Ue.ffirecordbatch_schemaAddr(this.__wbg_ptr)>>>0}},qq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffitable_free(t>>>0)),NP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,qq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,qq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_ffitable_free(e)}numBatches(){return Ue.ffitable_numBatches(this.__wbg_ptr)>>>0}schemaAddr(){return Ue.ffitable_schemaAddr(this.__wbg_ptr)>>>0}arrayAddr(e){return Ue.ffitable_arrayAddr(this.__wbg_ptr,e)>>>0}arrayAddrs(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.ffitable_arrayAddrs(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=r0e(e,r).slice();return Ue.__wbindgen_free(e,r*4,4),i}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}drop(){let e=this.__destroy_into_raw();Ue.ffitable_drop(e)}},Zje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_ffivector_free(t>>>0));var Gq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_filemetadata_free(t>>>0)),D5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Gq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Gq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_filemetadata_free(e)}version(){return Ue.filemetadata_version(this.__wbg_ptr)}numRows(){return Ue.filemetadata_numRows(this.__wbg_ptr)}createdBy(){try{let i=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.filemetadata_createdBy(i,this.__wbg_ptr);var e=$t()[i/4+0],r=$t()[i/4+1];let n;return e!==0&&(n=ou(e,r).slice(),Ue.__wbindgen_free(e,r*1,1)),n}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}keyValueMetadata(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.filemetadata_keyValueMetadata(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return hn(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}},Yje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_intounderlyingbytesource_free(t>>>0));var Xje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_intounderlyingsink_free(t>>>0));var Zq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_intounderlyingsource_free(t>>>0)),O5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Zq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Zq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_intounderlyingsource_free(e)}pull(e){let r=Ue.intounderlyingsource_pull(this.__wbg_ptr,Qt(e));return hn(r)}cancel(){let e=this.__destroy_into_raw();Ue.intounderlyingsource_cancel(e)}},Yq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_parquetfile_free(t>>>0)),B5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Yq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Yq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_parquetfile_free(e)}static fromUrl(e,r){let i=gp(e,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),n=Ac,s=Ue.parquetfile_fromUrl(i,n,pc(r)?0:Qt(r));return hn(s)}static fromFile(e){let r=Ue.parquetfile_fromFile(Qt(e));return hn(r)}metadata(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.parquetfile_metadata(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return F5.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}read(e){let r=Ue.parquetfile_read(this.__wbg_ptr,pc(e)?0:Qt(e));return hn(r)}stream(e){let r=Ue.parquetfile_stream(this.__wbg_ptr,pc(e)?0:Qt(e));return hn(r)}},Xq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_parquetmetadata_free(t>>>0)),F5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Xq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Xq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_parquetmetadata_free(e)}fileMetadata(){let e=Ue.parquetmetadata_fileMetadata(this.__wbg_ptr);return D5.__wrap(e)}numRowGroups(){return Ue.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(e){let r=Ue.parquetmetadata_rowGroup(this.__wbg_ptr,e);return zP.__wrap(r)}rowGroups(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.parquetmetadata_rowGroups(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=DP(e,r).slice();return Ue.__wbindgen_free(e,r*4,4),i}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}},Qq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_recordbatch_free(t>>>0)),N5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Qq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Qq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_recordbatch_free(e)}get numRows(){return Ue.recordbatch_numRows(this.__wbg_ptr)>>>0}get numColumns(){return Ue.recordbatch_numColumns(this.__wbg_ptr)>>>0}get schema(){let e=Ue.recordbatch_schema(this.__wbg_ptr);return Kw.__wrap(e)}toFFI(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.recordbatch_toFFI(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return FP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let n=this.__destroy_into_raw(),s=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.recordbatch_intoFFI(s,n);var e=$t()[s/4+0],r=$t()[s/4+1],i=$t()[s/4+2];if(i)throw hn(r);return FP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.recordbatch_intoIPCStream(c,o);var e=$t()[c/4+0],r=$t()[c/4+1],i=$t()[c/4+2],n=$t()[c/4+3];if(n)throw hn(i);var s=U5(e,r).slice();return Ue.__wbindgen_free(e,r*1,1),s}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}withSchema(e){try{let o=Ue.__wbindgen_add_to_stack_pointer(-16);t0e(e,Kw);var r=e.__destroy_into_raw();Ue.recordbatch_withSchema(o,this.__wbg_ptr,r);var i=$t()[o/4+0],n=$t()[o/4+1],s=$t()[o/4+2];if(s)throw hn(n);return t.__wrap(i)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}slice(e,r){let i=Ue.recordbatch_slice(this.__wbg_ptr,e,r);return t.__wrap(i)}getArrayMemorySize(){return Ue.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}},Kq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_rowgroupmetadata_free(t>>>0)),zP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Kq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Kq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_rowgroupmetadata_free(e)}numColumns(){return Ue.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}column(e){let r=Ue.rowgroupmetadata_column(this.__wbg_ptr,e);return OP.__wrap(r)}columns(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.rowgroupmetadata_columns(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=DP(e,r).slice();return Ue.__wbindgen_free(e,r*4,4),i}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}numRows(){return Ue.rowgroupmetadata_numRows(this.__wbg_ptr)}totalByteSize(){return Ue.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}compressedSize(){return Ue.rowgroupmetadata_compressedSize(this.__wbg_ptr)}},Jq=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_schema_free(t>>>0)),Kw=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,Jq.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Jq.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_schema_free(e)}toFFI(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.schema_toFFI(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return BP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let n=this.__destroy_into_raw(),s=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.schema_intoFFI(s,n);var e=$t()[s/4+0],r=$t()[s/4+1],i=$t()[s/4+2];if(i)throw hn(r);return BP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.schema_intoIPCStream(c,o);var e=$t()[c/4+0],r=$t()[c/4+1],i=$t()[c/4+2],n=$t()[c/4+3];if(n)throw hn(i);var s=U5(e,r).slice();return Ue.__wbindgen_free(e,r*1,1),s}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}withMetadata(e){try{let s=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.schema_withMetadata(s,this.__wbg_ptr,Qt(e));var r=$t()[s/4+0],i=$t()[s/4+1],n=$t()[s/4+2];if(n)throw hn(i);return t.__wrap(r)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}indexOf(e){try{let s=Ue.__wbindgen_add_to_stack_pointer(-16),o=gp(e,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),c=Ac;Ue.schema_indexOf(s,this.__wbg_ptr,o,c);var r=$t()[s/4+0],i=$t()[s/4+1],n=$t()[s/4+2];if(n)throw hn(i);return r>>>0}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}metadata(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.schema_metadata(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return hn(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}},eG=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_table_free(t>>>0)),UP=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,eG.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,eG.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_table_free(e)}get schema(){let e=Ue.table_schema(this.__wbg_ptr);return Kw.__wrap(e)}get numBatches(){return Ue.table_numBatches(this.__wbg_ptr)>>>0}toFFI(){try{let n=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.table_toFFI(n,this.__wbg_ptr);var e=$t()[n/4+0],r=$t()[n/4+1],i=$t()[n/4+2];if(i)throw hn(r);return NP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let n=this.__destroy_into_raw(),s=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.table_intoFFI(s,n);var e=$t()[s/4+0],r=$t()[s/4+1],i=$t()[s/4+2];if(i)throw hn(r);return NP.__wrap(e)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.table_intoIPCStream(c,o);var e=$t()[c/4+0],r=$t()[c/4+1],i=$t()[c/4+2],n=$t()[c/4+3];if(n)throw hn(i);var s=U5(e,r).slice();return Ue.__wbindgen_free(e,r*1,1),s}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}static fromIPCStream(e){try{let s=Ue.__wbindgen_add_to_stack_pointer(-16),o=iG(e,Ue.__wbindgen_malloc),c=Ac;Ue.table_fromIPCStream(s,o,c);var r=$t()[s/4+0],i=$t()[s/4+1],n=$t()[s/4+2];if(n)throw hn(i);return t.__wrap(r)}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}getArrayMemorySize(){return Ue.table_getArrayMemorySize(this.__wbg_ptr)>>>0}},Qje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_wasmgetoptions_free(t>>>0));var tG=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_wasmobjectmeta_free(t>>>0)),z5=class t{static __wrap(e){e=e>>>0;let r=Object.create(t.prototype);return r.__wbg_ptr=e,tG.register(r,r.__wbg_ptr,r),r}toJSON(){return{location:this.location,last_modified:this.last_modified,size:this.size,e_tag:this.e_tag,version:this.version}}toString(){return JSON.stringify(this)}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tG.unregister(this),e}free(){let e=this.__destroy_into_raw();Ue.__wbg_wasmobjectmeta_free(e)}get location(){let e,r;try{let s=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.__wbg_get_wasmobjectmeta_location(s,this.__wbg_ptr);var i=$t()[s/4+0],n=$t()[s/4+1];return e=i,r=n,ou(i,n)}finally{Ue.__wbindgen_add_to_stack_pointer(16),Ue.__wbindgen_free(e,r,1)}}set location(e){let r=gp(e,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),i=Ac;Ue.__wbg_set_wasmobjectmeta_location(this.__wbg_ptr,r,i)}get last_modified(){let e=Ue.__wbg_get_wasmobjectmeta_last_modified(this.__wbg_ptr);return hn(e)}set last_modified(e){Ue.__wbg_set_wasmobjectmeta_last_modified(this.__wbg_ptr,Qt(e))}get size(){return Ue.__wbg_get_wasmobjectmeta_size(this.__wbg_ptr)>>>0}set size(e){Ue.__wbg_set_wasmobjectmeta_size(this.__wbg_ptr,e)}get e_tag(){try{let i=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.__wbg_get_wasmobjectmeta_e_tag(i,this.__wbg_ptr);var e=$t()[i/4+0],r=$t()[i/4+1];let n;return e!==0&&(n=ou(e,r).slice(),Ue.__wbindgen_free(e,r*1,1)),n}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}set e_tag(e){var r=pc(e)?0:gp(e,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),i=Ac;Ue.__wbg_set_wasmobjectmeta_e_tag(this.__wbg_ptr,r,i)}get version(){try{let i=Ue.__wbindgen_add_to_stack_pointer(-16);Ue.__wbg_get_wasmobjectmeta_version(i,this.__wbg_ptr);var e=$t()[i/4+0],r=$t()[i/4+1];let n;return e!==0&&(n=ou(e,r).slice(),Ue.__wbindgen_free(e,r*1,1)),n}finally{Ue.__wbindgen_add_to_stack_pointer(16)}}set version(e){var r=pc(e)?0:gp(e,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),i=Ac;Ue.__wbg_set_wasmobjectmeta_version(this.__wbg_ptr,r,i)}},Kje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_wasmobjectstore_free(t>>>0));var Jje=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_writerproperties_free(t>>>0));var eWe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Ue.__wbg_writerpropertiesbuilder_free(t>>>0));async function n0e(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(i){if(t.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 t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function s0e(){let t={};return t.wbg={},t.wbg.__wbindgen_number_new=function(e){return Qt(e)},t.wbg.__wbg_columnchunkmetadata_new=function(e){let r=OP.__wrap(e);return Qt(r)},t.wbg.__wbg_rowgroupmetadata_new=function(e){let r=zP.__wrap(e);return Qt(r)},t.wbg.__wbg_parquetfile_new=function(e){let r=B5.__wrap(e);return Qt(r)},t.wbg.__wbindgen_object_drop_ref=function(e){hn(e)},t.wbg.__wbindgen_object_clone_ref=function(e){let r=Et(e);return Qt(r)},t.wbg.__wbindgen_error_new=function(e,r){let i=new Error(ou(e,r));return Qt(i)},t.wbg.__wbindgen_is_undefined=function(e){return Et(e)===void 0},t.wbg.__wbindgen_in=function(e,r){return Et(e)in Et(r)},t.wbg.__wbindgen_is_bigint=function(e){return typeof Et(e)=="bigint"},t.wbg.__wbindgen_bigint_from_u64=function(e){let r=BigInt.asUintN(64,e);return Qt(r)},t.wbg.__wbindgen_jsval_eq=function(e,r){return Et(e)===Et(r)},t.wbg.__wbindgen_is_object=function(e){let r=Et(e);return typeof r=="object"&&r!==null},t.wbg.__wbindgen_string_new=function(e,r){let i=ou(e,r);return Qt(i)},t.wbg.__wbindgen_number_get=function(e,r){let i=Et(r),n=typeof i=="number"?i:void 0;XAe()[e/8+1]=pc(n)?0:n,$t()[e/4+0]=!pc(n)},t.wbg.__wbg_fetch_1db5b0ae726d68b5=function(e){let r=fetch(Et(e));return Qt(r)},t.wbg.__wbg_wasmobjectmeta_new=function(e){let r=z5.__wrap(e);return Qt(r)},t.wbg.__wbindgen_string_get=function(e,r){let i=Et(r),n=typeof i=="string"?i:void 0;var s=pc(n)?0:gp(n,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),o=Ac;$t()[e/4+1]=o,$t()[e/4+0]=s},t.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){let r=fetch(Et(e));return Qt(r)},t.wbg.__wbg_done_2ffa852272310e47=function(e){return Et(e).done},t.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){let r=Et(e).value;return Qt(r)},t.wbg.__wbg_newwithintounderlyingsource_a03a82aa1bbbb292=function(e,r){let i=new ReadableStream(O5.__wrap(e),hn(r));return Qt(i)},t.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return Ns(function(e){let r=Et(e).getReader();return Qt(r)},arguments)},t.wbg.__wbg_sethighWaterMark_ea50ed3ec2143088=function(e,r){Et(e).highWaterMark=r},t.wbg.__wbg_recordbatch_new=function(e){let r=N5.__wrap(e);return Qt(r)},t.wbg.__wbg_table_new=function(e){let r=UP.__wrap(e);return Qt(r)},t.wbg.__wbindgen_jsval_loose_eq=function(e,r){return Et(e)==Et(r)},t.wbg.__wbindgen_boolean_get=function(e){let r=Et(e);return typeof r=="boolean"?r?1:0:2},t.wbg.__wbindgen_as_number=function(e){return+Et(e)},t.wbg.__wbg_String_b9412f8799faab3e=function(e,r){let i=String(Et(r)),n=gp(i,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),s=Ac;$t()[e/4+1]=s,$t()[e/4+0]=n},t.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,r){let i=Et(e)[Et(r)];return Qt(i)},t.wbg.__wbg_set_f975102236d3c502=function(e,r,i){Et(e)[hn(r)]=hn(i)},t.wbg.__wbindgen_cb_drop=function(e){let r=hn(e).original;return r.cnt--==1?(r.a=0,!0):!1},t.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(Et(e))},t.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){let r=Et(e).queueMicrotask;return Qt(r)},t.wbg.__wbindgen_is_function=function(e){return typeof Et(e)=="function"},t.wbg.__wbg_fetch_921fad6ef9e883dd=function(e,r){let i=Et(e).fetch(Et(r));return Qt(i)},t.wbg.__wbg_new_ab6fd82b10560829=function(){return Ns(function(){let e=new Headers;return Qt(e)},arguments)},t.wbg.__wbg_append_7bfcb4937d1d5e29=function(){return Ns(function(e,r,i,n,s){Et(e).append(ou(r,i),ou(n,s))},arguments)},t.wbg.__wbg_close_a994f9425dab445c=function(){return Ns(function(e){Et(e).close()},arguments)},t.wbg.__wbg_enqueue_ea194723156c0cc2=function(){return Ns(function(e,r){Et(e).enqueue(Et(r))},arguments)},t.wbg.__wbg_size_9c7e57fbd4f0f4b5=function(e){return Et(e).size},t.wbg.__wbg_arrayBuffer_307ddd1bd1d04e23=function(e){let r=Et(e).arrayBuffer();return Qt(r)},t.wbg.__wbg_slice_1991e6e71a6587f3=function(){return Ns(function(e,r,i){let n=Et(e).slice(r,i);return Qt(n)},arguments)},t.wbg.__wbg_read_e7d0f8a49be01d86=function(e){let r=Et(e).read();return Qt(r)},t.wbg.__wbg_releaseLock_5c49db976c08b864=function(e){Et(e).releaseLock()},t.wbg.__wbg_cancel_6ee33d4006737aef=function(e){let r=Et(e).cancel();return Qt(r)},t.wbg.__wbg_byobRequest_72fca99f9c32c193=function(e){let r=Et(e).byobRequest;return pc(r)?0:Qt(r)},t.wbg.__wbg_close_184931724d961ccc=function(){return Ns(function(e){Et(e).close()},arguments)},t.wbg.__wbg_instanceof_Response_849eb93e75734b6e=function(e){let r;try{r=Et(e)instanceof Response}catch{r=!1}return r},t.wbg.__wbg_url_5f6dc4009ac5f99d=function(e,r){let i=Et(r).url,n=gp(i,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),s=Ac;$t()[e/4+1]=s,$t()[e/4+0]=n},t.wbg.__wbg_status_61a01141acd3cf74=function(e){return Et(e).status},t.wbg.__wbg_headers_9620bfada380764a=function(e){let r=Et(e).headers;return Qt(r)},t.wbg.__wbg_body_9545a94f397829db=function(e){let r=Et(e).body;return pc(r)?0:Qt(r)},t.wbg.__wbg_arrayBuffer_29931d52c7206b02=function(){return Ns(function(e){let r=Et(e).arrayBuffer();return Qt(r)},arguments)},t.wbg.__wbg_signal_a61f78a3478fd9bc=function(e){let r=Et(e).signal;return Qt(r)},t.wbg.__wbg_new_0d76b0581eca6298=function(){return Ns(function(){let e=new AbortController;return Qt(e)},arguments)},t.wbg.__wbg_abort_2aa7521d5690750e=function(e){Et(e).abort()},t.wbg.__wbg_view_7f0ce470793a340f=function(e){let r=Et(e).view;return pc(r)?0:Qt(r)},t.wbg.__wbg_respond_b1a43b2e3a06d525=function(){return Ns(function(e,r){Et(e).respond(r>>>0)},arguments)},t.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0=function(){return Ns(function(e,r,i){let n=new Request(ou(e,r),Et(i));return Qt(n)},arguments)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,r){let i=Et(e)[r>>>0];return Qt(i)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return Et(e).length},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,r){let i=new Function(ou(e,r));return Qt(i)},t.wbg.__wbg_new_d9bc3a0147634640=function(){return Qt(new Map)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){let r=Et(e).next;return Qt(r)},t.wbg.__wbg_next_196c84450b364254=function(){return Ns(function(e){let r=Et(e).next();return Qt(r)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return Et(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){let r=Et(e).value;return Qt(r)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Qt(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return Ns(function(e,r){let i=Reflect.get(Et(e),Et(r));return Qt(i)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return Ns(function(e,r){let i=Et(e).call(Et(r));return Qt(i)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){let e=new Object;return Qt(e)},t.wbg.__wbindgen_is_string=function(e){return typeof Et(e)=="string"},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Ns(function(){let e=self.self;return Qt(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return Ns(function(){let e=window.window;return Qt(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Ns(function(){let e=globalThis.globalThis;return Qt(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return Ns(function(){let e=global.global;return Qt(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(Et(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let r;try{r=Et(e)instanceof ArrayBuffer}catch{r=!1}return r},t.wbg.__wbg_new_28c511d9baebfa89=function(e,r){let i=new Error(ou(e,r));return Qt(i)},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Ns(function(e,r,i){let n=Et(e).call(Et(r),Et(i));return Qt(n)},arguments)},t.wbg.__wbg_set_8417257aaedc936b=function(e,r,i){let n=Et(e).set(Et(r),Et(i));return Qt(n)},t.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(Et(e))},t.wbg.__wbg_new_cf3ec55744a78578=function(e){let r=new Date(Et(e));return Qt(r)},t.wbg.__wbg_entries_95cc2c823b285a09=function(e){let r=Object.entries(Et(e));return Qt(r)},t.wbg.__wbg_new_81740750da40724f=function(e,r){try{var i={a:e,b:r},n=(o,c)=>{let f=i.a;i.a=0;try{return i0e(f,i.b,o,c)}finally{i.a=f}};let s=new Promise(n);return Qt(s)}finally{i.a=i.b=0}},t.wbg.__wbg_resolve_b0083a7967828ec8=function(e){let r=Promise.resolve(Et(e));return Qt(r)},t.wbg.__wbg_catch_0260e338d10f79ae=function(e,r){let i=Et(e).catch(Et(r));return Qt(i)},t.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,r){let i=Et(e).then(Et(r));return Qt(i)},t.wbg.__wbg_then_a73caa9a87991566=function(e,r,i){let n=Et(e).then(Et(r),Et(i));return Qt(n)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){let r=Et(e).buffer;return Qt(r)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,r,i){let n=new Uint8Array(Et(e),r>>>0,i>>>0);return Qt(n)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){let r=new Uint8Array(Et(e));return Qt(r)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,r,i){Et(e).set(Et(r),i>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return Et(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let r;try{r=Et(e)instanceof Uint8Array}catch{r=!1}return r},t.wbg.__wbg_newwithlength_e9b4878cebadb3d3=function(e){let r=new Uint8Array(e>>>0);return Qt(r)},t.wbg.__wbg_newwithbyteoffset_27c6424791adc775=function(e,r){let i=new Uint8Array(Et(e),r>>>0);return Qt(i)},t.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){let r=Et(e).buffer;return Qt(r)},t.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return Et(e).byteLength},t.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return Et(e).byteOffset},t.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return Ns(function(e){let r=JSON.stringify(Et(e));return Qt(r)},arguments)},t.wbg.__wbg_has_0af94d20077affa2=function(){return Ns(function(e,r){return Reflect.has(Et(e),Et(r))},arguments)},t.wbg.__wbg_set_1f9b04f170055d33=function(){return Ns(function(e,r,i){return Reflect.set(Et(e),Et(r),Et(i))},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,r){let i=Et(r),n=typeof i=="bigint"?i:void 0;KAe()[e/8+1]=pc(n)?BigInt(0):n,$t()[e/4+0]=!pc(n)},t.wbg.__wbindgen_debug_string=function(e,r){let i=L5(Et(r)),n=gp(i,Ue.__wbindgen_malloc,Ue.__wbindgen_realloc),s=Ac;$t()[e/4+1]=s,$t()[e/4+0]=n},t.wbg.__wbindgen_throw=function(e,r){throw new Error(ou(e,r))},t.wbg.__wbindgen_memory=function(){let e=Ue.memory;return Qt(e)},t.wbg.__wbindgen_function_table=function(){let e=Ue.__wbindgen_export_2;return Qt(e)},t.wbg.__wbindgen_closure_wrapper13295=function(e,r,i){let n=JAe(e,r,3248,e0e);return Qt(n)},t}function o0e(t,e){return Ue=t.exports,oG.__wbindgen_wasm_module=e,Yw=null,Gw=null,Zw=null,Xw=null,qw=null,Ue}async function oG(t){if(Ue!==void 0)return Ue;typeof t>"u"&&(t=new URL("parquet_wasm_bg.wasm",import.meta.url));let e=s0e();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:i}=await n0e(await t,e);return o0e(r,i)}var aG=oG;function cG(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function di(t){return this instanceof di?(this.v=t,this):new di(t)}function au(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(L){i[L]&&(n[L]=function(N){return new Promise(function(V,$){s.push([L,N,V,$])>1||c(L,N)})})}function c(L,N){try{f(i[L](N))}catch(V){M(s[0][3],V)}}function f(L){L.value instanceof di?Promise.resolve(L.value.v).then(y,b):M(s[0][2],L)}function y(L){c("next",L)}function b(L){c("throw",L)}function M(L,N){L(N),s.shift(),s.length&&c(s[0][0],s[0][1])}}function a1(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:di(t[n](o)),done:!1}:s?s(o):o}:s}}function Jh(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof lG=="function"?lG(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(c,f){o=t[s](o),n(c,f,o.done,o.value)})}}function n(s,o,c,f){Promise.resolve(f).then(function(y){s({value:y,done:c})},o)}}var q5={};Zc(q5,{compareArrayLike:()=>$5,joinUint8Arrays:()=>cu,memcpy:()=>t2,rebaseValueOffsets:()=>ZP,toArrayBufferView:()=>wi,toArrayBufferViewAsyncIterator:()=>tf,toArrayBufferViewIterator:()=>ad,toBigInt64Array:()=>GP,toBigUint64Array:()=>A0e,toFloat32Array:()=>m0e,toFloat32ArrayAsyncIterator:()=>k0e,toFloat32ArrayIterator:()=>S0e,toFloat64Array:()=>g0e,toFloat64ArrayAsyncIterator:()=>L0e,toFloat64ArrayIterator:()=>T0e,toInt16Array:()=>f0e,toInt16ArrayAsyncIterator:()=>P0e,toInt16ArrayIterator:()=>x0e,toInt32Array:()=>gg,toInt32ArrayAsyncIterator:()=>C0e,toInt32ArrayIterator:()=>v0e,toInt8Array:()=>h0e,toInt8ArrayAsyncIterator:()=>M0e,toInt8ArrayIterator:()=>y0e,toUint16Array:()=>d0e,toUint16ArrayAsyncIterator:()=>I0e,toUint16ArrayIterator:()=>b0e,toUint32Array:()=>p0e,toUint32ArrayAsyncIterator:()=>R0e,toUint32ArrayIterator:()=>w0e,toUint8Array:()=>Ur,toUint8ArrayAsyncIterator:()=>H5,toUint8ArrayIterator:()=>W5,toUint8ClampedArray:()=>_0e,toUint8ClampedArrayAsyncIterator:()=>D0e,toUint8ClampedArrayIterator:()=>E0e});var a0e=new TextDecoder("utf-8"),Jw=t=>a0e.decode(t),l0e=new TextEncoder,od=t=>l0e.encode(t);var c0e=t=>typeof t=="number",uG=t=>typeof t=="boolean",No=t=>typeof t=="function",Il=t=>t!=null&&Object(t)===t,lu=t=>Il(t)&&No(t.then);var ef=t=>Il(t)&&No(t[Symbol.iterator]),Ju=t=>Il(t)&&No(t[Symbol.asyncIterator]),VP=t=>Il(t)&&Il(t.schema);var jP=t=>Il(t)&&"done"in t&&"value"in t;var WP=t=>Il(t)&&No(t.stat)&&c0e(t.fd);var HP=t=>Il(t)&&e2(t.body),$P=t=>"_getDOMStream"in t&&"_getNodeStream"in t,hG=t=>Il(t)&&No(t.abort)&&No(t.getWriter)&&!$P(t),e2=t=>Il(t)&&No(t.cancel)&&No(t.getReader)&&!$P(t),fG=t=>Il(t)&&No(t.end)&&No(t.write)&&uG(t.writable)&&!$P(t),qP=t=>Il(t)&&No(t.read)&&No(t.pipe)&&uG(t.readable)&&!$P(t),dG=t=>Il(t)&&No(t.clear)&&No(t.bytes)&&No(t.position)&&No(t.setPosition)&&No(t.capacity)&&No(t.getBufferIdentifier)&&No(t.createLong);var j5=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function u0e(t){let e=t[0]?[t[0]]:[],r,i,n,s;for(let o,c,f=0,y=0,b=t.length;++fb+M.byteLength,0),n,s,o,c=0,f=-1,y=Math.min(e||Number.POSITIVE_INFINITY,i);for(let b=r.length;++fwi(Int8Array,t),f0e=t=>wi(Int16Array,t),gg=t=>wi(Int32Array,t),GP=t=>wi(BigInt64Array,t),Ur=t=>wi(Uint8Array,t),d0e=t=>wi(Uint16Array,t),p0e=t=>wi(Uint32Array,t),A0e=t=>wi(BigUint64Array,t),m0e=t=>wi(Float32Array,t),g0e=t=>wi(Float64Array,t),_0e=t=>wi(Uint8ClampedArray,t),V5=t=>(t.next(),t);function*ad(t,e){let r=function*(n){yield n},i=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof j5?r(e):ef(e)?e:r(e);return yield*V5(function*(n){let s=null;do s=n.next(yield wi(t,s));while(!s.done)}(i[Symbol.iterator]())),new t}var y0e=t=>ad(Int8Array,t),x0e=t=>ad(Int16Array,t),v0e=t=>ad(Int32Array,t),W5=t=>ad(Uint8Array,t),b0e=t=>ad(Uint16Array,t),w0e=t=>ad(Uint32Array,t),S0e=t=>ad(Float32Array,t),T0e=t=>ad(Float64Array,t),E0e=t=>ad(Uint8ClampedArray,t);function tf(t,e){return au(this,arguments,function*(){if(lu(e))return yield di(yield di(yield*a1(Jh(tf(t,yield di(e))))));let i=function(o){return au(this,arguments,function*(){yield yield di(yield di(o))})},n=function(o){return au(this,arguments,function*(){yield di(yield*a1(Jh(V5(function*(c){let f=null;do f=c.next(yield f?.value);while(!f.done)}(o[Symbol.iterator]())))))})},s=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof j5?i(e):ef(e)?n(e):Ju(e)?e:i(e);return yield di(yield*a1(Jh(V5(function(o){return au(this,arguments,function*(){let c=null;do c=yield di(o.next(yield yield di(wi(t,c))));while(!c.done)})}(s[Symbol.asyncIterator]()))))),yield di(new t)})}var M0e=t=>tf(Int8Array,t),P0e=t=>tf(Int16Array,t),C0e=t=>tf(Int32Array,t),H5=t=>tf(Uint8Array,t),I0e=t=>tf(Uint16Array,t),R0e=t=>tf(Uint32Array,t),k0e=t=>tf(Float32Array,t),L0e=t=>tf(Float64Array,t),D0e=t=>tf(Uint8ClampedArray,t);function ZP(t,e,r){if(t!==0){r=r.slice(0,e);for(let i=-1,n=r.length;++i0)do if(t[r]!==e[r])return!1;while(++r(t.next(),t);function*O0e(t){let e,r=!1,i=[],n,s,o,c=0;function f(){return s==="peek"?cu(i,o)[0]:([n,i,c]=cu(i,o),n)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});let y=W5(t)[Symbol.iterator]();try{do if({done:e,value:n}=Number.isNaN(o-c)?y.next():y.next(o-c),!e&&n.byteLength>0&&(i.push(n),c+=n.byteLength),e||o<=c)do({cmd:s,size:o}=yield f());while(o0&&(n.push(s),f+=s.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield di(y()));while(c0&&(n.push(Ur(s)),f+=s.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield di(y()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return lr(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(e).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(e){return lr(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Ur(r)),r})}},G5=(t,e)=>{let r=n=>i([e,n]),i;return[e,r,new Promise(n=>(i=n)&&t.once(e,r))]};function N0e(t){return au(this,arguments,function*(){let r=[],i="error",n=!1,s=null,o,c,f=0,y=[],b;function M(){return o==="peek"?cu(y,c)[0]:([b,y,f]=cu(y,c),b)}if({cmd:o,size:c}=(yield yield di(null))||{cmd:"read",size:0},t.isTTY)return yield yield di(new Uint8Array(0)),yield di(null);try{r[0]=G5(t,"end"),r[1]=G5(t,"error");do{if(r[2]=G5(t,"readable"),[i,s]=yield di(Promise.race(r.map(N=>N[2]))),i==="error")break;if((n=i==="end")||(Number.isFinite(c-f)?(b=Ur(t.read(c-f)),b.byteLength0&&(y.push(b),f+=b.byteLength)),n||c<=f)do({cmd:o,size:c}=yield yield di(M()));while(c{for(let[q,J]of N)t.off(q,J);try{let q=t.destroy;q&&q.call(t,V),V=void 0}catch(q){V=q||V}finally{V!=null?Q(V):$()}})}})}var fn;(function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"})(fn||(fn={}));var Rn;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(Rn||(Rn={}));var sn;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(sn||(sn={}));var zs;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(zs||(zs={}));var xr;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(xr||(xr={}));var zo;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(zo||(zo={}));var ld=new Int32Array(2),XP=new Float32Array(ld.buffer),QP=new Float64Array(ld.buffer),l1=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var r2;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(r2||(r2={}));var uu=class t{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new t(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<>8}writeUint16(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8}writeInt32(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8,this.bytes_[e+2]=r>>16,this.bytes_[e+3]=r>>24}writeUint32(e,r){this.bytes_[e]=r,this.bytes_[e+1]=r>>8,this.bytes_[e+2]=r>>16,this.bytes_[e+3]=r>>24}writeInt64(e,r){this.writeInt32(e,Number(BigInt.asIntN(32,r))),this.writeInt32(e+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(e,r){this.writeUint32(e,Number(BigInt.asUintN(32,r))),this.writeUint32(e+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(e,r){XP[0]=r,this.writeInt32(e,ld[0])}writeFloat64(e,r){QP[0]=r,this.writeInt32(e,ld[l1?0:1]),this.writeInt32(e+4,ld[l1?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=e);let i=~(this.bb.capacity()-this.space+r)+1&e-1;for(;this.space=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?e-this.vtable[r]:0);let n=2;this.addInt16(e-this.object_start);let s=(i+n)*2;this.addInt16(s);let o=0,c=this.space;e:for(r=0;r=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+n),this.addOffset(e),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,r){this.finish(e,r,!0)}requiredField(e,r){let i=this.bb.capacity()-e,n=i-this.bb.readInt32(i);if(!(r=0;i--)e.addInt32(r[i]);return e.endVector()}static startTypeIdsVector(e,r){e.startVector(4,r,4)}static endUnion(e){return e.endObject()}static createUnion(e,r,i){return t.startUnion(e),t.addMode(e,r),t.addTypeIds(e,i),t.endUnion(e)}};var d2=class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsUtf8(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return t.startUtf8(e),t.endUtf8(e)}};var kn;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"})(kn||(kn={}));var rl=class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsField(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}name(e){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):kn.NONE}type(e){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(e,this.bb_pos+r):null}dictionary(e){let r=this.bb.__offset(this.bb_pos,12);return r?(e||new cd).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(e,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new t).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new Uo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,r){e.addFieldOffset(0,r,0)}static addNullable(e,r){e.addFieldInt8(1,+r,0)}static addTypeType(e,r){e.addFieldInt8(2,r,kn.NONE)}static addType(e,r){e.addFieldOffset(3,r,0)}static addDictionary(e,r){e.addFieldOffset(4,r,0)}static addChildren(e,r){e.addFieldOffset(5,r,0)}static createChildrenVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startChildrenVector(e,r){e.startVector(4,r,4)}static addCustomMetadata(e,r){e.addFieldOffset(6,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endField(e){return e.endObject()}};var mc=class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsSchema(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):u0.Little}fields(e,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new rl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Uo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,r){e.addFieldInt16(0,r,u0.Little)}static addFields(e,r){e.addFieldOffset(1,r,0)}static createFieldsVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startFieldsVector(e,r){e.startVector(4,r,4)}static addCustomMetadata(e,r){e.addFieldOffset(2,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static addFeatures(e,r){e.addFieldOffset(3,r,0)}static createFeaturesVector(e,r){e.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)e.addInt64(r[i]);return e.endVector()}static startFeaturesVector(e,r){e.startVector(8,r,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,r){e.finish(r)}static finishSizePrefixedSchemaBuffer(e,r){e.finish(r,void 0,!0)}static createSchema(e,r,i,n,s){return t.startSchema(e),t.addEndianness(e,r),t.addFields(e,i),t.addCustomMetadata(e,n),t.addFeatures(e,s),t.endSchema(e)}};var Pi;(function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"})(Pi||(Pi={}));var Ne;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(Ne||(Ne={}));var Fi;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(Fi||(Fi={}));var pB={};Zc(pB,{clampRange:()=>E2,createElementComparator:()=>v0,wrapIndex:()=>yg});var Y5={};Zc(Y5,{valueToString:()=>of});function of(t){if(t===null)return"null";if(t===void 0)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>of(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,r)=>typeof r=="bigint"?`${r}`:r)}var J5={};Zc(J5,{BN:()=>A2,bigNumToBigInt:()=>AG,bigNumToNumber:()=>K5,bigNumToString:()=>d1,isArrowBigNumSymbol:()=>pG});function Qi(t){if(typeof t=="bigint"&&(tNumber.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function X5(t,e){return Qi(t/e)+Qi(t%e)/Qi(e)}var pG=Symbol.for("isArrowBigNum");function af(t,...e){return e.length===0?Object.setPrototypeOf(wi(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}af.prototype[pG]=!0;af.prototype.toJSON=function(){return`"${d1(this)}"`};af.prototype.valueOf=function(t){return K5(this,t)};af.prototype.toString=function(){return d1(this)};af.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return K5(this);case"string":return d1(this);case"default":return AG(this)}return d1(this)};function h1(...t){return af.apply(this,t)}function f1(...t){return af.apply(this,t)}function p2(...t){return af.apply(this,t)}Object.setPrototypeOf(h1.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(f1.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(p2.prototype,Object.create(Uint32Array.prototype));Object.assign(h1.prototype,af.prototype,{constructor:h1,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(f1.prototype,af.prototype,{constructor:f1,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(p2.prototype,af.prototype,{constructor:p2,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var z0e=BigInt(4294967296)*BigInt(4294967296),U0e=z0e-BigInt(1);function K5(t,e){let{buffer:r,byteOffset:i,byteLength:n,signed:s}=t,o=new BigUint64Array(r,i,n/8),c=s&&o.at(-1)&BigInt(1)<=0)return Q5(t);e=e.slice();let i=1;for(let s=0;s(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(Wt.prototype);var na=class extends Wt{constructor(){super(Ne.Null)}toString(){return"Null"}};gG=Symbol.toStringTag;na[gG]=(t=>t[Symbol.toStringTag]="Null")(na.prototype);var Us=class extends Wt{constructor(e,r){super(Ne.Int),this.isSigned=e,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}`}};_G=Symbol.toStringTag;Us[_G]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(Us.prototype);var m2=class extends Us{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},g2=class extends Us{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},lf=class extends Us{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},_2=class extends Us{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},y2=class extends Us{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},x2=class extends Us{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},v2=class extends Us{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},b2=class extends Us{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(m2.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(g2.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(lf.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(_2.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(y2.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(x2.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(v2.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(b2.prototype,"ArrayType",{value:BigUint64Array});var sa=class extends Wt{constructor(e){super(Ne.Float),this.precision=e}get ArrayType(){switch(this.precision){case sn.HALF:return Uint16Array;case sn.SINGLE:return Float32Array;case sn.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};yG=Symbol.toStringTag;sa[yG]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(sa.prototype);var w2=class extends sa{constructor(){super(sn.HALF)}},S2=class extends sa{constructor(){super(sn.SINGLE)}},p1=class extends sa{constructor(){super(sn.DOUBLE)}};Object.defineProperty(w2.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(S2.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(p1.prototype,"ArrayType",{value:Float64Array});var th=class extends Wt{constructor(){super(Ne.Binary)}toString(){return"Binary"}};xG=Symbol.toStringTag;th[xG]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(th.prototype);var hd=class extends Wt{constructor(){super(Ne.LargeBinary)}toString(){return"LargeBinary"}};vG=Symbol.toStringTag;hd[vG]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(hd.prototype);var rh=class extends Wt{constructor(){super(Ne.Utf8)}toString(){return"Utf8"}};bG=Symbol.toStringTag;rh[bG]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(rh.prototype);var fd=class extends Wt{constructor(){super(Ne.LargeUtf8)}toString(){return"LargeUtf8"}};wG=Symbol.toStringTag;fd[wG]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(fd.prototype);var gc=class extends Wt{constructor(){super(Ne.Bool)}toString(){return"Bool"}};SG=Symbol.toStringTag;gc[SG]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(gc.prototype);var ih=class extends Wt{constructor(e,r,i=128){super(Ne.Decimal),this.scale=e,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};TG=Symbol.toStringTag;ih[TG]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ih.prototype);var nh=class extends Wt{constructor(e){super(Ne.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${zs[this.unit]}>`}get ArrayType(){return this.unit===zs.DAY?Int32Array:BigInt64Array}};EG=Symbol.toStringTag;nh[EG]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(nh.prototype);var sh=class extends Wt{constructor(e,r){super(Ne.Time),this.unit=e,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${xr[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};MG=Symbol.toStringTag;sh[MG]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(sh.prototype);var oh=class extends Wt{constructor(e,r){super(Ne.Timestamp),this.unit=e,this.timezone=r}toString(){return`Timestamp<${xr[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};PG=Symbol.toStringTag;oh[PG]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(oh.prototype);var ah=class extends Wt{constructor(e){super(Ne.Interval),this.unit=e}toString(){return`Interval<${zo[this.unit]}>`}};CG=Symbol.toStringTag;ah[CG]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(ah.prototype);var lh=class extends Wt{constructor(e){super(Ne.Duration),this.unit=e}toString(){return`Duration<${xr[this.unit]}>`}};IG=Symbol.toStringTag;lh[IG]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(lh.prototype);var il=class extends Wt{constructor(e){super(Ne.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};RG=Symbol.toStringTag;il[RG]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(il.prototype);var yn=class extends Wt{constructor(e){super(Ne.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}};kG=Symbol.toStringTag;yn[kG]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(yn.prototype);var _c=class extends Wt{constructor(e,r,i){super(Ne.Union),this.mode=e,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(e=>`${e.type}`).join(" | ")}>`}};LG=Symbol.toStringTag;_c[LG]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(_c.prototype);var ch=class extends Wt{constructor(e){super(Ne.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};DG=Symbol.toStringTag;ch[DG]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(ch.prototype);var Rl=class extends Wt{constructor(e,r){super(Ne.FixedSizeList),this.listSize=e,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}>`}};OG=Symbol.toStringTag;Rl[OG]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(Rl.prototype);var yc=class extends Wt{constructor(e,r=!1){var i,n,s;if(super(Ne.Map),this.children=[e],this.keysSorted=r,e&&(e.name="entries",!((i=e?.type)===null||i===void 0)&&i.children)){let o=(n=e?.type)===null||n===void 0?void 0:n.children[0];o&&(o.name="key");let c=(s=e?.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(e=>`${e.name}:${e.type}`).join(", ")}}>`}};BG=Symbol.toStringTag;yc[BG]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(yc.prototype);var V0e=(t=>()=>++t)(-1),xc=class extends Wt{constructor(e,r,i,n){super(Ne.Dictionary),this.indices=r,this.dictionary=e,this.isOrdered=n||!1,this.id=i==null?V0e():Qi(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}>`}};FG=Symbol.toStringTag;xc[FG]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(xc.prototype);function fu(t){let e=t;switch(t.typeId){case Ne.Decimal:return t.bitWidth/32;case Ne.Interval:return 1+e.unit;case Ne.FixedSizeList:return e.listSize;case Ne.FixedSizeBinary:return e.byteWidth;default:return 1}}var kr=class{visitMany(e,...r){return e.map((i,n)=>this.visit(i,...r.map(s=>s[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,r=!0){return j0e(this,e,r)}getVisitFnByTypeId(e,r=!0){return A1(this,e,r)}visitNull(e,...r){return null}visitBool(e,...r){return null}visitInt(e,...r){return null}visitFloat(e,...r){return null}visitUtf8(e,...r){return null}visitLargeUtf8(e,...r){return null}visitBinary(e,...r){return null}visitLargeBinary(e,...r){return null}visitFixedSizeBinary(e,...r){return null}visitDate(e,...r){return null}visitTimestamp(e,...r){return null}visitTime(e,...r){return null}visitDecimal(e,...r){return null}visitList(e,...r){return null}visitStruct(e,...r){return null}visitUnion(e,...r){return null}visitDictionary(e,...r){return null}visitInterval(e,...r){return null}visitDuration(e,...r){return null}visitFixedSizeList(e,...r){return null}visitMap(e,...r){return null}};function j0e(t,e,r=!0){return typeof e=="number"?A1(t,e,r):typeof e=="string"&&e in Ne?A1(t,Ne[e],r):e&&e instanceof Wt?A1(t,NG(e),r):e?.type&&e.type instanceof Wt?A1(t,NG(e.type),r):A1(t,Ne.NONE,r)}function A1(t,e,r=!0){let i=null;switch(e){case Ne.Null:i=t.visitNull;break;case Ne.Bool:i=t.visitBool;break;case Ne.Int:i=t.visitInt;break;case Ne.Int8:i=t.visitInt8||t.visitInt;break;case Ne.Int16:i=t.visitInt16||t.visitInt;break;case Ne.Int32:i=t.visitInt32||t.visitInt;break;case Ne.Int64:i=t.visitInt64||t.visitInt;break;case Ne.Uint8:i=t.visitUint8||t.visitInt;break;case Ne.Uint16:i=t.visitUint16||t.visitInt;break;case Ne.Uint32:i=t.visitUint32||t.visitInt;break;case Ne.Uint64:i=t.visitUint64||t.visitInt;break;case Ne.Float:i=t.visitFloat;break;case Ne.Float16:i=t.visitFloat16||t.visitFloat;break;case Ne.Float32:i=t.visitFloat32||t.visitFloat;break;case Ne.Float64:i=t.visitFloat64||t.visitFloat;break;case Ne.Utf8:i=t.visitUtf8;break;case Ne.LargeUtf8:i=t.visitLargeUtf8;break;case Ne.Binary:i=t.visitBinary;break;case Ne.LargeBinary:i=t.visitLargeBinary;break;case Ne.FixedSizeBinary:i=t.visitFixedSizeBinary;break;case Ne.Date:i=t.visitDate;break;case Ne.DateDay:i=t.visitDateDay||t.visitDate;break;case Ne.DateMillisecond:i=t.visitDateMillisecond||t.visitDate;break;case Ne.Timestamp:i=t.visitTimestamp;break;case Ne.TimestampSecond:i=t.visitTimestampSecond||t.visitTimestamp;break;case Ne.TimestampMillisecond:i=t.visitTimestampMillisecond||t.visitTimestamp;break;case Ne.TimestampMicrosecond:i=t.visitTimestampMicrosecond||t.visitTimestamp;break;case Ne.TimestampNanosecond:i=t.visitTimestampNanosecond||t.visitTimestamp;break;case Ne.Time:i=t.visitTime;break;case Ne.TimeSecond:i=t.visitTimeSecond||t.visitTime;break;case Ne.TimeMillisecond:i=t.visitTimeMillisecond||t.visitTime;break;case Ne.TimeMicrosecond:i=t.visitTimeMicrosecond||t.visitTime;break;case Ne.TimeNanosecond:i=t.visitTimeNanosecond||t.visitTime;break;case Ne.Decimal:i=t.visitDecimal;break;case Ne.List:i=t.visitList;break;case Ne.Struct:i=t.visitStruct;break;case Ne.Union:i=t.visitUnion;break;case Ne.DenseUnion:i=t.visitDenseUnion||t.visitUnion;break;case Ne.SparseUnion:i=t.visitSparseUnion||t.visitUnion;break;case Ne.Dictionary:i=t.visitDictionary;break;case Ne.Interval:i=t.visitInterval;break;case Ne.IntervalDayTime:i=t.visitIntervalDayTime||t.visitInterval;break;case Ne.IntervalYearMonth:i=t.visitIntervalYearMonth||t.visitInterval;break;case Ne.Duration:i=t.visitDuration;break;case Ne.DurationSecond:i=t.visitDurationSecond||t.visitDuration;break;case Ne.DurationMillisecond:i=t.visitDurationMillisecond||t.visitDuration;break;case Ne.DurationMicrosecond:i=t.visitDurationMicrosecond||t.visitDuration;break;case Ne.DurationNanosecond:i=t.visitDurationNanosecond||t.visitDuration;break;case Ne.FixedSizeList:i=t.visitFixedSizeList;break;case Ne.Map:i=t.visitMap;break}if(typeof i=="function")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${Ne[e]}'`)}function NG(t){switch(t.typeId){case Ne.Null:return Ne.Null;case Ne.Int:{let{bitWidth:e,isSigned:r}=t;switch(e){case 8:return r?Ne.Int8:Ne.Uint8;case 16:return r?Ne.Int16:Ne.Uint16;case 32:return r?Ne.Int32:Ne.Uint32;case 64:return r?Ne.Int64:Ne.Uint64}return Ne.Int}case Ne.Float:switch(t.precision){case sn.HALF:return Ne.Float16;case sn.SINGLE:return Ne.Float32;case sn.DOUBLE:return Ne.Float64}return Ne.Float;case Ne.Binary:return Ne.Binary;case Ne.LargeBinary:return Ne.LargeBinary;case Ne.Utf8:return Ne.Utf8;case Ne.LargeUtf8:return Ne.LargeUtf8;case Ne.Bool:return Ne.Bool;case Ne.Decimal:return Ne.Decimal;case Ne.Time:switch(t.unit){case xr.SECOND:return Ne.TimeSecond;case xr.MILLISECOND:return Ne.TimeMillisecond;case xr.MICROSECOND:return Ne.TimeMicrosecond;case xr.NANOSECOND:return Ne.TimeNanosecond}return Ne.Time;case Ne.Timestamp:switch(t.unit){case xr.SECOND:return Ne.TimestampSecond;case xr.MILLISECOND:return Ne.TimestampMillisecond;case xr.MICROSECOND:return Ne.TimestampMicrosecond;case xr.NANOSECOND:return Ne.TimestampNanosecond}return Ne.Timestamp;case Ne.Date:switch(t.unit){case zs.DAY:return Ne.DateDay;case zs.MILLISECOND:return Ne.DateMillisecond}return Ne.Date;case Ne.Interval:switch(t.unit){case zo.DAY_TIME:return Ne.IntervalDayTime;case zo.YEAR_MONTH:return Ne.IntervalYearMonth}return Ne.Interval;case Ne.Duration:switch(t.unit){case xr.SECOND:return Ne.DurationSecond;case xr.MILLISECOND:return Ne.DurationMillisecond;case xr.MICROSECOND:return Ne.DurationMicrosecond;case xr.NANOSECOND:return Ne.DurationNanosecond}return Ne.Duration;case Ne.Map:return Ne.Map;case Ne.List:return Ne.List;case Ne.Struct:return Ne.Struct;case Ne.Union:switch(t.mode){case Rn.Dense:return Ne.DenseUnion;case Rn.Sparse:return Ne.SparseUnion}return Ne.Union;case Ne.FixedSizeBinary:return Ne.FixedSizeBinary;case Ne.FixedSizeList:return Ne.FixedSizeList;case Ne.Dictionary:return Ne.Dictionary}throw new Error(`Unrecognized type '${Ne[t.typeId]}'`)}kr.prototype.visitInt8=null;kr.prototype.visitInt16=null;kr.prototype.visitInt32=null;kr.prototype.visitInt64=null;kr.prototype.visitUint8=null;kr.prototype.visitUint16=null;kr.prototype.visitUint32=null;kr.prototype.visitUint64=null;kr.prototype.visitFloat16=null;kr.prototype.visitFloat32=null;kr.prototype.visitFloat64=null;kr.prototype.visitDateDay=null;kr.prototype.visitDateMillisecond=null;kr.prototype.visitTimestampSecond=null;kr.prototype.visitTimestampMillisecond=null;kr.prototype.visitTimestampMicrosecond=null;kr.prototype.visitTimestampNanosecond=null;kr.prototype.visitTimeSecond=null;kr.prototype.visitTimeMillisecond=null;kr.prototype.visitTimeMicrosecond=null;kr.prototype.visitTimeNanosecond=null;kr.prototype.visitDenseUnion=null;kr.prototype.visitSparseUnion=null;kr.prototype.visitIntervalDayTime=null;kr.prototype.visitIntervalYearMonth=null;kr.prototype.visitDuration=null;kr.prototype.visitDurationSecond=null;kr.prototype.visitDurationMillisecond=null;kr.prototype.visitDurationMicrosecond=null;kr.prototype.visitDurationNanosecond=null;var eB={};Zc(eB,{float64ToUint16:()=>T2,uint16ToFloat64:()=>eC});var zG=new Float64Array(1),m1=new Uint32Array(zG.buffer);function eC(t){let e=(t&31744)>>10,r=(t&1023)/1024,i=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,e-15)*(1+r)}function T2(t){if(t!==t)return 32256;zG[0]=t;let e=(m1[1]&2147483648)>>16&65535,r=m1[1]&2146435072,i=0;return r>=1089470464?m1[0]>0?r=31744:(r=(r&2080374784)>>16,i=(m1[1]&1048575)>>10):r<=1056964608?(i=1048576+(m1[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(m1[1]&1048575)+512>>10),e|r|i&65535}var zr=class extends kr{};function Zr(t){return(e,r,i)=>{if(e.setValid(r,i!=null))return t(e,r,i)}}var W0e=(t,e,r)=>{t[e]=Math.floor(r/864e5)},UG=(t,e,r,i)=>{if(r+1{let n=t+r;i?e[n>>3]|=1<>3]&=~(1<{t[e]=r},tB=({values:t},e,r)=>{t[e]=r},VG=({values:t},e,r)=>{t[e]=T2(r)},$0e=(t,e,r)=>{switch(t.type.precision){case sn.HALF:return VG(t,e,r);case sn.SINGLE:case sn.DOUBLE:return tB(t,e,r)}},tC=({values:t},e,r)=>{W0e(t,e,r.valueOf())},rC=({values:t},e,r)=>{t[e]=BigInt(r)},rB=({stride:t,values:e},r,i)=>{e.set(i.subarray(0,t),t*r)},jG=({values:t,valueOffsets:e},r,i)=>UG(t,e,r,i),WG=({values:t,valueOffsets:e},r,i)=>UG(t,e,r,od(i)),iB=(t,e,r)=>{t.type.unit===zs.DAY?tC(t,e,r):rC(t,e,r)},iC=({values:t},e,r)=>{t[e]=BigInt(r/1e3)},nC=({values:t},e,r)=>{t[e]=BigInt(r)},sC=({values:t},e,r)=>{t[e]=BigInt(r*1e3)},oC=({values:t},e,r)=>{t[e]=BigInt(r*1e6)},nB=(t,e,r)=>{switch(t.type.unit){case xr.SECOND:return iC(t,e,r);case xr.MILLISECOND:return nC(t,e,r);case xr.MICROSECOND:return sC(t,e,r);case xr.NANOSECOND:return oC(t,e,r)}},aC=({values:t},e,r)=>{t[e]=r},lC=({values:t},e,r)=>{t[e]=r},cC=({values:t},e,r)=>{t[e]=r},uC=({values:t},e,r)=>{t[e]=r},sB=(t,e,r)=>{switch(t.type.unit){case xr.SECOND:return aC(t,e,r);case xr.MILLISECOND:return lC(t,e,r);case xr.MICROSECOND:return cC(t,e,r);case xr.NANOSECOND:return uC(t,e,r)}},oB=({values:t,stride:e},r,i)=>{t.set(i.subarray(0,e),e*r)},q0e=(t,e,r)=>{let i=t.children[0],n=t.valueOffsets,s=Ma.getVisitFn(i);if(Array.isArray(r))for(let o=-1,c=n[e],f=n[e+1];c{let i=t.children[0],{valueOffsets:n}=t,s=Ma.getVisitFn(i),{[e]:o,[e+1]:c}=n,f=r instanceof Map?r.entries():Object.entries(r);for(let y of f)if(s(i,o,y),++o>=c)break},Z0e=(t,e)=>(r,i,n,s)=>i&&r(i,t,e[s]),Y0e=(t,e)=>(r,i,n,s)=>i&&r(i,t,e.get(s)),X0e=(t,e)=>(r,i,n,s)=>i&&r(i,t,e.get(n.name)),Q0e=(t,e)=>(r,i,n,s)=>i&&r(i,t,e[n.name]),K0e=(t,e,r)=>{let i=t.type.children.map(s=>Ma.getVisitFn(s.type)),n=r instanceof Map?X0e(e,r):r instanceof Pr?Y0e(e,r):Array.isArray(r)?Z0e(e,r):Q0e(e,r);t.type.children.forEach((s,o)=>n(i[o],t.children[o],s,o))},J0e=(t,e,r)=>{t.type.mode===Rn.Dense?HG(t,e,r):$G(t,e,r)},HG=(t,e,r)=>{let i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];Ma.visit(n,t.valueOffsets[e],r)},$G=(t,e,r)=>{let i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];Ma.visit(n,e,r)},eme=(t,e,r)=>{var i;(i=t.dictionary)===null||i===void 0||i.set(t.values[e],r)},aB=(t,e,r)=>{t.type.unit===zo.DAY_TIME?hC(t,e,r):fC(t,e,r)},hC=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},fC=({values:t},e,r)=>{t[e]=r[0]*12+r[1]%12},dC=({values:t},e,r)=>{t[e]=r},pC=({values:t},e,r)=>{t[e]=r},AC=({values:t},e,r)=>{t[e]=r},mC=({values:t},e,r)=>{t[e]=r},lB=(t,e,r)=>{switch(t.type.unit){case xr.SECOND:return dC(t,e,r);case xr.MILLISECOND:return pC(t,e,r);case xr.MICROSECOND:return AC(t,e,r);case xr.NANOSECOND:return mC(t,e,r)}},tme=(t,e,r)=>{let{stride:i}=t,n=t.children[0],s=Ma.getVisitFn(n);if(Array.isArray(r))for(let o=-1,c=e*i;++o`${of(e)}: ${of(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new cB(this[cf],this[g1])}},cB=class{constructor(e,r){this.childIndex=0,this.children=e.children,this.rowIndex=r,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return er.name)}has(e,r){return e[cf].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(e,r){if(e[cf].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];let i=e[cf].type.children.findIndex(n=>n.name===r);if(i!==-1){let n=So.visit(e[cf].children[i],e[g1]);return Reflect.set(e,r,n),n}}set(e,r,i){let n=e[cf].type.children.findIndex(s=>s.name===r);return n!==-1?(Ma.visit(e[cf].children[n],e[g1],i),Reflect.set(e,r,i)):Reflect.has(e,r)||typeof r=="symbol"?Reflect.set(e,r,i):!1}};var Lr=class extends kr{};function $r(t){return(e,r)=>e.getValid(r)?t(e,r):null}var rme=(t,e)=>864e5*t[e],ime=(t,e)=>null,qG=(t,e,r)=>{if(r+1>=e.length)return null;let i=Qi(e[r]),n=Qi(e[r+1]);return t.subarray(i,n)},nme=({offset:t,values:e},r)=>{let i=t+r;return(e[i>>3]&1<rme(t,e),ZG=({values:t},e)=>Qi(t[e]),y0=({stride:t,values:e},r)=>e[t*r],sme=({stride:t,values:e},r)=>eC(e[t*r]),YG=({values:t},e)=>t[e],ome=({stride:t,values:e},r)=>e.subarray(t*r,t*(r+1)),XG=({values:t,valueOffsets:e},r)=>qG(t,e,r),QG=({values:t,valueOffsets:e},r)=>{let i=qG(t,e,r);return i!==null?Jw(i):null},ame=({values:t},e)=>t[e],lme=({type:t,values:e},r)=>t.precision!==sn.HALF?e[r]:eC(e[r]),cme=(t,e)=>t.type.unit===zs.DAY?GG(t,e):ZG(t,e),KG=({values:t},e)=>1e3*Qi(t[e]),JG=({values:t},e)=>Qi(t[e]),eZ=({values:t},e)=>X5(t[e],BigInt(1e3)),tZ=({values:t},e)=>X5(t[e],BigInt(1e6)),ume=(t,e)=>{switch(t.type.unit){case xr.SECOND:return KG(t,e);case xr.MILLISECOND:return JG(t,e);case xr.MICROSECOND:return eZ(t,e);case xr.NANOSECOND:return tZ(t,e)}},rZ=({values:t},e)=>t[e],iZ=({values:t},e)=>t[e],nZ=({values:t},e)=>t[e],sZ=({values:t},e)=>t[e],hme=(t,e)=>{switch(t.type.unit){case xr.SECOND:return rZ(t,e);case xr.MILLISECOND:return iZ(t,e);case xr.MICROSECOND:return nZ(t,e);case xr.NANOSECOND:return sZ(t,e)}},fme=({values:t,stride:e},r)=>A2.decimal(t.subarray(e*r,e*(r+1))),dme=(t,e)=>{let{valueOffsets:r,stride:i,children:n}=t,{[e*i]:s,[e*i+1]:o}=r,f=n[0].slice(s,o-s);return new Pr([f])},pme=(t,e)=>{let{valueOffsets:r,children:i}=t,{[e]:n,[e+1]:s}=r,o=i[0];return new dd(o.slice(n,s-n))},Ame=(t,e)=>new _0(t,e),mme=(t,e)=>t.type.mode===Rn.Dense?oZ(t,e):aZ(t,e),oZ=(t,e)=>{let r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];return So.visit(i,t.valueOffsets[e])},aZ=(t,e)=>{let r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];return So.visit(i,e)},gme=(t,e)=>{var r;return(r=t.dictionary)===null||r===void 0?void 0:r.get(t.values[e])},_me=(t,e)=>t.type.unit===zo.DAY_TIME?lZ(t,e):cZ(t,e),lZ=({values:t},e)=>t.subarray(2*e,2*(e+1)),cZ=({values:t},e)=>{let r=t[e],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},uZ=({values:t},e)=>t[e],hZ=({values:t},e)=>t[e],fZ=({values:t},e)=>t[e],dZ=({values:t},e)=>t[e],yme=(t,e)=>{switch(t.type.unit){case xr.SECOND:return uZ(t,e);case xr.MILLISECOND:return hZ(t,e);case xr.MICROSECOND:return fZ(t,e);case xr.NANOSECOND:return dZ(t,e)}},xme=(t,e)=>{let{stride:r,children:i}=t,s=i[0].slice(e*r,r);return new Pr([s])};Lr.prototype.visitNull=$r(ime);Lr.prototype.visitBool=$r(nme);Lr.prototype.visitInt=$r(ame);Lr.prototype.visitInt8=$r(y0);Lr.prototype.visitInt16=$r(y0);Lr.prototype.visitInt32=$r(y0);Lr.prototype.visitInt64=$r(YG);Lr.prototype.visitUint8=$r(y0);Lr.prototype.visitUint16=$r(y0);Lr.prototype.visitUint32=$r(y0);Lr.prototype.visitUint64=$r(YG);Lr.prototype.visitFloat=$r(lme);Lr.prototype.visitFloat16=$r(sme);Lr.prototype.visitFloat32=$r(y0);Lr.prototype.visitFloat64=$r(y0);Lr.prototype.visitUtf8=$r(QG);Lr.prototype.visitLargeUtf8=$r(QG);Lr.prototype.visitBinary=$r(XG);Lr.prototype.visitLargeBinary=$r(XG);Lr.prototype.visitFixedSizeBinary=$r(ome);Lr.prototype.visitDate=$r(cme);Lr.prototype.visitDateDay=$r(GG);Lr.prototype.visitDateMillisecond=$r(ZG);Lr.prototype.visitTimestamp=$r(ume);Lr.prototype.visitTimestampSecond=$r(KG);Lr.prototype.visitTimestampMillisecond=$r(JG);Lr.prototype.visitTimestampMicrosecond=$r(eZ);Lr.prototype.visitTimestampNanosecond=$r(tZ);Lr.prototype.visitTime=$r(hme);Lr.prototype.visitTimeSecond=$r(rZ);Lr.prototype.visitTimeMillisecond=$r(iZ);Lr.prototype.visitTimeMicrosecond=$r(nZ);Lr.prototype.visitTimeNanosecond=$r(sZ);Lr.prototype.visitDecimal=$r(fme);Lr.prototype.visitList=$r(dme);Lr.prototype.visitStruct=$r(Ame);Lr.prototype.visitUnion=$r(mme);Lr.prototype.visitDenseUnion=$r(oZ);Lr.prototype.visitSparseUnion=$r(aZ);Lr.prototype.visitDictionary=$r(gme);Lr.prototype.visitInterval=$r(_me);Lr.prototype.visitIntervalDayTime=$r(lZ);Lr.prototype.visitIntervalYearMonth=$r(cZ);Lr.prototype.visitDuration=$r(yme);Lr.prototype.visitDurationSecond=$r(uZ);Lr.prototype.visitDurationMillisecond=$r(hZ);Lr.prototype.visitDurationMicrosecond=$r(fZ);Lr.prototype.visitDurationNanosecond=$r(dZ);Lr.prototype.visitFixedSizeList=$r(xme);Lr.prototype.visitMap=$r(pme);var So=new Lr;var x0=Symbol.for("keys"),y1=Symbol.for("vals"),_1=Symbol.for("kKeysAsStrings"),hB=Symbol.for("_kKeysAsStrings"),dd=class{constructor(e){return this[x0]=new Pr([e.children[0]]).memoize(),this[y1]=e.children[1],new Proxy(this,new dB)}get[_1](){return this[hB]||(this[hB]=Array.from(this[x0].toArray(),String))}[Symbol.iterator](){return new fB(this[x0],this[y1])}get size(){return this[x0].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[x0],r=this[y1],i={};for(let n=-1,s=e.length;++n`${of(e)}: ${of(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},fB=class{constructor(e,r){this.keys=e,this.vals=r,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),So.visit(this.vals,e)]})}},dB=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[_1]}has(e,r){return e[_1].includes(r)}getOwnPropertyDescriptor(e,r){if(e[_1].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,r){if(Reflect.has(e,r))return e[r];let i=e[_1].indexOf(r);if(i!==-1){let n=So.visit(Reflect.get(e,y1),i);return Reflect.set(e,r,n),n}}set(e,r,i){let n=e[_1].indexOf(r);return n!==-1?(Ma.visit(Reflect.get(e,y1),n,i),Reflect.set(e,r,i)):Reflect.has(e,r)?Reflect.set(e,r,i):!1}};Object.defineProperties(dd.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[x0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[y1]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hB]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var pZ;function E2(t,e,r,i){let{length:n=0}=t,s=typeof e!="number"?0:e,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(t,s,o):[s,o]}var yg=(t,e)=>t<0?e+t:t,AZ=t=>t!==t;function v0(t){if(typeof t!=="object"||t===null)return AZ(t)?AZ:r=>r===t;if(t instanceof Date){let r=t.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(t)?r=>r?$5(t,r):!1:t instanceof Map?bme(t):Array.isArray(t)?vme(t):t instanceof Pr?wme(t):Sme(t,!0)}function vme(t){let e=[];for(let r=-1,i=t.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 Tme(t,r);case Map:return mZ(t,r,r.keys());case dd:case _0:case Object:case void 0:return mZ(t,r,e||Object.keys(r))}return r instanceof Pr?Eme(t,r):!1}}function Tme(t,e){let r=t.length;if(e.length!==r)return!1;for(let i=-1;++ixg,getBit:()=>gZ,getBool:()=>yC,packBools:()=>bg,popcnt_array:()=>_Z,popcnt_bit_range:()=>M2,popcnt_uint32:()=>_C,setBool:()=>Mme,truncateBitmap:()=>vg});function yC(t,e,r,i){return(r&1<>i}function Mme(t,e,r){return r?!!(t[e>>3]|=1<>3]&=~(1<0||r.byteLength>3):bg(new xg(r,t,e,null,yC)).subarray(0,i)),n}return r}function bg(t){let e=[],r=0,i=0,n=0;for(let o of t)o&&(n|=1<0)&&(e[r++]=n);let s=new Uint8Array(e.length+7&-8);return s.set(e),s}var xg=class{constructor(e,r,i,n,s){this.bytes=e,this.length=i,this.context=n,this.get=s,this.bit=r%8,this.byteIndex=r>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,n=e+(e%8===0?0:8-e%8);return M2(t,e,n)+M2(t,i,r)+_Z(t,n>>3,i-n>>3)}function _Z(t,e,r){let i=0,n=Math.trunc(e),s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=r===void 0?t.byteLength:n+r;for(;o-n>=4;)i+=_C(s.getUint32(n)),n+=4;for(;o-n>=2;)i+=_C(s.getUint16(n)),n+=2;for(;o-n>=1;)i+=_C(s.getUint8(n)),n+=1;return i}function _C(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}var Pme=-1,Vi=class t{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:e}=this;return Wt.isSparseUnion(e)?this.children.some(r=>r.nullable):Wt.isDenseUnion(e)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:r,values:i,nullBitmap:n,typeIds:s}=this;return r&&(e+=r.byteLength),i&&(e+=i.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),this.children.reduce((o,c)=>o+c.byteLength,e)}get nullCount(){if(Wt.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let e=this._nullCount,r;return e<=Pme&&(r=this.nullBitmap)&&(this._nullCount=e=r.length===0?0:this.length-M2(r,this.offset,this.offset+this.length)),e}constructor(e,r,i,n,s,o=[],c){this.type=e,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 f;s instanceof t?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=fu(e),s&&((f=s[0])&&(this.valueOffsets=f),(f=s[1])&&(this.values=f),(f=s[2])&&(this.nullBitmap=f),(f=s[3])&&(this.typeIds=f)))}getValid(e){let{type:r}=this;if(Wt.isUnion(r)){let i=r,n=this.children[i.typeIdToChildIndex[this.typeIds[e]]],s=i.mode===Rn.Dense?this.valueOffsets[e]:e;return n.getValid(s)}if(this.nullable&&this.nullCount>0){let i=this.offset+e;return(this.nullBitmap[i>>3]&1<>3;(!s||s.byteLength<=b)&&(s=new Uint8Array((o+c+63&-64)>>3).fill(255),this.nullCount>0?(s.set(vg(o,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let M=s[b];i=(M&y)!==0,s[b]=r?M|y:M&~y}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(e=this.type,r=this.offset,i=this.length,n=this._nullCount,s=this,o=this.children){return new t(e,r,i,n,s,o,this.dictionary)}slice(e,r){let{stride:i,typeId:n,children:s}=this,o=+(this._nullCount===0)-1,c=n===16?i:1,f=this._sliceBuffers(e,r,i,n);return this.clone(this.type,this.offset+e,r,o,f,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*e,c*r))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===Ne.Null)return this.clone(this.type,0,e,0);let{length:r,nullCount:i}=this,n=new Uint8Array((e+63&-64)>>3).fill(255,0,r>>3);n[r>>3]=(1<0&&n.set(vg(this.offset,r,this.nullBitmap),0);let s=this.buffers;return s[Fi.VALIDITY]=n,this.clone(this.type,0,e,i+(e-r),s)}_sliceBuffers(e,r,i,n){let s,{buffers:o}=this;return(s=o[Fi.TYPE])&&(o[Fi.TYPE]=s.subarray(e,e+r)),(s=o[Fi.OFFSET])&&(o[Fi.OFFSET]=s.subarray(e,e+r+1))||(s=o[Fi.DATA])&&(o[Fi.DATA]=n===6?s:s.subarray(i*e,i*(e+r))),o}_sliceChildren(e,r,i){return e.map(n=>n.slice(r,i))}};Vi.prototype.children=Object.freeze([]);var mB=class t extends kr{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{["type"]:r,["offset"]:i=0,["length"]:n=0}=e;return new Vi(r,i,n,n)}visitBool(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length>>3,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitInt(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitFloat(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitUtf8(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.data),s=Ur(e.nullBitmap),o=gg(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,n,s])}visitLargeUtf8(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.data),s=Ur(e.nullBitmap),o=GP(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,n,s])}visitBinary(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.data),s=Ur(e.nullBitmap),o=gg(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,n,s])}visitLargeBinary(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.data),s=Ur(e.nullBitmap),o=GP(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,n,s])}visitFixedSizeBinary(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitDate(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitTimestamp(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitTime(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitDecimal(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitList(e){let{["type"]:r,["offset"]:i=0,["child"]:n}=e,s=Ur(e.nullBitmap),o=gg(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,void 0,s],[n])}visitStruct(e){let{["type"]:r,["offset"]:i=0,["children"]:n=[]}=e,s=Ur(e.nullBitmap),{length:o=n.reduce((f,{length:y})=>Math.max(f,y),0),nullCount:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,void 0,s],n)}visitUnion(e){let{["type"]:r,["offset"]:i=0,["children"]:n=[]}=e,s=wi(r.ArrayType,e.typeIds),{["length"]:o=s.length,["nullCount"]:c=-1}=e;if(Wt.isSparseUnion(r))return new Vi(r,i,o,c,[void 0,void 0,void 0,s],n);let f=gg(e.valueOffsets);return new Vi(r,i,o,c,[f,void 0,void 0,s],n)}visitDictionary(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.indices.ArrayType,e.data),{["dictionary"]:o=new Pr([new t().visit({type:r.dictionary})])}=e,{["length"]:c=s.length,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[void 0,s,n],[],o)}visitInterval(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitDuration(e){let{["type"]:r,["offset"]:i=0}=e,n=Ur(e.nullBitmap),s=wi(r.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,s,n])}visitFixedSizeList(e){let{["type"]:r,["offset"]:i=0,["child"]:n=new t().visit({type:r.valueType})}=e,s=Ur(e.nullBitmap),{["length"]:o=n.length/fu(r),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new Vi(r,i,o,c,[void 0,void 0,s],[n])}visitMap(e){let{["type"]:r,["offset"]:i=0,["child"]:n=new t().visit({type:r.childType})}=e,s=Ur(e.nullBitmap),o=gg(e.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:f=e.nullBitmap?-1:0}=e;return new Vi(r,i,c,f,[o,void 0,s],[n])}},Cme=new mB;function wr(t){return Cme.visit(t)}var P2=class{constructor(e=0,r){this.numChunks=e,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function xC(t){return t.reduce((e,r)=>e+r.nullCount,0)}function vC(t){return t.reduce((e,r,i)=>(e[i+1]=e[i]+r.length,e),new Uint32Array(t.length+1))}function bC(t,e,r,i){let n=[];for(let s=-1,o=t.length;++s=i)break;if(r>=f+y)continue;if(f>=r&&f+y<=i){n.push(c);continue}let b=Math.max(0,r-f),M=Math.min(i-f,y);n.push(c.slice(b,M-b))}return n.length===0&&n.push(t[0].slice(0,0)),n}function gB(t,e,r,i){let n=0,s=0,o=e.length-1;do{if(n>=o-1)return r0?0:-1}function Rme(t,e){let{nullBitmap:r}=t;if(!r||t.nullCount<=0)return-1;let i=0;for(let n of new xg(r,t.offset+(e||0),t.length,r,yC)){if(!n)return i;++i}return-1}function Jr(t,e,r){if(e===void 0)return-1;if(e===null)switch(t.typeId){case Ne.Union:break;case Ne.Dictionary:break;default:return Rme(t,r)}let i=So.getVisitFn(t),n=v0(e);for(let s=(r||0)-1,o=t.length;++s{let n=t.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let r=0;return new P2(t.data.length,i=>{let s=t.data[i].length,o=t.slice(r,r+s);return r+=s,new _B(o)})}var _B=class{constructor(e){this.vector=e,this.index=0}next(){return this.indexc.data):e;if(s.length===0||s.some(c=>!(c instanceof Vi)))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:f,indexOf:y}=bZ[o.typeId],b=s[0];this.isValid=M=>C2(b,M),this.get=M=>c(b,M),this.set=(M,L)=>f(b,M,L),this.indexOf=M=>y(b,M),this._offsets=[0,b.length];break}default:Object.setPrototypeOf(this,wZ[o.typeId]),this._offsets=vC(s);break}this.data=s,this.type=o,this.stride=fu(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((e,r)=>e+r.byteLength,0)}get nullable(){return yZ(this.data)}get nullCount(){return xC(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Ne[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(yg(e,this.length))}set(e,r){}indexOf(e,r){return-1}includes(e,r){return this.indexOf(e,r)>-1}[Symbol.iterator](){return v1.visit(this)}concat(...e){return new t(this.data.concat(e.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(e,r){return new t(E2(this,e,r,({data:i,_offsets:n},s,o)=>bC(i,n,s,o)))}toJSON(){return[...this]}toArray(){let{type:e,data:r,length:i,stride:n,ArrayType:s}=this;switch(e.typeId){case Ne.Int:case Ne.Float:case Ne.Decimal:case Ne.Time:case Ne.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:f})=>(o.array.set(c.subarray(0,f*n),o.offset),o.offset+=f*n,o),{array:new s(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===e))}getChildAt(e){return e>-1&&er[e])):null}get isMemoized(){return Wt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Wt.isDictionary(this.type)){let e=new TC(this.data[0].dictionary),r=this.data.map(i=>{let n=i.clone();return n.dictionary=e,n});return new t(r)}return new TC(this)}unmemoize(){if(Wt.isDictionary(this.type)&&this.isMemoized){let e=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let n=i.clone();return n.dictionary=e,n});return new t(r)}return this}};vZ=Symbol.toStringTag;Pr[vZ]=(t=>{t.type=Wt.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;let e=Object.keys(Ne).map(r=>Ne[r]).filter(r=>typeof r=="number"&&r!==Ne.NONE);for(let r of e){let i=So.getVisitFnByTypeId(r),n=Ma.getVisitFnByTypeId(r),s=wg.getVisitFnByTypeId(r);bZ[r]={get:i,set:n,indexOf:s},wZ[r]=Object.create(t,{isValid:{value:x1(C2)},get:{value:x1(So.getVisitFnByTypeId(r))},set:{value:wC(Ma.getVisitFnByTypeId(r))},indexOf:{value:SC(wg.getVisitFnByTypeId(r))}})}return"Vector"})(Pr.prototype);var TC=class t extends Pr{constructor(e){super(e.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 f=r.call(this,o);return s[o]=f,f}}),Object.defineProperty(this,"set",{value(o,c){i.call(this,o,c),s[o]=c}}),Object.defineProperty(this,"slice",{value:(o,c)=>new t(n.call(this,o,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Pr(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function SZ(t){if(!t||t.length<=0)return function(n){return!0};let e="",r=t.filter(i=>i===i);return r.length>0&&(e=` + switch (x) {${r.map(i=>` + case ${kme(i)}:`).join("")} + return false; + }`),t.length!==r.length&&(e=`if (x !== x) return false; +${e}`),new Function("x",`${e} +return true;`)}function kme(t){return typeof t!="bigint"?of(t):`${of(t)}n`}function yB(t,e){let r=Math.ceil(t)*e-1;return(r-r%64+64||64)/e}function TZ(t,e=0){return t.length>=e?t.subarray(0,e):t2(new t.constructor(e),t,0)}var uf=class{constructor(e,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new e(this.length),this.stride=i,this.BYTES_PER_ELEMENT=e.BYTES_PER_ELEMENT,this.ArrayType=e}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(e,r){return this}append(e){return this.set(this.length,e)}reserve(e){if(e>0){this.length+=e;let r=this.stride,i=this.length*r,n=this.buffer.length;i>=n&&this._resize(n===0?yB(i*1,this.BYTES_PER_ELEMENT):yB(i*2,this.BYTES_PER_ELEMENT))}return this}flush(e=this.length){e=yB(e*this.stride,this.BYTES_PER_ELEMENT);let r=TZ(this.buffer,e);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(e){return this.buffer=TZ(this.buffer,e)}},bp=class extends uf{last(){return this.get(this.length-1)}get(e){return this.buffer[e]}set(e,r){return this.reserve(e-this.length+1),this.buffer[e*this.stride]=r,this}},b1=class extends bp{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(e){return this.buffer[e>>3]>>e%8&1}set(e,r){let{buffer:i}=this.reserve(e-this.length+1),n=e>>3,s=e%8,o=i[n]>>s&1;return r?o===0&&(i[n]|=1<=0&&n.fill(n[i],i,e),n[e]=n[e-1]+r,this}flush(e=this.length-1){return e>this.length&&this.set(e-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(e+1)}};var es=class{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e){throw new Error('"throughDOM" not available in this environment')}constructor({type:e,nullValues:r}){this.length=0,this.finished=!1,this.type=e,this.children=[],this.nullValues=r,this.stride=fu(e),this._nulls=new b1,r&&r.length>0&&(this._isValid=SZ(r))}toVector(){return new Pr([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let e=0,{_offsets:r,_values:i,_nulls:n,_typeIds:s,children:o}=this;return r&&(e+=r.byteLength),i&&(e+=i.byteLength),n&&(e+=n.byteLength),s&&(e+=s.byteLength),o.reduce((c,f)=>c+f.byteLength,e)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let e=0;return this._offsets&&(e+=this._offsets.reservedByteLength),this._values&&(e+=this._values.reservedByteLength),this._nulls&&(e+=this._nulls.reservedByteLength),this._typeIds&&(e+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,e)}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(e){return this.set(this.length,e)}isValid(e){return this._isValid(e)}set(e,r){return this.setValid(e,this.isValid(r))&&this.setValue(e,r),this}setValue(e,r){this._setValue(this,e,r)}setValid(e,r){return this.length=this._nulls.set(e,+r).length,r}addChild(e,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(e){return this.children[e]||null}flush(){let e,r,i,n,{type:s,length:o,nullCount:c,_typeIds:f,_offsets:y,_values:b,_nulls:M}=this;(r=f?.flush(o))?n=y?.flush(o):(n=y?.flush(o))?e=b?.flush(y.last()):e=b?.flush(o),c>0&&(i=M?.flush(o));let L=this.children.map(N=>N.flush());return this.clear(),wr({type:s,length:o,nullCount:c,children:L,child:L[0],data:e,typeIds:r,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(let e of this.children)e.finish();return this}clear(){var e,r,i,n;this.length=0,(e=this._nulls)===null||e===void 0||e.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}};es.prototype.length=1;es.prototype.stride=1;es.prototype.children=null;es.prototype.finished=!1;es.prototype.nullValues=null;es.prototype._isValid=()=>!0;var To=class extends es{constructor(e){super(e),this._values=new bp(this.ArrayType,0,this.stride)}setValue(e,r){let i=this._values;return i.reserve(e-i.length+1),super.setValue(e,r)}},vc=class extends es{constructor(e){super(e),this._pendingLength=0,this._offsets=new w1(e.type)}setValue(e,r){let i=this._pending||(this._pending=new Map),n=i.get(e);n&&(this._pendingLength-=n.length),this._pendingLength+=r instanceof dd?r[x0].length:r.length,i.set(e,r)}setValid(e,r){return super.setValid(e,r)?!0:((this._pending||(this._pending=new Map)).set(e,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 e=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,e&&e.size>0&&this._flushPending(e,r),this}};var Sg=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,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(e,r,i,n){return e.prep(8,24),e.writeInt64(BigInt(n??0)),e.pad(4),e.writeInt32(i),e.writeInt64(BigInt(r??0)),e.offset()}};var du=class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsFooter(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):fn.V1}schema(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new mc).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(e,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Sg).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new Sg).__init(this.bb.__vector(this.bb_pos+i)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Uo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,r){e.addFieldInt16(0,r,fn.V1)}static addSchema(e,r){e.addFieldOffset(1,r,0)}static addDictionaries(e,r){e.addFieldOffset(2,r,0)}static startDictionariesVector(e,r){e.startVector(24,r,8)}static addRecordBatches(e,r){e.addFieldOffset(3,r,0)}static startRecordBatchesVector(e,r){e.startVector(24,r,8)}static addCustomMetadata(e,r){e.addFieldOffset(4,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,r){e.finish(r)}static finishSizePrefixedFooterBuffer(e,r){e.finish(r,void 0,!0)}};var pn=class t{constructor(e=[],r,i,n=fn.V5){this.fields=e||[],this.metadata=r||new Map,i||(i=xB(e)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,r)=>`${r}: ${e}`).join(", ")} }>`}select(e){let r=new Set(e),i=this.fields.filter(n=>r.has(n.name));return new t(i,this.metadata)}selectAt(e){let r=e.map(i=>this.fields[i]).filter(Boolean);return new t(r,this.metadata)}assign(...e){let r=e[0]instanceof t?e[0]:Array.isArray(e[0])?new t(e[0]):new t(e),i=[...this.fields],n=EC(EC(new Map,this.metadata),r.metadata),s=r.fields.filter(c=>{let f=i.findIndex(y=>y.name===c.name);return~f?(i[f]=c.clone({metadata:EC(EC(new Map,i[f].metadata),c.metadata)}))&&!1:!0}),o=xB(s,new Map);return new t([...i,...s],n,new Map([...this.dictionaries,...o]))}};pn.prototype.fields=null;pn.prototype.metadata=null;pn.prototype.dictionaries=null;var Ai=class t{static new(...e){let[r,i,n,s]=e;return e[0]&&typeof e[0]=="object"&&({name:r}=e[0],i===void 0&&(i=e[0].type),n===void 0&&(n=e[0].nullable),s===void 0&&(s=e[0].metadata)),new t(`${r}`,i,n,s)}constructor(e,r,i=!1,n){this.name=e,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(...e){let[r,i,n,s]=e;return!e[0]||typeof e[0]!="object"?[r=this.name,i=this.type,n=this.nullable,s=this.metadata]=e:{name:r=this.name,type:i=this.type,nullable:n=this.nullable,metadata:s=this.metadata}=e[0],t.new(r,i,n,s)}};Ai.prototype.type=null;Ai.prototype.name=null;Ai.prototype.nullable=null;Ai.prototype.metadata=null;function EC(t,e){return new Map([...t||new Map,...e||new Map])}function xB(t,e=new Map){for(let r=-1,i=t.length;++r0&&xB(s.children,e)}return e}var Lme=_g,Dme=uu,wp=class{static decode(e){e=new Dme(Ur(e));let r=du.getRootAsFooter(e),i=pn.decode(r.schema(),new Map,r.version());return new vB(i,r)}static encode(e){let r=new Lme,i=pn.encode(r,e.schema);du.startRecordBatchesVector(r,e.numRecordBatches);for(let o of[...e.recordBatches()].slice().reverse())Sp.encode(r,o);let n=r.endVector();du.startDictionariesVector(r,e.numDictionaries);for(let o of[...e.dictionaryBatches()].slice().reverse())Sp.encode(r,o);let s=r.endVector();return du.startFooter(r),du.addSchema(r,i),du.addVersion(r,fn.V5),du.addRecordBatches(r,n),du.addDictionaries(r,s),du.finishFooterBuffer(r,du.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,r=fn.V5,i,n){this.schema=e,this.version=r,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let e,r=-1,i=this.numRecordBatches;++r=0&&e=0&&e=0&&e=0&&ethis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return lr(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Gn);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ea.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ea.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return lr(this,void 0,void 0,function*(){return yield this.abort(e),Gn})}return(e){return lr(this,void 0,void 0,function*(){return yield this.close(),Gn})}read(e){return lr(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return lr(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){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(Gn)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var pd=class extends MC{write(e){if((e=Ur(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Jw(this.toUint8Array(!0)):this.toUint8Array(!1).then(Jw)}toUint8Array(e=!1){return e?cu(this._values)[0]:lr(this,void 0,void 0,function*(){var r,i,n,s;let o=[],c=0;try{for(var f=!0,y=Jh(this),b;b=yield y.next(),r=b.done,!r;f=!0){s=b.value,f=!1;let M=s;o.push(M),c+=M.byteLength}}catch(M){i={error:M}}finally{try{!f&&!r&&(n=y.return)&&(yield n.call(y))}finally{if(i)throw i.error}}return cu(o,c)[0]})}},Ad=class{constructor(e){e&&(this.source=new bB(Ea.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},uh=class t{constructor(e){e instanceof t?this.source=e.source:e instanceof pd?this.source=new Tp(Ea.fromAsyncIterable(e)):qP(e)?this.source=new Tp(Ea.fromNodeStream(e)):e2(e)?this.source=new Tp(Ea.fromDOMStream(e)):HP(e)?this.source=new Tp(Ea.fromDOMStream(e.body)):ef(e)?this.source=new Tp(Ea.fromIterable(e)):lu(e)?this.source=new Tp(Ea.fromAsyncIterable(e)):Ju(e)&&(this.source=new Tp(Ea.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},bB=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,r="read"){return this.source.next({cmd:r,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Gn)}return(e){return Object.create(this.source.return&&this.source.return(e)||Gn)}},Tp=class{constructor(e){this.source=e,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(e){return lr(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return lr(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return lr(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return lr(this,arguments,void 0,function*(r,i="read"){return yield this.source.next({cmd:i,size:r})})}throw(e){return lr(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(e))||Gn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(e){return lr(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(e))||Gn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var R2=class extends Ad{constructor(e,r){super(),this.position=0,this.buffer=Ur(e),this.size=r===void 0?this.buffer.byteLength:r}readInt32(e){let{buffer:r,byteOffset:i}=this.readAt(e,4);return new DataView(r,i).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),ek2,Int128:()=>L2,Int64:()=>Ep,Uint64:()=>bs});function S1(t){return t<0&&(t=4294967295+t+1),`0x${t.toString(16)}`}var T1=8,wB=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],k2=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.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(e){let r=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],r>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(e){return this.buffer[1]>>0,r[2]=this.buffer[2]+e.buffer[2]>>>0,r[1]=this.buffer[1]+e.buffer[1]>>>0,r[0]=this.buffer[0]+e.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`${S1(this.buffer[3])} ${S1(this.buffer[2])} ${S1(this.buffer[1])} ${S1(this.buffer[0])}`}static multiply(e,r){return new t(new Uint32Array(e.buffer)).times(r)}static add(e,r){return new t(new Uint32Array(e.buffer)).plus(r)}static from(e,r=new Uint32Array(4)){return t.fromString(typeof e=="string"?e:e.toString(),r)}static fromNumber(e,r=new Uint32Array(4)){return t.fromString(e.toString(),r)}static fromString(e,r=new Uint32Array(4)){let i=e.startsWith("-"),n=e.length,s=new t(r);for(let o=i?1:0;o0&&this.readData(e,i)||new Uint8Array(0)}readOffsets(e,r){return this.readData(e,r)}readTypeIds(e,r){return this.readData(e,r)}readData(e,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(e){return this.dictionaries.get(e.id)}},PC=class extends D2{constructor(e,r,i,n,s){super(new Uint8Array(0),r,i,n,s),this.sources=e}readNullBitmap(e,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):bg(this.sources[i])}readOffsets(e,{offset:r}=this.nextBufferRange()){return wi(Uint8Array,wi(e.OffsetArrayType,this.sources[r]))}readTypeIds(e,{offset:r}=this.nextBufferRange()){return wi(Uint8Array,wi(e.ArrayType,this.sources[r]))}readData(e,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return Wt.isTimestamp(e)?wi(Uint8Array,Ep.convertArray(i[r])):(Wt.isInt(e)||Wt.isTime(e))&&e.bitWidth===64||Wt.isDuration(e)?wi(Uint8Array,Ep.convertArray(i[r])):Wt.isDate(e)&&e.unit===zs.MILLISECOND?wi(Uint8Array,Ep.convertArray(i[r])):Wt.isDecimal(e)?wi(Uint8Array,L2.convertArray(i[r])):Wt.isBinary(e)||Wt.isLargeBinary(e)||Wt.isFixedSizeBinary(e)?Ome(i[r]):Wt.isBool(e)?bg(i[r]):Wt.isUtf8(e)||Wt.isLargeUtf8(e)?od(i[r].join("")):wi(Uint8Array,wi(e.ArrayType,i[r].map(n=>+n)))}};function Ome(t){let e=t.join(""),r=new Uint8Array(e.length/2);for(let i=0;i>1]=Number.parseInt(e.slice(i,i+2),16);return r}var Eg=class extends vc{constructor(e){super(e),this._values=new uf(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,r){return super.setValue(e,Ur(r))}_flushPending(e,r){let i=this._offsets,n=this._values.reserve(r).buffer,s=0;for(let[o,c]of e)if(c===void 0)i.set(o,0);else{let f=c.length;n.set(c,s),i.set(o,f),s+=f}}};var Mg=class extends vc{constructor(e){super(e),this._values=new uf(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,r){return super.setValue(e,Ur(r))}_flushPending(e,r){let i=this._offsets,n=this._values.reserve(r).buffer,s=0;for(let[o,c]of e)if(c===void 0)i.set(o,BigInt(0));else{let f=c.length;n.set(c,s),i.set(o,BigInt(f)),s+=f}}};var w0=class extends es{constructor(e){super(e),this._values=new b1}setValue(e,r){this._values.set(e,+r)}};var S0=class extends To{};S0.prototype._setValue=iB;var E1=class extends S0{};E1.prototype._setValue=tC;var M1=class extends S0{};M1.prototype._setValue=rC;var P1=class extends To{};P1.prototype._setValue=oB;var O2=class extends es{constructor({type:e,nullValues:r,dictionaryHashFunction:i}){super({type:new xc(e.dictionary,e.indices,e.id,e.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Pg({type:this.type.indices,nullValues:r}),this.dictionary=Pg({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(e){return this.indices.isValid(e)}setValid(e,r){let i=this.indices;return r=i.setValid(e,r),this.length=i.length,r}setValue(e,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(e,s)}flush(){let e=this.type,r=this._dictionary,i=this.dictionary.toVector(),n=this.indices.flush().clone(e);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(e){return typeof e=="string"?e:`${e}`}};var C1=class extends To{};C1.prototype._setValue=rB;var B2=class extends es{setValue(e,r){let[i]=this.children,n=e*this.stride;for(let s=-1,o=r.length;++s0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(e);return this.type=new Rl(this.type.listSize,new Ai(r,e.type,!0)),i}};var T0=class extends To{setValue(e,r){this._values.set(e,r)}},F2=class extends T0{setValue(e,r){super.setValue(e,T2(r))}},N2=class extends T0{},z2=class extends T0{};var E0=class extends To{};E0.prototype._setValue=aB;var I1=class extends E0{};I1.prototype._setValue=hC;var R1=class extends E0{};R1.prototype._setValue=fC;var md=class extends To{};md.prototype._setValue=lB;var k1=class extends md{};k1.prototype._setValue=dC;var L1=class extends md{};L1.prototype._setValue=pC;var D1=class extends md{};D1.prototype._setValue=AC;var O1=class extends md{};O1.prototype._setValue=mC;var pu=class extends To{setValue(e,r){this._values.set(e,r)}},U2=class extends pu{},V2=class extends pu{},j2=class extends pu{},W2=class extends pu{},H2=class extends pu{},$2=class extends pu{},q2=class extends pu{},G2=class extends pu{};var Z2=class extends vc{constructor(e){super(e),this._offsets=new w1(e.type)}addChild(e,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new il(new Ai(r,e.type,!0)),this.numChildren-1}_flushPending(e){let r=this._offsets,[i]=this.children;for(let[n,s]of e)if(typeof s>"u")r.set(n,0);else{let o=s,c=o.length,f=r.set(n,c).buffer[n];for(let y=-1;++y0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=e,this.type=new yc(new Ai(r,e.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(e){let r=this._offsets,[i]=this.children;for(let[n,s]of e)if(s===void 0)r.set(n,0);else{let{[n]:o,[n+1]:c}=r.set(n,s.size).buffer;for(let f of s.entries())if(i.set(o,f),++o>=c)break}}};var X2=class extends es{setValue(e,r){}setValid(e,r){return this.length=Math.max(e+1,this.length),r}};var Q2=class extends es{setValue(e,r){let{children:i,type:n}=this;switch(Array.isArray(r)||r.constructor){case!0:return n.children.forEach((s,o)=>i[o].set(e,r[o]));case Map:return n.children.forEach((s,o)=>i[o].set(e,r.get(s.name)));default:return n.children.forEach((s,o)=>i[o].set(e,r[s.name]))}}setValid(e,r){return super.setValid(e,r)||this.children.forEach(i=>i.setValid(e,r)),r}addChild(e,r=`${this.numChildren}`){let i=this.children.push(e);return this.type=new yn([...this.type.children,new Ai(r,e.type,!0)]),i}};var gd=class extends To{};gd.prototype._setValue=nB;var B1=class extends gd{};B1.prototype._setValue=iC;var F1=class extends gd{};F1.prototype._setValue=nC;var N1=class extends gd{};N1.prototype._setValue=sC;var z1=class extends gd{};z1.prototype._setValue=oC;var _d=class extends To{};_d.prototype._setValue=sB;var U1=class extends _d{};U1.prototype._setValue=aC;var V1=class extends _d{};V1.prototype._setValue=lC;var j1=class extends _d{};j1.prototype._setValue=cC;var W1=class extends _d{};W1.prototype._setValue=uC;var Cg=class extends es{constructor(e){super(e),this._typeIds=new bp(Int8Array,0,1),typeof e.valueToChildTypeId=="function"&&(this._valueToChildTypeId=e.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(e,r){return this.set(this.length,e,r)}set(e,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,e)),this.setValue(e,r,i),this}setValue(e,r,i){this._typeIds.set(e,i);let n=this.type.typeIdToChildIndex[i],s=this.children[n];s?.set(e,r)}addChild(e,r=`${this.children.length}`){let i=this.children.push(e),{type:{children:n,mode:s,typeIds:o}}=this,c=[...n,new Ai(r,e.type)];return this.type=new _c(s,[...o,i],c),i}_valueToChildTypeId(e,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.")}},K2=class extends Cg{},J2=class extends Cg{constructor(e){super(e),this._offsets=new bp(Int32Array)}setValue(e,r,i){let n=this._typeIds.set(e,i).buffer[e],s=this.getChildAt(this.type.typeIdToChildIndex[n]),o=this._offsets.set(e,s.length).buffer[e];s?.set(o,r)}};var H1=class extends vc{constructor(e){super(e),this._values=new uf(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,r){return super.setValue(e,od(r))}_flushPending(e,r){}};H1.prototype._flushPending=Eg.prototype._flushPending;var $1=class extends vc{constructor(e){super(e),this._values=new uf(Uint8Array)}get byteLength(){let e=this._pendingLength+this.length*4;return this._offsets&&(e+=this._offsets.byteLength),this._values&&(e+=this._values.byteLength),this._nulls&&(e+=this._nulls.byteLength),e}setValue(e,r){return super.setValue(e,od(r))}_flushPending(e,r){}};$1.prototype._flushPending=Mg.prototype._flushPending;var TB=class extends kr{visitNull(){return X2}visitBool(){return w0}visitInt(){return pu}visitInt8(){return U2}visitInt16(){return V2}visitInt32(){return j2}visitInt64(){return W2}visitUint8(){return H2}visitUint16(){return $2}visitUint32(){return q2}visitUint64(){return G2}visitFloat(){return T0}visitFloat16(){return F2}visitFloat32(){return N2}visitFloat64(){return z2}visitUtf8(){return H1}visitLargeUtf8(){return $1}visitBinary(){return Eg}visitLargeBinary(){return Mg}visitFixedSizeBinary(){return C1}visitDate(){return S0}visitDateDay(){return E1}visitDateMillisecond(){return M1}visitTimestamp(){return gd}visitTimestampSecond(){return B1}visitTimestampMillisecond(){return F1}visitTimestampMicrosecond(){return N1}visitTimestampNanosecond(){return z1}visitTime(){return _d}visitTimeSecond(){return U1}visitTimeMillisecond(){return V1}visitTimeMicrosecond(){return j1}visitTimeNanosecond(){return W1}visitDecimal(){return P1}visitList(){return Z2}visitStruct(){return Q2}visitUnion(){return Cg}visitDenseUnion(){return J2}visitSparseUnion(){return K2}visitDictionary(){return O2}visitInterval(){return E0}visitIntervalDayTime(){return I1}visitIntervalYearMonth(){return R1}visitDuration(){return md}visitDurationSecond(){return k1}visitDurationMillisecond(){return L1}visitDurationMicrosecond(){return D1}visitDurationNanosecond(){return O1}visitFixedSizeList(){return B2}visitMap(){return Y2}},EZ=new TB;var Br=class extends kr{compareSchemas(e,r){return e===r||r instanceof e.constructor&&this.compareManyFields(e.fields,r.fields)}compareManyFields(e,r){return e===r||Array.isArray(e)&&Array.isArray(r)&&e.length===r.length&&e.every((i,n)=>this.compareFields(i,r[n]))}compareFields(e,r){return e===r||r instanceof e.constructor&&e.name===r.name&&e.nullable===r.nullable&&this.visit(e.type,r.type)}};function kl(t,e){return e instanceof t.constructor}function Ig(t,e){return t===e||kl(t,e)}function Mp(t,e){return t===e||kl(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function CC(t,e){return t===e||kl(t,e)&&t.precision===e.precision}function Bme(t,e){return t===e||kl(t,e)&&t.byteWidth===e.byteWidth}function EB(t,e){return t===e||kl(t,e)&&t.unit===e.unit}function eS(t,e){return t===e||kl(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function tS(t,e){return t===e||kl(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Fme(t,e){return t===e||kl(t,e)&&t.children.length===e.children.length&&yd.compareManyFields(t.children,e.children)}function Nme(t,e){return t===e||kl(t,e)&&t.children.length===e.children.length&&yd.compareManyFields(t.children,e.children)}function MB(t,e){return t===e||kl(t,e)&&t.mode===e.mode&&t.typeIds.every((r,i)=>r===e.typeIds[i])&&yd.compareManyFields(t.children,e.children)}function zme(t,e){return t===e||kl(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&yd.visit(t.indices,e.indices)&&yd.visit(t.dictionary,e.dictionary)}function PB(t,e){return t===e||kl(t,e)&&t.unit===e.unit}function rS(t,e){return t===e||kl(t,e)&&t.unit===e.unit}function Ume(t,e){return t===e||kl(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&yd.compareManyFields(t.children,e.children)}function Vme(t,e){return t===e||kl(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&yd.compareManyFields(t.children,e.children)}Br.prototype.visitNull=Ig;Br.prototype.visitBool=Ig;Br.prototype.visitInt=Mp;Br.prototype.visitInt8=Mp;Br.prototype.visitInt16=Mp;Br.prototype.visitInt32=Mp;Br.prototype.visitInt64=Mp;Br.prototype.visitUint8=Mp;Br.prototype.visitUint16=Mp;Br.prototype.visitUint32=Mp;Br.prototype.visitUint64=Mp;Br.prototype.visitFloat=CC;Br.prototype.visitFloat16=CC;Br.prototype.visitFloat32=CC;Br.prototype.visitFloat64=CC;Br.prototype.visitUtf8=Ig;Br.prototype.visitLargeUtf8=Ig;Br.prototype.visitBinary=Ig;Br.prototype.visitLargeBinary=Ig;Br.prototype.visitFixedSizeBinary=Bme;Br.prototype.visitDate=EB;Br.prototype.visitDateDay=EB;Br.prototype.visitDateMillisecond=EB;Br.prototype.visitTimestamp=eS;Br.prototype.visitTimestampSecond=eS;Br.prototype.visitTimestampMillisecond=eS;Br.prototype.visitTimestampMicrosecond=eS;Br.prototype.visitTimestampNanosecond=eS;Br.prototype.visitTime=tS;Br.prototype.visitTimeSecond=tS;Br.prototype.visitTimeMillisecond=tS;Br.prototype.visitTimeMicrosecond=tS;Br.prototype.visitTimeNanosecond=tS;Br.prototype.visitDecimal=Ig;Br.prototype.visitList=Fme;Br.prototype.visitStruct=Nme;Br.prototype.visitUnion=MB;Br.prototype.visitDenseUnion=MB;Br.prototype.visitSparseUnion=MB;Br.prototype.visitDictionary=zme;Br.prototype.visitInterval=PB;Br.prototype.visitIntervalDayTime=PB;Br.prototype.visitIntervalYearMonth=PB;Br.prototype.visitDuration=rS;Br.prototype.visitDurationSecond=rS;Br.prototype.visitDurationMillisecond=rS;Br.prototype.visitDurationMicrosecond=rS;Br.prototype.visitDurationNanosecond=rS;Br.prototype.visitFixedSizeList=Ume;Br.prototype.visitMap=Vme;var yd=new Br;function Rg(t,e){return yd.compareSchemas(t,e)}function MZ(t,e){return yd.compareFields(t,e)}function PZ(t,e){return yd.visit(t,e)}function Pg(t){let e=t.type,r=new(EZ.getVisitFn(e)())(t);if(e.children&&e.children.length>0){let i=t.children||[],n={nullValues:t.nullValues},s=Array.isArray(i)?(o,c)=>i[c]||n:({name:o})=>i[o]||n;for(let[o,c]of e.children.entries()){let{type:f}=c,y=s(c,o);r.children.push(Pg(Object.assign(Object.assign({},y),{type:f})))}}return r}function IC(t,e){return jme(t,e.map(r=>r.data.concat()))}function jme(t,e){let r=[...t.fields],i=[],n={numBatches:e.reduce((M,L)=>Math.max(M,L.length),0)},s=0,o=0,c=-1,f=e.length,y,b=[];for(;n.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c0&&(i[s++]=wr({type:new yn(r),length:o,nullCount:0,children:b.slice()})))}return[t=t.assign(r),i.map(M=>new Vs(t,M))]}function Wme(t,e,r,i,n){var s;let o=(e+63&-64)>>3;for(let c=-1,f=i.length;++c=e)b===e?r[c]=y:(r[c]=y.slice(0,e),n.numBatches=Math.max(n.numBatches,i[c].unshift(y.slice(e,b-e))));else{let M=t[c];t[c]=M.clone({nullable:!0}),r[c]=(s=y?._changeLengthAndBackfillNullBitmap(e))!==null&&s!==void 0?s:wr({type:M.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return r}var IZ,Pa=class t{constructor(...e){var r,i;if(e.length===0)return this.batches=[],this.schema=new pn([]),this._offsets=[0],this;let n,s;e[0]instanceof pn&&(n=e.shift()),e.at(-1)instanceof Uint32Array&&(s=e.pop());let o=f=>{if(f){if(f instanceof Vs)return[f];if(f instanceof t)return f.batches;if(f instanceof Vi){if(f.type instanceof yn)return[new Vs(new pn(f.type.children),f)]}else{if(Array.isArray(f))return f.flatMap(y=>o(y));if(typeof f[Symbol.iterator]=="function")return[...f].flatMap(y=>o(y));if(typeof f=="object"){let y=Object.keys(f),b=y.map(N=>new Pr([f[N]])),M=n??new pn(y.map((N,V)=>new Ai(String(N),b[V].type,b[V].nullable))),[,L]=IC(M,b);return L.length===0?[new Vs(f)]:L}}}return[]},c=e.flatMap(f=>o(f));if(n=(i=n??((r=c[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new pn([]),!(n instanceof pn))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let f of c){if(!(f instanceof Vs))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Rg(n,f.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=c,this._offsets=s??vC(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,r)=>e+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=xC(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(yg(e,this.numRows))}set(e,r){}indexOf(e,r){return-1}[Symbol.iterator](){return this.batches.length>0?v1.visit(new Pr(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ + ${this.toArray().join(`, + `)} +]`}concat(...e){let r=this.schema,i=this.data.concat(e.flatMap(({data:n})=>n));return new t(r,i.map(n=>new Vs(r,n)))}slice(e,r){let i=this.schema;[e,r]=E2({length:this.numRows},e,r);let n=bC(this.data,this._offsets,e,r);return new t(i,n.map(s=>new Vs(i,s)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===e))}getChildAt(e){if(e>-1&&ei.children[e]);if(r.length===0){let{type:i}=this.schema.fields[e],n=wr({type:i,length:0,nullCount:0});r.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new Pr(r)}return null}setChild(e,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===e),r)}setChildAt(e,r){let i=this.schema,n=[...this.batches];if(e>-1&&ethis.getChildAt(y));[s[e],c[e]]=[o,r],[i,n]=IC(i,c)}return new t(i,n)}select(e){let r=this.schema.fields.reduce((i,n,s)=>i.set(n.name,s),new Map);return this.selectAt(e.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(e){let r=this.schema.selectAt(e),i=this.batches.map(n=>n.selectAt(e));return new t(r,i)}assign(e){let r=this.schema.fields,[i,n]=e.schema.fields.reduce((c,f,y)=>{let[b,M]=c,L=r.findIndex(N=>N.name===f.name);return~L?M[L]=y:b.push(y),c},[[],[]]),s=this.schema.assign(e.schema),o=[...r.map((c,f)=>[f,n[f]]).map(([c,f])=>f===void 0?this.getChildAt(c):e.getChildAt(f)),...i.map(c=>e.getChildAt(c))].filter(Boolean);return new t(...IC(s,o))}};IZ=Symbol.toStringTag;Pa[IZ]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=x1(C2),t.get=x1(So.getVisitFn(Ne.Struct)),t.set=wC(Ma.getVisitFn(Ne.Struct)),t.indexOf=SC(wg.getVisitFn(Ne.Struct)),"Table"))(Pa.prototype);var kZ,Vs=class t{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof pn))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=wr({nullCount:0,type:new yn(this.schema.fields),children:this.schema.fields.map(r=>wr({type:r.type,nullCount:0}))})]=e,!(this.data instanceof Vi))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=RZ(this.schema,this.data.children);break}case 1:{let[r]=e,{fields:i,children:n,length:s}=Object.keys(r).reduce((f,y,b)=>(f.children[b]=r[y],f.length=Math.max(f.length,r[y].length),f.fields[b]=Ai.new({name:y,type:r[y].type,nullable:!0}),f),{length:0,fields:new Array,children:new Array}),o=new pn(i),c=wr({type:new yn(i),length:s,children:n,nullCount:0});[this.schema,this.data]=RZ(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=LZ(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(e){return this.data.getValid(e)}get(e){return So.visit(this.data,e)}at(e){return this.get(yg(e,this.numRows))}set(e,r){return Ma.visit(this.data,e,r)}indexOf(e,r){return wg.visit(this.data,e,r)}[Symbol.iterator](){return v1.visit(new Pr([this.data]))}toArray(){return[...this]}concat(...e){return new Pa(this.schema,[this,...e])}slice(e,r){let[i]=new Pr([this.data]).slice(e,r).data;return new t(this.schema,i)}getChild(e){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===e))}getChildAt(e){return e>-1&&en.name===e),r)}setChildAt(e,r){let i=this.schema,n=this.data;if(e>-1&&ec.name===s);~o&&(n[o]=this.data.children[o])}return new t(r,wr({type:i,length:this.numRows,children:n}))}selectAt(e){let r=this.schema.selectAt(e),i=e.map(s=>this.data.children[s]).filter(Boolean),n=wr({type:new yn(r.fields),length:this.numRows,children:i});return new t(r,n)}};kZ=Symbol.toStringTag;Vs[kZ]=(t=>(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Vs.prototype);function RZ(t,e,r=e.reduce((i,n)=>Math.max(i,n.length),0)){var i;let n=[...t.fields],s=[...e],o=(r+63&-64)>>3;for(let[c,f]of t.fields.entries()){let y=e[c];(!y||y.length!==r)&&(n[c]=f.clone({nullable:!0}),s[c]=(i=y?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:wr({type:f.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[t.assign(n),wr({type:new yn(n),length:r,children:s})]}function LZ(t,e,r=new Map){var i,n;if(((i=t?.length)!==null&&i!==void 0?i:0)>0&&t?.length===e?.length)for(let s=-1,o=t.length;++swr({type:n.type})),i=wr({type:new yn(e.fields),nullCount:0,children:r});super(e,i)}};var hf=class t{constructor(){this.bb=null,this.bb_pos=0}__init(e,r){return this.bb_pos=e,this.bb=r,this}static getRootAsMessage(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):fn.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Pi.NONE}header(e){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(e,this.bb_pos+r):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Uo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,r){e.addFieldInt16(0,r,fn.V1)}static addHeaderType(e,r){e.addFieldInt8(1,r,Pi.NONE)}static addHeader(e,r){e.addFieldOffset(2,r,0)}static addBodyLength(e,r){e.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(e,r){e.addFieldOffset(4,r,0)}static createCustomMetadataVector(e,r){e.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)e.addOffset(r[i]);return e.endVector()}static startCustomMetadataVector(e,r){e.startVector(4,r,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,r){e.finish(r)}static finishSizePrefixedMessageBuffer(e,r){e.finish(r,void 0,!0)}static createMessage(e,r,i,n,s,o){return t.startMessage(e),t.addVersion(e,r),t.addHeaderType(e,i),t.addHeader(e,n),t.addBodyLength(e,s),t.addCustomMetadata(e,o),t.endMessage(e)}};var CB=class extends kr{visit(e,r){return e==null||r==null?void 0:super.visit(e,r)}visitNull(e,r){return h2.startNull(r),h2.endNull(r)}visitInt(e,r){return nf.startInt(r),nf.addBitWidth(r,e.bitWidth),nf.addIsSigned(r,e.isSigned),nf.endInt(r)}visitFloat(e,r){return A0.startFloatingPoint(r),A0.addPrecision(r,e.precision),A0.endFloatingPoint(r)}visitBinary(e,r){return o2.startBinary(r),o2.endBinary(r)}visitLargeBinary(e,r){return l2.startLargeBinary(r),l2.endLargeBinary(r)}visitBool(e,r){return a2.startBool(r),a2.endBool(r)}visitUtf8(e,r){return d2.startUtf8(r),d2.endUtf8(r)}visitLargeUtf8(e,r){return c2.startLargeUtf8(r),c2.endLargeUtf8(r)}visitDecimal(e,r){return ud.startDecimal(r),ud.addScale(r,e.scale),ud.addPrecision(r,e.precision),ud.addBitWidth(r,e.bitWidth),ud.endDecimal(r)}visitDate(e,r){return h0.startDate(r),h0.addUnit(r,e.unit),h0.endDate(r)}visitTime(e,r){return yp.startTime(r),yp.addUnit(r,e.unit),yp.addBitWidth(r,e.bitWidth),yp.endTime(r)}visitTimestamp(e,r){let i=e.timezone&&r.createString(e.timezone)||void 0;return xp.startTimestamp(r),xp.addUnit(r,e.unit),i!==void 0&&xp.addTimezone(r,i),xp.endTimestamp(r)}visitInterval(e,r){return m0.startInterval(r),m0.addUnit(r,e.unit),m0.endInterval(r)}visitDuration(e,r){return f0.startDuration(r),f0.addUnit(r,e.unit),f0.endDuration(r)}visitList(e,r){return u2.startList(r),u2.endList(r)}visitStruct(e,r){return f2.startStruct_(r),f2.endStruct_(r)}visitUnion(e,r){sf.startTypeIdsVector(r,e.typeIds.length);let i=sf.createTypeIdsVector(r,e.typeIds);return sf.startUnion(r),sf.addMode(r,e.mode),sf.addTypeIds(r,i),sf.endUnion(r)}visitDictionary(e,r){let i=this.visit(e.indices,r);return cd.startDictionaryEncoding(r),cd.addId(r,BigInt(e.id)),cd.addIsOrdered(r,e.isOrdered),i!==void 0&&cd.addIndexType(r,i),cd.endDictionaryEncoding(r)}visitFixedSizeBinary(e,r){return d0.startFixedSizeBinary(r),d0.addByteWidth(r,e.byteWidth),d0.endFixedSizeBinary(r)}visitFixedSizeList(e,r){return p0.startFixedSizeList(r),p0.addListSize(r,e.listSize),p0.endFixedSizeList(r)}visitMap(e,r){return g0.startMap(r),g0.addKeysSorted(r,e.keysSorted),g0.endMap(r)}},RC=new CB;function FZ(t,e=new Map){return new pn(Hme(t,e),kC(t.metadata),e)}function IB(t){return new Ca(t.count,zZ(t.columns),UZ(t.columns))}function NZ(t){return new wc(IB(t.data),t.id,t.isDelta)}function Hme(t,e){return(t.fields||[]).filter(Boolean).map(r=>Ai.fromJSON(r,e))}function DZ(t,e){return(t.children||[]).filter(Boolean).map(r=>Ai.fromJSON(r,e))}function zZ(t){return(t||[]).reduce((e,r)=>[...e,new hh(r.count,$me(r.VALIDITY)),...zZ(r.children)],[])}function UZ(t,e=[]){for(let r=-1,i=(t||[]).length;++re+ +(r===0),0)}function VZ(t,e){let r,i,n,s,o,c;return!e||!(s=t.dictionary)?(o=BZ(t,DZ(t,e)),n=new Ai(t.name,o,t.nullable,kC(t.metadata))):e.has(r=s.id)?(i=(i=s.indexType)?OZ(i):new lf,c=new xc(e.get(r),i,r,s.isOrdered),n=new Ai(t.name,c,t.nullable,kC(t.metadata))):(i=(i=s.indexType)?OZ(i):new lf,e.set(r,o=BZ(t,DZ(t,e))),c=new xc(o,i,r,s.isOrdered),n=new Ai(t.name,c,t.nullable,kC(t.metadata))),n||null}function kC(t=[]){return new Map(t.map(({key:e,value:r})=>[e,r]))}function OZ(t){return new Us(t.isSigned,t.bitWidth)}function BZ(t,e){let r=t.type.name;switch(r){case"NONE":return new na;case"null":return new na;case"binary":return new th;case"largebinary":return new hd;case"utf8":return new rh;case"largeutf8":return new fd;case"bool":return new gc;case"list":return new il((e||[])[0]);case"struct":return new yn(e||[]);case"struct_":return new yn(e||[])}switch(r){case"int":{let i=t.type;return new Us(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=t.type;return new sa(sn[i.precision])}case"decimal":{let i=t.type;return new ih(i.scale,i.precision,i.bitWidth)}case"date":{let i=t.type;return new nh(zs[i.unit])}case"time":{let i=t.type;return new sh(xr[i.unit],i.bitWidth)}case"timestamp":{let i=t.type;return new oh(xr[i.unit],i.timezone)}case"interval":{let i=t.type;return new ah(zo[i.unit])}case"duration":{let i=t.type;return new lh(xr[i.unit])}case"union":{let i=t.type,[n,...s]=(i.mode+"").toLowerCase(),o=n.toUpperCase()+s.join("");return new _c(Rn[o],i.typeIds||[],e||[])}case"fixedsizebinary":{let i=t.type;return new ch(i.byteWidth)}case"fixedsizelist":{let i=t.type;return new Rl(i.listSize,(e||[])[0])}case"map":{let i=t.type;return new yc((e||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var qme=_g,Gme=uu,Sc=class t{static fromJSON(e,r){let i=new t(0,fn.V5,r);return i._createHeader=Zme(e,r),i}static decode(e){e=new Gme(Ur(e));let r=hf.getRootAsMessage(e),i=r.bodyLength(),n=r.version(),s=r.headerType(),o=new t(i,n,s);return o._createHeader=Yme(r,s),o}static encode(e){let r=new qme,i=-1;return e.isSchema()?i=pn.encode(r,e.header()):e.isRecordBatch()?i=Ca.encode(r,e.header()):e.isDictionaryBatch()&&(i=wc.encode(r,e.header())),hf.startMessage(r),hf.addVersion(r,fn.V5),hf.addHeader(r,i),hf.addHeaderType(r,e.headerType),hf.addBodyLength(r,BigInt(e.bodyLength)),hf.finishMessageBuffer(r,hf.endMessage(r)),r.asUint8Array()}static from(e,r=0){if(e instanceof pn)return new t(0,fn.V5,Pi.Schema,e);if(e instanceof Ca)return new t(r,fn.V5,Pi.RecordBatch,e);if(e instanceof wc)return new t(r,fn.V5,Pi.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}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===Pi.Schema}isRecordBatch(){return this.headerType===Pi.RecordBatch}isDictionaryBatch(){return this.headerType===Pi.DictionaryBatch}constructor(e,r,i,n){this._version=r,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=Qi(e)}},Ca=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,r,i){this._nodes=r,this._buffers=i,this._length=Qi(e)}},wc=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(e,r,i=!1){this._data=e,this._isDelta=i,this._id=Qi(r)}},bc=class{constructor(e,r){this.offset=Qi(e),this.length=Qi(r)}},hh=class{constructor(e,r){this.length=Qi(e),this.nullCount=Qi(r)}};function Zme(t,e){return()=>{switch(e){case Pi.Schema:return pn.fromJSON(t);case Pi.RecordBatch:return Ca.fromJSON(t);case Pi.DictionaryBatch:return wc.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${Pi[e]}, type: ${e} }`)}}function Yme(t,e){return()=>{switch(e){case Pi.Schema:return pn.decode(t.header(new mc),new Map,t.version());case Pi.RecordBatch:return Ca.decode(t.header(new hu),t.version());case Pi.DictionaryBatch:return wc.decode(t.header(new _p),t.version())}throw new Error(`Unrecognized Message type: { name: ${Pi[e]}, type: ${e} }`)}}Ai.encode=oge;Ai.decode=nge;Ai.fromJSON=VZ;pn.encode=sge;pn.decode=Xme;pn.fromJSON=FZ;Ca.encode=age;Ca.decode=Qme;Ca.fromJSON=IB;wc.encode=lge;wc.decode=Kme;wc.fromJSON=NZ;hh.encode=cge;hh.decode=ege;bc.encode=uge;bc.decode=Jme;function Xme(t,e=new Map,r=fn.V5){let i=ige(t,e);return new pn(i,LC(t),e,r)}function Qme(t,e=fn.V5){if(t.compression()!==null)throw new Error("Record batch compression not implemented");return new Ca(t.length(),tge(t),rge(t,e))}function Kme(t,e=fn.V5){return new wc(Ca.decode(t.data(),e),t.id(),t.isDelta())}function Jme(t){return new bc(t.offset(),t.length())}function ege(t){return new hh(t.length(),t.nullCount())}function tge(t){let e=[];for(let r,i=-1,n=-1,s=t.nodesLength();++iAi.encode(t,s));mc.startFieldsVector(t,r.length);let i=mc.createFieldsVector(t,r),n=e.metadata&&e.metadata.size>0?mc.createCustomMetadataVector(t,[...e.metadata].map(([s,o])=>{let c=t.createString(`${s}`),f=t.createString(`${o}`);return Uo.startKeyValue(t),Uo.addKey(t,c),Uo.addValue(t,f),Uo.endKeyValue(t)})):-1;return mc.startSchema(t),mc.addFields(t,i),mc.addEndianness(t,hge?u0.Little:u0.Big),n!==-1&&mc.addCustomMetadata(t,n),mc.endSchema(t)}function oge(t,e){let r=-1,i=-1,n=-1,s=e.type,o=e.typeId;Wt.isDictionary(s)?(o=s.dictionary.typeId,n=RC.visit(s,t),i=RC.visit(s.dictionary,t)):i=RC.visit(s,t);let c=(s.children||[]).map(b=>Ai.encode(t,b)),f=rl.createChildrenVector(t,c),y=e.metadata&&e.metadata.size>0?rl.createCustomMetadataVector(t,[...e.metadata].map(([b,M])=>{let L=t.createString(`${b}`),N=t.createString(`${M}`);return Uo.startKeyValue(t),Uo.addKey(t,L),Uo.addValue(t,N),Uo.endKeyValue(t)})):-1;return e.name&&(r=t.createString(e.name)),rl.startField(t),rl.addType(t,i),rl.addTypeType(t,o),rl.addChildren(t,f),rl.addNullable(t,!!e.nullable),r!==-1&&rl.addName(t,r),n!==-1&&rl.addDictionary(t,n),y!==-1&&rl.addCustomMetadata(t,y),rl.endField(t)}function age(t,e){let r=e.nodes||[],i=e.buffers||[];hu.startNodesVector(t,r.length);for(let o of r.slice().reverse())hh.encode(t,o);let n=t.endVector();hu.startBuffersVector(t,i.length);for(let o of i.slice().reverse())bc.encode(t,o);let s=t.endVector();return hu.startRecordBatch(t),hu.addLength(t,BigInt(e.length)),hu.addNodes(t,n),hu.addBuffers(t,s),hu.endRecordBatch(t)}function lge(t,e){let r=Ca.encode(t,e.data);return _p.startDictionaryBatch(t),_p.addId(t,BigInt(e.id)),_p.addIsDelta(t,e.isDelta),_p.addData(t,r),_p.endDictionaryBatch(t)}function cge(t,e){return u1.createFieldNode(t,BigInt(e.length),BigInt(e.nullCount))}function uge(t,e){return c1.createBuffer(t,BigInt(e.offset),BigInt(e.length))}var hge=(()=>{let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),new Int16Array(t)[0]===256})();var kB=t=>`Expected ${Pi[t]} Message in stream, but was null or length 0.`,LB=t=>`Header pointer of flatbuffer-encoded ${Pi[t]} Message is null or length 0.`,$Z=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,qZ=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,q1=class{constructor(e){this.source=e instanceof Ad?e:new Ad(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done?Gn:e.value===-1&&(e=this.readMetadataLength()).done?Gn:(e=this.readMetadata(e.value)).done?Gn:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(kB(e));return r.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);let r=Ur(this.source.read(e));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(e){let r;if((r=this.next()).done)return null;if(e!=null&&r.value.headerType!==e)throw new Error(kB(e));return r.value}readSchema(){let e=Pi.Schema,r=this.readMessage(e),i=r?.header();if(!r||!i)throw new Error(LB(e));return i}},DC=4,RB="ARROW1",G1=new Uint8Array(RB.length);for(let t=0;tthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ea.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ea.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof t?e:VP(e)?dge(e):WP(e)?mge(e):lu(e)?lr(this,void 0,void 0,function*(){return yield t.from(yield e)}):HP(e)||e2(e)||qP(e)||Ju(e)?Age(new uh(e)):pge(new Ad(e))}static readAll(e){return e instanceof t?e.isSync()?ZZ(e):YZ(e):VP(e)||ArrayBuffer.isView(e)||ef(e)||jP(e)?ZZ(e):YZ(e)}},Pp=class extends Au{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return au(this,arguments,function*(){yield di(yield*a1(Jh(this[Symbol.iterator]())))})}},Lg=class extends Au{constructor(e){super(e),this._impl=e}readAll(){return lr(this,void 0,void 0,function*(){var e,r,i,n;let s=new Array;try{for(var o=!0,c=Jh(this),f;f=yield c.next(),e=f.done,!e;o=!0){n=f.value,o=!1;let y=n;s.push(y)}}catch(y){r={error:y}}finally{try{!o&&!e&&(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]()}},Dg=class extends Pp{constructor(e){super(e),this._impl=e}},BC=class extends Lg{constructor(e){super(e),this._impl=e}},FC=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,r){let i=this._loadVectors(e,r,this.schema.fields),n=wr({type:new yn(this.schema.fields),length:e.length,children:i});return new Vs(this.schema,n)}_loadDictionaryBatch(e,r){let{id:i,isDelta:n}=e,{dictionaries:s,schema:o}=this,c=s.get(i);if(n||!c){let f=o.dictionaries.get(i),y=this._loadVectors(e.data,r,[f]);return(c&&n?c.concat(new Pr(y)):new Pr(y)).memoize()}return c.memoize()}_loadVectors(e,r,i){return new D2(r,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},Y1=class extends FC{constructor(e,r){super(r),this._reader=VP(e)?new nS(this._handle=e):new q1(this._handle=e)}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(e){return this.closed||(this.autoDestroy=XZ(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Gn}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Gn}next(){if(this.closed)return Gn;let e,{_reader:r}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let i=e.header(),n=r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let i=e.header(),n=r.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new kg(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},X1=class extends FC{constructor(e,r){super(r),this._reader=new iS(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return lr(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return lr(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=XZ(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return lr(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Gn})}return(e){return lr(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Gn})}next(){return lr(this,void 0,void 0,function*(){if(this.closed)return Gn;let e,{_reader:r}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let i=e.header(),n=yield r.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let i=e.header(),n=yield r.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new kg(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return lr(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},NC=class extends Y1{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,r){super(e instanceof R2?e:new R2(e),r)}isSync(){return!0}isFile(){return!0}open(e){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(e)}readRecordBatch(e){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(Pi.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(e){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(Pi.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:e}=this,r=e.size-DB,i=e.readInt32(r),n=e.readAt(r-i,i);return wp.decode(n)}_readNextMessageAndValidate(e){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return lr(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,e)})}readRecordBatch(e){return lr(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(e);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(Pi.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(e){return lr(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(e);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(Pi.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 lr(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let r=e.size-DB,i=yield e.readInt32(r),n=yield e.readAt(r-i,i);return wp.decode(n)})}_readNextMessageAndValidate(e){return lr(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?OC(e)?new Dg(new NC(t.read())):new Pp(new Y1(t)):new Pp(new Y1(function*(){}()))}function Age(t){return lr(this,void 0,void 0,function*(){let e=yield t.peek(Z1+7&-8);return e&&e.byteLength>=4?OC(e)?new Dg(new NC(yield t.read())):new Lg(new X1(t)):new Lg(new X1(function(){return au(this,arguments,function*(){})}()))})}function mge(t){return lr(this,void 0,void 0,function*(){let{size:e}=yield t.stat(),r=new b0(t,e);return e>=GZ&&OC(yield r.readAt(0,Z1+7&-8))?new BC(new OB(r)):new Lg(new X1(r))})}var hs=class t extends kr{static assemble(...e){let r=n=>n.flatMap(s=>Array.isArray(s)?r(s):s instanceof Vs?s.data.children:s.data),i=new t;return i.visitMany(r(e)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof Pr)return this.visitMany(e.data),this;let{type:r}=e;if(!Wt.isDictionary(r)){let{length:i}=e;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Wt.isUnion(r))this.nodes.push(new hh(i,0));else{let{nullCount:n}=e;Wt.isNull(r)||ff.call(this,n<=0?new Uint8Array(0):vg(e.offset,i,e.nullBitmap)),this.nodes.push(new hh(i,n))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function ff(t){let e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new bc(this._byteLength,e)),this._byteLength+=e,this}function gge(t){var e;let{type:r,length:i,typeIds:n,valueOffsets:s}=t;if(ff.call(this,n),r.mode===Rn.Sparse)return FB.call(this,t);if(r.mode===Rn.Dense){if(t.offset<=0)return ff.call(this,s),FB.call(this,t);{let o=new Int32Array(i),c=Object.create(null),f=Object.create(null);for(let y,b,M=-1;++M{let M=r.typeIds[b],L=c[M],N=f[M];return y.slice(L,Math.min(i,N))}))}}return this}function _ge(t){let e;return t.nullCount>=t.length?ff.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?ff.call(this,vg(t.offset,t.length,e)):ff.call(this,bg(t.values))}function Cp(t){return ff.call(this,t.values.subarray(0,t.length*t.stride))}function zC(t){let{length:e,values:r,valueOffsets:i}=t,n=Qi(i[0]),s=Qi(i[e]),o=Math.min(s-n,r.byteLength-n);return ff.call(this,ZP(-n,e+1,i)),ff.call(this,r.subarray(n,n+o)),this}function NB(t){let{length:e,valueOffsets:r}=t;if(r){let{[0]:i,[e]:n}=r;return ff.call(this,ZP(-i,e+1,r)),this.visit(t.children[0].slice(i,n-i))}return this.visit(t.children[0])}function FB(t){return this.visitMany(t.type.children.map((e,r)=>t.children[r]).filter(Boolean))[0]}hs.prototype.visitBool=_ge;hs.prototype.visitInt=Cp;hs.prototype.visitFloat=Cp;hs.prototype.visitUtf8=zC;hs.prototype.visitLargeUtf8=zC;hs.prototype.visitBinary=zC;hs.prototype.visitLargeBinary=zC;hs.prototype.visitFixedSizeBinary=Cp;hs.prototype.visitDate=Cp;hs.prototype.visitTimestamp=Cp;hs.prototype.visitTime=Cp;hs.prototype.visitDecimal=Cp;hs.prototype.visitList=NB;hs.prototype.visitStruct=FB;hs.prototype.visitUnion=gge;hs.prototype.visitInterval=Cp;hs.prototype.visitDuration=Cp;hs.prototype.visitFixedSizeList=NB;hs.prototype.visitMap=NB;var Og=class extends Tg{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,r){throw new Error('"throughDOM" not available in this environment')}constructor(e){super(),this._position=0,this._started=!1,this._sink=new pd,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Il(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return lu(e)?e.then(r=>this.writeAll(r)):Ju(e)?UB(this,e):zB(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,r=null){return e===this._sink||e instanceof pd?this._sink=e:(this._sink=new pd,e&&hG(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&fG(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Rg(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(e){let r=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof Pa&&!(r=e.schema))return this.finish()&&void 0;if(e instanceof Vs&&!(r=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Rg(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}e instanceof Vs?e instanceof kg||this._writeRecordBatch(e):e instanceof Pa?this.writeAll(e.batches):ef(e)&&this.writeAll(e)}_writeMessage(e,r=8){let i=r-1,n=Sc.encode(e),s=n.byteLength,o=this._writeLegacyIpcFormat?4:8,c=s+o+i&~i,f=c-s-o;return e.headerType===Pi.RecordBatch?this._recordBatchBlocks.push(new Sp(c,e.bodyLength,this._position)):e.headerType===Pi.DictionaryBatch&&this._dictionaryBlocks.push(new Sp(c,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),s>0&&this._write(n),this._writePadding(f)}_write(e){if(this._started){let r=Ur(e);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(e){return this._writeMessage(Sc.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(G1)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:r,nodes:i,bufferRegions:n,buffers:s}=hs.assemble(e),o=new Ca(e.numRows,i,n),c=Sc.from(o,r);return this._writeDictionaries(e)._writeMessage(c)._writeBodyBuffers(s)}_writeDictionaryBatch(e,r,i=!1){this._dictionaryDeltaOffsets.set(r,e.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:n,nodes:s,bufferRegions:o,buffers:c}=hs.assemble(new Pr([e])),f=new Ca(e.length,s,o),y=new wc(f,r,i),b=Sc.from(y,n);return this._writeMessage(b)._writeBodyBuffers(c)}_writeBodyBuffers(e){let r,i,n;for(let s=-1,o=e.length;++s0&&(this._write(r),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(e){for(let[r,i]of e.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}},sS=class t extends Og{static writeAll(e,r){let i=new t(r);return lu(e)?e.then(n=>i.writeAll(n)):Ju(e)?UB(i,e):zB(i,e)}},oS=class t extends Og{static writeAll(e){let r=new t;return lu(e)?e.then(i=>r.writeAll(i)):Ju(e)?UB(r,e):zB(r,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeFooter(e){let r=wp.encode(new wp(e,fn.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function zB(t,e){let r=e;e instanceof Pa&&(r=e.batches,t.reset(void 0,e.schema));for(let i of r)t.write(i);return t.finish()}function UB(t,e){return lr(this,void 0,void 0,function*(){var r,i,n,s,o,c,f;try{for(r=!0,i=Jh(e);n=yield i.next(),s=n.done,!s;r=!0){f=n.value,r=!1;let y=f;t.write(y)}}catch(y){o={error:y}}finally{try{!r&&!s&&(c=i.return)&&(yield c.call(i))}finally{if(o)throw o.error}}return t.finish()})}function QZ(t,e){if(Ju(t))return xge(t,e);if(ef(t))return yge(t,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function yge(t,e){let r=null,i=e?.type==="bytes"||!1,n=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){s(o,r||(r=t[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},e));function s(o,c){let f,y=null,b=o.desiredSize||null;for(;!(y=c.next(i?b:null)).done;)if(ArrayBuffer.isView(y.value)&&(f=Ur(y.value))&&(b!=null&&i&&(b=b-f.byteLength+1),y.value=f),o.enqueue(y.value),b!=null&&--b<=0)return;o.close()}}function xge(t,e){let r=null,i=e?.type==="bytes"||!1,n=e?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(o){return lr(this,void 0,void 0,function*(){yield s(o,r||(r=t[Symbol.asyncIterator]()))})},pull(o){return lr(this,void 0,void 0,function*(){r?yield s(o,r):o.close()})},cancel(){return lr(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?n:void 0},e));function s(o,c){return lr(this,void 0,void 0,function*(){let f,y=null,b=o.desiredSize||null;for(;!(y=yield c.next(i?b:null)).done;)if(ArrayBuffer.isView(y.value)&&(f=Ur(y.value))&&(b!=null&&i&&(b=b-f.byteLength+1),y.value=f),o.enqueue(y.value),b!=null&&--b<=0)return;o.close()})}}function eY(t){return new VB(t)}var VB=class{constructor(e){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:i,["queueingStrategy"]:n="count"}=e,s=cG(e,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Pg(s),this._getSize=n!=="bytes"?KZ:JZ;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:f=>{this._maybeFlush(this._builder,this._controller=f)},start:f=>{this._maybeFlush(this._builder,this._controller=f)}},{highWaterMark:o,size:n!=="bytes"?KZ:JZ}),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:f=>this._writeValueAndReturnChunkSize(f)})}_writeValueAndReturnChunkSize(e){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(e)),this._bufferedSize-r}_maybeFlush(e,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,e.toVector()),e.finished&&((e.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,e.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(e,r){this._bufferedSize=0,this._controller=null,r==null?e.close():e.enqueue(r)}},KZ=t=>{var e;return(e=t?.length)!==null&&e!==void 0?e:0},JZ=t=>{var e;return(e=t?.byteLength)!==null&&e!==void 0?e:0};function UC(t,e){let r=new pd,i=null,n=new ReadableStream({cancel(){return lr(this,void 0,void 0,function*(){yield r.close()})},start(c){return lr(this,void 0,void 0,function*(){yield o(c,i||(i=yield s()))})},pull(c){return lr(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)},t)),readable:n};function s(){return lr(this,void 0,void 0,function*(){return yield(yield Au.from(r)).open(e)})}function o(c,f){return lr(this,void 0,void 0,function*(){let y=c.desiredSize,b=null;for(;!(b=yield f.next()).done;)if(c.enqueue(b.value),y!=null&&--y<=0)return;c.close()})}}function VC(t,e){let r=new this(t),i=new uh(r),n=new ReadableStream({cancel(){return lr(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return lr(this,void 0,void 0,function*(){yield s(o)})},start(o){return lr(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(r,t),readable:n};function s(o){return lr(this,void 0,void 0,function*(){let c=null,f=o.desiredSize;for(;c=yield i.read(f||null);)if(o.enqueue(c),f!=null&&(f-=c.byteLength)<=0)return;o.close()})}}function aS(t){let e=Au.from(t);return lu(e)?e.then(r=>aS(r)):e.isAsync()?e.readAll().then(r=>new Pa(r)):new Pa(e.readAll())}var jge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},J5),SB),AB),eB),q5),pB),Y5),{compareSchemas:Rg,compareFields:MZ,compareTypes:PZ});Ea.toDOMStream=QZ;es.throughDOM=eY;Au.throughDOM=UC;Dg.throughDOM=UC;Pp.throughDOM=UC;Og.throughDOM=VC;oS.throughDOM=VC;sS.throughDOM=VC;var Wge="0.6.1",Hge=`https://cdn.jsdelivr.net/npm/parquet-wasm@${Wge}/esm/parquet_wasm_bg.wasm`,jB=!1;async function tY(){jB||(await aG(Hge),jB=!0)}function $ge(t){if(!jB)throw new Error("wasm not ready");console.time("readParquet");let e=nG(new Uint8Array(t.buffer),{batchSize:Math.pow(2,31)}).intoIPCStream(),r=aS(e);return console.timeEnd("readParquet"),r}function cS(t){let e=[];for(let r of t){let i=$ge(r);i.batches.length!==1&&console.warn("Expected one batch"),e.push(...i.batches)}return new Pa(e)}var rY=Ei(Zi(),1);function WB(t){return t instanceof Array&&t?.[0]instanceof DataView?t?.[0].byteLength>0?cS(t).getChildAt(0):null:t}var Ip=class{model;callbacks;updateStateCallback;constructor(e,r){this.model=e,this.model.on("change",r),this.updateStateCallback=r,this.callbacks=new Map,this.callbacks.set("change",r)}async loadSubModels(){}initRegularAttribute(e,r){this[r]=this.model.get(e),this.model.off(`change:${e}`);let i=()=>{this[r]=this.model.get(e)};this.model.on(`change:${e}`,i),this.callbacks.set(`change:${e}`,i)}initVectorizedAccessor(e,r){this[r]=WB(this.model.get(e)),this.model.off(`change:${e}`);let i=()=>{this[r]=WB(this.model.get(e))};this.model.on(`change:${e}`,i),this.callbacks.set(`change:${e}`,i)}finalize(){for(let[e,r]of Object.entries(this.callbacks))this.model.off(e,r)}};async function uS(t,e){let r=[];for(let i of e)r.push(t.get_model(i.slice(10)));return await Promise.all(r)}function at(t){return t!=null}function iY(t,e=20){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}var qge=` +uniform bool brushing_enabled; +uniform int brushing_target; +uniform vec2 brushing_mousePos; +uniform float brushing_radius; +in vec2 brushingTargets; +out float brushing_isVisible; +bool brushing_isPointInRange(vec2 position) { +if (!brushing_enabled) { +return true; +} +vec2 source_commonspace = project_position(position); +vec2 target_commonspace = project_position(brushing_mousePos); +float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy); +return distance <= brushing_radius; +} +bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) { +return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos); +} +void brushing_setVisible(bool visible) { +brushing_isVisible = float(visible); +} +`,Gge=` +uniform bool brushing_enabled; +in float brushing_isVisible; +`,Zge={source:0,target:1,custom:2,source_target:3},Yge={"vs:DECKGL_FILTER_GL_POSITION":` +vec2 brushingTarget; +vec2 brushingSource; +if (brushing_target == 3) { +brushingTarget = geometry.worldPositionAlt.xy; +brushingSource = geometry.worldPosition.xy; +} else if (brushing_target == 0) { +brushingTarget = geometry.worldPosition.xy; +} else if (brushing_target == 1) { +brushingTarget = geometry.worldPositionAlt.xy; +} else { +brushingTarget = brushingTargets; +} +bool visible; +if (brushing_target == 3) { +visible = brushing_arePointsInRange(brushingSource, brushingTarget); +} else { +visible = brushing_isPointInRange(brushingTarget); +} +brushing_setVisible(visible); +`,"fs:DECKGL_FILTER_COLOR":` + if (brushing_enabled && brushing_isVisible < 0.5) { + discard; + } + `},nY={name:"brushing",dependencies:[Wh],vs:qge,fs:Gge,inject:Yge,getUniforms:t=>{if(!t||!("viewport"in t))return{};let{brushingEnabled:e=!0,brushingRadius:r=1e4,brushingTarget:i="source",mousePosition:n,viewport:s}=t;return{brushing_enabled:!!(e&&n&&s.containsPixel(n)),brushing_radius:r,brushing_target:Zge[i]||0,brushing_mousePos:n?s.unproject([n.x-s.x,n.y-s.y]):[0,0]}}};var Xge={getBrushingTarget:{type:"accessor",value:[0,0]},brushingTarget:"source",brushingEnabled:!0,brushingRadius:1e4},Q1=class extends nd{static{this.defaultProps=Xge}static{this.extensionName="BrushingExtension"}getShaders(){return{modules:[nY]}}initializeState(e,r){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,stepMode:"dynamic",accessor:"getBrushingTarget"}});let n=()=>{this.getCurrentLayer()?.setNeedsRedraw()};this.state.onMouseMove=n,e.deck&&e.deck.eventManager.on({pointermove:n,pointerleave:n})}finalizeState(e,r){if(e.deck){let i=this.state.onMouseMove;e.deck.eventManager.off({pointermove:i,pointerleave:i})}}};var sY=` +uniform bool filter_useSoftMargin; +uniform bool filter_enabled; +uniform bool filter_transformSize; +uniform ivec4 filter_categoryBitMask; +#ifdef DATAFILTER_TYPE +uniform DATAFILTER_TYPE filter_min; +uniform DATAFILTER_TYPE filter_softMin; +uniform DATAFILTER_TYPE filter_softMax; +uniform DATAFILTER_TYPE filter_max; +in DATAFILTER_TYPE filterValues; +#ifdef DATAFILTER_DOUBLE +in DATAFILTER_TYPE filterValues64Low; +uniform DATAFILTER_TYPE filter_min64High; +uniform DATAFILTER_TYPE filter_max64High; +#endif +#endif +#ifdef DATACATEGORY_TYPE +in DATACATEGORY_TYPE filterCategoryValues; +#endif +out float dataFilter_value; +float dataFilter_reduceValue(float value) { +return value; +} +float dataFilter_reduceValue(vec2 value) { +return min(value.x, value.y); +} +float dataFilter_reduceValue(vec3 value) { +return min(min(value.x, value.y), value.z); +} +float dataFilter_reduceValue(vec4 value) { +return min(min(value.x, value.y), min(value.z, value.w)); +} +#ifdef DATAFILTER_TYPE +void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) { +if (filter_useSoftMargin) { +DATAFILTER_TYPE leftInRange = mix( +smoothstep(filter_min, filter_softMin, valueFromMin), +step(filter_min, valueFromMin), +step(filter_softMin, filter_min) +); +DATAFILTER_TYPE rightInRange = mix( +1.0 - smoothstep(filter_softMax, filter_max, valueFromMax), +step(valueFromMax, filter_max), +step(filter_max, filter_softMax) +); +dataFilter_value = dataFilter_reduceValue(leftInRange * rightInRange); +} else { +dataFilter_value = dataFilter_reduceValue( +step(filter_min, valueFromMin) * step(valueFromMax, filter_max) +); +} +} +#endif +#ifdef DATACATEGORY_TYPE +void dataFilter_setCategoryValue(DATACATEGORY_TYPE category) { +#if DATACATEGORY_CHANNELS == 1 +int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)]; +#elif DATACATEGORY_CHANNELS == 2 +ivec2 dataFilter_masks = ivec2( +filter_categoryBitMask[int(category.x / 32.0)], +filter_categoryBitMask[int(category.y / 32.0) + 2] +); +#elif DATACATEGORY_CHANNELS == 3 +ivec3 dataFilter_masks = filter_categoryBitMask.xyz; +#else +ivec4 dataFilter_masks = filter_categoryBitMask; +#endif +DATACATEGORY_TYPE dataFilter_bits = DATACATEGORY_TYPE(dataFilter_masks) / pow(DATACATEGORY_TYPE(2.0), mod(category, 32.0)); +dataFilter_bits = mod(floor(dataFilter_bits), 2.0); +#if DATACATEGORY_CHANNELS == 1 +if(dataFilter_bits == 0.0) dataFilter_value = 0.0; +#else +if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0; +#endif +} +#endif +`,oY=` +uniform bool filter_transformColor; +in float dataFilter_value; +`;function aY(t){if(!t||!("extensions"in t))return{};let{filterRange:e=[-1,1],filterEnabled:r=!0,filterTransformSize:i=!0,filterTransformColor:n=!0}=t,s=t.filterSoftRange||e;return{...Number.isFinite(e[0])?{filter_min:e[0],filter_softMin:s[0],filter_softMax:s[1],filter_max:e[1]}:{filter_min:e.map(o=>o[0]),filter_softMin:s.map(o=>o[0]),filter_softMax:s.map(o=>o[1]),filter_max:e.map(o=>o[1])},filter_enabled:r,filter_useSoftMargin:!!t.filterSoftRange,filter_transformSize:r&&i,filter_transformColor:r&&n}}function Qge(t){if(!t||!("extensions"in t))return{};let e=aY(t);if(Number.isFinite(e.filter_min)){let r=Math.fround(e.filter_min);e.filter_min-=r,e.filter_softMin-=r,e.filter_min64High=r;let i=Math.fround(e.filter_max);e.filter_max-=i,e.filter_softMax-=i,e.filter_max64High=i}else{let r=e.filter_min.map(Math.fround);e.filter_min=e.filter_min.map((n,s)=>n-r[s]),e.filter_softMin=e.filter_softMin.map((n,s)=>n-r[s]),e.filter_min64High=r;let i=e.filter_max.map(Math.fround);e.filter_max=e.filter_max.map((n,s)=>n-i[s]),e.filter_softMax=e.filter_softMax.map((n,s)=>n-i[s]),e.filter_max64High=i}return e}var lY={"vs:#main-start":` +dataFilter_value = 1.0; +if (filter_enabled) { +#ifdef DATAFILTER_TYPE +#ifdef DATAFILTER_DOUBLE +dataFilter_setValue( +filterValues - filter_min64High + filterValues64Low, +filterValues - filter_max64High + filterValues64Low +); +#else +dataFilter_setValue(filterValues, filterValues); +#endif +#endif +#ifdef DATACATEGORY_TYPE +dataFilter_setCategoryValue(filterCategoryValues); +#endif +} +`,"vs:#main-end":` +if (dataFilter_value == 0.0) { +gl_Position = vec4(0.); +} +`,"vs:DECKGL_FILTER_SIZE":` +if (filter_transformSize) { +size = size * dataFilter_value; +} +`,"fs:DECKGL_FILTER_COLOR":` +if (dataFilter_value == 0.0) discard; +if (filter_transformColor) { +color.a *= dataFilter_value; +} +`},cY={name:"data-filter",vs:sY,fs:oY,inject:lY,getUniforms:aY},uY={name:"data-filter-fp64",vs:sY,fs:oY,inject:lY,getUniforms:Qge};var Kge=`#version 300 es +#define SHADER_NAME data-filter-vertex-shader + +#ifdef FLOAT_TARGET + in float filterIndices; + in float filterPrevIndices; +#else + in vec2 filterIndices; + in vec2 filterPrevIndices; +#endif + +out vec4 vColor; +const float component = 1.0 / 255.0; + +void main() { + #ifdef FLOAT_TARGET + dataFilter_value *= float(filterIndices != filterPrevIndices); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); + vColor = vec4(0.0, 0.0, 0.0, 1.0); + #else + // Float texture is not supported: pack result into 4 channels x 256 px x 64px + dataFilter_value *= float(filterIndices.x != filterPrevIndices.x); + float col = filterIndices.x; + float row = filterIndices.y * 4.0; + float channel = floor(row); + row = fract(row); + vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0)); + gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0); + #endif + gl_PointSize = 1.0; +} +`,Jge=`#version 300 es +#define SHADER_NAME data-filter-fragment-shader +precision highp float; + +in vec4 vColor; + +out vec4 fragColor; + +void main() { + if (dataFilter_value < 0.5) { + discard; + } + fragColor = vColor; +} +`,e_e=["float32-renderable-webgl","texture-blend-float-webgl"];function hY(t){return e_e.every(e=>t.features.has(e))}function fY(t,e){return e?t.createFramebuffer({width:1,height:1,colorAttachments:[t.createTexture({format:"rgba32float",type:5126,mipmaps:!1})]}):t.createFramebuffer({width:256,height:64,colorAttachments:[t.createTexture({format:"rgba8unorm",type:5126,mipmaps:!1})]})}function dY(t,e,r){return e.defines.NON_INSTANCED_MODEL=1,r&&(e.defines.FLOAT_TARGET=1),new en(t,{id:"data-filter-aggregation-model",vertexCount:1,isInstanced:!1,drawMode:0,vs:Kge,fs:Jge,...e})}var pY={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var r_e={getFilterValue:{type:"accessor",value:0},getFilterCategory:{type:"accessor",value:0},onFilteredItemsChange:{type:"function",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterCategories:[0],filterTransformSize:!0,filterTransformColor:!0},i_e={categorySize:0,filterSize:1,fp64:!1,countItems:!1},AY={1:"float",2:"vec2",3:"vec3",4:"vec4"},K1=class extends nd{static{this.defaultProps=r_e}static{this.extensionName="DataFilterExtension"}constructor(e={}){super({...i_e,...e})}getShaders(e){let{categorySize:r,filterSize:i,fp64:n}=e.opts,s={};return r&&(s.DATACATEGORY_TYPE=AY[r],s.DATACATEGORY_CHANNELS=r),i&&(s.DATAFILTER_TYPE=AY[i],s.DATAFILTER_DOUBLE=!!n),{modules:[n?uY:cY],defines:s}}initializeState(e,r){let i=this.getAttributeManager(),{categorySize:n,filterSize:s,fp64:o}=r.opts;i&&(s&&i.add({filterValues:{size:s,type:o?"float64":"float32",stepMode:"dynamic",accessor:"getFilterValue"}}),n&&i.add({filterCategoryValues:{size:n,stepMode:"dynamic",accessor:"getFilterCategory",transform:n===1?f=>r._getCategoryKey.call(this,f,0):f=>f.map((y,b)=>r._getCategoryKey.call(this,y,b))}}));let{device:c}=this.context;if(i&&r.opts.countItems){let f=hY(c);i.add({filterIndices:{size:f?1:2,vertexOffset:1,type:"unorm8",accessor:(M,{index:L})=>{let N=M&&M.__source?M.__source.index:L;return f?(N+1)%255:[(N+1)%255,Math.floor(N/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let y=fY(c,f),b=dY(c,r.getShaders.call(this,r),f);this.setState({filterFBO:y,filterModel:b})}}updateState({props:e,oldProps:r,changeFlags:i},n){let s=this.getAttributeManager(),{categorySize:o}=n.opts;if(this.state.filterModel){let c=s.attributes.filterValues?.needsUpdate()||s.attributes.filterCategoryValues?.needsUpdate()||e.filterEnabled!==r.filterEnabled||e.filterRange!==r.filterRange||e.filterSoftRange!==r.filterSoftRange||e.filterCategories!==r.filterCategories;c&&this.setState({filterNeedsUpdate:c})}if(s?.attributes.filterCategoryValues){let c=s.attributes.filterCategoryValues.needsUpdate()||!qn(e.filterCategories,r.filterCategories,2);c&&this.setState({categoryBitMaskNeedsUpdate:c}),i.dataChanged&&(this.setState({categoryMap:Array(o).fill(0).map(()=>({}))}),s.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"))}}draw(e,r){let i=this.state.filterFBO,n=this.state.filterModel,s=this.state.filterNeedsUpdate,o=this.state.categoryBitMaskNeedsUpdate,{onFilteredItemsChange:c}=this.props;if(o&&r._updateCategoryBitMask.call(this,e,r),s&&c&&n){let{attributes:{filterValues:f,filterCategoryValues:y,filterIndices:b}}=this.getAttributeManager();n.setVertexCount(this.getNumInstances()),this.context.device.clearWebGL({framebuffer:i,color:[0,0,0,0]}),n.updateModuleSettings(e.moduleParameters),n.setAttributes({...f?.getValue(),...y?.getValue(),...b?.getValue()}),n.setUniforms(e.uniforms),n.device.withParametersWebGL({framebuffer:i,...pY,viewport:[0,0,i.width,i.height]},()=>{n.draw(this.context.renderPass)});let M=n.device.readPixelsToArrayWebGL(i),L=0;for(let N=0;N{if(!t||!("dummyCollisionMap"in t))return{};let{collisionFBO:r,drawToCollisionMap:i,dummyCollisionMap:n}=t;return{collision_sort:!!i,collision_texture:!i&&r?r.colorAttachments[0]:n}},mY={name:"collision",dependencies:[Wh],vs:n_e,inject:s_e,getUniforms:o_e};var hS=class extends Yu{renderCollisionMap(e,r){let n=[0,0,0,0],s=[1,1,e.width-2*1,e.height-2*1];this.render({...r,clearColor:n,scissorRect:s,target:e,pass:"collision"})}getLayerParameters(e,r,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}getModuleParameters(){return{drawToCollisionMap:!0,picking:{isActive:1,isAttribute:!1},lightSources:{}}}};var HB=2,fS=class{constructor(){this.id="collision-filter-effect",this.props=null,this.useInPicking=!0,this.order=1,this.channels={},this.collisionFBOs={}}setup(e){this.context=e;let{device:r}=e;this.dummyCollisionMap=r.createTexture({width:1,height:1}),this.collisionFilterPass=new hS(r,{id:"default-collision-filter"})}preRender({effects:e,layers:r,layerFilter:i,viewports:n,onViewportActive:s,views:o,isPicking:c,preRenderStats:f={}}){let{device:y}=this.context;if(c)return;let b=r.filter(({props:{visible:Q,collisionEnabled:q}})=>Q&&q);if(b.length===0){this.channels={};return}let M=e?.filter(Q=>Q.useInPicking&&f[Q.id]),L=f["mask-effect"]?.didRender,N=this._groupByCollisionGroup(y,b),V=n[0],$=!this.lastViewport||!this.lastViewport.equals(V)||L;for(let Q in N){let q=this.collisionFBOs[Q],J=N[Q],[ee,oe]=y.canvasContext.getPixelSize();q.resize({width:ee/HB,height:oe/HB}),this._render(J,{effects:M,layerFilter:i,onViewportActive:s,views:o,viewport:V,viewportChanged:$})}}_render(e,{effects:r,layerFilter:i,onViewportActive:n,views:s,viewport:o,viewportChanged:c}){let{collisionGroup:f}=e,y=this.channels[f];if(!y)return;let b=c||e===y||!qn(y.layers,e.layers,1)||e.layerBounds.some((M,L)=>!oo(M,y.layerBounds[L]))||e.allLayersLoaded!==y.allLayersLoaded||e.layers.some(M=>M.props.transitions);if(this.channels[f]=e,b){this.lastViewport=o;let M=this.collisionFBOs[f];this.collisionFilterPass.renderCollisionMap(M,{pass:"collision-filter",isPicking:!0,layers:e.layers,effects:r,layerFilter:i,viewports:o?[o]:[],onViewportActive:n,views:s,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:M.device.canvasContext.getDevicePixelRatio()/HB}})}}_groupByCollisionGroup(e,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(e,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(e){let{collisionGroup:r}=e.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 e of Object.keys(this.collisionFBOs))this.destroyFBO(e);this.collisionFBOs={},this.lastViewport=void 0}createFBO(e,r){let{width:i,height:n}=e.gl.canvas,s=e.createTexture({format:"rgba8unorm",width:i,height:n,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=e.createTexture({format:"depth16unorm",width:i,height:n,mipmaps:!1,dataFormat:6402,type:5125});this.collisionFBOs[r]=e.createFramebuffer({id:`collision-${r}`,width:i,height:n,colorAttachments:[s],depthStencilAttachment:o})}destroyFBO(e){let r=this.collisionFBOs[e];r.colorAttachments[0]?.destroy(),r.depthStencilAttachment?.destroy(),r.destroy(),delete this.collisionFBOs[e]}};var a_e={getCollisionPriority:{type:"accessor",value:0},collisionEnabled:!0,collisionGroup:{type:"string",value:"default"},collisionTestProps:{}},J1=class extends nd{static{this.defaultProps=a_e}static{this.extensionName="CollisionFilterExtension"}getShaders(){return{modules:[mY]}}draw({uniforms:e,context:r,moduleParameters:i}){let{collisionEnabled:n}=this.props,{collisionFBO:s,drawToCollisionMap:o}=i,c=n&&!!s;e.collision_enabled=c,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(e,r){if(this.getAttributeManager()===null)return;this.context.deck?._addDefaultEffect(new fS),this.getAttributeManager().add({collisionPriorities:{size:1,stepMode:"dynamic",accessor:"getCollisionPriority"}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};var Bg=class extends Ip{static extensionType;constructor(e,r){super(e,r)}},dS=class extends Bg{static extensionType="brushing";extensionInstance;constructor(e,r,i){super(e,i),this.extensionInstance=new Q1,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"]}},pS=class extends Bg{static extensionType="collision-filter";extensionInstance;constructor(e,r,i){super(e,i),this.extensionInstance=new J1,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"]}},jC=class extends Bg{static extensionType="data-filter";extensionInstance;constructor(e,r,i){super(e,i);let n=this.model.get("filter_size");this.extensionInstance=new K1({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"]}},AS=class extends Bg{static extensionType="path-style";extensionInstance;constructor(e,r,i){super(e,i);let n=this.model.get("dash"),s=this.model.get("high_precision_dash"),o=this.model.get("offset");this.extensionInstance=new _PathStyleExtension({...at(n)?{dash:n}:{},...at(s)?{highPrecisionDash:s}:{},...at(o)?{offset:o}:{}}),r.initRegularAttribute("dash_gap_pickable","dashGapPickable"),r.initRegularAttribute("dash_justified","dashJustified"),r.initVectorizedAccessor("get_dash_array","getDashArray"),r.initVectorizedAccessor("get_offset","getOffset"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,"dashGapPickable","dashJustified","getDashArray","getOffset"]}};async function $B(t,e,r){let i=t.get("_extension_type"),n;switch(i){case dS.extensionType:n=new dS(t,e,r);break;case pS.extensionType:n=new pS(t,e,r);break;case jC.extensionType:n=new jC(t,e,r);break;case AS.extensionType:n=new AS(t,e,r);break;default:throw new Error(`no known model for extension type ${i}`)}return await n.loadSubModels(),n}var Fg=class extends Ip{pickable;visible;opacity;autoHighlight;extensions;extensionLayerPropertyNames=[];constructor(e,r){super(e,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(e=>e.extensionInstance)}extensionProps(){let e={};for(let r of this.extensionLayerPropertyNames)at(this[r])&&(e[r]=this[r]);return e}onClick(e){e.index&&(this.model.set("selected_index",e.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 e=async()=>{let r=this.model.get("extensions");if(!r){this.extensions=[];return}let i=await uS(this.model.widget_manager,r),n=[];for(let s of i){let o=await $B(s,this,this.updateStateCallback);n.push(o)}this.extensions=n};await e(),this.model.off("change:extensions"),this.model.on("change:extensions",e),this.callbacks.set("change:extensions",e)}};var gY=`#version 300 es +#define SHADER_NAME arc-layer-vertex-shader +in vec3 positions; +in vec4 instanceSourceColors; +in vec4 instanceTargetColors; +in vec3 instanceSourcePositions; +in vec3 instanceSourcePositions64Low; +in vec3 instanceTargetPositions; +in vec3 instanceTargetPositions64Low; +in vec3 instancePickingColors; +in float instanceWidths; +in float instanceHeights; +in float instanceTilts; +uniform bool greatCircle; +uniform bool useShortestPath; +uniform float numSegments; +uniform float opacity; +uniform float widthScale; +uniform float widthMinPixels; +uniform float widthMaxPixels; +uniform int widthUnits; +out vec4 vColor; +out vec2 uv; +out float isValid; +float paraboloid(float distance, float sourceZ, float targetZ, float ratio) { +float deltaZ = targetZ - sourceZ; +float dh = distance * instanceHeights; +if (dh == 0.0) { +return sourceZ + deltaZ * ratio; +} +float unitZ = deltaZ / dh; +float p2 = unitZ * unitZ + 1.0; +float dir = step(deltaZ, 0.0); +float z0 = mix(sourceZ, targetZ, dir); +float r = mix(ratio, 1.0 - ratio, dir); +return sqrt(r * (p2 - r)) * dh + z0; +} +vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) { +vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize); +dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); +return dir_screenspace * offset_direction * width / 2.0; +} +float getSegmentRatio(float index) { +return smoothstep(0.0, 1.0, index / (numSegments - 1.0)); +} +vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) { +float distance = length(source.xy - target.xy); +float z = paraboloid(distance, source.z, target.z, segmentRatio); +float tiltAngle = radians(instanceTilts); +vec2 tiltDirection = normalize(target.xy - source.xy); +vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle); +return vec3( +mix(source.xy, target.xy, segmentRatio) + tilt, +z * cos(tiltAngle) +); +} +float getAngularDist (vec2 source, vec2 target) { +vec2 sourceRadians = radians(source); +vec2 targetRadians = radians(target); +vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0); +vec2 shd_sq = sin_half_delta * sin_half_delta; +float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x; +return 2.0 * asin(sqrt(a)); +} +vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) { +vec2 lngLat; +if(abs(angularDist - PI) < 0.001) { +lngLat = (1.0 - t) * source.xy + t * target.xy; +} else { +float a = sin((1.0 - t) * angularDist); +float b = sin(t * angularDist); +vec3 p = source3D.yxz * a + target3D.yxz * b; +lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy)))); +} +float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t); +return vec3(lngLat, z); +} +void main(void) { +geometry.worldPosition = instanceSourcePositions; +geometry.worldPositionAlt = instanceTargetPositions; +float segmentIndex = positions.x; +float segmentRatio = getSegmentRatio(segmentIndex); +float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0)); +float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0)); +float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); +isValid = 1.0; +uv = vec2(segmentRatio, positions.y); +geometry.uv = uv; +geometry.pickingColor = instancePickingColors; +vec4 curr; +vec4 next; +vec3 source; +vec3 target; +if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +source = project_globe_(vec3(instanceSourcePositions.xy, 0.0)); +target = project_globe_(vec3(instanceTargetPositions.xy, 0.0)); +float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy); +vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio); +vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio); +vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio); +if (abs(currPos.x - prevPos.x) > 180.0) { +indexDir = -1.0; +isValid = 0.0; +} else if (abs(currPos.x - nextPos.x) > 180.0) { +indexDir = 1.0; +isValid = 0.0; +} +nextPos = indexDir < 0.0 ? prevPos : nextPos; +nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio; +if (isValid == 0.0) { +nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0; +float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x); +currPos = mix(currPos, nextPos, t); +segmentRatio = mix(segmentRatio, nextSegmentRatio, t); +} +vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio); +vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio); +curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position); +next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0)); +} else { +vec3 source_world = instanceSourcePositions; +vec3 target_world = instanceTargetPositions; +if (useShortestPath) { +source_world.x = mod(source_world.x + 180., 360.0) - 180.; +target_world.x = mod(target_world.x + 180., 360.0) - 180.; +float deltaLng = target_world.x - source_world.x; +if (deltaLng > 180.) target_world.x -= 360.; +if (deltaLng < -180.) source_world.x -= 360.; +} +source = project_position(source_world, instanceSourcePositions64Low); +target = project_position(target_world, instanceTargetPositions64Low); +float antiMeridianX = 0.0; +if (useShortestPath) { +if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { +antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE; +} +float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x); +if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) { +isValid = 0.0; +indexDir = sign(segmentRatio - thresholdRatio); +segmentRatio = thresholdRatio; +} +} +nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio; +vec3 currPos = interpolateFlat(source, target, segmentRatio); +vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio); +if (useShortestPath) { +if (nextPos.x < antiMeridianX) { +currPos.x += TILE_SIZE; +nextPos.x += TILE_SIZE; +} +} +curr = project_common_position_to_clipspace(vec4(currPos, 1.0)); +next = project_common_position_to_clipspace(vec4(nextPos, 1.0)); +geometry.position = vec4(currPos, 1.0); +} +float widthPixels = clamp( +project_size_to_pixel(instanceWidths * widthScale, widthUnits), +widthMinPixels, widthMaxPixels +); +vec3 offset = vec3( +getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels), +0.0); +DECKGL_FILTER_SIZE(offset, geometry); +DECKGL_FILTER_GL_POSITION(curr, geometry); +gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0); +vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio); +vColor = vec4(color.rgb, color.a * opacity); +DECKGL_FILTER_COLOR(vColor, geometry); +} +`;var _Y=`#version 300 es +#define SHADER_NAME arc-layer-fragment-shader +precision highp float; +in vec4 vColor; +in vec2 uv; +in float isValid; +out vec4 fragColor; +void main(void) { +if (isValid == 0.0) { +discard; +} +fragColor = vColor; +geometry.uv = uv; +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var WC=[0,0,0,255],l_e={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getSourceColor:{type:"accessor",value:WC},getTargetColor:{type:"accessor",value:WC},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}},Ng=class extends In{static{this.layerName="ArcLayer"}static{this.defaultProps=l_e}getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:gY,fs:_Y,modules:[Bs,vo]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getSourceColor",defaultValue:WC},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:WC},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(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e;(n.extensionsChanged||r.numSegments!==i.numSegments)&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:s,greatCircle:o,wrapLongitude:c}=this.props,f=this.state.model;f.setUniforms(e),f.setUniforms({greatCircle:o,widthUnits:xo[r],widthScale:i,widthMinPixels:n,widthMaxPixels:s,useShortestPath:c}),f.draw(this.context.renderPass)}_getModel(){let{numSegments:e}=this.props,r=[];for(let n=0;n0&&V>0&&(c[M++]=b-s,c[M++]=b-s-1,c[M++]=b-1,c[M++]=b-s,c[M++]=b-1,c[M++]=b),b++}}return{vertexCount:o,positions:y,indices:c,texCoords:f}}function h_e(t){let e=new Float64Array(12);for(let r=0;r 0.5) { + vTexPos = geometry.worldPosition.xy; + } + + vec4 color = vec4(0.0); + DECKGL_FILTER_COLOR(color, geometry); +} +`;var d_e=` +vec3 packUVsIntoRGB(vec2 uv) { + // Extract the top 8 bits. We want values to be truncated down so we can add a fraction + vec2 uv8bit = floor(uv * 256.); + + // Calculate the normalized remainders of u and v parts that do not fit into 8 bits + // Scale and clamp to 0-1 range + vec2 uvFraction = fract(uv * 256.); + vec2 uvFraction4bit = floor(uvFraction * 16.); + + // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates + float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.; + + return vec3(uv8bit, fractions) / 255.; +} +`,xY=`#version 300 es +#define SHADER_NAME bitmap-layer-fragment-shader + +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D bitmapTexture; + +in vec2 vTexCoord; +in vec2 vTexPos; + +out vec4 fragColor; + +uniform float desaturate; +uniform vec4 transparentColor; +uniform vec3 tintColor; +uniform float opacity; + +uniform float coordinateConversion; +uniform vec4 bounds; + +/* projection utils */ +const float TILE_SIZE = 512.0; +const float PI = 3.1415926536; +const float WORLD_SCALE = TILE_SIZE / PI / 2.0; + +// from degrees to Web Mercator +vec2 lnglat_to_mercator(vec2 lnglat) { + float x = lnglat.x; + float y = clamp(lnglat.y, -89.9, 89.9); + return vec2( + radians(x) + PI, + PI + log(tan(PI * 0.25 + radians(y) * 0.5)) + ) * WORLD_SCALE; +} + +// from Web Mercator to degrees +vec2 mercator_to_lnglat(vec2 xy) { + xy /= WORLD_SCALE; + return degrees(vec2( + xy.x - PI, + atan(exp(xy.y - PI)) * 2.0 - PI * 0.5 + )); +} +/* End projection utils */ + +// apply desaturation +vec3 color_desaturate(vec3 color) { + float luminance = (color.r + color.g + color.b) * 0.333333333; + return mix(color, vec3(luminance), desaturate); +} + +// apply tint +vec3 color_tint(vec3 color) { + return color * tintColor; +} + +// blend with background color +vec4 apply_opacity(vec3 color, float alpha) { + if (transparentColor.a == 0.0) { + return vec4(color, alpha); + } + float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha); + float highLightRatio = alpha / blendedAlpha; + vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio); + return vec4(blendedRGB, blendedAlpha); +} + +vec2 getUV(vec2 pos) { + return vec2( + (pos.x - bounds[0]) / (bounds[2] - bounds[0]), + (pos.y - bounds[3]) / (bounds[1] - bounds[3]) + ); +} + +${d_e} + +void main(void) { + vec2 uv = vTexCoord; + if (coordinateConversion < -0.5) { + vec2 lnglat = mercator_to_lnglat(vTexPos); + uv = getUV(lnglat); + } else if (coordinateConversion > 0.5) { + vec2 commonPos = lnglat_to_mercator(vTexPos); + uv = getUV(commonPos); + } + vec4 bitmapColor = texture(bitmapTexture, uv); + + fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity); + + geometry.uv = uv; + DECKGL_FILTER_COLOR(fragColor, geometry); + + if (bool(picking.isActive) && !bool(picking.isAttribute)) { + // Since instance information is not used, we can use picking color for pixel index + fragColor.rgb = packUVsIntoRGB(uv); + } +} +`;var p_e={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Kr.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,value:null}},zg=class extends In{static{this.layerName="BitmapLayer"}static{this.defaultProps=p_e}getShaders(){return super.getShaders({vs:yY,fs:xY,modules:[Bs,vo]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let r=!0;e.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:"float64",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:e,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==r.bounds){let s=this.state.mesh,o=this._createMesh();this.state.model.setVertexCount(o.vertexCount);for(let c in o)s&&s[c]!==o[c]&&n.invalidate(c);this.setState({mesh:o,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:r}=this.props,i=e.info;if(!i.color||!r)return i.bitmap=null,i;let{width:n,height:s}=r;i.index=0;let o=A_e(i.color);return i.bitmap={size:{width:n,height:s},uv:o,pixel:[Math.floor(o[0]*n),Math.floor(o[1]*s)]},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight({...e,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:e}=this.props,r=e;return vY(e)&&(r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),qB(r,this.context.viewport.resolution)}_getModel(){return new en(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:!1})}draw(e){let{uniforms:r,moduleParameters:i}=e,{model:n,coordinateConversion:s,bounds:o,disablePicking:c}=this.state,{image:f,desaturate:y,transparentColor:b,tintColor:M}=this.props;i.picking.isActive&&c||f&&n&&(n.setUniforms(r),n.setBindings({bitmapTexture:f}),n.setUniforms({desaturate:y,transparentColor:b.map(L=>L/255),tintColor:M.slice(0,3).map(L=>L/255),coordinateConversion:s,bounds:o}),n.draw(this.context.renderPass))}_getCoordinateUniforms(){let{LNGLAT:e,CARTESIAN:r,DEFAULT:i}=Kr,{_imageCoordinateSystem:n}=this.props;if(n!==i){let{bounds:s}=this.props;if(!vY(s))throw new Error("_imageCoordinateSystem only supports rectangular bounds");let o=this.context.viewport.resolution?e:r;if(n=n===e?e:r,n===e&&o===r)return{coordinateConversion:-1,bounds:s};if(n===r&&o===e){let c=Sa([s[0],s[1]]),f=Sa([s[2],s[3]]);return{coordinateConversion:1,bounds:[c[0],c[1],f[0],f[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}};function A_e(t){let[e,r,i]=t,n=(i&240)/256,s=(i&15)/16;return[(e+s)/256,(r+n)/256]}function vY(t){return Number.isFinite(t[0])}var bY=`#version 300 es +#define SHADER_NAME icon-layer-vertex-shader +in vec2 positions; +in vec3 instancePositions; +in vec3 instancePositions64Low; +in float instanceSizes; +in float instanceAngles; +in vec4 instanceColors; +in vec3 instancePickingColors; +in vec4 instanceIconFrames; +in float instanceColorModes; +in vec2 instanceOffsets; +in vec2 instancePixelOffset; +uniform float sizeScale; +uniform vec2 iconsTextureDim; +uniform float sizeMinPixels; +uniform float sizeMaxPixels; +uniform bool billboard; +uniform int sizeUnits; +out float vColorMode; +out vec4 vColor; +out vec2 vTextureCoords; +out vec2 uv; +vec2 rotate_by_angle(vec2 vertex, float angle) { +float angle_radian = angle * PI / 180.0; +float cos_angle = cos(angle_radian); +float sin_angle = sin(angle_radian); +mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); +return rotationMatrix * vertex; +} +void main(void) { +geometry.worldPosition = instancePositions; +geometry.uv = positions; +geometry.pickingColor = instancePickingColors; +uv = positions; +vec2 iconSize = instanceIconFrames.zw; +float sizePixels = clamp( +project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), +sizeMinPixels, sizeMaxPixels +); +float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y; +vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; +pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; +pixelOffset += instancePixelOffset; +pixelOffset.y *= -1.0; +if (billboard) { +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +vec3 offset = vec3(pixelOffset, 0.0); +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); +} else { +vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); +DECKGL_FILTER_SIZE(offset_common, geometry); +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +} +vTextureCoords = mix( +instanceIconFrames.xy, +instanceIconFrames.xy + iconSize, +(positions.xy + 1.0) / 2.0 +) / iconsTextureDim; +vColor = instanceColors; +DECKGL_FILTER_COLOR(vColor, geometry); +vColorMode = instanceColorModes; +} +`;var wY=`#version 300 es +#define SHADER_NAME icon-layer-fragment-shader +precision highp float; +uniform float opacity; +uniform sampler2D iconsTexture; +uniform float alphaCutoff; +in float vColorMode; +in vec4 vColor; +in vec2 vTextureCoords; +in vec2 uv; +out vec4 fragColor; +void main(void) { +geometry.uv = uv; +vec4 texColor = texture(iconsTexture, vTextureCoords); +vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode); +float a = texColor.a * opacity * vColor.a; +if (a < alphaCutoff) { +discard; +} +fragColor = vec4(color, a); +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var m_e=1024,g_e=4,SY=()=>{},TY={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},__e={x:0,y:0,width:0,height:0};function y_e(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function x_e(t,e,r,i){let n=Math.min(r/e.width,i/e.height),s=Math.floor(e.width*n),o=Math.floor(e.height*n);return n===1?{data:e,width:s,height:o}:(t.canvas.height=o,t.canvas.width=s,t.clearRect(0,0,s,o),t.drawImage(e,0,0,e.width,e.height,0,0,s,o),{data:t.canvas,width:s,height:o})}function mS(t){return t&&(t.id||t.url)}function v_e(t,e,r,i){let{width:n,height:s,device:o}=t,c=o.createTexture({format:"rgba8unorm",width:e,height:r,sampler:i}),f=o.createCommandEncoder();return f.copyTextureToTexture({source:t,destination:c,width:n,height:s}),f.finish(),t.destroy(),c}function EY(t,e,r){for(let i=0;io&&(EY(r,c,n),i=0,n=s+n+e,s=0,c=[]),c.push({icon:y,xOffset:i}),i=i+L+e,s=Math.max(s,M)}}return c.length>0&&EY(r,c,n),{mapping:r,rowHeight:s,xOffset:i,yOffset:n,canvasWidth:o,canvasHeight:y_e(s+n+e)}}function w_e(t,e,r){if(!t||!e)return null;r=r||{};let i={},{iterable:n,objectInfo:s}=su(t);for(let o of n){s.index++;let c=e(o,s),f=mS(c);if(!c)throw new Error("Icon is missing.");if(!c.url)throw new Error("Icon url is missing.");!i[f]&&(!r[f]||c.url!==r[f].url)&&(i[f]={...c,source:o,sourceIndex:s.index})}return i}var gS=class{constructor(e,{onUpdate:r=SY,onError:i=SY}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._textureParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=g_e,this._canvasWidth=m_e,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=r,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){let r=this._autoPacking?mS(e):e;return this._mapping[r]||__e}setProps({loadOptions:e,autoPacking:r,iconAtlas:i,iconMapping:n,textureParameters:s}){e&&(this._loadOptions=e),r!==void 0&&(this._autoPacking=r),n&&(this._mapping=n),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),s&&(this._textureParameters=s)}get isLoaded(){return this._pendingCount===0}packIcons(e,r){if(!this._autoPacking||typeof document>"u")return;let i=Object.values(w_e(e,r,this._mapping)||{});if(i.length>0){let{mapping:n,xOffset:s,yOffset:o,rowHeight:c,canvasHeight:f}=b_e({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=f,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._textureParameters||TY})),this._texture.height!==this._canvasHeight&&(this._texture=v_e(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||TY)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(i)}}_loadIcons(e){let r=this._canvas.getContext("2d",{willReadFrequently:!0});for(let i of e)this._pendingCount++,HA(i.url,this._loadOptions).then(n=>{let s=mS(i),o=this._mapping[s],{x:c,y:f,width:y,height:b}=o,{data:M,width:L,height:N}=x_e(r,n,y,b);this._texture.setSubImageData({data:M,x:c+(y-L)/2,y:f+(b-N)/2,width:L,height:N}),o.width=L,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 MY=[0,0,0,255],S_e={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:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:MY},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,value:null}},Ug=class extends In{static{this.defaultProps=S_e}static{this.layerName="IconLayer"}getShaders(){return super.getShaders({vs:bY,fs:wY,modules:[Bs,vo]})}initializeState(){this.state={iconManager:new gS(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",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:"uint8",accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:MY},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e,s=this.getAttributeManager(),{iconAtlas:o,iconMapping:c,data:f,getIcon:y,textureParameters:b}=r,{iconManager:M}=this.state;if(typeof o=="string")return;let L=o||this.internalState.isAsyncPropLoading("iconAtlas");M.setProps({loadOptions:r.loadOptions,autoPacking:!L,iconAtlas:o,iconMapping:L?c:null,textureParameters:b}),L?i.iconMapping!==r.iconMapping&&s.invalidate("getIcon"):(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getIcon))&&M.packIcons(f,y),n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize()}draw({uniforms:e}){let{sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,sizeUnits:s,billboard:o,alphaCutoff:c}=this.props,{iconManager:f}=this.state,y=f.getTexture();if(y){let b=this.state.model;b.setBindings({iconsTexture:y}),b.setUniforms(e),b.setUniforms({iconsTextureDim:[y.width,y.height],sizeUnits:xo[s],sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,billboard:o,alphaCutoff:c}),b.draw(this.context.renderPass)}}_getModel(){let e=[-1,-1,1,-1,-1,1,1,1];return new en(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new bo({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(e){let r=this.getCurrentLayer()?.props.onIconError;r?r(e):dr.error(e.error.message)()}getInstanceOffset(e){let{width:r,height:i,anchorX:n=r/2,anchorY:s=i/2}=this.state.iconManager.getIconMapping(e);return[r/2-n,i/2-s]}getInstanceColorMode(e){return this.state.iconManager.getIconMapping(e).mask?1:0}getInstanceIconFrame(e){let{x:r,y:i,width:n,height:s}=this.state.iconManager.getIconMapping(e);return[r,i,n,s]}};var PY=`#version 300 es +#define SHADER_NAME point-cloud-layer-vertex-shader +in vec3 positions; +in vec3 instanceNormals; +in vec4 instanceColors; +in vec3 instancePositions; +in vec3 instancePositions64Low; +in vec3 instancePickingColors; +uniform float opacity; +uniform float radiusPixels; +uniform int sizeUnits; +out vec4 vColor; +out vec2 unitPosition; +void main(void) { +geometry.worldPosition = instancePositions; +geometry.normal = project_normal(instanceNormals); +unitPosition = positions.xy; +geometry.uv = unitPosition; +geometry.pickingColor = instancePickingColors; +vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0); +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); +vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal); +vColor = vec4(lightColor, instanceColors.a * opacity); +DECKGL_FILTER_COLOR(vColor, geometry); +} +`;var CY=`#version 300 es +#define SHADER_NAME point-cloud-layer-fragment-shader +precision highp float; +in vec4 vColor; +in vec2 unitPosition; +out vec4 fragColor; +void main(void) { +geometry.uv = unitPosition; +float distToCenter = length(unitPosition); +if (distToCenter > 1.0) { +discard; +} +fragColor = vColor; +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var IY=[0,0,0,255],RY=[0,0,1],T_e={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:RY},getColor:{type:"accessor",value:IY},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function E_e(t){let{header:e,attributes:r}=t;if(!(!e||!r)&&(t.length=e.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0)){let{size:i,value:n}=r.COLOR_0;r.instanceColors={size:i,type:"unorm8",value:n}}}var Vg=class extends In{static{this.layerName="PointCloudLayer"}static{this.defaultProps=T_e}getShaders(){return super.getShaders({vs:PY,fs:CY,modules:[Bs,cp,vo]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:RY},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:IY}})}updateState(e){let{changeFlags:r,props:i}=e;super.updateState(e),r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),r.dataChanged&&E_e(i.data)}draw({uniforms:e}){let{pointSize:r,sizeUnits:i}=this.props,n=this.state.model;n.setUniforms(e),n.setUniforms({sizeUnits:xo[i],radiusPixels:r}),n.draw(this.context.renderPass)}_getModel(){let e=[];for(let r=0;r<3;r++){let i=r/3*Math.PI*2;e.push(Math.cos(i)*2,Math.sin(i)*2,0)}return new en(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new bo({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}};var kY=`#version 300 es +#define SHADER_NAME scatterplot-layer-vertex-shader +in vec3 positions; +in vec3 instancePositions; +in vec3 instancePositions64Low; +in float instanceRadius; +in float instanceLineWidths; +in vec4 instanceFillColors; +in vec4 instanceLineColors; +in vec3 instancePickingColors; +uniform float opacity; +uniform float radiusScale; +uniform float radiusMinPixels; +uniform float radiusMaxPixels; +uniform float lineWidthScale; +uniform float lineWidthMinPixels; +uniform float lineWidthMaxPixels; +uniform float stroked; +uniform bool filled; +uniform bool antialiasing; +uniform bool billboard; +uniform int radiusUnits; +uniform int lineWidthUnits; +out vec4 vFillColor; +out vec4 vLineColor; +out vec2 unitPosition; +out float innerUnitRadius; +out float outerRadiusPixels; +void main(void) { +geometry.worldPosition = instancePositions; +outerRadiusPixels = clamp( +project_size_to_pixel(radiusScale * instanceRadius, radiusUnits), +radiusMinPixels, radiusMaxPixels +); +float lineWidthPixels = clamp( +project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits), +lineWidthMinPixels, lineWidthMaxPixels +); +outerRadiusPixels += stroked * lineWidthPixels / 2.0; +float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0; +unitPosition = edgePadding * positions.xy; +geometry.uv = unitPosition; +geometry.pickingColor = instancePickingColors; +innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels; +if (billboard) { +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +vec3 offset = edgePadding * positions * outerRadiusPixels; +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); +} else { +vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels); +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +} +vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity); +DECKGL_FILTER_COLOR(vFillColor, geometry); +vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity); +DECKGL_FILTER_COLOR(vLineColor, geometry); +} +`;var LY=`#version 300 es +#define SHADER_NAME scatterplot-layer-fragment-shader +precision highp float; +uniform bool filled; +uniform float stroked; +uniform bool antialiasing; +in vec4 vFillColor; +in vec4 vLineColor; +in vec2 unitPosition; +in float innerUnitRadius; +in float outerRadiusPixels; +out vec4 fragColor; +void main(void) { +geometry.uv = unitPosition; +float distToCenter = length(unitPosition) * outerRadiusPixels; +float inCircle = antialiasing ? +smoothedge(distToCenter, outerRadiusPixels) : +step(distToCenter, outerRadiusPixels); +if (inCircle == 0.0) { +discard; +} +if (stroked > 0.5) { +float isLine = antialiasing ? +smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) : +step(innerUnitRadius * outerRadiusPixels, distToCenter); +if (filled) { +fragColor = mix(vFillColor, vLineColor, isLine); +} else { +if (isLine == 0.0) { +discard; +} +fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine); +} +} else if (!filled) { +discard; +} else { +fragColor = vFillColor; +} +fragColor.a *= inCircle; +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var DY=[0,0,0,255],M_e={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:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:DY},getLineColor:{type:"accessor",value:DY},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},xd=class extends In{static{this.defaultProps=M_e}static{this.layerName="ScatterplotLayer"}getShaders(){return super.getShaders({vs:kY,fs:LY,modules:[Bs,vo]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:n,radiusMaxPixels:s,stroked:o,filled:c,billboard:f,antialiasing:y,lineWidthUnits:b,lineWidthScale:M,lineWidthMinPixels:L,lineWidthMaxPixels:N}=this.props,V=this.state.model;V.setUniforms(e),V.setUniforms({stroked:o?1:0,filled:c,billboard:f,antialiasing:y,radiusUnits:xo[r],radiusScale:i,radiusMinPixels:n,radiusMaxPixels:s,lineWidthUnits:xo[b],lineWidthScale:M,lineWidthMinPixels:L,lineWidthMaxPixels:N}),V.draw(this.context.renderPass)}_getModel(){let e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new en(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new bo({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}};var ex={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function jg(t,e,r={}){return OY(t,r)!==e?(P_e(t,r),!0):!1}function OY(t,e={}){return Math.sign(HC(t,e))}var GB={x:0,y:1,z:2};function HC(t,e={}){let{start:r=0,end:i=t.length,plane:n="xy"}=e,s=e.size||2,o=0,c=GB[n[0]],f=GB[n[1]];for(let y=r,b=i-s;y0){let n=!0;for(let s=0;se[2]&&(r|=2),t[1]e[3]&&(r|=8),r}function xS(t,e){let{size:r=2,broken:i=!1,gridResolution:n=10,gridOffset:s=[0,0],startIndex:o=0,endIndex:c=t.length}=e||{},f=(c-o)/r,y=[],b=[y],M=M0(t,0,r,o),L,N,V=NY(M,n,s,[]),$=[];Tc(y,M);for(let Q=1;Qr&&(y=[],b.push(y),Tc(y,M)),N=yS(L,V)}Tc(y,L),_S(M,L)}return i?b:b[0]}var BY=0,I_e=1;function vS(t,e=null,r){if(!t.length)return[];let{size:i=2,gridResolution:n=10,gridOffset:s=[0,0],edgeTypes:o=!1}=r||{},c=[],f=[{pos:t,types:o?new Array(t.length/i).fill(I_e):null,holes:e||[]}],y=[[],[]],b=[];for(;f.length;){let{pos:M,types:L,holes:N}=f.shift();k_e(M,i,N[0]||M.length,y),b=NY(y[0],n,s,b);let V=yS(y[1],b);if(V){let $=FY(M,L,i,0,N[0]||M.length,b,V),Q={pos:$[0].pos,types:$[0].types,holes:[]},q={pos:$[1].pos,types:$[1].types,holes:[]};f.push(Q,q);for(let J=0;J=0?(Tc(y,N)&&M.push($),oe+=V):M.length&&(M[M.length-1]=BY),_S(Q,N),q=V,J=$;return[ee?{pos:f,types:e&&b}:null,oe?{pos:y,types:e&&M}:null]}function NY(t,e,r,i){let n=Math.floor((t[0]-r[0])/e)*e+r[0],s=Math.floor((t[1]-r[1])/e)*e+r[1];return i[0]=n,i[1]=s,i[2]=n+e,i[3]=s+e,i}function R_e(t,e,r){r&8?(t[1]+=e,t[3]+=e):r&4?(t[1]-=e,t[3]-=e):r&2?(t[0]+=e,t[2]+=e):r&1&&(t[0]-=e,t[2]-=e)}function k_e(t,e,r,i){let n=1/0,s=-1/0,o=1/0,c=-1/0;for(let f=0;fs?y:s,o=bc?b:c}return i[0][0]=n,i[0][1]=o,i[1][0]=s,i[1][1]=c,i}function qC(t,e){for(let r=0;rn&&(n=c,s=o-1)}return s}function O_e(t,e,r,i,n=L_e){let s=t[r],o=t[i-e];if(Math.abs(s-o)>180){let c=M0(t,0,e,r);c[0]+=Math.round((o-s)/360)*360,Tc(t,c),c[1]=Math.sign(c[1])*n,Tc(t,c),c[0]=s,Tc(t,c)}}function zY(t,e,r,i){let n=t[0],s;for(let o=r;o180||c<-180)&&(s-=Math.round(c/360)*360),t[o]=n=s}}function UY(t,e){let r,i=t.length/e;for(let s=0;s=i),n=n.flatMap(N=>[N[0],N[1]]),jg(n,ex.COUNTER_CLOCKWISE));let s=r>0,o=i+1,c=s?o*3+1:i,f=Math.PI*2/i,y=new Uint16Array(s?i*3*2:0),b=new Float32Array(c*3),M=new Float32Array(c*3),L=0;if(s){for(let N=0;N 0.0 && instanceElevations >= 0.0); +float dotRadius = radius * coverage * shouldRender; +geometry.pickingColor = instancePickingColors; +vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation); +vec3 centroidPosition64Low = instancePositions64Low; +vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius; +if (radiusUnits == UNIT_METERS) { +offset = project_size(offset); +} +vec3 pos = vec3(offset, 0.); +DECKGL_FILTER_SIZE(pos, geometry); +gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position); +geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z)); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +if (extruded && !isStroke) { +#ifdef FLAT_SHADING +position_commonspace = geometry.position; +vColor = vec4(color.rgb, color.a * opacity); +#else +vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal); +vColor = vec4(lightColor, color.a * opacity); +#endif +} else { +vColor = vec4(color.rgb, color.a * opacity); +} +DECKGL_FILTER_COLOR(vColor, geometry); +} +`;var jY=`#version 300 es +#define SHADER_NAME column-layer-fragment-shader +precision highp float; +uniform vec3 project_uCameraPosition; +uniform bool extruded; +uniform bool isStroke; +out vec4 fragColor; +in vec4 vColor; +#ifdef FLAT_SHADING +in vec4 position_commonspace; +#endif +void main(void) { +fragColor = vColor; +geometry.uv = vec2(0.); +#ifdef FLAT_SHADING +if (extruded && !isStroke && !bool(picking.isActive)) { +vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); +fragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal); +} +#endif +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var GC=[0,0,0,255],N_e={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,flatShading:!1,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:GC},getLineColor:{type:"accessor",value:GC},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}},Rp=class extends In{static{this.layerName="ColumnLayer"}static{this.defaultProps=N_e}getShaders(){let e={},{flatShading:r}=this.props;return r&&(e.FLAT_SHADING=1),super.getShaders({vs:VY,fs:jY,defines:e,modules:[Bs,r?Zb:cp,vo]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:GC},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:GC},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e,s=n.extensionsChanged||r.flatShading!==i.flatShading;s&&(this.state.models?.forEach(c=>c.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let o=this.getNumInstances();this.state.fillModel.setInstanceCount(o),this.state.wireframeModel.setInstanceCount(o),(s||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(e,r,i){let n=new bS({radius:1,height:i?2:0,vertices:r,nradial:e}),s=0;if(r)for(let o=0;o=e.length&&(r+=1-e.length/n);let s=r*n;return i[0]=e[s],i[1]=e[s+1],i[2]=n===3&&e[s+2]||0,i}isClosed(e){if(!this.normalize)return!!this.opts.loop;let{positionSize:r}=this,i=e.length-r;return e[0]===e[i]&&e[1]===e[i+1]&&(r===2||e[2]===e[i+2])}};function HY(t){return Array.isArray(t[0])}var $Y=`#version 300 es +#define SHADER_NAME path-layer-vertex-shader +in vec2 positions; +in float instanceTypes; +in vec3 instanceStartPositions; +in vec3 instanceEndPositions; +in vec3 instanceLeftPositions; +in vec3 instanceRightPositions; +in vec3 instanceLeftPositions64Low; +in vec3 instanceStartPositions64Low; +in vec3 instanceEndPositions64Low; +in vec3 instanceRightPositions64Low; +in float instanceStrokeWidths; +in vec4 instanceColors; +in vec3 instancePickingColors; +uniform float widthScale; +uniform float widthMinPixels; +uniform float widthMaxPixels; +uniform float jointType; +uniform float capType; +uniform float miterLimit; +uniform bool billboard; +uniform int widthUnits; +uniform float opacity; +out vec4 vColor; +out vec2 vCornerOffset; +out float vMiterLength; +out vec2 vPathPosition; +out float vPathLength; +out float vJointType; +const float EPSILON = 0.001; +const vec3 ZERO_OFFSET = vec3(0.0); +float flipIfTrue(bool flag) { +return -(float(flag) * 2. - 1.); +} +vec3 getLineJoinOffset( +vec3 prevPoint, vec3 currPoint, vec3 nextPoint, +vec2 width +) { +bool isEnd = positions.x > 0.0; +float sideOfPath = positions.y; +float isJoint = float(sideOfPath == 0.0); +vec3 deltaA3 = (currPoint - prevPoint); +vec3 deltaB3 = (nextPoint - currPoint); +mat3 rotationMatrix; +bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix); +if (needsRotation) { +deltaA3 = deltaA3 * rotationMatrix; +deltaB3 = deltaB3 * rotationMatrix; +} +vec2 deltaA = deltaA3.xy / width; +vec2 deltaB = deltaB3.xy / width; +float lenA = length(deltaA); +float lenB = length(deltaB); +vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0); +vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0); +vec2 perpA = vec2(-dirA.y, dirA.x); +vec2 perpB = vec2(-dirB.y, dirB.x); +vec2 tangent = dirA + dirB; +tangent = length(tangent) > 0. ? normalize(tangent) : perpA; +vec2 miterVec = vec2(-tangent.y, tangent.x); +vec2 dir = isEnd ? dirA : dirB; +vec2 perp = isEnd ? perpA : perpB; +float L = isEnd ? lenA : lenB; +float sinHalfA = abs(dot(miterVec, perp)); +float cosHalfA = abs(dot(dirA, miterVec)); +float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); +float cornerPosition = sideOfPath * turnDirection; +float miterSize = 1.0 / max(sinHalfA, EPSILON); +miterSize = mix( +min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), +miterSize, +step(0.0, cornerPosition) +); +vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) +* (sideOfPath + isJoint * turnDirection); +bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); +bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); +bool isCap = isStartCap || isEndCap; +if (isCap) { +offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint); +vJointType = capType; +} else { +vJointType = jointType; +} +vPathLength = L; +vCornerOffset = offsetVec; +vMiterLength = dot(vCornerOffset, miterVec * turnDirection); +vMiterLength = isCap ? isJoint : vMiterLength; +vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd); +vPathPosition = vec2( +dot(offsetFromStartOfPath, perp), +dot(offsetFromStartOfPath, dir) +); +geometry.uv = vPathPosition; +float isValid = step(instanceTypes, 3.5); +vec3 offset = vec3(offsetVec * width * isValid, 0.0); +if (needsRotation) { +offset = rotationMatrix * offset; +} +return offset; +} +void clipLine(inout vec4 position, vec4 refPosition) { +if (position.w < EPSILON) { +float r = (EPSILON - refPosition.w) / (position.w - refPosition.w); +position = refPosition + (position - refPosition) * r; +} +} +void main() { +geometry.pickingColor = instancePickingColors; +vColor = vec4(instanceColors.rgb, instanceColors.a * opacity); +float isEnd = positions.x; +vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd); +vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd); +vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd); +vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd); +vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd); +vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd); +geometry.worldPosition = currPosition; +vec2 widthPixels = vec2(clamp( +project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits), +widthMinPixels, widthMaxPixels) / 2.0); +vec3 width; +if (billboard) { +vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET); +vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position); +vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET); +clipLine(prevPositionScreen, currPositionScreen); +clipLine(nextPositionScreen, currPositionScreen); +clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); +width = vec3(widthPixels, 0.0); +DECKGL_FILTER_SIZE(width, geometry); +vec3 offset = getLineJoinOffset( +prevPositionScreen.xyz / prevPositionScreen.w, +currPositionScreen.xyz / currPositionScreen.w, +nextPositionScreen.xyz / nextPositionScreen.w, +project_pixel_size_to_clipspace(width.xy) +); +DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry); +gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w); +} else { +prevPosition = project_position(prevPosition, prevPosition64Low); +currPosition = project_position(currPosition, currPosition64Low); +nextPosition = project_position(nextPosition, nextPosition64Low); +width = vec3(project_pixel_size(widthPixels), 0.0); +DECKGL_FILTER_SIZE(width, geometry); +vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy); +geometry.position = vec4(currPosition + offset, 1.0); +gl_Position = project_common_position_to_clipspace(geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +} +DECKGL_FILTER_COLOR(vColor, geometry); +} +`;var qY=`#version 300 es +#define SHADER_NAME path-layer-fragment-shader +precision highp float; +uniform float miterLimit; +in vec4 vColor; +in vec2 vCornerOffset; +in float vMiterLength; +in vec2 vPathPosition; +in float vPathLength; +in float vJointType; +out vec4 fragColor; +void main(void) { +geometry.uv = vPathPosition; +if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) { +if (vJointType > 0.5 && length(vCornerOffset) > 1.0) { +discard; +} +if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) { +discard; +} +} +fragColor = vColor; +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var GY=[0,0,0,255],V_e={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:t=>t.path},getColor:{type:"accessor",value:GY},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},QB={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},fh=class extends In{static{this.defaultProps=V_e}static{this.layerName="PathLayer"}getShaders(){return super.getShaders({vs:$Y,fs:qY,modules:[Bs,vo]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:QB,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:QB,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:QB,defaultValue:GY},instancePickingColors:{size:4,type:"uint8",accessor:(i,{index:n,target:s})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,s)}}),this.setState({pathTesselator:new wS({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:r,changeFlags:i}=e,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:o}=this.state,c=r.data.attributes||{};o.updateGeometry({data:r.data,geometryBuffer:c.getPath,buffers:c,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:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||n.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll())}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(s=>s.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i=1&&t[0].length>=2&&Number.isFinite(t[0][0])}function oye(t){let e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function aye(t,e,r,i){for(let n=0;nc/e));let s=rx(t),o=i&&e===3;if(r){let c=s.length;s=s.slice();let f=[];for(let y=0;yf&&c>y||(f>y?(r||(s=s.slice()),rX(s,0,2,1)):(r||(s=s.slice()),rX(s,2,0,1)))}return(0,iX.default)(s,n,e)}var PS=class extends c0{constructor(e){let{fp64:r,IndexType:i=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(e){let{attributes:r}=this;return e==="indices"?r.indices&&r.indices.subarray(0,this.vertexCount):r[e]}updateGeometry(e){super.updateGeometry(e);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(e){if(this.normalize){let r=JC(e,this.positionSize);return this.opts.resolution?vS(rx(r),MS(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?YB(rx(r),MS(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return e}getGeometrySize(e){if(oX(e)){let r=0;for(let i of e)r+=this.getGeometrySize(i);return r}return rx(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,r){if(e&&oX(e))for(let i of e){let n=this.getGeometrySize(i);r.geometrySize=n,this.updateGeometryAttributes(i,r),r.vertexStart+=n,r.indexStart=this.indexStarts[r.geometryIndex+1]}else{let i=e;this._updateIndices(i,r),this._updatePositions(i,r),this._updateVertexValid(i,r)}}_updateIndices(e,{geometryIndex:r,vertexStart:i,indexStart:n}){let{attributes:s,indexStarts:o,typedArrayManager:c}=this,f=s.indices;if(!f||!e)return;let y=n,b=nX(e,this.positionSize,this.opts.preproject,this.opts.full3d);f=c.allocate(f,n+b.length,{copy:!0});for(let M=0;M2?o[f*s+2]:0;n[c*3]=y,n[c*3+1]=b,n[c*3+2]=M}}_updateVertexValid(e,{vertexStart:r,geometrySize:i}){let{positionSize:n}=this,s=this.attributes.vertexValid,o=e&&MS(e);if(e&&e.edgeTypes?s.set(e.edgeTypes,r):s.fill(1,r,r+i),o)for(let c=0;c0&&!Number.isFinite(t[0])}var eI=`uniform bool extruded; +uniform bool isWireframe; +uniform float elevationScale; +uniform float opacity; +in vec4 fillColors; +in vec4 lineColors; +in vec3 pickingColors; +out vec4 vColor; +struct PolygonProps { +vec3 positions; +vec3 positions64Low; +vec3 normal; +float elevations; +}; +vec3 project_offset_normal(vec3 vector) { +if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT || +project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) { +return normalize(vector * project_uCommonUnitsPerWorldUnit); +} +return project_normal(vector); +} +void calculatePosition(PolygonProps props) { +vec3 pos = props.positions; +vec3 pos64Low = props.positions64Low; +vec3 normal = props.normal; +vec4 colors = isWireframe ? lineColors : fillColors; +geometry.worldPosition = props.positions; +geometry.pickingColor = pickingColors; +if (extruded) { +pos.z += props.elevations * elevationScale; +} +gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +if (extruded) { +#ifdef IS_SIDE_VERTEX +normal = project_offset_normal(normal); +#else +normal = project_normal(normal); +#endif +geometry.normal = normal; +vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal); +vColor = vec4(lightColor, colors.a * opacity); +} else { +vColor = vec4(colors.rgb, colors.a * opacity); +} +DECKGL_FILTER_COLOR(vColor, geometry); +} +`;var aX=`#version 300 es +#define SHADER_NAME solid-polygon-layer-vertex-shader +in vec3 vertexPositions; +in vec3 vertexPositions64Low; +in float elevations; +${eI} +void main(void) { +PolygonProps props; +props.positions = vertexPositions; +props.positions64Low = vertexPositions64Low; +props.elevations = elevations; +props.normal = vec3(0.0, 0.0, 1.0); +calculatePosition(props); +} +`;var lX=`#version 300 es +#define SHADER_NAME solid-polygon-layer-vertex-shader-side +#define IS_SIDE_VERTEX +in vec2 positions; +in vec3 vertexPositions; +in vec3 nextVertexPositions; +in vec3 vertexPositions64Low; +in vec3 nextVertexPositions64Low; +in float elevations; +in float instanceVertexValid; +${eI} +void main(void) { +if(instanceVertexValid < 0.5){ +gl_Position = vec4(0.); +return; +} +PolygonProps props; +vec3 pos; +vec3 pos64Low; +vec3 nextPos; +vec3 nextPos64Low; +#if RING_WINDING_ORDER_CW == 1 +pos = vertexPositions; +pos64Low = vertexPositions64Low; +nextPos = nextVertexPositions; +nextPos64Low = nextVertexPositions64Low; +#else +pos = nextVertexPositions; +pos64Low = nextVertexPositions64Low; +nextPos = vertexPositions; +nextPos64Low = vertexPositions64Low; +#endif +props.positions = mix(pos, nextPos, positions.x); +props.positions64Low = mix(pos64Low, nextPos64Low, positions.x); +props.normal = vec3( +pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y), +nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x), +0.0); +props.elevations = elevations * positions.y; +calculatePosition(props); +} +`;var cX=`#version 300 es +#define SHADER_NAME solid-polygon-layer-fragment-shader +precision highp float; +in vec4 vColor; +out vec4 fragColor; +void main(void) { +fragColor = vColor; +geometry.uv = vec2(0.); +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var rI=[0,0,0,255],lye={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:rI},getLineColor:{type:"accessor",value:rI},material:!0},tI={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},dh=class extends In{static{this.defaultProps=lye}static{this.layerName="SolidPolygonLayer"}getShaders(e){return super.getShaders({vs:e==="top"?aX:lX,fs:cX,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Bs,cp,vo]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:r}=this.props,{_full3d:i}=this.props;e.isGeospatial&&r===Kr.DEFAULT&&(r=Kr.LNGLAT);let n;r===Kr.LNGLAT&&(i?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new PS({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let s=this.getAttributeManager(),o=!0;s.remove(["instancePickingColors"]),s.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:o},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:tI,accessor:"getPolygon",update:this.calculatePositions,noAlloc:o,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:o},elevations:{size:1,stepMode:"dynamic",transition:tI,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:tI,accessor:"getFillColor",defaultValue:rI},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:tI,accessor:"getLineColor",defaultValue:rI},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(c,{index:f,target:y})=>this.encodePickingColor(c&&c.__source?c.__source.index:f,y)}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(s=>s.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;ic.destroy()),this.setState(this._getModels()),s.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:s}=this.state,o=e.data.attributes||{};s.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:o.getPolygon,buffers:o,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,s,o;if(r){let c=this.getShaders("top");c.defines.NON_INSTANCED_MODEL=1;let f=this.getAttributeManager().getBufferLayouts({isInstanced:!1});n=new en(this.context.device,{...c,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:f,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(i){let c=this.getAttributeManager().getBufferLayouts({isInstanced:!0});s=new en(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:c,uniforms:{isWireframe:!1},geometry:new bo({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),o=new en(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:c,uniforms:{isWireframe:!0},geometry:new bo({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[s,o,n].filter(Boolean),topModel:n,sideModel:s,wireframeModel:o}}calculateIndices(e){let{polygonTesselator:r}=this.state;e.startIndices=r.indexStarts,e.value=r.get("indices")}calculatePositions(e){let{polygonTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}};function iI({data:t,getIndex:e,dataRange:r,replace:i}){let{startRow:n=0,endRow:s=1/0}=r,o=t.length,c=o,f=o;for(let L=0;LL&&N>=n&&(c=L),N>=s){f=L;break}}let y=c,M=f-c!==i.length?t.slice(f):void 0;for(let L=0;Lt.polygon},getFillColor:{type:"accessor",value:cye},getLineColor:{type:"accessor",value:uX},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},kp=class extends Xi{static{this.layerName="PolygonLayer"}static{this.defaultProps=uye}initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&dr.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(r&&Array.isArray(e.dataChanged)){let i=this.state.paths.slice(),n=e.dataChanged.map(s=>iI({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(e={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:s}=this.props,o=[],c=n==="XY"?2:3,{startRow:f,endRow:y}=e,{iterable:b,objectInfo:M}=su(r,f,y);for(let L of b){M.index++;let N=i(L,M);s&&(N=JC(N,c));let{holeIndices:V}=N,$=N.positions||N;if(V)for(let Q=0;Q<=V.length;Q++){let q=$.slice(V[Q-1]||0,V[Q]||$.length);o.push(this.getSubLayerRow({path:q},L,M.index))}else o.push(this.getSubLayerRow({path:$},L,M.index))}return o}renderLayers(){let{data:e,_dataDiff:r,stroked:i,filled:n,extruded:s,wireframe:o,_normalize:c,_windingOrder:f,elevationScale:y,transitions:b,positionFormat:M}=this.props,{lineWidthUnits:L,lineWidthScale:N,lineWidthMinPixels:V,lineWidthMaxPixels:$,lineJointRounded:Q,lineMiterLimit:q,lineDashJustified:J}=this.props,{getFillColor:ee,getLineColor:oe,getLineWidth:ve,getLineDashArray:Re,getElevation:Ze,getPolygon:He,updateTriggers:ot,material:et}=this.props,{paths:Lt,pathsDiff:Gt}=this.state,qt=this.getSubLayerClass("fill",dh),Ar=this.getSubLayerClass("stroke",fh),ri=this.shouldRenderSubLayer("fill",Lt)&&new qt({_dataDiff:r,extruded:s,elevationScale:y,filled:n,wireframe:o,_normalize:c,_windingOrder:f,getElevation:Ze,getFillColor:ee,getLineColor:s&&o?oe:uX,material:et,transitions:b},this.getSubLayerProps({id:"fill",updateTriggers:ot&&{getPolygon:ot.getPolygon,getElevation:ot.getElevation,getFillColor:ot.getFillColor,lineColors:s&&o,getLineColor:ot.getLineColor}}),{data:e,positionFormat:M,getPolygon:He}),Bn=!s&&i&&this.shouldRenderSubLayer("stroke",Lt)&&new Ar({_dataDiff:Gt&&(()=>Gt),widthUnits:L,widthScale:N,widthMinPixels:V,widthMaxPixels:$,jointRounded:Q,miterLimit:q,dashJustified:J,_pathType:"loop",transitions:b&&{getWidth:b.getLineWidth,getColor:b.getLineColor,getPath:b.getPolygon},getColor:this.getSubLayerAccessor(oe),getWidth:this.getSubLayerAccessor(ve),getDashArray:this.getSubLayerAccessor(Re)},this.getSubLayerProps({id:"stroke",updateTriggers:ot&&{getWidth:ot.getLineWidth,getColor:ot.getLineColor,getDashArray:ot.getLineDashArray}}),{data:Lt,positionFormat:M,getPath:fo=>fo.path});return[!s&&ri,Bn,s&&ri]}};function hX(t,e){if(!t)return null;let r="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[r];return r!==-1?hye(t,i,r):null}function hye(t,e,r){let i={properties:{...t.properties[e]}};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[r];return i}function fX(t,e){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let s=[];for(let o=0;o 0.0) { +float inFill = alpha; +float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance); +color = mix(outlineColor, vColor, inFill); +alpha = inBorder; +} +} +float a = alpha * color.a; +if (a < alphaCutoff) { +discard; +} +fragColor = vec4(color.rgb, a * opacity); +} +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var i8=192/256,pX=[],fye={getIconOffsets:{type:"accessor",value:t=>t.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}},CS=class extends Ug{static{this.defaultProps=fye}static{this.layerName="MultiIconLayer"}getShaders(){return{...super.getShaders(),fs:dX}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(r,{index:i,target:n})=>this.encodePickingColor(i,n)}})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e,{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&&dr.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){let{sdf:r,smoothing:i,outlineWidth:n}=this.props,{outlineColor:s}=this.state,o=n?Math.max(i,i8*(1-n)):-1;if(e.uniforms={...e.uniforms,sdfBuffer:i8,outlineBuffer:o,gamma:i,sdf:!!r,outlineColor:s},super.draw(e),r&&n){let{iconManager:c}=this.state,f=c.getTexture(),y=this.state.model;f&&(y.setUniforms({outlineBuffer:i8}),y.draw(this.context.renderPass))}}getInstanceOffset(e){return e?Array.from(e).flatMap(r=>super.getInstanceOffset(r)):pX}getInstanceColorMode(e){return 1}getInstanceIconFrame(e){return e?Array.from(e).flatMap(r=>super.getInstanceIconFrame(r)):pX}};var IS=class{constructor({fontSize:e=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 f=this.size=e+r*4,y=this._createCanvas(f),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${c} ${o} ${e}px ${s}`,b.textBaseline="alphabetic",b.textAlign="left",b.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(e){let r=document.createElement("canvas");return r.width=r.height=e,r}draw(e){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:o}=this.ctx.measureText(e),c=Math.ceil(i),f=0,y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-s))),b=Math.min(this.size-this.buffer,c+Math.ceil(n)),M=y+2*this.buffer,L=b+2*this.buffer,N=Math.max(M*L,0),V=new Uint8ClampedArray(N),$={data:V,width:M,height:L,glyphWidth:y,glyphHeight:b,glyphTop:c,glyphLeft:f,glyphAdvance:r};if(y===0||b===0)return $;let{ctx:Q,buffer:q,gridInner:J,gridOuter:ee}=this;Q.clearRect(q,q,y,b),Q.fillText(e,q,q+c);let oe=Q.getImageData(q,q,y,b);ee.fill(1e20,0,N),J.fill(0,0,N);for(let ve=0;ve0?ot*ot:0,J[He]=ot<0?ot*ot:0}}AX(ee,0,0,M,L,M,this.f,this.v,this.z),AX(J,q,q,y,b,M,this.f,this.v,this.z);for(let ve=0;ve-1);f++,s[f]=c,o[f]=y,o[f+1]=1e20}for(let c=0,f=0;cn&&(y=0,f++),s[M]={x:y+i,y:c+f*b+i,width:L,height:b,layoutWidth:L,layoutHeight:r},y+=L+i*2}return{mapping:s,xOffset:y,yOffset:c+f*b,canvasHeight:Aye(c+(f+1)*b)}}function _X(t,e,r,i){let n=0;for(let s=e;si&&(oc){let M=_X(t,c,f,n);y+M>i&&(oi&&(M=yX(t,c,f,i,n,s),o=s[s.length-1])),c=f,y+=M}return y}function gye(t,e,r,i,n=0,s){s===void 0&&(s=t.length);let o=[];return e==="break-all"?yX(t,n,s,r,i,o):mye(t,n,s,r,i,o),o}function _ye(t,e,r,i,n,s){let o=0,c=0;for(let f=e;f0,M=[0,0],L=[0,0],N=0,V=0,$=0;for(let Q=0;Q<=o;Q++){let q=s[Q];if((q===` +`||Q===o)&&($=Q),$>V){let J=b?gye(s,r,i,n,V,$):pye;for(let ee=0;ee<=J.length;ee++){let oe=ee===0?V:J[ee-1],ve=ee1||f>0){let N=t.constructor;L=new N(y);for(let V=0;V=0&&this._order.splice(r,1)}_appendOrder(e){this._order.push(e)}};function yye(){let t=[];for(let e=32;e<128;e++)t.push(String.fromCharCode(e));return t}var Hg={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:yye(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},bX=1024,wX=.9,SX=1.2,EX=3,nI=new ix(EX);function xye(t,e){let r;typeof e=="string"?r=new Set(Array.from(e)):r=new Set(e);let i=nI.get(t);if(!i)return r;for(let n in i.mapping)r.has(n)&&r.delete(n);return r}function vye(t,e){for(let r=0;r=EX,"Invalid cache limit"),nI=new ix(t)}var RS=class{constructor(){this.props={...Hg}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:e,buffer:r}=this.props;return(e*SX+r*2)/e}setProps(e={}){Object.assign(this.props,e),this._key=this._getKey();let r=xye(this._key,this.props.characterSet),i=nI.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let n=this._generateFontAtlas(r,i);this._atlas=n,nI.set(this._key,n)}_generateFontAtlas(e,r){let{fontFamily:i,fontWeight:n,fontSize:s,buffer:o,sdf:c,radius:f,cutoff:y}=this.props,b=r&&r.data;b||(b=document.createElement("canvas"),b.width=bX);let M=b.getContext("2d",{willReadFrequently:!0});TX(M,i,s,n);let{mapping:L,canvasHeight:N,xOffset:V,yOffset:$}=gX({getFontWidth:Q=>M.measureText(Q).width,fontHeight:s*SX,buffer:o,characterSet:e,maxCanvasWidth:bX,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(b.height!==N){let Q=M.getImageData(0,0,b.width,b.height);b.height=N,M.putImageData(Q,0,0)}if(TX(M,i,s,n),c){let Q=new IS({fontSize:s,buffer:o,radius:f,cutoff:y,fontFamily:i,fontWeight:`${n}`});for(let q of e){let{data:J,width:ee,height:oe,glyphTop:ve}=Q.draw(q);L[q].width=ee,L[q].layoutOffsetY=s*wX-ve;let Re=M.createImageData(ee,oe);vye(J,Re),M.putImageData(Re,L[q].x,L[q].y)}}else for(let Q of e)M.fillText(Q,L[Q].x,L[Q].y+o+s*wX);return{xOffset:V,yOffset:$,mapping:L,data:b,width:b.width,height:b.height}}_getKey(){let{fontFamily:e,fontWeight:r,fontSize:i,buffer:n,sdf:s,radius:o,cutoff:c}=this.props;return s?`${e} ${r} ${i} ${n} ${o} ${c}`:`${e} ${r} ${i} ${n}`}};var PX=`#version 300 es +#define SHADER_NAME text-background-layer-vertex-shader +in vec2 positions; +in vec3 instancePositions; +in vec3 instancePositions64Low; +in vec4 instanceRects; +in float instanceSizes; +in float instanceAngles; +in vec2 instancePixelOffsets; +in float instanceLineWidths; +in vec4 instanceFillColors; +in vec4 instanceLineColors; +in vec3 instancePickingColors; +uniform bool billboard; +uniform float opacity; +uniform float sizeScale; +uniform float sizeMinPixels; +uniform float sizeMaxPixels; +uniform vec4 padding; +uniform int sizeUnits; +out vec4 vFillColor; +out vec4 vLineColor; +out float vLineWidth; +out vec2 uv; +out vec2 dimensions; +vec2 rotate_by_angle(vec2 vertex, float angle) { +float angle_radian = radians(angle); +float cos_angle = cos(angle_radian); +float sin_angle = sin(angle_radian); +mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); +return rotationMatrix * vertex; +} +void main(void) { +geometry.worldPosition = instancePositions; +geometry.uv = positions; +geometry.pickingColor = instancePickingColors; +uv = positions; +vLineWidth = instanceLineWidths; +float sizePixels = clamp( +project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), +sizeMinPixels, sizeMaxPixels +); +dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw; +vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions); +pixelOffset = rotate_by_angle(pixelOffset, instanceAngles); +pixelOffset += instancePixelOffsets; +pixelOffset.y *= -1.0; +if (billboard) { +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +vec3 offset = vec3(pixelOffset, 0.0); +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); +} else { +vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); +DECKGL_FILTER_SIZE(offset_common, geometry); +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +} +vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity); +DECKGL_FILTER_COLOR(vFillColor, geometry); +vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity); +DECKGL_FILTER_COLOR(vLineColor, geometry); +} +`;var CX=`#version 300 es +#define SHADER_NAME text-background-layer-fragment-shader +precision highp float; +uniform bool stroked; +in vec4 vFillColor; +in vec4 vLineColor; +in float vLineWidth; +in vec2 uv; +in vec2 dimensions; +out vec4 fragColor; +void main(void) { +geometry.uv = uv; +vec2 pixelPosition = uv * dimensions; +if (stroked) { +float distToEdge = min( +min(pixelPosition.x, dimensions.x - pixelPosition.x), +min(pixelPosition.y, dimensions.y - pixelPosition.y) +); +float isBorder = smoothedge(distToEdge, vLineWidth); +fragColor = mix(vFillColor, vLineColor, isBorder); +} else { +fragColor = vFillColor; +} +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var bye={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:t=>t.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}},kS=class extends In{static{this.defaultProps=bye}static{this.layerName="TextBackgroundLayer"}getShaders(){return super.getShaders({vs:PX,fs:CX,modules:[Bs,vo]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",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,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:r}=e;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:r,sizeScale:i,sizeUnits:n,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:c}=this.props,{padding:f}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]);let y=this.state.model;y.setUniforms(e),y.setUniforms({billboard:r,stroked:!!c,padding:f,sizeUnits:xo[n],sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o}),y.draw(this.context.renderPass)}_getModel(){let e=[0,0,1,0,1,1,0,1];return new en(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new bo({topology:"triangle-fan-webgl",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}};var IX={start:1,middle:0,end:-1},RX={top:1,center:0,bottom:-1},n8=[0,0,0,255],wye=1,Sye={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:n8},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:Hg.characterSet},fontFamily:Hg.fontFamily,fontWeight:Hg.fontWeight,lineHeight:wye,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:n8},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:n8},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"]}},Lp=class extends Xi{constructor(){super(...arguments),this.getBoundingRect=(e,r)=>{let{size:[i,n]}=this.transformParagraph(e,r),{fontSize:s}=this.state.fontAtlasManager.props;i/=s,n/=s;let{getTextAnchor:o,getAlignmentBaseline:c}=this.props,f=IX[typeof o=="function"?o(e,r):o],y=RX[typeof c=="function"?c(e,r):c];return[(f-1)*i/2,(y-1)*n/2,i,n]},this.getIconOffsets=(e,r)=>{let{getTextAnchor:i,getAlignmentBaseline:n}=this.props,{x:s,y:o,rowWidth:c,size:[f,y]}=this.transformParagraph(e,r),b=IX[typeof i=="function"?i(e,r):i],M=RX[typeof n=="function"?n(e,r):n],L=s.length,N=new Array(L*2),V=0;for(let $=0;$0&&dr.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){let{props:r,oldProps:i,changeFlags:n}=e;(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:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:r,fontWeight:i}=this.props,{fontAtlasManager:n,characterSet:s}=this.state,o={...e,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(){let{data:e,characterSet:r}=this.props,i=e.attributes?.getText,{getText:n}=this.props,s=e.startIndices,o,c=r==="auto"&&new Set;if(i&&s){let{texts:f,characterCount:y}=vX({...ArrayBuffer.isView(i)?{value:i}:i,length:e.length,startIndices:s,characterSet:c});o=y,n=(b,{index:M})=>f[M]}else{let{iterable:f,objectInfo:y}=su(e);s=[0],o=0;for(let b of f){y.index++;let M=Array.from(n(b,y)||"");c&&M.forEach(c.add,c),o+=M.length,s.push(o)}}this.setState({getText:n,startIndices:s,numInstances:o,characterSet:c||r})}transformParagraph(e,r){let{fontAtlasManager:i}=this.state,n=i.mapping,s=this.state.getText,{wordBreak:o,lineHeight:c,maxWidth:f}=this.props,y=s(e,r)||"";return xX(y,c,o,f*i.props.fontSize,n)}renderLayers(){let{startIndices:e,numInstances:r,getText:i,fontAtlasManager:{scale:n,atlas:s,mapping:o},styleVersion:c}=this.state,{data:f,_dataDiff:y,getPosition:b,getColor:M,getSize:L,getAngle:N,getPixelOffset:V,getBackgroundColor:$,getBorderColor:Q,getBorderWidth:q,backgroundPadding:J,background:ee,billboard:oe,fontSettings:ve,outlineWidth:Re,outlineColor:Ze,sizeScale:He,sizeUnits:ot,sizeMinPixels:et,sizeMaxPixels:Lt,transitions:Gt,updateTriggers:qt}=this.props,Ar=this.getSubLayerClass("characters",CS),ri=this.getSubLayerClass("background",kS);return[ee&&new ri({getFillColor:$,getLineColor:Q,getLineWidth:q,padding:J,getPosition:b,getSize:L,getAngle:N,getPixelOffset:V,billboard:oe,sizeScale:He,sizeUnits:ot,sizeMinPixels:et,sizeMaxPixels:Lt,transitions:Gt&&{getPosition:Gt.getPosition,getAngle:Gt.getAngle,getSize:Gt.getSize,getFillColor:Gt.getBackgroundColor,getLineColor:Gt.getBorderColor,getLineWidth:Gt.getBorderWidth,getPixelOffset:Gt.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:qt.getPosition,getAngle:qt.getAngle,getSize:qt.getSize,getFillColor:qt.getBackgroundColor,getLineColor:qt.getBorderColor,getLineWidth:qt.getBorderWidth,getPixelOffset:qt.getPixelOffset,getBoundingRect:{getText:qt.getText,getTextAnchor:qt.getTextAnchor,getAlignmentBaseline:qt.getAlignmentBaseline,styleVersion:c}}}),{data:f.attributes&&f.attributes.background?{length:f.length,attributes:f.attributes.background}:f,_dataDiff:y,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new Ar({sdf:ve.sdf,smoothing:Number.isFinite(ve.smoothing)?ve.smoothing:Hg.smoothing,outlineWidth:Re/(ve.radius||Hg.radius),outlineColor:Ze,iconAtlas:s,iconMapping:o,getPosition:b,getColor:M,getSize:L,getAngle:N,getPixelOffset:V,billboard:oe,sizeScale:He*n,sizeUnits:ot,sizeMinPixels:et*n,sizeMaxPixels:Lt*n,transitions:Gt&&{getPosition:Gt.getPosition,getAngle:Gt.getAngle,getColor:Gt.getColor,getSize:Gt.getSize,getPixelOffset:Gt.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:qt.getText,getPosition:qt.getPosition,getAngle:qt.getAngle,getColor:qt.getColor,getSize:qt.getSize,getPixelOffset:qt.getPixelOffset,getIconOffsets:{getTextAnchor:qt.getTextAnchor,getAlignmentBaseline:qt.getAlignmentBaseline,styleVersion:c}}}),{data:f,_dataDiff:y,startIndices:e,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(e){MX(e)}};var LS={circle:{type:xd,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:Ug,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:Lp,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"}}},DS={type:fh,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},sI={type:dh,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function nx({type:t,props:e}){let r={};for(let i in e)r[i]=t.defaultProps[e[i]];return r}function oI(t,e){let{transitions:r,updateTriggers:i}=t.props,n={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let s in e){let o=e[s],c=t.props[s];s.startsWith("get")&&(c=t.getSubLayerAccessor(c),n.updateTriggers[o]=i[s],r&&(n.transitions[o]=r[s])),n[o]=c}return n}function LX(t){if(Array.isArray(t))return t;switch(dr.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return dr.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function s8(t,e,r={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:n=0,endRow:s=t.length}=r;for(let o=n;o{c.push(r({geometry:{type:"Point",coordinates:M}},i,n))});break;case"LineString":f.push(r({geometry:t},i,n));break;case"MultiLineString":o.forEach(M=>{f.push(r({geometry:{type:"LineString",coordinates:M}},i,n))});break;case"Polygon":y.push(r({geometry:t},i,n)),o.forEach(M=>{b.push(r({geometry:{type:"LineString",coordinates:M}},i,n))});break;case"MultiPolygon":o.forEach(M=>{y.push(r({geometry:{type:"Polygon",coordinates:M}},i,n)),M.forEach(L=>{b.push(r({geometry:{type:"LineString",coordinates:L}},i,n))})});break;default:}}var Tye={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Eye(t,e){let r=Tye[t];for(dr.assert(r,`Unknown GeoJSON type ${t}`);e&&--r>0;)e=e[0];return e&&Number.isFinite(e[0])}function DX(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function aI(t){return t.geometry.coordinates}function OX(t,e){let r=DX(),{pointFeatures:i,lineFeatures:n,polygonFeatures:s,polygonOutlineFeatures:o}=t;return r.points.data=i,r.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),r.points.getPosition=aI,r.lines.data=n,r.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),r.lines.getPath=aI,r.polygons.data=s,r.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),r.polygons.getPolygon=aI,r.polygonsOutline.data=o,r.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),r.polygonsOutline.getPath=aI,r}function BX(t,e){let r=DX(),{points:i,lines:n,polygons:s}=t,o=fX(t,e);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 Mye=["points","linestrings","polygons"],Pye={...nx(LS.circle),...nx(LS.icon),...nx(LS.text),...nx(DS),...nx(sI),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},sx=class extends Xi{static{this.layerName="GeoJsonLayer"}static{this.defaultProps=Pye}initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,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:e,changeFlags:r}):this._updateStateJSON({props:e,changeFlags:r})}_updateStateBinary({props:e,changeFlags:r}){let i=BX(e.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:e,changeFlags:r}){let i=LX(e.data),n=this.getSubLayerRow.bind(this),s={},o={};if(Array.isArray(r.dataChanged)){let f=this.state.features;for(let y in f)s[y]=f[y].slice(),o[y]=[];for(let y of r.dataChanged){let b=s8(i,n,y);for(let M in f)o[M].push(iI({data:s[M],getIndex:L=>L.__source.index,dataRange:y,replace:b[M]}))}}else s=s8(i,n);let c=OX(s,o);this.setState({features:s,featuresDiff:o,layerProps:c})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i,sourceLayer:n}=r;return r.featureType=Mye.find(s=>n.id.startsWith(`${this.id}-${s}-`)),i>=0&&n.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(e){let r=`${this.id}-points-`,i=e.featureType==="points";for(let n of this.getSubLayers())n.id.startsWith(r)===i&&n.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:r}=this.props,{layerProps:i}=this.state,n="polygons-fill",s=this.shouldRenderSubLayer(n,i.polygons?.data)&&this.getSubLayerClass(n,sI.type);if(s){let o=oI(this,sI.props),c=e&&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:e,stroked:r}=this.props,{layerProps:i}=this.state,n="polygons-stroke",s="linestrings",o=!e&&r&&this.shouldRenderSubLayer(n,i.polygonsOutline?.data)&&this.getSubLayerClass(n,DS.type),c=this.shouldRenderSubLayer(s,i.lines?.data)&&this.getSubLayerClass(s,DS.type);if(o||c){let f=oI(this,DS.props);return[o&&new o(f,this.getSubLayerProps({id:n,updateTriggers:f.updateTriggers}),i.polygonsOutline),c&&new c(f,this.getSubLayerProps({id:s,updateTriggers:f.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:e}=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(e.split("+")),o=[];for(let c of s){let f=`points-${c}`,y=LS[c],b=y&&this.shouldRenderSubLayer(f,r.points?.data)&&this.getSubLayerClass(f,y.type);if(b){let M=oI(this,y.props),L=r.points;if(c==="text"&&i){let{instancePickingColors:N,...V}=L.data.attributes;L={...L,data:{...L.data,attributes:V}}}o.push(new b(M,this.getSubLayerProps({id:f,updateTriggers:M.updateTriggers,highlightedObjectIndex:n}),L))}}return o}renderLayers(){let{extruded:e}=this.props,r=this._renderPolygonLayer(),i=this._renderLineLayers(),n=this._renderPointLayers();return[!e&&r,i,n,e&&r]}getSubLayerAccessor(e){let{binary:r}=this.state;return!r||typeof e!="function"?super.getSubLayerAccessor(e):(i,n)=>{let{data:s,index:o}=n,c=hX(s,o);return e(c,n)}}};var lI={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function o8(t,e,r={}){return FX(t,r)!==e?(Cye(t,r),!0):!1}function FX(t,e={}){return Math.sign(ox(t,e))}var $g={x:0,y:1,z:2};function ox(t,e={}){let{start:r=0,end:i=t.length,plane:n="xy"}=e,s=e.size||2,o=0,c=$g[n[0]],f=$g[n[1]];for(let y=r,b=i-s;y{e([r,i],[n,s],o,c)},this.options):zX(this.points,e,this.options)}modifyWindingDirection(e){return this.isFlatArray?o8(this.points,e,this.options):NX(this.points,e,this.options)}};function u8(t,e,r=2,i,n="xy"){let s=e&&e.length,o=s?e[0]*r:t.length,c=VX(t,0,o,r,!0,i&&i[0],n),f=[];if(!c||c.next===c.prev)return f;let y,b,M,L,N,V,$;if(s&&(c=Oye(t,e,c,r,i,n)),t.length>80*r){L=b=t[0],N=M=t[1];for(let Q=r;Qb&&(b=V),$>M&&(M=$);y=Math.max(b-L,M-N),y=y!==0?32767/y:0}return OS(c,f,r,L,N,y,0),f}function VX(t,e,r,i,n,s,o){let c,f;s===void 0&&(s=ox(t,{start:e,end:r,size:i,plane:o}));let y=$g[o[0]],b=$g[o[1]];if(n===s<0)for(c=e;c=e;c-=i)f=UX(c,t[c+y],t[c+b],f);return f&&hI(f,f.next)&&(FS(f),f=f.next),f}function qg(t,e){if(!t)return t;e||(e=t);let r=t,i;do if(i=!1,!r.steiner&&(hI(r,r.next)||Ss(r.prev,r,r.next)===0)){if(FS(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function OS(t,e,r,i,n,s,o){if(!t)return;!o&&s&&Uye(t,i,n,s);let c=t,f,y;for(;t.prev!==t.next;){if(f=t.prev,y=t.next,s?kye(t,i,n,s):Rye(t)){e.push(f.i/r|0),e.push(t.i/r|0),e.push(y.i/r|0),FS(t),t=y.next,c=y.next;continue}if(t=y,t===c){o?o===1?(t=Lye(qg(t),e,r),OS(t,e,r,i,n,s,2)):o===2&&Dye(t,e,r,i,n,s):OS(qg(t),e,r,i,n,s,1);break}}}function Rye(t){let e=t.prev,r=t,i=t.next;if(Ss(e,r,i)>=0)return!1;let n=e.x,s=r.x,o=i.x,c=e.y,f=r.y,y=i.y,b=ns?n>o?n:o:s>o?s:o,N=c>f?c>y?c:y:f>y?f:y,V=i.next;for(;V!==e;){if(V.x>=b&&V.x<=L&&V.y>=M&&V.y<=N&&lx(n,c,s,f,o,y,V.x,V.y)&&Ss(V.prev,V,V.next)>=0)return!1;V=V.next}return!0}function kye(t,e,r,i){let n=t.prev,s=t,o=t.next;if(Ss(n,s,o)>=0)return!1;let c=n.x,f=s.x,y=o.x,b=n.y,M=s.y,L=o.y,N=cf?c>y?c:y:f>y?f:y,Q=b>M?b>L?b:L:M>L?M:L,q=c8(N,V,e,r,i),J=c8($,Q,e,r,i),ee=t.prevZ,oe=t.nextZ;for(;ee&&ee.z>=q&&oe&&oe.z<=J;){if(ee.x>=N&&ee.x<=$&&ee.y>=V&&ee.y<=Q&&ee!==n&&ee!==o&&lx(c,b,f,M,y,L,ee.x,ee.y)&&Ss(ee.prev,ee,ee.next)>=0||(ee=ee.prevZ,oe.x>=N&&oe.x<=$&&oe.y>=V&&oe.y<=Q&&oe!==n&&oe!==o&&lx(c,b,f,M,y,L,oe.x,oe.y)&&Ss(oe.prev,oe,oe.next)>=0))return!1;oe=oe.nextZ}for(;ee&&ee.z>=q;){if(ee.x>=N&&ee.x<=$&&ee.y>=V&&ee.y<=Q&&ee!==n&&ee!==o&&lx(c,b,f,M,y,L,ee.x,ee.y)&&Ss(ee.prev,ee,ee.next)>=0)return!1;ee=ee.prevZ}for(;oe&&oe.z<=J;){if(oe.x>=N&&oe.x<=$&&oe.y>=V&&oe.y<=Q&&oe!==n&&oe!==o&&lx(c,b,f,M,y,L,oe.x,oe.y)&&Ss(oe.prev,oe,oe.next)>=0)return!1;oe=oe.nextZ}return!0}function Lye(t,e,r){let i=t;do{let n=i.prev,s=i.next.next;!hI(n,s)&&jX(n,i,i.next,s)&&BS(n,s)&&BS(s,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(s.i/r|0),FS(i),FS(i.next),i=t=s),i=i.next}while(i!==t);return qg(i)}function Dye(t,e,r,i,n,s){let o=t;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&Wye(o,c)){let f=WX(o,c);o=qg(o,o.next),f=qg(f,f.next),OS(o,e,r,i,n,s,0),OS(f,e,r,i,n,s,0);return}c=c.next}o=o.next}while(o!==t)}function Oye(t,e,r,i,n,s){let o=[],c,f,y,b,M;for(c=0,f=e.length;c=r.next.y&&r.next.y!==r.y){let L=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(L<=i&&L>s&&(s=L,o=r.x=r.x&&r.x>=f&&i!==r.x&&lx(no.x||r.x===o.x&&zye(o,r)))&&(o=r,b=M)),r=r.next;while(r!==c);return o}function zye(t,e){return Ss(t.prev,t,e.prev)<0&&Ss(e.next,t,t.next)<0}function Uye(t,e,r,i){let n=t;do n.z===0&&(n.z=c8(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Vye(n)}function Vye(t){let e,r,i=1,n,s,o,c,f,y;do{for(s=t,t=null,y=null,n=0;s;){for(n++,c=s,o=0,r=0;r0||f>0&&c;)o!==0&&(f===0||!c||s.z<=c.z)?(e=s,s=s.nextZ,o--):(e=c,c=c.nextZ,f--),y?y.nextZ=e:t=e,e.prevZ=y,y=e;s=c}y.nextZ=null,i*=2}while(n>1);return t}function c8(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function jye(t){let e=t,r=t;do(e.x=(t-o)*(s-c)&&(t-o)*(i-c)>=(r-o)*(e-c)&&(r-o)*(s-c)>=(n-o)*(i-c)}function Wye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Hye(t,e)&&(BS(t,e)&&BS(e,t)&&$ye(t,e)&&(Ss(t.prev,t,e.prev)||Ss(t,e.prev,e))||hI(t,e)&&Ss(t.prev,t,t.next)>0&&Ss(e.prev,e,e.next)>0)}function Ss(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function hI(t,e){return t.x===e.x&&t.y===e.y}function jX(t,e,r,i){let n=uI(Ss(t,e,r)),s=uI(Ss(t,e,i)),o=uI(Ss(r,i,t)),c=uI(Ss(r,i,e));return!!(n!==s&&o!==c||n===0&&cI(t,r,e)||s===0&&cI(t,i,e)||o===0&&cI(r,t,i)||c===0&&cI(r,e,i))}function cI(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function uI(t){return t>0?1:t<0?-1:0}function Hye(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&jX(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function BS(t,e){return Ss(t.prev,t,t.next)<0?Ss(t,e,t.next)>=0&&Ss(t,t.prev,e)>=0:Ss(t,e,t.prev)<0||Ss(t,t.next,e)<0}function $ye(t,e){let r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.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!==t);return i}function WX(t,e){let r=new NS(t.i,t.x,t.y),i=new NS(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function UX(t,e,r,i){let n=new NS(t,e,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 FS(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var NS=class{constructor(e,r,i){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=e,this.x=r,this.y=i}};function qX(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("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"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var df=1,pf=2,Dp=3,GX=4,zS=5,h8=6378137,ZX=6356752314e-3,f8=.0066943799901413165,Gg=484813681109536e-20,_t=Math.PI/2,YX=.16666666666666666,XX=.04722222222222222,QX=.022156084656084655,Pt=1e-10,Ts=.017453292519943295,Ec=57.29577951308232,Hi=Math.PI/4,C0=Math.PI*2,Es=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 KX={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var JX=/[\s_\-\/\(\)]/g;function mu(t,e){if(t[e])return t[e];for(var r=Object.keys(t),i=e.toLowerCase().replace(JX,""),n=-1,s,o;++n=this.text.length)return;t=this.text[this.place++]}switch(this.state){case VS:return this.neutral(t);case tQ:return this.keyword(t);case fI:return this.quoted(t);case iQ:return this.afterquote(t);case rQ:return this.number(t);case d8:return}};Op.prototype.afterquote=function(t){if(t==='"'){this.word+='"',this.state=fI;return}if(dI.test(t)){this.word=this.word.trim(),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in afterquote yet, index '+this.place)};Op.prototype.afterItem=function(t){if(t===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=VS;return}if(t==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=VS,this.currentObject=this.stack.pop(),this.currentObject||(this.state=d8);return}};Op.prototype.number=function(t){if(nQ.test(t)){this.word+=t;return}if(dI.test(t)){this.word=parseFloat(this.word),this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in number yet, index '+this.place)};Op.prototype.quoted=function(t){if(t==='"'){this.state=iQ;return}this.word+=t};Op.prototype.keyword=function(t){if(Qye.test(t)){this.word+=t;return}if(t==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=VS;return}if(dI.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in keyword yet, index '+this.place)};Op.prototype.neutral=function(t){if(Xye.test(t)){this.word=t,this.state=tQ;return}if(t==='"'){this.word="",this.state=fI;return}if(nQ.test(t)){this.word=t,this.state=rQ;return}if(dI.test(t)){this.afterItem(t);return}throw new Error(`havn't handled "`+t+'" in neutral yet, index '+this.place)};Op.prototype.output=function(){for(;this.place0?90:-90),t.lat_ts=t.lat1):!t.lat_ts&&t.lat0&&t.projName==="Polar_Stereographic"&&(t.lat_ts=t.lat0,t.lat0=vd(t.lat0>0?90:-90))}function pI(t){var e=eQ(t),r=e.shift(),i=e.shift();e.unshift(["name",i]),e.unshift(["type",r]);var n={};return Zg(e,n),t1e(n),n}function ph(t){var e=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?ph[t]=US(arguments[1]):ph[t]=pI(arguments[1]):ph[t]=r}else if(arguments.length===1){if(Array.isArray(t))return t.map(function(i){Array.isArray(i)?ph.apply(e,i):ph(i)});if(typeof t=="string"){if(t in ph)return ph[t]}else"EPSG"in t?ph["EPSG:"+t.EPSG]=t:"ESRI"in t?ph["ESRI:"+t.ESRI]=t:"IAU2000"in t?ph["IAU2000:"+t.IAU2000]=t:console.log(t);return}}qX(ph);var cx=ph;function r1e(t){return typeof t=="string"}function i1e(t){return t in cx}var n1e=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function s1e(t){return n1e.some(function(e){return t.indexOf(e)>-1})}var o1e=["3857","900913","3785","102113"];function a1e(t){var e=mu(t,"authority");if(e){var r=mu(e,"epsg");return r&&o1e.indexOf(r)>-1}}function l1e(t){var e=mu(t,"extension");if(e)return mu(e,"proj4")}function c1e(t){return t[0]==="+"}function u1e(t){if(r1e(t)){if(i1e(t))return cx[t];if(s1e(t)){var e=pI(t);if(a1e(e))return cx["EPSG:3857"];var r=l1e(e);return r?US(r):e}if(c1e(t))return US(t)}else return t}var oQ=u1e;function p8(t,e){t=t||{};var r,i;if(!e)return t;for(i in e)r=e[i],r!==void 0&&(t[i]=r);return t}function nl(t,e,r){var i=t*e;return r/Math.sqrt(1-i*i)}function bd(t){return t<0?-1:1}function It(t){return Math.abs(t)<=Es?t:t-bd(t)*C0}function Dl(t,e,r){var i=t*r,n=.5*t;return i=Math.pow((1-i)/(1+i),n),Math.tan(.5*(_t-e))/i}function Bp(t,e){for(var r=.5*t,i,n,s=_t-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),n=_t-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,s+=n,Math.abs(n)<=1e-10)return s;return-9999}function h1e(){var t=this.b/this.a;this.es=1-t*t,"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 f1e(t){var e=t.x,r=t.y;if(r*Ec>90&&r*Ec<-90&&e*Ec>180&&e*Ec<-180)return null;var i,n;if(Math.abs(Math.abs(r)-_t)<=Pt)return null;if(this.sphere)i=this.x0+this.a*this.k0*It(e-this.long0),n=this.y0+this.a*this.k0*Math.log(Math.tan(Hi+.5*r));else{var s=Math.sin(r),o=Dl(this.e,r,s);i=this.x0+this.a*this.k0*It(e-this.long0),n=this.y0-this.a*this.k0*Math.log(o)}return t.x=i,t.y=n,t}function d1e(t){var e=t.x-this.x0,r=t.y-this.y0,i,n;if(this.sphere)n=_t-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(n=Bp(this.e,s),n===-9999)return null}return i=It(this.long0+e/(this.a*this.k0)),t.x=i,t.y=n,t}var p1e=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],aQ={init:h1e,forward:f1e,inverse:d1e,names:p1e};function A1e(){}function lQ(t){return t}var m1e=["longlat","identity"],cQ={init:A1e,forward:lQ,inverse:lQ,names:m1e};var g1e=[aQ,cQ],AI={},mI=[];function uQ(t,e){var r=mI.length;return t.names?(mI[r]=t,t.names.forEach(function(i){AI[i.toLowerCase()]=r}),this):(console.log(e),!0)}function _1e(t){if(!t)return!1;var e=t.toLowerCase();if(typeof AI[e]<"u"&&mI[AI[e]])return mI[AI[e]]}function y1e(){g1e.forEach(uQ)}var hQ={start:y1e,add:uQ,get:_1e};var si={};si.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};si.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};si.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};si.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};si.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};si.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};si.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};si.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};si.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};si.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};si.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};si.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};si.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};si.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};si.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};si.clrk80ign={a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"};si.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};si.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};si.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};si.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};si.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};si.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};si.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};si.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};si.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};si.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};si.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};si.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};si.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};si.hough={a:6378270,rf:297,ellipseName:"Hough"};si.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};si.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};si.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};si.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};si.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};si.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};si.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};si.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};si.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};si.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};si.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};si.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var fQ=si.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};si.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function dQ(t,e,r,i){var n=t*t,s=e*e,o=(n-s)/n,c=0;i?(t*=1-o*(YX+o*(XX+o*QX)),n=t*t,o=0):c=Math.sqrt(o);var f=(n-s)/s;return{es:o,e:c,ep2:f}}function pQ(t,e,r,i,n){if(!t){var s=mu(si,i);s||(s=fQ),t=s.a,e=s.b,r=s.rf}return r&&!e&&(e=(1-1/r)*t),(r===0||Math.abs(t-e)3&&(c.datum_params[3]!==0||c.datum_params[4]!==0||c.datum_params[5]!==0||c.datum_params[6]!==0)&&(c.datum_type=pf,c.datum_params[3]*=Gg,c.datum_params[4]*=Gg,c.datum_params[5]*=Gg,c.datum_params[6]=c.datum_params[6]/1e6+1)),o&&(c.datum_type=Dp,c.grids=o),c.a=r,c.b=i,c.es=n,c.ep2=s,c}var AQ=x1e;var mQ={};function m8(t,e){var r=new DataView(e),i=b1e(r),n=w1e(r,i),s=S1e(r,n,i),o={header:n,subgrids:s};return mQ[t]=o,o}function gQ(t){if(t===void 0)return null;var e=t.split(",");return e.map(v1e)}function v1e(t){if(t.length===0)return null;var e=t[0]==="@";return e&&(t=t.slice(1)),t==="null"?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:mQ[t]||null,isNull:!1}}function ux(t){return t/3600*Math.PI/180}function b1e(t){var e=t.getInt32(8,!1);return e===11?!1:(e=t.getInt32(8,!0),e!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function w1e(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:A8(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}function A8(t,e,r){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,r)))}function S1e(t,e,r){for(var i=176,n=[],s=0;s5e-11?!1:t.datum_type===df?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type===pf?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]:!0}function gI(t,e,r){var i=t.x,n=t.y,s=t.z?t.z:0,o,c,f,y;if(n<-_t&&n>-1.001*_t)n=-_t;else if(n>_t&&n<1.001*_t)n=_t;else{if(n<-_t)return{x:-1/0,y:-1/0,z:t.z};if(n>_t)return{x:1/0,y:1/0,z:t.z}}return i>Math.PI&&(i-=2*Math.PI),c=Math.sin(n),y=Math.cos(n),f=c*c,o=r/Math.sqrt(1-e*f),{x:(o+s)*y*Math.cos(i),y:(o+s)*y*Math.sin(i),z:(o*(1-e)+s)*c}}function _I(t,e,r,i){var n=1e-12,s=n*n,o=30,c,f,y,b,M,L,N,V,$,Q,q,J,ee,oe=t.x,ve=t.y,Re=t.z?t.z:0,Ze,He,ot;if(c=Math.sqrt(oe*oe+ve*ve),f=Math.sqrt(oe*oe+ve*ve+Re*Re),c/rs&&eei.y||V>i.x||qc&&Math.abs(f.y)>c);if(o<0)return console.log("Inverse grid shift iterator failed to converge."),i;i.x=It(s.x+r.ll[0]),i.y=s.y+r.ll[1]}else isNaN(s.x)||(i.x=t.x+s.x,i.y=t.y+s.y);return i}function bQ(t,e){var r={x:t.x/e.del[0],y:t.y/e.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>=e.lim[0]||i.y<0||i.y>=e.lim[1])return s;o=i.y*e.lim[0]+i.x;var c={x:e.cvs[o][0],y:e.cvs[o][1]};o++;var f={x:e.cvs[o][0],y:e.cvs[o][1]};o+=e.lim[0];var y={x:e.cvs[o][0],y:e.cvs[o][1]};o--;var b={x:e.cvs[o][0],y:e.cvs[o][1]},M=n.x*n.y,L=n.x*(1-n.y),N=(1-n.x)*(1-n.y),V=(1-n.x)*n.y;return s.x=N*c.x+L*f.x+V*b.x+M*y.x,s.y=N*c.y+L*f.y+V*b.y+M*y.y,s}function g8(t,e,r){var i=r.x,n=r.y,s=r.z||0,o,c,f,y={};for(f=0;f<3;f++)if(!(e&&f===2&&r.z===void 0))switch(f===0?(o=i,"ew".indexOf(t.axis[f])!==-1?c="x":c="y"):f===1?(o=n,"ns".indexOf(t.axis[f])!==-1?c="y":c="x"):(o=s,c="z"),t.axis[f]){case"e":y[c]=o;break;case"w":y[c]=-o;break;case"n":y[c]=o;break;case"s":y[c]=-o;break;case"u":r[c]!==void 0&&(y.z=o);break;case"d":r[c]!==void 0&&(y.z=-o);break;default:return null}return y}function xI(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function TQ(t){SQ(t.x),SQ(t.y)}function SQ(t){if(typeof Number.isFinite=="function"){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if(typeof t!="number"||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function C1e(t,e){return(t.datum.datum_type===df||t.datum.datum_type===pf||t.datum.datum_type===Dp)&&e.datumCode!=="WGS84"||(e.datum.datum_type===df||e.datum.datum_type===pf||e.datum.datum_type===Dp)&&t.datumCode!=="WGS84"}function Yg(t,e,r,i){var n;Array.isArray(r)?r=xI(r):r={x:r.x,y:r.y,z:r.z,m:r.m};var s=r.z!==void 0;if(TQ(r),t.datum&&e.datum&&C1e(t,e)&&(n=new I0("WGS84"),r=Yg(t,n,r,i),t=n),i&&t.axis!=="enu"&&(r=g8(t,!1,r)),t.projName==="longlat")r={x:r.x*Ts,y:r.y*Ts,z:r.z||0};else if(t.to_meter&&(r={x:r.x*t.to_meter,y:r.y*t.to_meter,z:r.z||0}),r=t.inverse(r),!r)return;if(t.from_greenwich&&(r.x+=t.from_greenwich),r=wQ(t.datum,e.datum,r),!!r)return e.from_greenwich&&(r={x:r.x-e.from_greenwich,y:r.y,z:r.z||0}),e.projName==="longlat"?r={x:r.x*Ec,y:r.y*Ec,z:r.z||0}:(r=e.forward(r),e.to_meter&&(r={x:r.x/e.to_meter,y:r.y/e.to_meter,z:r.z||0})),i&&e.axis!=="enu"?g8(e,!0,r):(r&&!s&&delete r.z,r)}var EQ=I0("WGS84");function _8(t,e,r,i){var n,s,o;return Array.isArray(r)?(n=Yg(t,e,r,i)||{x:NaN,y:NaN},r.length>2?typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.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=Yg(t,e,r,i),o=Object.keys(r),o.length===2||o.forEach(function(c){if(typeof t.name<"u"&&t.name==="geocent"||typeof e.name<"u"&&e.name==="geocent"){if(c==="x"||c==="y"||c==="z")return}else if(c==="x"||c==="y")return;s[c]=r[c]}),s)}function MQ(t){return t instanceof I0?t:t.oProj?t.oProj:I0(t)}function I1e(t,e,r){t=MQ(t);var i=!1,n;return typeof e>"u"?(e=t,t=EQ,i=!0):(typeof e.x<"u"||Array.isArray(e))&&(r=e,e=t,t=EQ,i=!0),e=MQ(e),r?_8(t,e,r):(n={forward:function(s,o){return _8(t,e,s,o)},inverse:function(s,o){return _8(e,t,s,o)}},i&&(n.oProj=e),n)}var Mc=I1e;var PQ=6,IQ="AJSAJS",RQ="AFAFAF",fx=65,Pc=73,Ah=79,jS=86,WS=90,kQ={forward:x8,inverse:R1e,toPoint:v8};function x8(t,e){return e=e||5,D1e(k1e({lat:t[1],lon:t[0]}),e)}function R1e(t){var e=b8(DQ(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function v8(t){var e=b8(DQ(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function y8(t){return t*(Math.PI/180)}function CQ(t){return 180*(t/Math.PI)}function k1e(t){var e=t.lat,r=t.lon,i=6378137,n=.00669438,s=.9996,o,c,f,y,b,M,L,N=y8(e),V=y8(r),$,Q;Q=Math.floor((r+180)/6)+1,r===180&&(Q=60),e>=56&&e<64&&r>=3&&r<12&&(Q=32),e>=72&&e<84&&(r>=0&&r<9?Q=31:r>=9&&r<21?Q=33:r>=21&&r<33?Q=35:r>=33&&r<42&&(Q=37)),o=(Q-1)*6-180+3,$=y8(o),c=n/(1-n),f=i/Math.sqrt(1-n*Math.sin(N)*Math.sin(N)),y=Math.tan(N)*Math.tan(N),b=c*Math.cos(N)*Math.cos(N),M=Math.cos(N)*(V-$),L=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 q=s*f*(M+(1-y+b)*M*M*M/6+(5-18*y+y*y+72*b-58*c)*M*M*M*M*M/120)+5e5,J=s*(L+f*Math.tan(N)*(M*M/2+(5-y+9*b+4*b*b)*M*M*M*M/24+(61-58*y+y*y+600*b-330*c)*M*M*M*M*M*M/720));return e<0&&(J+=1e7),{northing:Math.round(J),easting:Math.round(q),zoneNumber:Q,zoneLetter:L1e(e)}}function b8(t){var e=t.northing,r=t.easting,i=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var s=.9996,o=6378137,c=.00669438,f,y=(1-Math.sqrt(1-c))/(1+Math.sqrt(1-c)),b,M,L,N,V,$,Q,q,J,ee=r-5e5,oe=e;i<"N"&&(oe-=1e7),Q=(n-1)*6-180+3,f=c/(1-c),$=oe/s,q=$/(o*(1-c/4-3*c*c/64-5*c*c*c/256)),J=q+(3*y/2-27*y*y*y/32)*Math.sin(2*q)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*q)+151*y*y*y/96*Math.sin(6*q),b=o/Math.sqrt(1-c*Math.sin(J)*Math.sin(J)),M=Math.tan(J)*Math.tan(J),L=f*Math.cos(J)*Math.cos(J),N=o*(1-c)/Math.pow(1-c*Math.sin(J)*Math.sin(J),1.5),V=ee/(b*s);var ve=J-b*Math.tan(J)/N*(V*V/2-(5+3*M+10*L-4*L*L-9*f)*V*V*V*V/24+(61+90*M+298*L+45*M*M-252*f-3*L*L)*V*V*V*V*V*V/720);ve=CQ(ve);var Re=(V-(1+2*M+L)*V*V*V/6+(5-2*L+28*M-3*L*L+8*f+24*M*M)*V*V*V*V*V/120)/Math.cos(J);Re=Q+CQ(Re);var Ze;if(t.accuracy){var He=b8({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});Ze={top:He.lat,right:He.lon,bottom:ve,left:Re}}else Ze={lat:ve,lon:Re};return Ze}function L1e(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function D1e(t,e){var r="00000"+t.easting,i="00000"+t.northing;return t.zoneNumber+t.zoneLetter+O1e(t.easting,t.northing,t.zoneNumber)+r.substr(r.length-5,e)+i.substr(i.length-5,e)}function O1e(t,e,r){var i=LQ(r),n=Math.floor(t/1e5),s=Math.floor(e/1e5)%20;return B1e(n,s,i)}function LQ(t){var e=t%PQ;return e===0&&(e=PQ),e}function B1e(t,e,r){var i=r-1,n=IQ.charCodeAt(i),s=RQ.charCodeAt(i),o=n+t-1,c=s+e,f=!1;o>WS&&(o=o-WS+fx-1,f=!0),(o===Pc||nPc||(o>Pc||nAh||(o>Ah||nWS&&(o=o-WS+fx-1),c>jS?(c=c-jS+fx-1,f=!0):f=!1,(c===Pc||sPc||(c>Pc||sAh||(c>Ah||sjS&&(c=c-jS+fx-1);var y=String.fromCharCode(o)+String.fromCharCode(c);return y}function DQ(t){if(t&&t.length===0)throw"MGRSPoint coverting from nothing";for(var e=t.length,r=null,i="",n,s=0;!/[A-Z]/.test(n=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;i+=n,s++}var o=parseInt(i,10);if(s===0||s+3>e)throw"MGRSPoint bad conversion from: "+t;var c=t.charAt(s++);if(c<="A"||c==="B"||c==="Y"||c>="Z"||c==="I"||c==="O")throw"MGRSPoint zone letter "+c+" not handled: "+t;r=t.substring(s,s+=2);for(var f=LQ(o),y=F1e(r.charAt(0),f),b=N1e(r.charAt(1),f);b0&&($=1e5/Math.pow(10,L),Q=t.substring(s,s+L),N=parseFloat(Q)*$,q=t.substring(s+L),V=parseFloat(q)*$),J=N+y,ee=V+b,{easting:J,northing:ee,zoneLetter:c,zoneNumber:o,accuracy:$}}function F1e(t,e){for(var r=IQ.charCodeAt(e-1),i=1e5,n=!1;r!==t.charCodeAt(0);){if(r++,r===Pc&&r++,r===Ah&&r++,r>WS){if(n)throw"Bad character: "+t;r=fx,n=!0}i+=1e5}return i}function N1e(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var r=RQ.charCodeAt(e-1),i=0,n=!1;r!==t.charCodeAt(0);){if(r++,r===Pc&&r++,r===Ah&&r++,r>jS){if(n)throw"Bad character: "+t;r=fx,n=!0}i+=1e5}return i}function z1e(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function dx(t,e,r){if(!(this instanceof dx))return new dx(t,e,r);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if(typeof t=="object")this.x=t.x,this.y=t.y,this.z=t.z||0;else if(typeof t=="string"&&typeof e>"u"){var i=t.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=t,this.y=e,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}dx.fromMGRS=function(t){return new dx(v8(t))};dx.prototype.toMGRS=function(t){return x8([this.x,this.y],t)};var OQ=dx;var U1e=1,V1e=.25,BQ=.046875,FQ=.01953125,NQ=.01068115234375,j1e=.75,W1e=.46875,H1e=.013020833333333334,$1e=.007120768229166667,q1e=.3645833333333333,G1e=.005696614583333333,Z1e=.3076171875;function vI(t){var e=[];e[0]=U1e-t*(V1e+t*(BQ+t*(FQ+t*NQ))),e[1]=t*(j1e-t*(BQ+t*(FQ+t*NQ)));var r=t*t;return e[2]=r*(W1e-t*(H1e+t*$1e)),r*=t,e[3]=r*(q1e-t*G1e),e[4]=r*t*Z1e,e}function Xg(t,e,r,i){return r*=e,e*=e,i[0]*t-r*(i[1]+e*(i[2]+e*(i[3]+e*i[4])))}var Y1e=20;function bI(t,e,r){for(var i=1/(1-e),n=t,s=Y1e;s;--s){var o=Math.sin(n),c=1-e*o*o;if(c=(Xg(n,o,Math.cos(n),r)-t)*(c*Math.sqrt(c))*i,n-=c,Math.abs(c)Pt?Math.tan(r):0,$=Math.pow(V,2),Q=Math.pow($,2);n=1-this.es*Math.pow(c,2),b=b/Math.sqrt(n);var q=Xg(r,c,f,this.en);s=this.a*(this.k0*b*(1+M/6*(1-$+L+M/20*(5-18*$+Q+14*L-58*$*L+M/42*(61+179*Q-Q*$-479*$)))))+this.x0,o=this.a*(this.k0*(q-this.ml0+c*i*b/2*(1+M/12*(5-$+9*L+4*N+M/30*(61+Q-58*$+270*L-330*$*L+M/56*(1385+543*Q-Q*$-3111*$))))))+this.y0}else{var y=f*Math.sin(i);if(Math.abs(Math.abs(y)-1)=1){if(y-1>Pt)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return t.x=s,t.y=o,t}function K1e(t){var e,r,i,n,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+o/this.k0,r=bI(e,this.es,this.en),Math.abs(r)<_t){var M=Math.sin(r),L=Math.cos(r),N=Math.abs(L)>Pt?Math.tan(r):0,V=this.ep2*Math.pow(L,2),$=Math.pow(V,2),Q=Math.pow(N,2),q=Math.pow(Q,2);e=1-this.es*Math.pow(M,2);var J=s*Math.sqrt(e)/this.k0,ee=Math.pow(J,2);e=e*N,i=r-e*ee/(1-this.es)*.5*(1-ee/12*(5+3*Q-9*V*Q+V-4*$-ee/30*(61+90*Q-252*V*Q+45*q+46*V-ee/56*(1385+3633*Q+4095*q+1574*q*Q)))),n=It(this.long0+J*(1-ee/6*(1+2*Q+V-ee/20*(5+28*Q+24*q+8*V*Q+6*V-ee/42*(61+662*Q+1320*q+720*q*Q))))/L)}else i=_t*bd(o),n=0;else{var c=Math.exp(s/this.k0),f=.5*(c-1/c),y=this.lat0+o/this.k0,b=Math.cos(y);e=Math.sqrt((1-Math.pow(b,2))/(1+Math.pow(f,2))),i=Math.asin(e),o<0&&(i=-i),f===0&&b===0?n=0:n=It(Math.atan2(f,b)+this.long0)}return t.x=n,t.y=i,t}var J1e=["Fast_Transverse_Mercator","Fast Transverse Mercator"],px={init:X1e,forward:Q1e,inverse:K1e,names:J1e};function wI(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function Ia(t,e){t=Math.abs(t),e=Math.abs(e);var r=Math.max(t,e),i=Math.min(t,e)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function zQ(t){var e=1+t,r=e-1;return r===0?t:t*Math.log(e)/r}function UQ(t){var e=Math.abs(t);return e=zQ(e*(1+e/(Ia(1,e)+1))),t<0?-e:e}function SI(t,e){for(var r=2*Math.cos(2*e),i=t.length-1,n=t[i],s=0,o;--i>=0;)o=-s+r*n+t[i],s=n,n=o;return e+o*Math.sin(2*e)}function VQ(t,e){for(var r=2*Math.cos(e),i=t.length-1,n=t[i],s=0,o;--i>=0;)o=-s+r*n+t[i],s=n,n=o;return Math.sin(e)*o}function jQ(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function w8(t,e,r){for(var i=Math.sin(e),n=Math.cos(e),s=wI(r),o=jQ(r),c=2*n*o,f=-2*i*s,y=t.length-1,b=t[y],M=0,L=0,N=0,V,$;--y>=0;)V=L,$=M,L=b,M=N,b=-V+c*L-f*M+t[y],N=-$+f*L+c*M;return c=i*o,f=n*s,[c*b-f*N,c*N+f*b]}function exe(){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&&(px.init.apply(this),this.forward=px.forward,this.inverse=px.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 t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),r=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),r=r*e,this.cgb[1]=r*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=r*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),r=r*e,this.cgb[2]=r*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=r*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),r=r*e,this.cgb[3]=r*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=r*(1237/630+e*(-12/5+e*(-24832/14175))),r=r*e,this.cgb[4]=r*(4174/315+e*(-144838/6237)),this.cbg[4]=r*(-734/315+e*(109598/31185)),r=r*e,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=r*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=r*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),r=r*e,this.utg[2]=r*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=r*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),r=r*e,this.utg[3]=r*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=r*(49561/161280+e*(-179/168+e*(6601661/7257600))),r=r*e,this.utg[4]=r*(-4583/161280+e*(108847/3991680)),this.gtu[4]=r*(34729/80640+e*(-3418889/1995840)),r=r*e,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=SI(this.cbg,this.lat0);this.Zb=-this.Qn*(i+VQ(this.gtu,2*i))}function txe(t){var e=It(t.x-this.long0),r=t.y;r=SI(this.cbg,r);var i=Math.sin(r),n=Math.cos(r),s=Math.sin(e),o=Math.cos(e);r=Math.atan2(i,o*n),e=Math.atan2(s*n,Ia(i,n*o)),e=UQ(Math.tan(e));var c=w8(this.gtu,2*r,2*e);r=r+c[0],e=e+c[1];var f,y;return Math.abs(e)<=2.623395162778?(f=this.a*(this.Qn*e)+this.x0,y=this.a*(this.Qn*r+this.Zb)+this.y0):(f=1/0,y=1/0),t.x=f,t.y=y,t}function rxe(t){var e=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,e=e/this.Qn;var i,n;if(Math.abs(e)<=2.623395162778){var s=w8(this.utg,2*r,2*e);r=r+s[0],e=e+s[1],e=Math.atan(wI(e));var o=Math.sin(r),c=Math.cos(r),f=Math.sin(e),y=Math.cos(e);r=Math.atan2(o*y,Ia(f,y*c)),e=Math.atan2(f,y*c),i=It(e+this.long0),n=SI(this.cgb,r)}else i=1/0,n=1/0;return t.x=i,t.y=n,t}var ixe=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"],Ax={init:exe,forward:txe,inverse:rxe,names:ixe};function WQ(t,e){if(t===void 0){if(t=Math.floor((It(e)+Math.PI)*30/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var nxe="etmerc";function sxe(){var t=WQ(this.zone,this.long0);if(t===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Ts,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Ax.init.apply(this),this.forward=Ax.forward,this.inverse=Ax.inverse}var oxe=["Universal Transverse Mercator System","utm"],HQ={init:sxe,names:oxe,dependsOn:nxe};function TI(t,e){return Math.pow((1-t)/(1+t),e)}var axe=20;function lxe(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Hi)/(Math.pow(Math.tan(.5*this.lat0+Hi),this.C)*TI(this.e*t,this.ratexp))}function cxe(t){var e=t.x,r=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+Hi),this.C)*TI(this.e*Math.sin(r),this.ratexp))-_t,t.x=this.C*e,t}function uxe(t){for(var e=1e-14,r=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+Hi)/this.K,1/this.C),s=axe;s>0&&(i=2*Math.atan(n*TI(this.e*Math.sin(t.y),-.5*this.e))-_t,!(Math.abs(i-t.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)<=Pt&&Math.abs(Math.cos(this.lat_ts))>Pt&&(this.k0=.5*this.cons*nl(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Dl(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))-_t,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function _xe(t){var e=t.x,r=t.y,i=Math.sin(r),n=Math.cos(r),s,o,c,f,y,b,M=It(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=Pt&&Math.abs(r+this.lat0)<=Pt?(t.x=NaN,t.y=NaN,t):this.sphere?(s=2*this.k0/(1+this.sinlat0*i+this.coslat0*n*Math.cos(M)),t.x=this.a*s*n*Math.sin(M)+this.x0,t.y=this.a*s*(this.coslat0*i-this.sinlat0*n*Math.cos(M))+this.y0,t):(o=2*Math.atan(this.ssfn_(r,i,this.e))-_t,f=Math.cos(o),c=Math.sin(o),Math.abs(this.coslat0)<=Pt?(y=Dl(this.e,r*this.con,this.con*i),b=2*this.a*this.k0*y/this.cons,t.x=this.x0+b*Math.sin(e-this.long0),t.y=this.y0-this.con*b*Math.cos(e-this.long0),t):(Math.abs(this.sinlat0)0?e=It(this.long0+Math.atan2(t.x,-1*t.y)):e=It(this.long0+Math.atan2(t.x,t.y)):e=It(this.long0+Math.atan2(t.x*Math.sin(c),o*this.coslat0*Math.cos(c)-t.y*this.sinlat0*Math.sin(c))),t.x=e,t.y=r,t)}else if(Math.abs(this.coslat0)<=Pt){if(o<=Pt)return r=this.lat0,e=this.long0,t.x=e,t.y=r,t;t.x*=this.con,t.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Bp(this.e,i),e=this.con*It(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=Pt?s=this.X0:(s=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=It(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)))),r=-1*Bp(this.e,Math.tan(.5*(_t+s)));return t.x=e,t.y=r,t}var xxe=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)","Polar_Stereographic"],qQ={init:gxe,forward:_xe,inverse:yxe,names:xxe,ssfn_:mxe};function vxe(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),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(e,2)),this.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var c=Math.log(Math.tan(Math.PI/4+this.b0/2)),f=Math.log(Math.tan(Math.PI/4+t/2)),y=Math.log((1+o*e)/(1-o*e));this.K=c-this.alpha*f+this.alpha*o/2*y}function bxe(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),i=-this.alpha*(e+r)+this.K,n=2*(Math.atan(Math.exp(i))-Math.PI/4),s=this.alpha*(t.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 t.y=this.R/2*Math.log((1+Math.sin(c))/(1-Math.sin(c)))+this.y0,t.x=this.R*o+this.x0,t}function wxe(t){for(var e=t.x-this.x0,r=t.y-this.y0,i=e/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,f=0,y=s,b=-1e3,M=0;Math.abs(y-b)>1e-7;){if(++M>20)return;f=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(y))/2)),b=y,y=2*Math.atan(Math.exp(f))-Math.PI/2}return t.x=c,t.y=y,t}var Sxe=["somerc"],GQ={init:vxe,forward:bxe,inverse:wxe,names:Sxe};var mx=1e-7;function Txe(t){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],r=typeof t.PROJECTION=="object"?Object.keys(t.PROJECTION)[0]:t.PROJECTION;return"no_uoff"in t||"no_off"in t||e.indexOf(r)!==-1}function Exe(){var t,e,r,i,n,s,o,c,f,y,b=0,M,L=0,N=0,V=0,$=0,Q=0,q=0,J;this.no_off=Txe(this),this.no_rot="no_rot"in this;var ee=!1;"alpha"in this&&(ee=!0);var oe=!1;if("rectified_grid_angle"in this&&(oe=!0),ee&&(q=this.alpha),oe&&(b=this.rectified_grid_angle*Ts),ee||oe)L=this.longc;else if(N=this.long1,$=this.lat1,V=this.long2,Q=this.lat2,Math.abs($-Q)<=mx||(t=Math.abs($))<=mx||Math.abs(t-_t)<=mx||Math.abs(Math.abs(this.lat0)-_t)<=mx||Math.abs(Math.abs(Q)-_t)<=mx)throw new Error;var ve=1-this.es;e=Math.sqrt(ve),Math.abs(this.lat0)>Pt?(c=Math.sin(this.lat0),r=Math.cos(this.lat0),t=1-this.es*c*c,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/ve),this.A=this.B*this.k0*e/t,i=this.B*e/(r*Math.sqrt(t)),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(Dl(this.e,this.lat0,c),this.B)):(this.B=1/e,this.A=this.k0,this.E=i=n=1),ee||oe?(ee?(M=Math.asin(Math.sin(q)/i),oe||(b=q)):(M=b,q=Math.asin(i*Math.sin(M))),this.lam0=L-Math.asin(.5*(n-1/n)*Math.tan(M))/this.B):(s=Math.pow(Dl(this.e,$,Math.sin($)),this.B),o=Math.pow(Dl(this.e,Q,Math.sin(Q)),this.B),n=this.E/s,f=(o-s)/(o+s),y=this.E*this.E,y=(y-o*s)/(y+o*s),t=N-V,t<-Math.pi?V-=C0:t>Math.pi&&(V+=C0),this.lam0=It(.5*(N+V)-Math.atan(y*Math.tan(.5*this.B*(N-V))/f)/this.B),M=Math.atan(2*Math.sin(this.B*It(N-this.lam0))/(n-1/n)),b=q=Math.asin(i*Math.sin(M))),this.singam=Math.sin(M),this.cosgam=Math.cos(M),this.sinrot=Math.sin(b),this.cosrot=Math.cos(b),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,J=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(q))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*M,this.v_pole_n=this.ArB*Math.log(Math.tan(Hi-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(Hi+n))}function Mxe(t){var e={},r,i,n,s,o,c,f,y;if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-_t)>Pt){if(o=this.E/Math.pow(Dl(this.e,t.y,Math.sin(t.y)),this.B),c=1/o,r=.5*(o-c),i=.5*(o+c),s=Math.sin(this.B*t.x),n=(r*this.singam-s*this.cosgam)/i,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,f=this.ArB*t.y;return this.no_rot?(e.x=f,e.y=y):(f-=this.u_0,e.x=y*this.cosrot+f*this.sinrot,e.y=f*this.cosrot-y*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Pxe(t){var e,r,i,n,s,o,c,f={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(r=t.y,e=t.x):(r=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.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*e),c=(o*this.cosgam+n*this.singam)/s,Math.abs(Math.abs(c)-1)Pt?this.ns=Math.log(i/c)/Math.log(n/f):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=i/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(y,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Rxe(t){var e=t.x,r=t.y;Math.abs(2*Math.abs(r)-Math.PI)<=Pt&&(r=bd(r)*(_t-2*Pt));var i=Math.abs(Math.abs(r)-_t),n,s;if(i>Pt)n=Dl(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*It(e-this.long0);return t.x=this.k0*(s*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-s*Math.cos(o))+this.y0,t}function kxe(t){var e,r,i,n,s,o=(t.x-this.x0)/this.k0,c=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+c*c),r=1):(e=-Math.sqrt(o*o+c*c),r=-1);var f=0;if(e!==0&&(f=Math.atan2(r*o,r*c)),e!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(e/(this.a*this.f0),r),n=Bp(this.e,i),n===-9999)return null}else n=-_t;return s=It(f/this.ns+this.long0),t.x=s,t.y=n,t}var Lxe=["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)"],YQ={init:Ixe,forward:Rxe,inverse:kxe,names:Lxe};function Dxe(){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 Oxe(t){var e,r,i,n,s,o,c,f=t.x,y=t.y,b=It(f-this.long0);return e=Math.pow((1+this.e*Math.sin(y))/(1-this.e*Math.sin(y)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(y/2+this.s45),this.alfa)/e)-this.s45),i=-b*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),t.y=c*Math.cos(o)/1,t.x=c*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t}function Bxe(t){var e,r,i,n,s,o,c,f,y=t.x;t.x=t.y,t.y=y,this.czech||(t.y*=-1,t.x*=-1),o=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.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),e=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(e)),t.x=this.long0-r/this.alfa,c=e,f=0;var b=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/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-t.y)<1e-10&&(f=1),c=t.y,b+=1;while(f===0&&b<15);return b>=15?null:t}var Fxe=["Krovak","krovak"],XQ={init:Dxe,forward:Oxe,inverse:Bxe,names:Fxe};function Vo(t,e,r,i,n){return t*n-e*Math.sin(2*n)+r*Math.sin(4*n)-i*Math.sin(6*n)}function Fp(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Np(t){return .375*t*(1+.25*t*(1+.46875*t))}function zp(t){return .05859375*t*t*(1+.75*t)}function Up(t){return t*t*t*(35/3072)}function Vp(t,e,r){var i=e*r;return t/Math.sqrt(1-i*i)}function Af(t){return Math.abs(t)<_t?t:t-bd(t)*Math.PI}function Qg(t,e,r,i,n){var s,o;s=t/e;for(var c=0;c<15;c++)if(o=(t-(e*s-r*Math.sin(2*s)+i*Math.sin(4*s)-n*Math.sin(6*s)))/(e-2*r*Math.cos(2*s)+4*i*Math.cos(4*s)-6*n*Math.cos(6*s)),s+=o,Math.abs(o)<=1e-10)return s;return NaN}function Nxe(){this.sphere||(this.e0=Fp(this.es),this.e1=Np(this.es),this.e2=zp(this.es),this.e3=Up(this.es),this.ml0=this.a*Vo(this.e0,this.e1,this.e2,this.e3,this.lat0))}function zxe(t){var e,r,i=t.x,n=t.y;if(i=It(i-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(i)),r=this.a*(Math.atan2(Math.tan(n),Math.cos(i))-this.lat0);else{var s=Math.sin(n),o=Math.cos(n),c=Vp(this.a,this.e,s),f=Math.tan(n)*Math.tan(n),y=i*Math.cos(n),b=y*y,M=this.es*o*o/(1-this.es),L=this.a*Vo(this.e0,this.e1,this.e2,this.e3,n);e=c*y*(1-b*f*(1/6-(8-f+8*M)*b/120)),r=L-this.ml0+c*s/o*b*(.5+(5-f+6*M)*b/24)}return t.x=e+this.x0,t.y=r+this.y0,t}function Uxe(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,r=t.y/this.a,i,n;if(this.sphere){var s=r+this.lat0;i=Math.asin(Math.sin(s)*Math.cos(e)),n=Math.atan2(Math.tan(e),Math.cos(s))}else{var o=this.ml0/this.a+r,c=Qg(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(c)-_t)<=Pt)return t.x=this.long0,t.y=_t,r<0&&(t.y*=-1),t;var f=Vp(this.a,this.e,Math.sin(c)),y=f*f*f/this.a/this.a*(1-this.es),b=Math.pow(Math.tan(c),2),M=e*this.a/f,L=M*M;i=c-f*Math.tan(c)/y*M*M*(.5-(1+3*b)*M*M/24),n=M*(1-L*(b/3+(1+3*b)*b*L/15))/Math.cos(c)}return t.x=It(n+this.long0),t.y=Af(i),t}var Vxe=["Cassini","Cassini_Soldner","cass"],QQ={init:Nxe,forward:zxe,inverse:Uxe,names:Vxe};function mf(t,e){var r;return t>1e-7?(r=t*e,(1-t*t)*(e/(1-r*r)-.5/t*Math.log((1-r)/(1+r)))):2*e}var jxe=1,Wxe=2,Hxe=3,$xe=4;function qxe(){var t=Math.abs(this.lat0);if(Math.abs(t-_t)0){var e;switch(this.qp=mf(this.e,1),this.mmf=.5/(1-this.es),this.apa=tve(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),e=Math.sin(this.lat0),this.sinb1=mf(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*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 Gxe(t){var e,r,i,n,s,o,c,f,y,b,M=t.x,L=t.y;if(M=It(M-this.long0),this.sphere){if(s=Math.sin(L),b=Math.cos(L),i=Math.cos(M),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+b*i:1+this.sinph0*s+this.cosph0*b*i,r<=Pt)return null;r=Math.sqrt(2/r),e=r*b*Math.sin(M),r*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*b*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(L+this.lat0)=0?(e=(y=Math.sqrt(o))*n,r=i*(this.mode===this.S_POLE?y:-y)):e=r=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*r+this.y0,t}function Zxe(t){t.x-=this.x0,t.y-=this.y0;var e=t.x/this.a,r=t.y/this.a,i,n,s,o,c,f,y;if(this.sphere){var b=0,M,L=0;if(M=Math.sqrt(e*e+r*r),n=M*.5,n>1)return null;switch(n=2*Math.asin(n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(L=Math.sin(n),b=Math.cos(n)),this.mode){case this.EQUIT:n=Math.abs(M)<=Pt?0:Math.asin(r*L/M),e*=L,r=b*M;break;case this.OBLIQ:n=Math.abs(M)<=Pt?this.lat0:Math.asin(b*this.sinph0+r*L*this.cosph0/M),e*=L*this.cosph0,r=(b-Math.sin(n)*this.sinph0)*M;break;case this.N_POLE:r=-r,n=_t-n;break;case this.S_POLE:n-=_t;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,r)}else{if(y=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,r*=this.dd,f=Math.sqrt(e*e+r*r),f1&&(t=t>1?1:-1),Math.asin(t)}function nve(){Math.abs(this.lat1+this.lat2)Pt?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 sve(t){var e=t.x,r=t.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=mf(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,s=this.ns0*It(e-this.long0),o=n*Math.sin(s)+this.x0,c=this.rh-n*Math.cos(s)+this.y0;return t.x=o,t.y=c,t}function ove(t){var e,r,i,n,s,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),n=0,e!==0&&(n=Math.atan2(i*t.x,i*t.y)),i=e*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=It(n/this.ns0+this.long0),t.x=s,t.y=o,t}function ave(t,e){var r,i,n,s,o,c=Cc(.5*e);if(t0||Math.abs(o)<=Pt?(c=this.x0+this.a*s*r*Math.sin(i)/o,f=this.y0+this.a*s*(this.cos_p14*e-this.sin_p14*r*n)/o):(c=this.x0+this.infinity_dist*r*Math.sin(i),f=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*r*n)),t.x=c,t.y=f,t}function hve(t){var e,r,i,n,s,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),r=Math.sin(n),i=Math.cos(n),o=Cc(i*this.sin_p14+t.y*r*this.cos_p14/e),s=Math.atan2(t.x*r,e*this.cos_p14*i-t.y*this.sin_p14*r),s=It(this.long0+s)):(o=this.phic0,s=0),t.x=s,t.y=o,t}var fve=["gnom"],eK={init:cve,forward:uve,inverse:hve,names:fve};function tK(t,e){var r=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-r)<1e-6)return e<0?-1*_t:_t;for(var i=Math.asin(.5*e),n,s,o,c,f=0;f<30;f++)if(s=Math.sin(i),o=Math.cos(i),c=t*s,n=Math.pow(1-c*c,2)/(2*o)*(e/(1-t*t)-s/(1-c*c)+.5/t*Math.log((1-c)/(1+c))),i+=n,Math.abs(n)<=1e-10)return i;return NaN}function dve(){this.sphere||(this.k0=nl(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function pve(t){var e=t.x,r=t.y,i,n,s=It(e-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=mf(this.e,Math.sin(r));i=this.x0+this.a*this.k0*s,n=this.y0+this.a*o*.5/this.k0}return t.x=i,t.y=n,t}function Ave(t){t.x-=this.x0,t.y-=this.y0;var e,r;return this.sphere?(e=It(this.long0+t.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(r=tK(this.e,2*t.y*this.k0/this.a),e=It(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=r,t}var mve=["cea"],rK={init:dve,forward:pve,inverse:Ave,names:mve};function gve(){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 _ve(t){var e=t.x,r=t.y,i=It(e-this.long0),n=Af(r-this.lat0);return t.x=this.x0+this.a*i*this.rc,t.y=this.y0+this.a*n,t}function yve(t){var e=t.x,r=t.y;return t.x=It(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Af(this.lat0+(r-this.y0)/this.a),t}var xve=["Equirectangular","Equidistant_Cylindrical","eqc"],iK={init:gve,forward:_ve,inverse:yve,names:xve};var nK=20;function vve(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Fp(this.es),this.e1=Np(this.es),this.e2=zp(this.es),this.e3=Up(this.es),this.ml0=this.a*Vo(this.e0,this.e1,this.e2,this.e3,this.lat0)}function bve(t){var e=t.x,r=t.y,i,n,s,o=It(e-this.long0);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=Pt?(i=this.a*o,n=-1*this.a*this.lat0):(i=this.a*Math.sin(s)/Math.tan(r),n=this.a*(Af(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=Pt)i=this.a*o,n=-1*this.ml0;else{var c=Vp(this.a,this.e,Math.sin(r))/Math.tan(r);i=c*Math.sin(s),n=this.a*Vo(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+c*(1-Math.cos(s))}return t.x=i+this.x0,t.y=n+this.y0,t}function wve(t){var e,r,i,n,s,o,c,f,y;if(i=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Pt)e=It(i/this.a+this.long0),r=0;else{o=this.lat0+n/this.a,c=i*i/this.a/this.a+o*o,f=o;var b;for(s=nK;s;--s)if(b=Math.tan(f),y=-1*(o*(f*b+1)-f-.5*(f*f+c)*b)/((f-o)/b-1),f+=y,Math.abs(y)<=Pt){r=f;break}e=It(this.long0+Math.asin(i*Math.tan(f)/this.a)/Math.sin(r))}else if(Math.abs(n+this.ml0)<=Pt)r=0,e=It(this.long0+i/this.a);else{o=(this.ml0+n)/this.a,c=i*i/this.a/this.a+o*o,f=o;var M,L,N,V,$;for(s=nK;s;--s)if($=this.e*Math.sin(f),M=Math.sqrt(1-$*$)*Math.tan(f),L=this.a*Vo(this.e0,this.e1,this.e2,this.e3,f),N=this.e0-2*this.e1*Math.cos(2*f)+4*this.e2*Math.cos(4*f)-6*this.e3*Math.cos(6*f),V=L/this.a,y=(o*(M*V+1)-V-.5*M*(V*V+c))/(this.es*Math.sin(2*f)*(V*V+c-2*o*V)/(4*M)+(o-V)*(M*N-2/Math.sin(2*f))-N),f-=y,Math.abs(y)<=Pt){r=f;break}M=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),e=It(this.long0+Math.asin(i*M/this.a)/Math.sin(r))}return t.x=e,t.y=r,t}var Sve=["Polyconic","poly"],sK={init:vve,forward:bve,inverse:wve,names:Sve};function Tve(){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 Eve(t){var e,r=t.x,i=t.y,n=i-this.lat0,s=r-this.long0,o=n/Gg*1e-5,c=s,f=1,y=0;for(e=1;e<=10;e++)f=f*o,y=y+this.A[e]*f;var b=y,M=c,L=1,N=0,V,$,Q=0,q=0;for(e=1;e<=6;e++)V=L*b-N*M,$=N*b+L*M,L=V,N=$,Q=Q+this.B_re[e]*L-this.B_im[e]*N,q=q+this.B_im[e]*L+this.B_re[e]*N;return t.x=q*this.a+this.x0,t.y=Q*this.a+this.y0,t}function Mve(t){var e,r=t.x,i=t.y,n=r-this.x0,s=i-this.y0,o=s/this.a,c=n/this.a,f=1,y=0,b,M,L=0,N=0;for(e=1;e<=6;e++)b=f*o-y*c,M=y*o+f*c,f=b,y=M,L=L+this.C_re[e]*f-this.C_im[e]*y,N=N+this.C_im[e]*f+this.C_re[e]*y;for(var V=0;V.999999999999&&(r=.999999999999),e=Math.asin(r);var i=It(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*e+Math.sin(2*e))/Math.PI,Math.abs(r)>1&&(r=1);var n=Math.asin(r);return t.x=i,t.y=n,t}var Vve=["Mollweide","moll"],cK={init:Nve,forward:zve,inverse:Uve,names:Vve};function jve(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;if(r!==0&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=It(this.long0+s/this.ns),i=Af(this.g-r/this.a),t.x=n,t.y=i,t;var o=this.g-r/this.a;return i=Qg(o,this.e0,this.e1,this.e2,this.e3),n=It(this.long0+s/this.ns),t.x=n,t.y=i,t}var $ve=["Equidistant_Conic","eqdc"],uK={init:jve,forward:Wve,inverse:Hve,names:$ve};function qve(){this.R=this.a}function Gve(t){var e=t.x,r=t.y,i=It(e-this.long0),n,s;Math.abs(r)<=Pt&&(n=this.x0+this.R*i,s=this.y0);var o=Cc(2*Math.abs(r/Math.PI));(Math.abs(i)<=Pt||Math.abs(Math.abs(r)-_t)<=Pt)&&(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),f=c*c,y=Math.sin(o),b=Math.cos(o),M=b/(y+b-1),L=M*M,N=M*(2/y-1),V=N*N,$=Math.PI*this.R*(c*(M-V)+Math.sqrt(f*(M-V)*(M-V)-(V+f)*(L-V)))/(V+f);i<0&&($=-$),n=this.x0+$;var Q=f+M;return $=Math.PI*this.R*(N*Q-c*Math.sqrt((V+f)*(f+1)-Q*Q))/(V+f),r>=0?s=this.y0+$:s=this.y0-$,t.x=n,t.y=s,t}function Zve(t){var e,r,i,n,s,o,c,f,y,b,M,L,N;return t.x-=this.x0,t.y-=this.y0,M=Math.PI*this.R,i=t.x/M,n=t.y/M,s=i*i+n*n,o=-Math.abs(n)*(1+s),c=o-2*n*n+i*i,f=-2*o+1+2*n*n+s*s,N=n*n/f+(2*c*c*c/f/f/f-9*o*c/f/f)/27,y=(o-c*c/3/f)/f,b=2*Math.sqrt(-y/3),M=3*N/y/b,Math.abs(M)>1&&(M>=0?M=1:M=-1),L=Math.acos(M)/3,t.y>=0?r=(-b*Math.cos(L+Math.PI/3)-c/3/f)*Math.PI:r=-(-b*Math.cos(L+Math.PI/3)-c/3/f)*Math.PI,Math.abs(i)2*_t*this.a?void 0:(r=e/this.a,i=Math.sin(r),n=Math.cos(r),s=this.long0,Math.abs(e)<=Pt?o=this.lat0:(o=Cc(n*this.sin_p12+t.y*i*this.cos_p12/e),c=Math.abs(this.lat0)-_t,Math.abs(c)<=Pt?this.lat0>=0?s=It(this.long0+Math.atan2(t.x,-t.y)):s=It(this.long0-Math.atan2(-t.x,t.y)):s=It(this.long0+Math.atan2(t.x*i,e*this.cos_p12*n-t.y*this.sin_p12*i))),t.x=s,t.y=o,t)):(f=Fp(this.es),y=Np(this.es),b=zp(this.es),M=Up(this.es),Math.abs(this.sin_p12-1)<=Pt?(L=this.a*Vo(f,y,b,M,_t),e=Math.sqrt(t.x*t.x+t.y*t.y),N=L-e,o=Qg(N/this.a,f,y,b,M),s=It(this.long0+Math.atan2(t.x,-1*t.y)),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=Pt?(L=this.a*Vo(f,y,b,M,_t),e=Math.sqrt(t.x*t.x+t.y*t.y),N=e-L,o=Qg(N/this.a,f,y,b,M),s=It(this.long0+Math.atan2(t.x,t.y)),t.x=s,t.y=o,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),Q=Math.atan2(t.x,t.y),V=Vp(this.a,this.e,this.sin_p12),q=Math.cos(Q),J=this.e*this.cos_p12*q,ee=-J*J/(1-this.es),oe=3*this.es*(1-ee)*this.sin_p12*this.cos_p12*q/(1-this.es),ve=e/V,Re=ve-ee*(1+ee)*Math.pow(ve,3)/6-oe*(1+3*ee)*Math.pow(ve,4)/24,Ze=1-ee*Re*Re/2-ve*Re*Re*Re/6,$=Math.asin(this.sin_p12*Math.cos(Re)+this.cos_p12*Math.sin(Re)*q),s=It(this.long0+Math.asin(Math.sin(Q)*Math.sin(Re)/Math.cos($))),He=Math.sin($),o=Math.atan2((He-this.es*Ze*this.sin_p12)*Math.tan($),He*(1-this.es)),t.x=s,t.y=o,t))}var Jve=["Azimuthal_Equidistant","aeqd"],fK={init:Xve,forward:Qve,inverse:Kve,names:Jve};function ebe(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function tbe(t){var e,r,i,n,s,o,c,f,y=t.x,b=t.y;return i=It(y-this.long0),e=Math.sin(b),r=Math.cos(b),n=Math.cos(i),o=this.sin_p14*e+this.cos_p14*r*n,s=1,(o>0||Math.abs(o)<=Pt)&&(c=this.a*s*r*Math.sin(i),f=this.y0+this.a*s*(this.cos_p14*e-this.sin_p14*r*n)),t.x=c,t.y=f,t}function rbe(t){var e,r,i,n,s,o,c;return t.x-=this.x0,t.y-=this.y0,e=Math.sqrt(t.x*t.x+t.y*t.y),r=Cc(e/this.a),i=Math.sin(r),n=Math.cos(r),o=this.long0,Math.abs(e)<=Pt?(c=this.lat0,t.x=o,t.y=c,t):(c=Cc(n*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.abs(this.lat0)-_t,Math.abs(s)<=Pt?(this.lat0>=0?o=It(this.long0+Math.atan2(t.x,-t.y)):o=It(this.long0-Math.atan2(-t.x,t.y)),t.x=o,t.y=c,t):(o=It(this.long0+Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i)),t.x=o,t.y=c,t))}var ibe=["ortho"],dK={init:ebe,forward:tbe,inverse:rbe,names:ibe};var Ms={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},xn={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function nbe(){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>=_t-Hi/2?this.face=Ms.TOP:this.lat0<=-(_t-Hi/2)?this.face=Ms.BOTTOM:Math.abs(this.long0)<=Hi?this.face=Ms.FRONT:Math.abs(this.long0)<=_t+Hi?this.face=this.long0>0?Ms.RIGHT:Ms.LEFT:this.face=Ms.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 sbe(t){var e={x:0,y:0},r,i,n,s,o,c,f={value:0};if(t.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(t.y)):r=t.y,i=t.x,this.face===Ms.TOP)s=_t-r,i>=Hi&&i<=_t+Hi?(f.value=xn.AREA_0,n=i-_t):i>_t+Hi||i<=-(_t+Hi)?(f.value=xn.AREA_1,n=i>0?i-Es:i+Es):i>-(_t+Hi)&&i<=-Hi?(f.value=xn.AREA_2,n=i+_t):(f.value=xn.AREA_3,n=i);else if(this.face===Ms.BOTTOM)s=_t+r,i>=Hi&&i<=_t+Hi?(f.value=xn.AREA_0,n=-i+_t):i=-Hi?(f.value=xn.AREA_1,n=-i):i<-Hi&&i>=-(_t+Hi)?(f.value=xn.AREA_2,n=-i-_t):(f.value=xn.AREA_3,n=i>0?-i+Es:-i-Es);else{var y,b,M,L,N,V,$;this.face===Ms.RIGHT?i=gx(i,+_t):this.face===Ms.BACK?i=gx(i,+Es):this.face===Ms.LEFT&&(i=gx(i,-_t)),L=Math.sin(r),N=Math.cos(r),V=Math.sin(i),$=Math.cos(i),y=N*$,b=N*V,M=L,this.face===Ms.FRONT?(s=Math.acos(y),n=MI(s,M,b,f)):this.face===Ms.RIGHT?(s=Math.acos(b),n=MI(s,M,-y,f)):this.face===Ms.BACK?(s=Math.acos(-y),n=MI(s,M,-b,f)):this.face===Ms.LEFT?(s=Math.acos(-b),n=MI(s,M,y,f)):(s=n=0,f.value=xn.AREA_0)}return c=Math.atan(12/Es*(n+Math.acos(Math.sin(n)*Math.cos(Hi))-_t)),o=Math.sqrt((1-Math.cos(s))/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(n))))),f.value===xn.AREA_1?c+=_t:f.value===xn.AREA_2?c+=Es:f.value===xn.AREA_3&&(c+=1.5*Es),e.x=o*Math.cos(c),e.y=o*Math.sin(c),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,t.x=e.x,t.y=e.y,t}function obe(t){var e={lam:0,phi:0},r,i,n,s,o,c,f,y,b,M={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),r=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?M.value=xn.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(M.value=xn.AREA_1,r-=_t):t.x<0&&-t.x>=Math.abs(t.y)?(M.value=xn.AREA_2,r=r<0?r+Es:r-Es):(M.value=xn.AREA_3,r+=_t),b=Es/12*Math.tan(r),o=Math.sin(b)/(Math.cos(b)-1/Math.sqrt(2)),c=Math.atan(o),n=Math.cos(r),s=Math.tan(i),f=1-n*n*s*s*(1-Math.cos(Math.atan(1/Math.cos(c)))),f<-1?f=-1:f>1&&(f=1),this.face===Ms.TOP)y=Math.acos(f),e.phi=_t-y,M.value===xn.AREA_0?e.lam=c+_t:M.value===xn.AREA_1?e.lam=c<0?c+Es:c-Es:M.value===xn.AREA_2?e.lam=c-_t:e.lam=c;else if(this.face===Ms.BOTTOM)y=Math.acos(f),e.phi=y-_t,M.value===xn.AREA_0?e.lam=-c+_t:M.value===xn.AREA_1?e.lam=-c:M.value===xn.AREA_2?e.lam=-c-_t:e.lam=c<0?-c-Es:-c+Es;else{var L,N,V;L=f,b=L*L,b>=1?V=0:V=Math.sqrt(1-b)*Math.sin(c),b+=V*V,b>=1?N=0:N=Math.sqrt(1-b),M.value===xn.AREA_1?(b=N,N=-V,V=b):M.value===xn.AREA_2?(N=-N,V=-V):M.value===xn.AREA_3&&(b=N,N=V,V=-b),this.face===Ms.RIGHT?(b=L,L=-N,N=b):this.face===Ms.BACK?(L=-L,N=-N):this.face===Ms.LEFT&&(b=L,L=N,N=-b),e.phi=Math.acos(-V)-_t,e.lam=Math.atan2(N,L),this.face===Ms.RIGHT?e.lam=gx(e.lam,-_t):this.face===Ms.BACK?e.lam=gx(e.lam,-Es):this.face===Ms.LEFT&&(e.lam=gx(e.lam,+_t))}if(this.es!==0){var $,Q,q;$=e.phi<0?1:0,Q=Math.tan(e.phi),q=this.b/Math.sqrt(Q*Q+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-q*q)/(this.one_minus_f*q)),$&&(e.phi=-e.phi)}return e.lam+=this.long0,t.x=e.lam,t.y=e.phi,t}function MI(t,e,r,i){var n;return tHi&&n<=_t+Hi?(i.value=xn.AREA_1,n-=_t):n>_t+Hi||n<=-(_t+Hi)?(i.value=xn.AREA_2,n=n>=0?n-Es:n+Es):(i.value=xn.AREA_3,n+=_t)),n}function gx(t,e){var r=t+e;return r<-Es?r+=C0:r>+Es&&(r-=C0),r}var abe=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],pK={init:nbe,forward:sbe,inverse:obe,names:abe};var S8=[[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]],HS=[[-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]],AK=.8487,mK=1.3523,gK=Ec/5,lbe=1/gK,_x=18,PI=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},cbe=function(t,e){return t[1]+e*(2*t[2]+e*3*t[3])};function ube(t,e,r,i){for(var n=e;i;--i){var s=t(n);if(n-=s,Math.abs(s)=_x&&(i=_x-1),r=Ec*(r-lbe*i);var n={x:PI(S8[i],r)*e,y:PI(HS[i],r)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*AK+this.x0,n.y=n.y*this.a*mK+this.y0,n}function dbe(t){var e={x:(t.x-this.x0)/(this.a*AK),y:Math.abs(t.y-this.y0)/(this.a*mK)};if(e.y>=1)e.x/=S8[_x][0],e.y=t.y<0?-_t:_t;else{var r=Math.floor(e.y*_x);for(r<0?r=0:r>=_x&&(r=_x-1);;)if(HS[r][0]>e.y)--r;else if(HS[r+1][0]<=e.y)++r;else break;var i=HS[r],n=5*(e.y-i[0])/(HS[r+1][0]-i[0]);n=ube(function(s){return(PI(i,s)-e.y)/cbe(i,s)},n,Pt,100),e.x/=PI(S8[r],n),e.y=(5*r+n)*Ts,t.y<0&&(e.y=-e.y)}return e.x=It(e.x+this.long0),e}var pbe=["Robinson","robin"],_K={init:hbe,forward:fbe,inverse:dbe,names:pbe};function Abe(){this.name="geocent"}function mbe(t){var e=gI(t,this.es,this.a);return e}function gbe(t){var e=_I(t,this.es,this.a,this.b);return e}var _be=["Geocentric","geocentric","geocent","Geocent"],yK={init:Abe,forward:mbe,inverse:gbe,names:_be};var sl={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},$S={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 ybe(){if(Object.keys($S).forEach(function(r){if(typeof this[r]>"u")this[r]=$S[r].def;else{if($S[r].num&&isNaN(this[r]))throw new Error("Invalid parameter value, must be numeric "+r+" = "+this[r]);$S[r].num&&(this[r]=parseFloat(this[r]))}$S[r].degrees&&(this[r]=this[r]*Ts)}.bind(this)),Math.abs(Math.abs(this.lat0)-_t)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 t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)}function xbe(t){t.x-=this.long0;var e=Math.sin(t.y),r=Math.cos(t.y),i=Math.cos(t.x),n,s;switch(this.mode){case sl.OBLIQ:s=this.sinph0*e+this.cosph0*r*i;break;case sl.EQUIT:s=r*i;break;case sl.S_POLE:s=-e;break;case sl.N_POLE:s=e;break}switch(s=this.pn1/(this.p-s),n=s*r*Math.sin(t.x),this.mode){case sl.OBLIQ:s*=this.cosph0*e-this.sinph0*r*i;break;case sl.EQUIT:s*=e;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,t.x=n*this.a,t.y=s*this.a,t}function vbe(t){t.x/=this.a,t.y/=this.a;var e={x:t.x,y:t.y},r,i,n;n=1/(this.pn1-t.y*this.sw),r=this.pn1*t.x*n,i=this.pn1*t.y*this.cw*n,t.x=r*this.cg+i*this.sg,t.y=i*this.cg-r*this.sg;var s=Ia(t.x,t.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 t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,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 Sbe(t){var e=t.x,r=t.y,i,n,s,o;if(e=e-this.long0,this.shape==="ellipse"){r=Math.atan(this.radius_p2*Math.tan(r));var c=this.radius_p/Ia(this.radius_p*Math.cos(r),Math.sin(r));if(n=c*Math.cos(e)*Math.cos(r),s=c*Math.sin(e)*Math.cos(r),o=c*Math.sin(r),(this.radius_g-n)*n-s*s-o*o*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=this.radius_g-n,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Ia(o,i)),t.y=this.radius_g_1*Math.atan(o/i)):(t.x=this.radius_g_1*Math.atan(s/i),t.y=this.radius_g_1*Math.atan(o/Ia(s,i)))}else this.shape==="sphere"&&(i=Math.cos(r),n=Math.cos(e)*i,s=Math.sin(e)*i,o=Math.sin(r),i=this.radius_g-n,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Ia(o,i)),t.y=this.radius_g_1*Math.atan(o/i)):(t.x=this.radius_g_1*Math.atan(s/i),t.y=this.radius_g_1*Math.atan(o/Ia(s,i))));return t.x=t.x*this.a,t.y=t.y*this.a,t}function Tbe(t){var e=-1,r=0,i=0,n,s,o,c;if(t.x=t.x/this.a,t.y=t.y/this.a,this.shape==="ellipse"){this.flip_axis?(i=Math.tan(t.y/this.radius_g_1),r=Math.tan(t.x/this.radius_g_1)*Ia(1,i)):(r=Math.tan(t.x/this.radius_g_1),i=Math.tan(t.y/this.radius_g_1)*Ia(1,r));var f=i/this.radius_p;if(n=r*r+f*f+e*e,s=2*this.radius_g*e,o=s*s-4*n*this.C,o<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(o))/(2*n),e=this.radius_g+c*e,r*=c,i*=c,t.x=Math.atan2(r,e),t.y=Math.atan(i*Math.cos(t.x)/e),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if(this.shape==="sphere"){if(this.flip_axis?(i=Math.tan(t.y/this.radius_g_1),r=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+i*i)):(r=Math.tan(t.x/this.radius_g_1),i=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+r*r)),n=r*r+i*i+e*e,s=2*this.radius_g*e,o=s*s-4*n*this.C,o<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(o))/(2*n),e=this.radius_g+c*e,r*=c,i*=c,t.x=Math.atan2(r,e),t.y=Math.atan(i*Math.cos(t.x)/e)}return t.x=t.x+this.long0,t}var Ebe=["Geostationary Satellite View","Geostationary_Satellite","geos"],vK={init:wbe,forward:Sbe,inverse:Tbe,names:Ebe};var qS=1.340264,GS=-.081106,ZS=893e-6,YS=.003796,CI=Math.sqrt(3)/2;function Mbe(){this.es=0,this.long0=this.long0!==void 0?this.long0:0}function Pbe(t){var e=It(t.x-this.long0),r=t.y,i=Math.asin(CI*Math.sin(r)),n=i*i,s=n*n*n;return t.x=e*Math.cos(i)/(CI*(qS+3*GS*n+s*(7*ZS+9*YS*n))),t.y=i*(qS+GS*n+s*(ZS+YS*n)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function Cbe(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e=1e-9,r=12,i=t.y,n,s,o,c,f,y;for(y=0;yEK(r)));let e=new Float64Array(t.length);for(let r=0;rMK(r)));let e=new Float64Array(t.length);for(let r=0;rPK(s));let e=[],r=0;for(let s=0;sCK(e))):yx(t)}function IK(t){return"data"in t?new Pr(t.data.map(e=>IK(e))):DI(t)}function BI(t){return Wt.isFixedSizeList(t)?!(![2,3,4].includes(t.listSize)||!Wt.isFloat(t.children[0])):Wt.isStruct(t)?!(![2,3,4].includes(t.children.length)||!t.children.every(e=>["x","y","z","m"].includes(e.name))||!t.children.every(e=>Wt.isFloat(e))):!1}function FI(t){return!(!Wt.isList(t)||!BI(t.children[0].type))}function P8(t){return!(!Wt.isList(t)||!FI(t.children[0].type))}function RK(t){return!(!Wt.isList(t)||!BI(t.children[0].type))}function kK(t){return!(!Wt.isList(t)||!FI(t.children[0].type))}function LK(t){return!(!Wt.isList(t)||!P8(t.children[0].type))}function Dbe(t){return BI(t.type)}function Obe(t){return FI(t.type)}function Bbe(t){return P8(t.type)}function Fbe(t){return RK(t.type)}function Nbe(t){return kK(t.type)}function zbe(t){return LK(t.type)}function Ube(t,e){if(!t)throw new Error(`assertion failed ${e}`)}function Vbe(){throw new Error("assertion failed")}function DK(t,e){if(Dbe(t))return OK(t,e);if(Obe(t))return T8(t,e);if(Bbe(t))return E8(t,e);if(Fbe(t))return T8(t,e);if(Nbe(t))return E8(t,e);if(zbe(t))return jbe(t,e);Vbe()}function OK(t,e){Ube(t.type.listSize===2,"expected 2D");let r=KS(t),i=r.values,n=new Float64Array(i.length);for(let o=0;oTK(n,i))):TK(t,i)}function TK(t,e){let r=[0,0];return DK(t,(n,s)=>(r[0]=n,r[1]=s,e.forward(r)))}var R0;(function(t){t.POINT="geoarrow.point",t.LINESTRING="geoarrow.linestring",t.POLYGON="geoarrow.polygon",t.MULTIPOINT="geoarrow.multipoint",t.MULTILINESTRING="geoarrow.multilinestring",t.MULTIPOLYGON="geoarrow.multipolygon"})(R0||(R0={}));var LI=class{minX;minY;maxX;maxY;constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}updateBbox(e){e.minXthis.maxX&&(this.maxX=e.maxX),e.maxY>this.maxY&&(this.maxY=e.maxY)}updateCoord(e,r){ethis.maxX&&(this.maxX=e),r>this.maxY&&(this.maxY=r)}};function Hbe(t,e){switch(e.metadata.get("ARROW:extension:name")){case R0.POINT:return BK(t);case R0.LINESTRING:case R0.MULTIPOINT:return FK(t);case R0.POLYGON:case R0.MULTILINESTRING:return NK(t);case R0.MULTIPOLYGON:return qbe(t);default:throw new Error("Unknown ext type name")}}function $be(t){let r=KS(t).values,i=new LI;for(let n=0;nzK(r)));let e=new w0({type:new gc,nullValues:[null]});e.set(t.length-1,null);for(let r=0;rUK(r,e));return}for(let r=0;rQS(s,e)));let r=[];for(let s of t.children)r.push(QS(s,e));let i;t.dictionary!==void 0&&(i=QS(t.dictionary,e));let n={[Fi.OFFSET]:II(t.buffers[Fi.OFFSET],e),[Fi.DATA]:II(t.buffers[Fi.DATA],e),[Fi.VALIDITY]:II(t.buffers[Fi.VALIDITY],e),[Fi.TYPE]:II(t.buffers[Fi.TYPE],e)};return new Vi(t.type,t.offset,t.length,t._nullCount,n,r,i)}function RI(t){if("data"in t)return t.data.some(r=>RI(r));for(let r of t.children)if(RI(r))return!0;if(t.dictionary!==void 0&&RI(t.dictionary))return!0;let e=[Fi.OFFSET,Fi.DATA,Fi.VALIDITY,Fi.TYPE];for(let r of e)if(t.buffers[r]!==void 0&&VK(t.buffers[r]))return!0;return!1}function VK(t){return!(t.byteOffset===0&&t.byteLength===t.buffer.byteLength)}function II(t,e){return t===void 0||!e&&!VK(t)?t:t.slice()}function kI(t,e=!1){if("data"in t){let i=[],n=[];for(let o of t.data){let[c,f]=kI(o);i.push(c),n.push(...f)}return[new Pr(i),n]}t=QS(t,e);let r=[];for(let i=0;i1)throw new Error("expected 1 field");return new il(e[0])}case Ne.Struct:{let e=t.children.map(XS);return new yn(e)}case Ne.Union:{let e=t.children.map(XS);return new _c(t.mode,t.typeIds,e)}case Ne.FixedSizeBinary:return new ch(t.byteWidth);case Ne.FixedSizeList:{let e=t.children.map(XS);if(e.length>1)throw new Error("expected 1 field");return new Rl(t.listSize,e[0])}case Ne.Map:{let e=t.children.map(XS);if(e.length>1)throw new Error("expected 1 field");let r=e[0];return new yc(r,t.keysSorted)}case Ne.Duration:return new lh(t.unit);default:throw new Error(`unknown type ${t}`)}}function XS(t){let e=jK(t.type);return new Ai(t.name,e,t.nullable,t.metadata)}function I8(t){let e=t.children.map(n=>I8(n)),r=t.dictionary?WK(t.dictionary):void 0,i={[Fi.OFFSET]:t.valueOffsets,[Fi.DATA]:t.values,[Fi.VALIDITY]:t.nullBitmap,[Fi.TYPE]:t.typeIds};return new Vi(jK(t.type),t.offset,t.length,t._nullCount,i,e,r)}function WK(t){return new Pr(t.data.map(e=>I8(e)))}var R8=Object.freeze({__proto__:null,hardClone:QS,isShared:RI,preparePostMessage:kI,rehydrateData:I8,rehydrateVector:WK});function Jbe(t,e,r){let i=t.fields.findIndex(n=>n.name===r||n.metadata.get("ARROW:extension:name")===e);return i!==-1?i:null}function ewe(t,e){let{index:r,data:i}=t,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:t.target};return e(o)}function lo(t){let{props:e,propName:r,propInput:i,chunkIdx:n,geomCoordOffsets:s}=t;if(i!==void 0)if(i instanceof Pr){let o=i.data[n];if(Wt.isFixedSizeList(o)){Mr(o.children.length===1);let c=o.children[0].values;s&&(c=NI(c,o.type.listSize,s)),e.data.attributes[r]={value:c,size:o.type.listSize,normalized:!0}}else if(Wt.isFloat(o)){let c=o.values;s&&(c=NI(c,1,s)),e.data.attributes[r]={value:c,size:1}}}else typeof i=="function"?e[r]=(o,c)=>r==="getPolygonOffset"?i(o,c):ewe(c,i):e[r]=i}function NI(t,e,r){let i=r[r.length-1],n=new t.constructor(i*e);for(let s=0;s(e[i+1]=e[i]+r.length,e),new Uint32Array(t.length+1))}function uo(t,e){let r=[],i=[];for(let[n,s]of Object.entries(t))n.startsWith("get")&&s instanceof Pr&&(r.push(s),n.endsWith("Color")&&i.push(s));twe(e,r);for(let n of i)rwe(n)}function twe(t,e){for(let r of e)Mr(t.batches.length===r.data.length);for(let r of e)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 e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:s,id:o,bbox:c,userData:f,zoom:y}=this,b=this._loaderId;this._abortController=new AbortController;let{signal:M}=this._abortController,L=await r.scheduleRequest(this,$=>$.isSelected?1:-1);if(!L){this._isCancelled=!0;return}if(this._isCancelled){L.done();return}let N=null,V;try{N=await e({index:s,id:o,bbox:c,userData:f,zoom:y,signal:M})}catch($){V=$||!0}finally{L.done()}if(b===this._loaderId){if(this._loader=void 0,this.content=N,this._isCancelled&&!N){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,V?n(V,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var ho={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var ZK=new Xt,awe=new Xt,vx=class t{constructor(e=[0,0,0],r=[0,0,0],i){i=i||ZK.copy(e).add(r).scale(.5),this.center=new Xt(i),this.halfDiagonal=new Xt(r).subtract(this.center),this.minimum=new Xt(e),this.maximum=new Xt(r)}clone(){return new t(this.minimum,this.maximum,this.center)}equals(e){return this===e||!!e&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=awe.from(e.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)+e.distance;return s-n>0?ho.INSIDE:s+n<0?ho.OUTSIDE:ho.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=ZK.from(e).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 rT=new Xt,YK=new Xt,bx=class t{constructor(e=[0,0,0],r=0){this.radius=-0,this.center=new Xt,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=rT.from(r),this.center=new Xt().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new t(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,s=e.radius,o=rT.copy(n).subtract(r),c=o.magnitude();if(i>=c+s)return this.clone();if(s>=c+i)return e.clone();let f=(i+c+s)*.5;return YK.copy(o).scale((-i+f)/c).add(r),this.center.copy(YK),this.radius=f,this}expand(e){let i=rT.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=ao.getScaling(rT,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=rT.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,s=e.normal.dot(r)+e.distance;return s<-i?ho.OUTSIDE:s=f?ho.INSIDE:ho.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=cwe.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,UI),s=i.getColumn(1,VI),o=i.getColumn(2,jI),c=n.magnitude(),f=s.magnitude(),y=o.magnitude();n.normalize(),s.normalize(),o.normalize();let b=0,M;return M=Math.abs(r.dot(n))-c,M>0&&(b+=M*M),M=Math.abs(r.dot(s))-f,M>0&&(b+=M*M),M=Math.abs(r.dot(o))-y,M>0&&(b+=M*M),b}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,f=c.getColumn(0,UI),y=c.getColumn(1,VI),b=c.getColumn(2,jI),M=uwe.copy(f).add(y).add(b).add(o),L=hwe.copy(M).subtract(e),N=r.dot(L);return n=Math.min(N,n),s=Math.max(N,s),M.copy(o).add(f).add(y).subtract(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),M.copy(o).add(f).subtract(y).add(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),M.copy(o).add(f).subtract(y).subtract(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),o.copy(M).subtract(f).add(y).add(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),o.copy(M).subtract(f).add(y).subtract(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),o.copy(M).subtract(f).subtract(y).add(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),o.copy(M).subtract(f).subtract(y).subtract(b),L.copy(M).subtract(e),N=r.dot(L),n=Math.min(N,n),s=Math.max(N,s),i[0]=n,i[1]=s,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,UI);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,VI);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,jI);return n.transformAsPoint(e),this.halfAxes=new vs([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var XK=new Xt,QK=new Xt,Wp=class t{constructor(e=[0,0,1],r=0){this.normal=new Xt,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return Yf(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=XK.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),Yf(oo(this.normal.len(),1)),this.distance=n,this}clone(){return new t(this.normal,this.distance)}equals(e){return oo(this.distance,e.distance)&&oo(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=QK.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=XK.from(e),n=this.getPointDistance(i),s=QK.copy(this.normal).scale(n);return i.subtract(s).to(r)}};var KK=[new Xt([1,0,0]),new Xt([0,1,0]),new Xt([0,0,1])],JK=new Xt,fwe=new Xt,Hp=class t{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*KK.length;let r=e.center,i=e.radius,n=0;for(let s of KK){let o=this.planes[n],c=this.planes[n+1];o||(o=this.planes[n]=new Wp),c||(c=this.planes[n+1]=new Wp);let f=JK.copy(s).scale(-i).add(r);o.fromPointNormal(f,s);let y=JK.copy(s).scale(i).add(r),b=fwe.copy(s).negate();c.fromPointNormal(y,b),n+=2}return this}computeVisibility(e){let r=ho.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case ho.OUTSIDE:return ho.OUTSIDE;case ho.INTERSECTING:r=ho.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(Yf(Number.isFinite(r),"parentPlaneMask is required."),r===t.MASK_OUTSIDE||r===t.MASK_INSIDE)return r;let i=t.MASK_INSIDE,n=this.planes;for(let s=0;sf;)_we(c,WI),eJ.copy(WI).transpose(),c.multiplyRight(WI),c.multiplyLeft(eJ),o.multiplyRight(WI),++n>2&&(++s,n=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=c.toTarget(e.diagonal),e}function mwe(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var L8=[1,0,0],D8=[2,2,1];function gwe(t){let e=0;for(let r=0;r<3;++r){let i=t[wd.getElementIndex(D8[r],L8[r])];e+=2*i*i}return Math.sqrt(e)}function _we(t,e){let r=Gb.EPSILON15,i=0,n=1;for(let y=0;y<3;++y){let b=Math.abs(t[wd.getElementIndex(D8[y],L8[y])]);b>i&&(n=y,i=b)}let s=L8[n],o=D8[n],c=1,f=0;if(Math.abs(t[wd.getElementIndex(o,s)])>r){let y=t[wd.getElementIndex(o,o)],b=t[wd.getElementIndex(s,s)],M=t[wd.getElementIndex(o,s)],L=(y-b)/2/M,N;L<0?N=-1/(-L+Math.sqrt(1+L*L)):N=1/(L+Math.sqrt(1+L*L)),c=1/Math.sqrt(1+N*N),f=N*c}return vs.IDENTITY.to(e),e[wd.getElementIndex(s,s)]=e[wd.getElementIndex(o,o)]=c,e[wd.getElementIndex(o,s)]=f,e[wd.getElementIndex(s,o)]=-f,e}var k0=new Xt,ywe=new Xt,xwe=new Xt,vwe=new Xt,bwe=new Xt,wwe=new vs,Swe={diagonal:new vs,unitary:new vs};function B8(t,e=new iT){if(!t||t.length===0)return e.halfAxes=new vs([0,0,0,0,0,0,0,0,0]),e.center=new Xt,e;let r=t.length,i=new Xt(0,0,0);for(let ot of t)i.add(ot);let n=1/r;i.multiplyByScalar(n);let s=0,o=0,c=0,f=0,y=0,b=0;for(let ot of t){let et=k0.copy(ot).subtract(i);s+=et.x*et.x,o+=et.x*et.y,c+=et.x*et.z,f+=et.y*et.y,y+=et.y*et.z,b+=et.z*et.z}s*=n,o*=n,c*=n,f*=n,y*=n,b*=n;let M=wwe;M[0]=s,M[1]=o,M[2]=c,M[3]=o,M[4]=f,M[5]=y,M[6]=c,M[7]=y,M[8]=b;let{unitary:L}=O8(M,Swe),N=e.halfAxes.copy(L),V=N.getColumn(0,xwe),$=N.getColumn(1,vwe),Q=N.getColumn(2,bwe),q=-Number.MAX_VALUE,J=-Number.MAX_VALUE,ee=-Number.MAX_VALUE,oe=Number.MAX_VALUE,ve=Number.MAX_VALUE,Re=Number.MAX_VALUE;for(let ot of t)k0.copy(ot),q=Math.max(k0.dot(V),q),J=Math.max(k0.dot($),J),ee=Math.max(k0.dot(Q),ee),oe=Math.min(k0.dot(V),oe),ve=Math.min(k0.dot($),ve),Re=Math.min(k0.dot(Q),Re);V=V.multiplyByScalar(.5*(oe+q)),$=$.multiplyByScalar(.5*(ve+J)),Q=Q.multiplyByScalar(.5*(Re+ee)),e.center.copy(V).add($).add(Q);let Ze=ywe.set(q-oe,J-ve,ee-Re).multiplyByScalar(.5),He=new vs([Ze[0],0,0,0,Ze[1],0,0,0,Ze[2]]);return e.halfAxes.multiplyRight(He),e}var wx=512,tJ=3,rJ=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],iJ=rJ.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Twe=iJ.concat([[.25,.5],[.75,.5]]),F8=class t{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new t(e,r,i),new t(e,r+1,i),new t(e+1,r,i),new t(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:s,maxZ:o,bounds:c,offset:f,project:y}=e,b=this.getBoundingVolume(n,f,y);if(c&&!this.insideBounds(c)||i.computeVisibility(b)<0)return!1;if(!this.childVisible){let{z:L}=this;if(L=s){let N=b.distanceTo(r.cameraPosition)*r.scale/r.height;L+=Math.floor(Math.log2(N))}if(L>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let L of this.children)L.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let s=Math.pow(2,this.z),o=wx/s;return this.x*oe&&(this.y+1)*o>r}getBoundingVolume(e,r,i){if(i){let f=this.z<1?Twe:this.z<2?iJ:rJ,y=[];for(let b of f){let M=HI(this.x+b[0],this.y+b[1],this.z);M[2]=e[0],y.push(i(M)),e[0]!==e[1]&&(M[2]=e[1],y.push(i(M)))}return B8(y)}let n=Math.pow(2,this.z),s=wx/n,o=this.x*s+r*wx,c=wx-(this.y+1)*s;return new vx([o,c,e[0]],[o+s,c+s,e[1]])}};function nJ(t,e,r,i){let n=t instanceof l0&&t.resolution?t.projectPosition:null,s=Object.values(t.getFrustumPlanes()).map(({normal:N,distance:V})=>new Wp(N.clone().negate(),V)),o=new Hp(s),c=t.distanceScales.unitsPerMeter[2],f=r&&r[0]*c||0,y=r&&r[1]*c||0,b=t instanceof el&&t.pitch<=60?e:0;if(i){let[N,V,$,Q]=i,q=Sa([N,Q]),J=Sa([$,V]);i=[q[0],wx-q[1],J[0],wx-J[1]]}let M=new F8(0,0,0),L={viewport:t,project:n,cullingVolume:o,elevationBounds:[f,y],minZ:b,maxZ:e,bounds:i,offset:0};if(M.update(L),t instanceof el&&t.subViewports&&t.subViewports.length>1){for(L.offset=-1;M.update(L)&&!(--L.offset<-tJ););for(L.offset=1;M.update(L)&&!(++L.offset>tJ););}return M.getSelected()}var $p=512,Ewe=[-1/0,-1/0,1/0,1/0],z8={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.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 Mwe(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function U8(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let s=Mwe(i)%t.length;t=t[s]}let n=t;for(let s of Object.keys(r)){let o=new RegExp(`{${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 Pwe(t,e,r){let i;if(e&&e.length===2){let[n,s]=e,o=t.getBounds({z:n}),c=t.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=t.getBounds();return t.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 aJ({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>N8(n,e||0,r))}function N8(t,e,r){if(!Array.isArray(e)){let s=r.x-t.x,o=r.y-t.y,{width:c,height:f}=r,y={targetZ:e},b=t.unproject([s,o],y),M=t.unproject([s+c,o],y),L=t.unproject([s,o+f],y),N=t.unproject([s+c,o+f],y);return[Math.min(b[0],M[0],L[0],N[0]),Math.min(b[1],M[1],L[1],N[1]),Math.max(b[0],M[0],L[0],N[0]),Math.max(b[1],M[1],L[1],N[1])]}let i=N8(t,e[0],r),n=N8(t,e[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 Cwe(t,e,r){return r?oJ(t,r).map(n=>n*e/$p):t.map(i=>i*e/$p)}function V8(t,e){return Math.pow(2,t)*$p/e}function HI(t,e,r){let i=V8(r,$p),n=t/i*360-180,s=Math.PI-2*Math.PI*e/i,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function sJ(t,e,r,i){let n=V8(r,i);return[t/n*$p,e/n*$p]}function j8(t,e,r,i,n=$p){if(t.isGeospatial){let[y,b]=HI(e,r,i),[M,L]=HI(e+1,r+1,i);return{west:y,north:b,east:M,south:L}}let[s,o]=sJ(e,r,i,n),[c,f]=sJ(e+1,r+1,i,n);return{left:s,top:o,right:c,bottom:f}}function Iwe(t,e,r,i,n){let s=Pwe(t,null,i),o=V8(e,r),[c,f,y,b]=Cwe(s,o,n),M=[];for(let L=Math.floor(c);Le&&(y=e);let b=n;return o&&c&&n&&!t.isGeospatial&&(b=oJ(n,o)),t.isGeospatial?nJ(t,y,i,n):Iwe(t,y,s,b||Ewe,c)}function lJ(t){let e={},r;return i=>{for(let n in i)if(!Rwe(i[n],e[n])){r=t(i),e=i;break}return r}}function Rwe(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i{}},Bwe={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},nT=class{constructor(e){this._getCullBounds=lJ(aJ),this.opts={...Bwe,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Ty({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Jn,this._modelMatrixInverse=new Jn}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new Jn(i):new Jn,s=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!oo(this._zRange,r)||s){s&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let c=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(f=>this._getTile(f,!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(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[s,o,c,f]of i){let y;if("west"in n)y=n.wests&&n.southo;else{let b=Math.min(n.top,n.bottom),M=Math.max(n.top,n.bottom);y=n.lefts&&bo}if(y)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:s,modelMatrixInverse:o}){let{tileSize:c,extent:f,zoomOffset:y}=this.opts;return W8({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:c,extent:f,modelMatrix:s,modelMatrixInverse:o,zoomOffset:y})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:j8(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||sT,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 e=="function"?e:Owe[e])(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:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:Dwe*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[o,c]of e)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?c.byteLength:0,e.delete(o),this.opts.onTileUnload?.(c)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),s=!1;return!n&&r?(n=new zI(e),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(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function Fwe(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!uJ(e)&&H8(e);for(let e of t)e.isVisible=!!(e.state&$I)}function Nwe(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&uJ(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=!!(r.state&$I),r.children&&(r.isVisible||r.state&cJ))for(let i of r.children)i.state=cJ;else r.isSelected&&H8(r)}function uJ(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=$I,!0;e=e.parent}return!1}function H8(t){for(let e of t.children)e.isLoaded||e.content?e.state|=$I:H8(e)}var zwe={TilesetClass:nT,data:{type:"data",value:[]},dataComparator:z8.equal,renderSubLayers:{type:"function",value:t=>new sx(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:sT,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Sx=class extends Xi{static{this.defaultProps=zwe}static{this.layerName="TileLayer"}initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(s=>{s.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:s,maxZoom:o,minZoom:c,maxRequests:f,debounceTime:y,zoomOffset:b}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:o,minZoom:c,tileSize:e,refinementStrategy:n,extent:s,maxRequests:f,debounceTime:y,zoomOffset:b,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:s}=e,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:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:s}=e;return e.url=typeof r=="string"||Array.isArray(r)?U8(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:s}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let r=e.sourceLayer,i=r.props.tile,n=e.info;return n.picked&&(n.tile=i),n.sourceTile=i,n.sourceTileSubLayer=r,n}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=fp(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}};var js=function(t){t=t||{};var e=typeof t<"u"?t:{},r={},i;for(i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);var n=[],s="";function o(Ke){return e.locateFile?e.locateFile(Ke,s):s+Ke}var c;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",c=function(mt,Ot,_r){var m=new XMLHttpRequest;m.open("GET",mt,!0),m.responseType="arraybuffer",m.onload=function(){if(m.status==200||m.status==0&&m.response){Ot(m.response);return}var cr=fe(mt);if(cr){Ot(cr.buffer);return}_r()},m.onerror=_r,m.send(null)};var f=e.print||console.log.bind(console),y=e.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(e[i]=r[i]);r=null,e.arguments&&(n=e.arguments);var b=0,M=function(Ke){b=Ke},L=function(){return b},N=8;function V(Ke,mt,Ot,_r){switch(Ot=Ot||"i8",Ot.charAt(Ot.length-1)==="*"&&(Ot="i32"),Ot){case"i1":Ar[Ke>>0]=mt;break;case"i8":Ar[Ke>>0]=mt;break;case"i16":Bn[Ke>>1]=mt;break;case"i32":$s[Ke>>2]=mt;break;case"i64":Tt=[mt>>>0,(Ro=mt,+zl(Ro)>=1?Ro>0?(vn(+ds(Ro/4294967296),4294967295)|0)>>>0:~~+ct((Ro-+(~~Ro>>>0))/4294967296)>>>0:0)],$s[Ke>>2]=Tt[0],$s[Ke+4>>2]=Tt[1];break;case"float":jo[Ke>>2]=mt;break;case"double":Ci[Ke>>3]=mt;break;default:Oc("invalid type for setValue: "+Ot)}}function $(Ke,mt,Ot){switch(mt=mt||"i8",mt.charAt(mt.length-1)==="*"&&(mt="i32"),mt){case"i1":return Ar[Ke>>0];case"i8":return Ar[Ke>>0];case"i16":return Bn[Ke>>1];case"i32":return $s[Ke>>2];case"i64":return $s[Ke>>2];case"float":return jo[Ke>>2];case"double":return Ci[Ke>>3];default:Oc("invalid type for getValue: "+mt)}return null}var Q=!1;function q(Ke,mt){Ke||Oc("Assertion failed: "+mt)}function J(Ke){var mt=e["_"+Ke];return q(mt,"Cannot call unknown function "+Ke+", make sure it is exported"),mt}function ee(Ke,mt,Ot,_r,m){var $i={string:function(Nn){var Ri=0;if(Nn!=null&&Nn!==0){var ki=(Nn.length<<2)+1;Ri=g_(ki),ot(Nn,Ri,ki)}return Ri},array:function(Nn){var Ri=g_(Nn.length);return Lt(Nn,Ri),Ri}};function cr(Nn){return mt==="string"?Ze(Nn):mt==="boolean"?!!Nn:Nn}var ue=J(Ke),Rs=[],Ir=0;if(_r)for(var En=0;En<_r.length;En++){var Tr=$i[Ot[En]];Tr?(Ir===0&&(Ir=tm()),Rs[En]=Tr(_r[En])):Rs[En]=_r[En]}var Fr=ue.apply(null,Rs);return Fr=cr(Fr),Ir!==0&&Zx(Ir),Fr}function oe(Ke,mt,Ot,_r){Ot=Ot||[];var m=Ot.every(function(cr){return cr==="number"}),$i=mt!=="string";return $i&&m&&!_r?J(Ke):function(){return ee(Ke,mt,Ot,arguments,_r)}}var ve=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Re(Ke,mt,Ot){for(var _r=mt+Ot,m=mt;Ke[m]&&!(m>=_r);)++m;if(m-mt>16&&Ke.subarray&&ve)return ve.decode(Ke.subarray(mt,m));for(var $i="";mt>10,56320|Ir&1023)}}return $i}function Ze(Ke,mt){return Ke?Re(ri,Ke,mt):""}function He(Ke,mt,Ot,_r){if(!(_r>0))return 0;for(var m=Ot,$i=Ot+_r-1,cr=0;cr=55296&&ue<=57343){var Rs=Ke.charCodeAt(++cr);ue=65536+((ue&1023)<<10)|Rs&1023}if(ue<=127){if(Ot>=$i)break;mt[Ot++]=ue}else if(ue<=2047){if(Ot+1>=$i)break;mt[Ot++]=192|ue>>6,mt[Ot++]=128|ue&63}else if(ue<=65535){if(Ot+2>=$i)break;mt[Ot++]=224|ue>>12,mt[Ot++]=128|ue>>6&63,mt[Ot++]=128|ue&63}else{if(Ot+3>=$i)break;mt[Ot++]=240|ue>>18,mt[Ot++]=128|ue>>12&63,mt[Ot++]=128|ue>>6&63,mt[Ot++]=128|ue&63}}return mt[Ot]=0,Ot-m}function ot(Ke,mt,Ot){return He(Ke,ri,mt,Ot)}var et=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Lt(Ke,mt){Ar.set(Ke,mt)}function Gt(Ke,mt){return Ke%mt>0&&(Ke+=mt-Ke%mt),Ke}var qt,Ar,ri,Bn,fo,$s,Nl,jo,Ci;function qs(Ke){qt=Ke,e.HEAP8=Ar=new Int8Array(Ke),e.HEAP16=Bn=new Int16Array(Ke),e.HEAP32=$s=new Int32Array(Ke),e.HEAPU8=ri=new Uint8Array(Ke),e.HEAPU16=fo=new Uint16Array(Ke),e.HEAPU32=Nl=new Uint32Array(Ke),e.HEAPF32=jo=new Float32Array(Ke),e.HEAPF64=Ci=new Float64Array(Ke)}var ll=5267040,kc=24128,Lc=e.TOTAL_MEMORY||33554432;e.buffer?qt=e.buffer:qt=new ArrayBuffer(Lc),Lc=qt.byteLength,qs(qt),$s[kc>>2]=ll;function on(Ke){for(;Ke.length>0;){var mt=Ke.shift();if(typeof mt=="function"){mt();continue}var Ot=mt.func;typeof Ot=="number"?mt.arg===void 0?e.dynCall_v(Ot):e.dynCall_vi(Ot,mt.arg):Ot(mt.arg===void 0?null:mt.arg)}}var is=[],Di=[],ns=[],Wo=[];function cl(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)fs(e.preRun.shift());on(is)}function Co(){on(Di)}function La(){on(ns)}function la(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)po(e.postRun.shift());on(Wo)}function fs(Ke){is.unshift(Ke)}function po(Ke){Wo.unshift(Ke)}var zl=Math.abs,ct=Math.ceil,ds=Math.floor,vn=Math.min,Si=0,gi=null,Ao=null;function vu(Ke){Si++,e.monitorRunDependencies&&e.monitorRunDependencies(Si)}function ul(Ke){if(Si--,e.monitorRunDependencies&&e.monitorRunDependencies(Si),Si==0&&(gi!==null&&(clearInterval(gi),gi=null),Ao)){var mt=Ao;Ao=null,mt()}}e.preloadedImages={},e.preloadedAudios={};var Io=null,hl="data:application/octet-stream;base64,";function Da(Ke){return String.prototype.startsWith?Ke.startsWith(hl):Ke.indexOf(hl)===0}var Ro,Tt;Io="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP7KBdLHZTpFAqKYk69AqekDbeGY41MdjQD8AZzHK501A1vcrrjubNkD5LnquvBYhQCbiRRD71QlAqt72EbOH8z8Eu+jL1YbdP4uaox/xUcY/abedg1XfsD+BsUdzJ4KZP5wE9YFySIM/rW1kAKMpbT+rZFthVRhWPy4PKlXIs0A/qMZLlwDnMEHByqEF0I0ZQQYSFD8lUQNBPpY+dFs07UAH8BZImBPWQN9RY0I0sMBA2T7kLfc6qUByFYvfhBKTQMq+0Mis1XxA0XQbeQXMZUBJJ5aEGXpQQP7/SY0a6ThAaMD92b/UIkAs8s8yqXoMQNIegOvCk/U/aOi7NZJP4D8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjb29yZGlqay5jAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAbGF0TG5nVG9DZWxsAGNlbGxUb0NoaWxkUG9zAHZhbGlkYXRlQ2hpbGRQb3MAbGF0TG5nLmMAY2VsbEFyZWFSYWRzMgBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGNlbGxUb0xvY2FsSWprAGJhc2VDZWxsICE9IG9yaWdpbkJhc2VDZWxsACEob3JpZ2luT25QZW50ICYmIGluZGV4T25QZW50KQBiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvQ2VsbAAhX2lzQmFzZUNlbGxQZW50YWdvbihiYXNlQ2VsbCkAYmFzZUNlbGxSb3RhdGlvbnMgPj0gMABncmlkUGF0aENlbGxzADAAdmVydGV4LmMAY2VsbFRvVmVydGV4AGdyYXBoLT5idWNrZXRzICE9IE5VTEwAdmVydGV4R3JhcGguYwBpbml0VmVydGV4R3JhcGgAbm9kZSAhPSBOVUxMAGFkZFZlcnRleE5vZGU=";var Ho=24144;function bn(Ke){return Ke}function Ul(Ke){var mt=/\b__Z[\w\d_]+/g;return Ke.replace(mt,function(Ot){var _r=Ot;return Ot===_r?Ot:_r+" ["+Ot+"]"})}function Oa(){var Ke=new Error;if(!Ke.stack){try{throw new Error(0)}catch(mt){Ke=mt}if(!Ke.stack)return"(no stack trace available)"}return Ke.stack.toString()}function Ct(){var Ke=Oa();return e.extraStackTrace&&(Ke+=` +`+e.extraStackTrace()),Ul(Ke)}function Vr(Ke,mt,Ot,_r){Oc("Assertion failed: "+Ze(Ke)+", at: "+[mt?Ze(mt):"unknown filename",Ot,_r?Ze(_r):"unknown function"])}function br(){return Ar.length}function Gs(Ke,mt,Ot){ri.set(ri.subarray(mt,mt+Ot),Ke)}function Ba(Ke){return e.___errno_location&&($s[e.___errno_location()>>2]=Ke),Ke}function Rr(Ke){Oc("OOM")}function ca(Ke){try{var mt=new ArrayBuffer(Ke);return mt.byteLength!=Ke?void 0:(new Int8Array(mt).set(Ar),mo(mt),qs(mt),1)}catch{}}function be(Ke){var mt=br(),Ot=16777216,_r=2147483648-Ot;if(Ke>_r)return!1;for(var m=16777216,$i=Math.max(mt,m);$i>4,m=(ue&15)<<4|Rs>>2,$i=(Rs&3)<<6|Ir,Ot=Ot+String.fromCharCode(_r),Rs!==64&&(Ot=Ot+String.fromCharCode(m)),Ir!==64&&(Ot=Ot+String.fromCharCode($i));while(En13780509?(d=mr(15,d)|0,d|0):(g=((p|0)<0)<<31>>31,T=Do(p|0,g|0,3,0)|0,x=ye()|0,g=ni(p|0,g|0,1,0)|0,g=Do(T|0,x|0,g|0,ye()|0)|0,g=ni(g|0,ye()|0,1,0)|0,p=ye()|0,m[d>>2]=g,m[d+4>>2]=p,d=0,d|0)}function Od(p,d,g,x){return p=p|0,d=d|0,g=g|0,x=x|0,Su(p,d,g,x,0)|0}function Su(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0;if(j=he,he=he+16|0,k=j,!(wf(p,d,g,x,T)|0))return x=0,he=j,x|0;do if((g|0)>=0){if((g|0)>13780509){if(C=mr(15,k)|0,C|0)break;D=k,k=m[D>>2]|0,D=m[D+4>>2]|0}else C=((g|0)<0)<<31>>31,G=Do(g|0,C|0,3,0)|0,D=ye()|0,C=ni(g|0,C|0,1,0)|0,C=Do(G|0,D|0,C|0,ye()|0)|0,C=ni(C|0,ye()|0,1,0)|0,D=ye()|0,m[k>>2]=C,m[k+4>>2]=D,k=C;if(Lf(x|0,0,k<<3|0)|0,T|0){Lf(T|0,0,k<<2|0)|0,C=Yo(p,d,g,x,T,k,D,0)|0;break}C=Hc(k,4)|0,C?(G=Yo(p,d,g,x,C,k,D,0)|0,Wr(C),C=G):C=13}else C=2;while(!1);return G=C,he=j,G|0}function wf(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0;if(Ye=he,he=he+16|0,Fe=Ye,Ie=Ye+8|0,Le=Fe,m[Le>>2]=p,m[Le+4>>2]=d,(g|0)<0)return Ie=2,he=Ye,Ie|0;if(C=x,m[C>>2]=p,m[C+4>>2]=d,C=(T|0)!=0,C&&(m[T>>2]=0),Gi(p,d)|0)return Ie=9,he=Ye,Ie|0;m[Ie>>2]=0;e:do if((g|0)>=1)if(C)for(ie=1,G=0,de=0,Le=1,C=p;;){if(!(G|de)){if(C=ps(C,d,4,Ie,Fe)|0,C|0)break e;if(d=Fe,C=m[d>>2]|0,d=m[d+4>>2]|0,Gi(C,d)|0){C=9;break e}}if(C=ps(C,d,m[22384+(de<<2)>>2]|0,Ie,Fe)|0,C|0)break e;if(d=Fe,C=m[d>>2]|0,d=m[d+4>>2]|0,p=x+(ie<<3)|0,m[p>>2]=C,m[p+4>>2]=d,m[T+(ie<<2)>>2]=Le,p=G+1|0,k=(p|0)==(Le|0),D=de+1|0,j=(D|0)==6,Gi(C,d)|0){C=9;break e}if(Le=Le+(j&k&1)|0,(Le|0)>(g|0)){C=0;break}else ie=ie+1|0,G=k?0:p,de=k?j?0:D:de}else for(ie=1,G=0,de=0,Le=1,C=p;;){if(!(G|de)){if(C=ps(C,d,4,Ie,Fe)|0,C|0)break e;if(d=Fe,C=m[d>>2]|0,d=m[d+4>>2]|0,Gi(C,d)|0){C=9;break e}}if(C=ps(C,d,m[22384+(de<<2)>>2]|0,Ie,Fe)|0,C|0)break e;if(d=Fe,C=m[d>>2]|0,d=m[d+4>>2]|0,p=x+(ie<<3)|0,m[p>>2]=C,m[p+4>>2]=d,p=G+1|0,k=(p|0)==(Le|0),D=de+1|0,j=(D|0)==6,Gi(C,d)|0){C=9;break e}if(Le=Le+(j&k&1)|0,(Le|0)>(g|0)){C=0;break}else ie=ie+1|0,G=k?0:p,de=k?j?0:D:de}else C=0;while(!1);return Ie=C,he=Ye,Ie|0}function Yo(p,d,g,x,T,C,k,D){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,C=C|0,k=k|0,D=D|0;var j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0;if(Ye=he,he=he+16|0,Fe=Ye+8|0,Ie=Ye,j=gs(p|0,d|0,C|0,k|0)|0,ie=ye()|0,de=x+(j<<3)|0,ut=de,lt=m[ut>>2]|0,ut=m[ut+4>>2]|0,G=(lt|0)==(p|0)&(ut|0)==(d|0),!((lt|0)==0&(ut|0)==0|G))do j=ni(j|0,ie|0,1,0)|0,j=D_(j|0,ye()|0,C|0,k|0)|0,ie=ye()|0,de=x+(j<<3)|0,lt=de,ut=m[lt>>2]|0,lt=m[lt+4>>2]|0,G=(ut|0)==(p|0)&(lt|0)==(d|0);while(!((ut|0)==0&(lt|0)==0|G));if(j=T+(j<<2)|0,G&&(m[j>>2]|0)<=(D|0)||(lt=de,m[lt>>2]=p,m[lt+4>>2]=d,m[j>>2]=D,(D|0)>=(g|0)))return lt=0,he=Ye,lt|0;switch(G=D+1|0,m[Fe>>2]=0,j=ps(p,d,2,Fe,Ie)|0,j|0){case 9:{Le=9;break}case 0:{j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j||(Le=9);break}default:}e:do if((Le|0)==9){switch(m[Fe>>2]=0,j=ps(p,d,3,Fe,Ie)|0,j|0){case 9:break;case 0:{if(j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j|0)break e;break}default:break e}switch(m[Fe>>2]=0,j=ps(p,d,1,Fe,Ie)|0,j|0){case 9:break;case 0:{if(j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j|0)break e;break}default:break e}switch(m[Fe>>2]=0,j=ps(p,d,5,Fe,Ie)|0,j|0){case 9:break;case 0:{if(j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j|0)break e;break}default:break e}switch(m[Fe>>2]=0,j=ps(p,d,4,Fe,Ie)|0,j|0){case 9:break;case 0:{if(j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j|0)break e;break}default:break e}switch(m[Fe>>2]=0,j=ps(p,d,6,Fe,Ie)|0,j|0){case 9:break;case 0:{if(j=Ie,j=Yo(m[j>>2]|0,m[j+4>>2]|0,g,x,T,C,k,G)|0,j|0)break e;break}default:break e}return lt=0,he=Ye,lt|0}while(!1);return lt=j,he=Ye,lt|0}function ps(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0;if(g>>>0>6)return T=1,T|0;if(de=(m[x>>2]|0)%6|0,m[x>>2]=de,(de|0)>0){C=0;do g=Vc(g)|0,C=C+1|0;while((C|0)<(m[x>>2]|0))}if(de=wt(p|0,d|0,45)|0,ye()|0,ie=de&127,ie>>>0>121)return T=5,T|0;j=jr(p,d)|0,C=wt(p|0,d|0,52)|0,ye()|0,C=C&15;e:do if(!C)G=8;else{for(;;){if(k=(15-C|0)*3|0,D=wt(p|0,d|0,k|0)|0,ye()|0,D=D&7,(D|0)==7){d=5;break}if(Ie=(P(C)|0)==0,C=C+-1|0,Le=Vt(7,0,k|0)|0,d=d&~(ye()|0),Fe=Vt(m[(Ie?432:16)+(D*28|0)+(g<<2)>>2]|0,0,k|0)|0,k=ye()|0,g=m[(Ie?640:224)+(D*28|0)+(g<<2)>>2]|0,p=Fe|p&~Le,d=k|d,!g){g=0;break e}if(!C){G=8;break e}}return d|0}while(!1);(G|0)==8&&(Ie=m[848+(ie*28|0)+(g<<2)>>2]|0,Fe=Vt(Ie|0,0,45)|0,p=Fe|p,d=ye()|0|d&-1040385,g=m[4272+(ie*28|0)+(g<<2)>>2]|0,(Ie&127|0)==127&&(Ie=Vt(m[848+(ie*28|0)+20>>2]|0,0,45)|0,d=ye()|0|d&-1040385,g=m[4272+(ie*28|0)+20>>2]|0,p=l(Ie|p,d)|0,d=ye()|0,m[x>>2]=(m[x>>2]|0)+1)),D=wt(p|0,d|0,45)|0,ye()|0,D=D&127;e:do if(qi(D)|0){t:do if((jr(p,d)|0)==1){if((ie|0)!=(D|0))if(fa(D,m[7696+(ie*28|0)>>2]|0)|0){p=v(p,d)|0,k=1,d=ye()|0;break}else Er(23313,22416,436,22424);switch(j|0){case 3:{p=l(p,d)|0,d=ye()|0,m[x>>2]=(m[x>>2]|0)+1,k=0;break t}case 5:{p=v(p,d)|0,d=ye()|0,m[x>>2]=(m[x>>2]|0)+5,k=0;break t}case 0:return Ie=9,Ie|0;default:return Ie=1,Ie|0}}else k=0;while(!1);if((g|0)>0){C=0;do p=E(p,d)|0,d=ye()|0,C=C+1|0;while((C|0)!=(g|0))}if((ie|0)!=(D|0)){if(!(iA(D)|0)){if((k|0)!=0|(jr(p,d)|0)!=5)break;m[x>>2]=(m[x>>2]|0)+1;break}switch(de&127){case 8:case 118:break e;default:}(jr(p,d)|0)!=3&&(m[x>>2]=(m[x>>2]|0)+1)}}else if((g|0)>0){C=0;do p=l(p,d)|0,d=ye()|0,C=C+1|0;while((C|0)!=(g|0))}while(!1);return m[x>>2]=((m[x>>2]|0)+g|0)%6|0,Ie=T,m[Ie>>2]=p,m[Ie+4>>2]=d,Ie=0,Ie|0}function rA(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0;for(D=he,he=he+16|0,C=D,k=D+8|0,T=(Gi(p,d)|0)==0,T=T?1:2;;){if(m[k>>2]=0,G=(ps(p,d,T,k,C)|0)==0,j=C,G&((m[j>>2]|0)==(g|0)?(m[j+4>>2]|0)==(x|0):0)){p=4;break}if(T=T+1|0,T>>>0>=7){T=7,p=4;break}}return(p|0)==4?(he=D,T|0):0}function v_(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0;if(Ie=he,he=he+16|0,Le=Ie,Fe=Ie+8|0,de=Le,m[de>>2]=p,m[de+4>>2]=d,!g)return Fe=x,m[Fe>>2]=p,m[Fe+4>>2]=d,Fe=0,he=Ie,Fe|0;m[Fe>>2]=0;e:do if(Gi(p,d)|0)p=9;else{if(C=(g|0)>0,C){T=0,de=p;do{if(p=ps(de,d,4,Fe,Le)|0,p|0)break e;if(d=Le,de=m[d>>2]|0,d=m[d+4>>2]|0,T=T+1|0,Gi(de,d)|0){p=9;break e}}while((T|0)<(g|0));if(ie=x,m[ie>>2]=de,m[ie+4>>2]=d,ie=g+-1|0,C){G=0,p=1;do{if(T=22384+(G<<2)|0,(G|0)==5)for(k=m[T>>2]|0,C=0,T=p;;){if(p=Le,p=ps(m[p>>2]|0,m[p+4>>2]|0,k,Fe,Le)|0,p|0)break e;if((C|0)!=(ie|0))if(j=Le,D=m[j>>2]|0,j=m[j+4>>2]|0,p=x+(T<<3)|0,m[p>>2]=D,m[p+4>>2]=j,!(Gi(D,j)|0))p=T+1|0;else{p=9;break e}else p=T;if(C=C+1|0,(C|0)>=(g|0))break;T=p}else for(k=Le,j=m[T>>2]|0,D=0,T=p,C=m[k>>2]|0,k=m[k+4>>2]|0;;){if(p=ps(C,k,j,Fe,Le)|0,p|0)break e;if(k=Le,C=m[k>>2]|0,k=m[k+4>>2]|0,p=x+(T<<3)|0,m[p>>2]=C,m[p+4>>2]=k,p=T+1|0,Gi(C,k)|0){p=9;break e}if(D=D+1|0,(D|0)>=(g|0))break;T=p}G=G+1|0}while(G>>>0<6);p=Le,k=de,T=m[p>>2]|0,C=d,p=m[p+4>>2]|0}else k=de,T=de,C=d,p=d}else k=x,m[k>>2]=p,m[k+4>>2]=d,k=p,T=p,C=d,p=d;p=(k|0)==(T|0)&(C|0)==(p|0)?0:9}while(!1);return Fe=p,he=Ie,Fe|0}function b_(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0;if(D=he,he=he+48|0,T=D+16|0,C=D+8|0,k=D,g|0)return k=15,he=D,k|0;if(G=p,j=m[G+4>>2]|0,g=C,m[g>>2]=m[G>>2],m[g+4>>2]=j,Dn(C,T),d=sm(T,d,k)|0,!d){if(g=m[C>>2]|0,C=m[p+8>>2]|0,(C|0)>0){T=m[p+12>>2]|0,d=0;do g=(m[T+(d<<3)>>2]|0)+g|0,d=d+1|0;while((d|0)<(C|0))}d=k,T=m[d>>2]|0,d=m[d+4>>2]|0,C=((g|0)<0)<<31>>31,(d|0)<(C|0)|(d|0)==(C|0)&T>>>0>>0?(d=k,m[d>>2]=g,m[d+4>>2]=C,d=C):g=T,j=ni(g|0,d|0,12,0)|0,G=ye()|0,d=k,m[d>>2]=j,m[d+4>>2]=G,d=x,m[d>>2]=j,m[d+4>>2]=G,d=0}return G=d,he=D,G|0}function im(p,d,g,x,T,C,k){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,C=C|0,k=k|0;var D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0,Wi=0,Oi=0,xi=0,ai=0,or=0,Qr=0,tn=0,Nr=0,rn=0,Qs=0,iv=0;if(tn=he,he=he+64|0,xi=tn+48|0,ai=tn+32|0,or=tn+24|0,Zt=tn+8|0,nr=tn,j=m[p>>2]|0,(j|0)<=0)return Qr=0,he=tn,Qr|0;for(Ut=p+4|0,Yt=xi+8|0,Wi=ai+8|0,Oi=Zt+8|0,D=0,nt=0;;){G=m[Ut>>2]|0,rt=G+(nt<<4)|0,m[xi>>2]=m[rt>>2],m[xi+4>>2]=m[rt+4>>2],m[xi+8>>2]=m[rt+8>>2],m[xi+12>>2]=m[rt+12>>2],(nt|0)==(j+-1|0)?(m[ai>>2]=m[G>>2],m[ai+4>>2]=m[G+4>>2],m[ai+8>>2]=m[G+8>>2],m[ai+12>>2]=m[G+12>>2]):(rt=G+(nt+1<<4)|0,m[ai>>2]=m[rt>>2],m[ai+4>>2]=m[rt+4>>2],m[ai+8>>2]=m[rt+8>>2],m[ai+12>>2]=m[rt+12>>2]),j=sA(xi,ai,x,or)|0;e:do if(j)G=0,D=j;else if(G=or,j=m[G>>2]|0,G=m[G+4>>2]|0,(G|0)>0|(G|0)==0&j>>>0>0){lt=0,rt=0;t:for(;;){if(iv=+ue[xi>>3],ut=Qo(j|0,G|0,lt|0,rt|0)|0,Qs=+(ut>>>0)+4294967296*+(ye()|0),Nr=+(j>>>0)+4294967296*+(G|0),rn=+(lt>>>0)+4294967296*+(rt|0),ue[Zt>>3]=iv*Qs/Nr+ +ue[ai>>3]*rn/Nr,ue[Oi>>3]=+ue[Yt>>3]*Qs/Nr+ +ue[Wi>>3]*rn/Nr,j=B(Zt,x,nr)|0,j|0){D=j;break}ut=nr,Ye=m[ut>>2]|0,ut=m[ut+4>>2]|0,Le=gs(Ye|0,ut|0,d|0,g|0)|0,ie=ye()|0,j=k+(Le<<3)|0,de=j,G=m[de>>2]|0,de=m[de+4>>2]|0;r:do if((G|0)==0&(de|0)==0)Xe=j,Qr=16;else for(Fe=0,Ie=0;;){if((Fe|0)>(g|0)|(Fe|0)==(g|0)&Ie>>>0>d>>>0){D=1;break t}if((G|0)==(Ye|0)&(de|0)==(ut|0))break r;if(j=ni(Le|0,ie|0,1,0)|0,Le=D_(j|0,ye()|0,d|0,g|0)|0,ie=ye()|0,Ie=ni(Ie|0,Fe|0,1,0)|0,Fe=ye()|0,j=k+(Le<<3)|0,de=j,G=m[de>>2]|0,de=m[de+4>>2]|0,(G|0)==0&(de|0)==0){Xe=j,Qr=16;break}}while(!1);if((Qr|0)==16&&(Qr=0,!((Ye|0)==0&(ut|0)==0))&&(Ie=Xe,m[Ie>>2]=Ye,m[Ie+4>>2]=ut,Ie=C+(m[T>>2]<<3)|0,m[Ie>>2]=Ye,m[Ie+4>>2]=ut,Ie=T,Ie=ni(m[Ie>>2]|0,m[Ie+4>>2]|0,1,0)|0,Ye=ye()|0,ut=T,m[ut>>2]=Ie,m[ut+4>>2]=Ye),lt=ni(lt|0,rt|0,1,0)|0,rt=ye()|0,G=or,j=m[G>>2]|0,G=m[G+4>>2]|0,!((G|0)>(rt|0)|(G|0)==(rt|0)&j>>>0>lt>>>0)){G=1;break e}}G=0}else G=1;while(!1);if(nt=nt+1|0,!G){Qr=21;break}if(j=m[p>>2]|0,(nt|0)>=(j|0)){D=0,Qr=21;break}}return(Qr|0)==21?(he=tn,D|0):0}function ql(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0,Wi=0,Oi=0,xi=0,ai=0,or=0,Qr=0,tn=0,Nr=0,rn=0,Qs=0;if(Qs=he,he=he+112|0,Qr=Qs+80|0,j=Qs+72|0,tn=Qs,Nr=Qs+56|0,g|0)return rn=15,he=Qs,rn|0;if(G=p+8|0,rn=Ql((m[G>>2]<<5)+32|0)|0,!rn)return rn=13,he=Qs,rn|0;if(ms(p,rn),ai=p,or=m[ai+4>>2]|0,g=j,m[g>>2]=m[ai>>2],m[g+4>>2]=or,Dn(j,Qr),g=sm(Qr,d,tn)|0,g)ai=0,or=0;else{if(g=m[j>>2]|0,C=m[G>>2]|0,(C|0)>0){k=m[p+12>>2]|0,T=0;do g=(m[k+(T<<3)>>2]|0)+g|0,T=T+1|0;while((T|0)!=(C|0));T=g}else T=g;g=tn,C=m[g>>2]|0,g=m[g+4>>2]|0,k=((T|0)<0)<<31>>31,(g|0)<(k|0)|(g|0)==(k|0)&C>>>0>>0?(g=tn,m[g>>2]=T,m[g+4>>2]=k,g=k):T=C,ai=ni(T|0,g|0,12,0)|0,or=ye()|0,g=tn,m[g>>2]=ai,m[g+4>>2]=or,g=0}if(g|0)return Wr(rn),rn=g,he=Qs,rn|0;if(T=Hc(ai,8)|0,!T)return Wr(rn),rn=13,he=Qs,rn|0;if(D=Hc(ai,8)|0,!D)return Wr(rn),Wr(T),rn=13,he=Qs,rn|0;Oi=Qr,m[Oi>>2]=0,m[Oi+4>>2]=0,Oi=p,xi=m[Oi+4>>2]|0,g=j,m[g>>2]=m[Oi>>2],m[g+4>>2]=xi,g=im(j,ai,or,d,Qr,T,D)|0;e:do if(g)Wr(T),Wr(D),Wr(rn);else{t:do if((m[G>>2]|0)>0){for(k=p+12|0,C=0;g=im((m[k>>2]|0)+(C<<3)|0,ai,or,d,Qr,T,D)|0,C=C+1|0,!(g|0);)if((C|0)>=(m[G>>2]|0))break t;Wr(T),Wr(D),Wr(rn);break e}while(!1);(or|0)>0|(or|0)==0&ai>>>0>0&&Lf(D|0,0,ai<<3|0)|0,xi=Qr,Oi=m[xi+4>>2]|0;t:do if((Oi|0)>0|(Oi|0)==0&(m[xi>>2]|0)>>>0>0){Ut=T,Yt=D,Wi=T,Oi=D,xi=T,g=T,Xe=T,Zt=D,nr=D,T=D;r:for(;;){for(ut=0,lt=0,rt=0,nt=0,C=0,k=0;;){D=tn,j=D+56|0;do m[D>>2]=0,D=D+4|0;while((D|0)<(j|0));if(d=Ut+(ut<<3)|0,G=m[d>>2]|0,d=m[d+4>>2]|0,wf(G,d,1,tn,0)|0){D=tn,j=D+56|0;do m[D>>2]=0,D=D+4|0;while((D|0)<(j|0));D=Hc(7,4)|0,D|0&&(Yo(G,d,1,tn,D,7,0,0)|0,Wr(D))}for(Ye=0;;){Ie=tn+(Ye<<3)|0,Fe=m[Ie>>2]|0,Ie=m[Ie+4>>2]|0;i:do if((Fe|0)==0&(Ie|0)==0)D=C,j=k;else{if(ie=gs(Fe|0,Ie|0,ai|0,or|0)|0,G=ye()|0,D=x+(ie<<3)|0,d=D,j=m[d>>2]|0,d=m[d+4>>2]|0,!((j|0)==0&(d|0)==0)){de=0,Le=0;do{if((de|0)>(or|0)|(de|0)==(or|0)&Le>>>0>ai>>>0)break r;if((j|0)==(Fe|0)&(d|0)==(Ie|0)){D=C,j=k;break i}D=ni(ie|0,G|0,1,0)|0,ie=D_(D|0,ye()|0,ai|0,or|0)|0,G=ye()|0,Le=ni(Le|0,de|0,1,0)|0,de=ye()|0,D=x+(ie<<3)|0,d=D,j=m[d>>2]|0,d=m[d+4>>2]|0}while(!((j|0)==0&(d|0)==0))}(Fe|0)==0&(Ie|0)==0?(D=C,j=k):(H(Fe,Ie,Nr)|0,Xo(p,rn,Nr)|0&&(Le=ni(C|0,k|0,1,0)|0,k=ye()|0,de=D,m[de>>2]=Fe,m[de+4>>2]=Ie,C=Yt+(C<<3)|0,m[C>>2]=Fe,m[C+4>>2]=Ie,C=Le),D=C,j=k)}while(!1);if(Ye=Ye+1|0,Ye>>>0>=7)break;C=D,k=j}if(ut=ni(ut|0,lt|0,1,0)|0,lt=ye()|0,rt=ni(rt|0,nt|0,1,0)|0,nt=ye()|0,k=Qr,C=m[k>>2]|0,k=m[k+4>>2]|0,(nt|0)<(k|0)|(nt|0)==(k|0)&rt>>>0>>0)C=D,k=j;else break}if((k|0)>0|(k|0)==0&C>>>0>0){C=0,k=0;do nt=Ut+(C<<3)|0,m[nt>>2]=0,m[nt+4>>2]=0,C=ni(C|0,k|0,1,0)|0,k=ye()|0,nt=Qr,rt=m[nt+4>>2]|0;while((k|0)<(rt|0)|((k|0)==(rt|0)?C>>>0<(m[nt>>2]|0)>>>0:0))}if(nt=Qr,m[nt>>2]=D,m[nt+4>>2]=j,(j|0)>0|(j|0)==0&D>>>0>0)Ye=T,ut=nr,lt=xi,rt=Zt,nt=Yt,T=Xe,nr=g,Zt=Wi,Xe=Ye,g=ut,xi=Oi,Oi=lt,Wi=rt,Yt=Ut,Ut=nt;else break t}Wr(Wi),Wr(Oi),Wr(rn),g=1;break e}else g=D;while(!1);Wr(rn),Wr(T),Wr(g),g=0}while(!1);return rn=g,he=Qs,rn|0}function Bd(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(ie=he,he=he+176|0,j=ie,(d|0)<1)return If(g,0,0),G=0,he=ie,G|0;for(D=p,D=wt(m[D>>2]|0,m[D+4>>2]|0,52)|0,ye()|0,If(g,(d|0)>6?d:6,D&15),D=0;x=p+(D<<3)|0,x=Y(m[x>>2]|0,m[x+4>>2]|0,j)|0,!(x|0);){if(x=m[j>>2]|0,(x|0)>0){k=0;do C=j+8+(k<<4)|0,k=k+1|0,x=j+8+(((k|0)%(x|0)|0)<<4)|0,T=H4(g,x,C)|0,T?L_(g,T)|0:jT(g,C,x)|0,x=m[j>>2]|0;while((k|0)<(x|0))}if(D=D+1|0,(D|0)>=(d|0)){x=0,G=13;break}}return(G|0)==13?(he=ie,x|0):(Rf(g),G=x,he=ie,G|0)}function ha(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;if(C=he,he=he+32|0,x=C,T=C+16|0,p=Bd(p,d,T)|0,p|0)return g=p,he=C,g|0;if(m[g>>2]=0,m[g+4>>2]=0,m[g+8>>2]=0,p=xm(T)|0,p|0)do{d=Ys(g)|0;do As(d,p)|0,k=p+16|0,m[x>>2]=m[k>>2],m[x+4>>2]=m[k+4>>2],m[x+8>>2]=m[k+8>>2],m[x+12>>2]=m[k+12>>2],L_(T,p)|0,p=WT(T,x)|0;while(p|0);p=xm(T)|0}while(p|0);return Rf(T),p=Aa(g)|0,p?(Vn(g),k=p,he=C,k|0):(k=0,he=C,k|0)}function qi(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=m[7696+(p*28|0)+16>>2]|0,p|0)}function iA(p){return p=p|0,(p|0)==4|(p|0)==117|0}function nm(p){return p=p|0,m[11120+((m[p>>2]|0)*216|0)+((m[p+4>>2]|0)*72|0)+((m[p+8>>2]|0)*24|0)+(m[p+12>>2]<<3)>>2]|0}function w_(p){return p=p|0,m[11120+((m[p>>2]|0)*216|0)+((m[p+4>>2]|0)*72|0)+((m[p+8>>2]|0)*24|0)+(m[p+12>>2]<<3)+4>>2]|0}function Fc(p,d){p=p|0,d=d|0,p=7696+(p*28|0)|0,m[d>>2]=m[p>>2],m[d+4>>2]=m[p+4>>2],m[d+8>>2]=m[p+8>>2],m[d+12>>2]=m[p+12>>2]}function S_(p,d){p=p|0,d=d|0;var g=0,x=0;if(d>>>0>20)return d=-1,d|0;do if((m[11120+(d*216|0)>>2]|0)!=(p|0))if((m[11120+(d*216|0)+8>>2]|0)!=(p|0))if((m[11120+(d*216|0)+16>>2]|0)!=(p|0))if((m[11120+(d*216|0)+24>>2]|0)!=(p|0))if((m[11120+(d*216|0)+32>>2]|0)!=(p|0))if((m[11120+(d*216|0)+40>>2]|0)!=(p|0))if((m[11120+(d*216|0)+48>>2]|0)!=(p|0))if((m[11120+(d*216|0)+56>>2]|0)!=(p|0))if((m[11120+(d*216|0)+64>>2]|0)!=(p|0))if((m[11120+(d*216|0)+72>>2]|0)!=(p|0))if((m[11120+(d*216|0)+80>>2]|0)!=(p|0))if((m[11120+(d*216|0)+88>>2]|0)!=(p|0))if((m[11120+(d*216|0)+96>>2]|0)!=(p|0))if((m[11120+(d*216|0)+104>>2]|0)!=(p|0))if((m[11120+(d*216|0)+112>>2]|0)!=(p|0))if((m[11120+(d*216|0)+120>>2]|0)!=(p|0))if((m[11120+(d*216|0)+128>>2]|0)!=(p|0))if((m[11120+(d*216|0)+136>>2]|0)==(p|0))p=2,g=1,x=2;else{if((m[11120+(d*216|0)+144>>2]|0)==(p|0)){p=0,g=2,x=0;break}if((m[11120+(d*216|0)+152>>2]|0)==(p|0)){p=0,g=2,x=1;break}if((m[11120+(d*216|0)+160>>2]|0)==(p|0)){p=0,g=2,x=2;break}if((m[11120+(d*216|0)+168>>2]|0)==(p|0)){p=1,g=2,x=0;break}if((m[11120+(d*216|0)+176>>2]|0)==(p|0)){p=1,g=2,x=1;break}if((m[11120+(d*216|0)+184>>2]|0)==(p|0)){p=1,g=2,x=2;break}if((m[11120+(d*216|0)+192>>2]|0)==(p|0)){p=2,g=2,x=0;break}if((m[11120+(d*216|0)+200>>2]|0)==(p|0)){p=2,g=2,x=1;break}if((m[11120+(d*216|0)+208>>2]|0)==(p|0)){p=2,g=2,x=2;break}else p=-1;return p|0}else p=2,g=1,x=1;else p=2,g=1,x=0;else p=1,g=1,x=2;else p=1,g=1,x=1;else p=1,g=1,x=0;else p=0,g=1,x=2;else p=0,g=1,x=1;else p=0,g=1,x=0;else p=2,g=0,x=2;else p=2,g=0,x=1;else p=2,g=0,x=0;else p=1,g=0,x=2;else p=1,g=0,x=1;else p=1,g=0,x=0;else p=0,g=0,x=2;else p=0,g=0,x=1;else p=0,g=0,x=0;while(!1);return d=m[11120+(d*216|0)+(g*72|0)+(p*24|0)+(x<<3)+4>>2]|0,d|0}function fa(p,d){return p=p|0,d=d|0,(m[7696+(p*28|0)+20>>2]|0)==(d|0)?(d=1,d|0):(d=(m[7696+(p*28|0)+24>>2]|0)==(d|0),d|0)}function dl(p,d){return p=p|0,d=d|0,m[848+(p*28|0)+(d<<2)>>2]|0}function Sf(p,d){return p=p|0,d=d|0,(m[848+(p*28|0)>>2]|0)==(d|0)?(d=0,d|0):(m[848+(p*28|0)+4>>2]|0)==(d|0)?(d=1,d|0):(m[848+(p*28|0)+8>>2]|0)==(d|0)?(d=2,d|0):(m[848+(p*28|0)+12>>2]|0)==(d|0)?(d=3,d|0):(m[848+(p*28|0)+16>>2]|0)==(d|0)?(d=4,d|0):(m[848+(p*28|0)+20>>2]|0)==(d|0)?(d=5,d|0):((m[848+(p*28|0)+24>>2]|0)==(d|0)?6:7)|0}function Nc(){return 122}function zc(p){p=p|0;var d=0,g=0,x=0;d=0;do Vt(d|0,0,45)|0,x=ye()|0|134225919,g=p+(d<<3)|0,m[g>>2]=-1,m[g+4>>2]=x,d=d+1|0;while((d|0)!=122);return 0}function T_(p){return p=p|0,+ue[p+16>>3]<+ue[p+24>>3]|0}function nA(p,d){p=p|0,d=d|0;var g=0,x=0,T=0;return g=+ue[d>>3],!(g>=+ue[p+8>>3])||!(g<=+ue[p>>3])?(d=0,d|0):(x=+ue[p+16>>3],g=+ue[p+24>>3],T=+ue[d+8>>3],d=T>=g,p=T<=x&1,x>2]=0,D=D+4|0;while((D|0)<(j|0));return d=me(d,G)|0,d|0?(Fe=d,he=Ie,Fe|0):(j=G,G=m[j>>2]|0,j=m[j+4>>2]|0,H(G,j,ie)|0,Y(G,j,de)|0,k=+tt(ie,de+8|0),ue[ie>>3]=+ue[p>>3],j=ie+8|0,ue[j>>3]=+ue[p+16>>3],ue[de>>3]=+ue[p+8>>3],G=de+8|0,ue[G>>3]=+ue[p+24>>3],T=+tt(ie,de),ut=+ue[j>>3]-+ue[G>>3],C=+Tr(+ut),Ye=+ue[ie>>3]-+ue[de>>3],x=+Tr(+Ye),!(ut==0|Ye==0)&&(ut=+pA(+C,+x),ut=+$l(+(T*T/+tv(+(ut/+tv(+C,+x)),3)/(k*(k*2.59807621135)*.8))),ue[Rs>>3]=ut,Le=~~ut>>>0,Fe=+Tr(ut)>=1?ut>0?~~+vh(+En(ut/4294967296),4294967295)>>>0:~~+$l((ut-+(~~ut>>>0))/4294967296)>>>0:0,(m[Rs+4>>2]&2146435072|0)!=2146435072)?(de=(Le|0)==0&(Fe|0)==0,d=g,m[d>>2]=de?1:Le,m[d+4>>2]=de?0:Fe,d=0):d=1,Fe=d,he=Ie,Fe|0)}function sA(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0;G=he,he=he+288|0,k=G+264|0,D=G+96|0,j=G,T=j,C=T+96|0;do m[T>>2]=0,T=T+4|0;while((T|0)<(C|0));return g=me(g,j)|0,g|0?(x=g,he=G,x|0):(g=j,T=m[g>>2]|0,g=m[g+4>>2]|0,H(T,g,k)|0,Y(T,g,D)|0,ie=+tt(k,D+8|0),ie=+$l(+(+tt(p,d)/(ie*2))),ue[Rs>>3]=ie,g=~~ie>>>0,T=+Tr(ie)>=1?ie>0?~~+vh(+En(ie/4294967296),4294967295)>>>0:~~+$l((ie-+(~~ie>>>0))/4294967296)>>>0:0,(m[Rs+4>>2]&2146435072|0)==2146435072?(x=1,he=G,x|0):(j=(g|0)==0&(T|0)==0,m[x>>2]=j?1:g,m[x+4>>2]=j?0:T,x=0,he=G,x|0))}function Tf(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0,m[p>>2]=d,m[p+4>>2]=g,m[p+8>>2]=x}function Uc(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0;de=d+8|0,m[de>>2]=0,j=+ue[p>>3],k=+Tr(+j),G=+ue[p+8>>3],D=+Tr(+G)/.8660254037844386,k=k+D*.5,g=~~k,p=~~D,k=k-+(g|0),D=D-+(p|0);do if(k<.5)if(k<.3333333333333333)if(m[d>>2]=g,D<(k+1)*.5){m[d+4>>2]=p;break}else{p=p+1|0,m[d+4>>2]=p;break}else if(Le=1-k,p=(!(D>2]=p,Le<=D&D>2]=g;break}else{m[d>>2]=g;break}else{if(!(k<.6666666666666666))if(g=g+1|0,m[d>>2]=g,D>2]=p;break}else{p=p+1|0,m[d+4>>2]=p;break}if(D<1-k){if(m[d+4>>2]=p,k*2+-1>2]=g;break}}else p=p+1|0,m[d+4>>2]=p;g=g+1|0,m[d>>2]=g}while(!1);do if(j<0)if(p&1){ie=(p+1|0)/2|0,ie=Qo(g|0,((g|0)<0)<<31>>31|0,ie|0,((ie|0)<0)<<31>>31|0)|0,g=~~(+(g|0)-((+(ie>>>0)+4294967296*+(ye()|0))*2+1)),m[d>>2]=g;break}else{ie=(p|0)/2|0,ie=Qo(g|0,((g|0)<0)<<31>>31|0,ie|0,((ie|0)<0)<<31>>31|0)|0,g=~~(+(g|0)-(+(ie>>>0)+4294967296*+(ye()|0))*2),m[d>>2]=g;break}while(!1);ie=d+4|0,G<0&&(g=g-((p<<1|1|0)/2|0)|0,m[d>>2]=g,p=0-p|0,m[ie>>2]=p),x=p-g|0,(g|0)<0?(T=0-g|0,m[ie>>2]=x,m[de>>2]=T,m[d>>2]=0,p=x,g=0):T=0,(p|0)<0&&(g=g-p|0,m[d>>2]=g,T=T-p|0,m[de>>2]=T,m[ie>>2]=0,p=0),C=g-T|0,x=p-T|0,(T|0)<0&&(m[d>>2]=C,m[ie>>2]=x,m[de>>2]=0,p=x,g=C,T=0),x=(p|0)<(g|0)?p:g,x=(T|0)<(x|0)?T:x,!((x|0)<=0)&&(m[d>>2]=g-x,m[ie>>2]=p-x,m[de>>2]=T-x)}function Rt(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0;d=m[p>>2]|0,k=p+4|0,g=m[k>>2]|0,(d|0)<0&&(g=g-d|0,m[k>>2]=g,C=p+8|0,m[C>>2]=(m[C>>2]|0)-d,m[p>>2]=0,d=0),(g|0)<0?(d=d-g|0,m[p>>2]=d,C=p+8|0,T=(m[C>>2]|0)-g|0,m[C>>2]=T,m[k>>2]=0,g=0):(T=p+8|0,C=T,T=m[T>>2]|0),(T|0)<0&&(d=d-T|0,m[p>>2]=d,g=g-T|0,m[k>>2]=g,m[C>>2]=0,T=0),x=(g|0)<(d|0)?g:d,x=(T|0)<(x|0)?T:x,!((x|0)<=0)&&(m[p>>2]=d-x,m[k>>2]=g-x,m[C>>2]=T-x)}function Gl(p,d){p=p|0,d=d|0;var g=0,x=0;x=m[p+8>>2]|0,g=+((m[p+4>>2]|0)-x|0),ue[d>>3]=+((m[p>>2]|0)-x|0)-g*.5,ue[d+8>>3]=g*.8660254037844386}function zn(p,d,g){p=p|0,d=d|0,g=g|0,m[g>>2]=(m[d>>2]|0)+(m[p>>2]|0),m[g+4>>2]=(m[d+4>>2]|0)+(m[p+4>>2]|0),m[g+8>>2]=(m[d+8>>2]|0)+(m[p+8>>2]|0)}function Tu(p,d,g){p=p|0,d=d|0,g=g|0,m[g>>2]=(m[p>>2]|0)-(m[d>>2]|0),m[g+4>>2]=(m[p+4>>2]|0)-(m[d+4>>2]|0),m[g+8>>2]=(m[p+8>>2]|0)-(m[d+8>>2]|0)}function om(p,d){p=p|0,d=d|0;var g=0,x=0;g=Go(m[p>>2]|0,d)|0,m[p>>2]=g,g=p+4|0,x=Go(m[g>>2]|0,d)|0,m[g>>2]=x,p=p+8|0,d=Go(m[p>>2]|0,d)|0,m[p>>2]=d}function Nt(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;k=m[p>>2]|0,D=(k|0)<0,x=(m[p+4>>2]|0)-(D?k:0)|0,C=(x|0)<0,T=(C?0-x|0:0)+((m[p+8>>2]|0)-(D?k:0))|0,g=(T|0)<0,p=g?0:T,d=(C?0:x)-(g?T:0)|0,T=(D?0:k)-(C?x:0)-(g?T:0)|0,g=(d|0)<(T|0)?d:T,g=(p|0)<(g|0)?p:g,x=(g|0)>0,p=p-(x?g:0)|0,d=d-(x?g:0)|0;e:do switch(T-(x?g:0)|0){case 0:switch(d|0){case 0:return D=p|0?(p|0)==1?1:7:0,D|0;case 1:return D=p|0?(p|0)==1?3:7:2,D|0;default:break e}case 1:switch(d|0){case 0:return D=p|0?(p|0)==1?5:7:4,D|0;case 1:{if(!p)p=6;else break e;return p|0}default:break e}default:}while(!1);return D=7,D|0}function am(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;k=p+8|0,T=m[k>>2]|0,C=(m[p>>2]|0)-T|0,D=p+4|0,T=(m[D>>2]|0)-T|0;do if(C>>>0>715827881|T>>>0>715827881){if(g=(C|0)>0,g){if((2147483647-C|0)<(C|0)||(2147483647-(C<<1)|0)<(C|0))return D=1,D|0}else if((-2147483648-C|0)>(C|0)||(-2147483648-(C<<1)|0)>(C|0))return D=1,D|0;if(d=C*3|0,(T|0)>0){if((2147483647-T|0)<(T|0))return D=1,D|0}else if((-2147483648-T|0)>(T|0))return D=1,D|0;if(x=T<<1,(C|0)>-1){if((d|-2147483648|0)>=(T|0))return D=1,D|0}else if((d^-2147483648|0)<(T|0))return D=1,D|0;if(g){if((2147483647-C|0)<(x|0))d=1;else{g=x;break}return d|0}else{if((-2147483648-C|0)>(x|0))d=1;else{g=x;break}return d|0}}else g=T<<1,d=C*3|0;while(!1);x=kf(+(d-T|0)/7)|0,m[p>>2]=x,T=kf(+(g+C|0)/7)|0,m[D>>2]=T,m[k>>2]=0,g=(T|0)<(x|0),d=g?x:T,g=g?T:x;do if((g|0)<0){if((d|0)>0){if((d|-2147483648|0)<(g|0)&((g|0)!=-2147483648&(2147483647-d|0)>=(g|0)))break;Er(23313,22444,355,22455)}if((g|0)==-2147483648|(-2147483648-d|0)>(g|0)&&Er(23313,22444,355,22455),(d|0)>-1){if((d|-2147483648|0)<(g|0))break;Er(23313,22444,355,22455)}else{if((d^-2147483648|0)>=(g|0))break;Er(23313,22444,355,22455)}}while(!1);return d=T-x|0,(x|0)<0?(g=0-x|0,m[D>>2]=d,m[k>>2]=g,m[p>>2]=0,x=0):(d=T,g=0),(d|0)<0&&(x=x-d|0,m[p>>2]=x,g=g-d|0,m[k>>2]=g,m[D>>2]=0,d=0),C=x-g|0,T=d-g|0,(g|0)<0?(m[p>>2]=C,m[D>>2]=T,m[k>>2]=0,d=T,T=C,g=0):T=x,x=(d|0)<(T|0)?d:T,x=(g|0)<(x|0)?g:x,(x|0)<=0?(D=0,D|0):(m[p>>2]=T-x,m[D>>2]=d-x,m[k>>2]=g-x,D=0,D|0)}function lm(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;k=p+8|0,T=m[k>>2]|0,C=(m[p>>2]|0)-T|0,D=p+4|0,T=(m[D>>2]|0)-T|0;do if(C>>>0>715827881|T>>>0>715827881){if(g=(C|0)>0,g){if((2147483647-C|0)<(C|0))return D=1,D|0}else if((-2147483648-C|0)>(C|0))return D=1,D|0;if(d=C<<1,(T|0)>0){if((2147483647-T|0)<(T|0)||(2147483647-(T<<1)|0)<(T|0))return D=1,D|0}else if((-2147483648-T|0)>(T|0)||(-2147483648-(T<<1)|0)>(T|0))return D=1,D|0;if(x=T*3|0,g){if((2147483647-d|0)<(T|0))return D=1,D|0}else if((-2147483648-d|0)>(T|0))return D=1,D|0;if((T|0)>-1){if((x|-2147483648|0)<(C|0)){g=x;break}else d=1;return d|0}else{if((x^-2147483648|0)<(C|0))d=1;else{g=x;break}return d|0}}else g=T*3|0,d=C<<1;while(!1);x=kf(+(d+T|0)/7)|0,m[p>>2]=x,T=kf(+(g-C|0)/7)|0,m[D>>2]=T,m[k>>2]=0,g=(T|0)<(x|0),d=g?x:T,g=g?T:x;do if((g|0)<0){if((d|0)>0){if((d|-2147483648|0)<(g|0)&((g|0)!=-2147483648&(2147483647-d|0)>=(g|0)))break;Er(23313,22444,404,22469)}if((g|0)==-2147483648|(-2147483648-d|0)>(g|0)&&Er(23313,22444,404,22469),(d|0)>-1){if((d|-2147483648|0)<(g|0))break;Er(23313,22444,404,22469)}else{if((d^-2147483648|0)>=(g|0))break;Er(23313,22444,404,22469)}}while(!1);return d=T-x|0,(x|0)<0?(g=0-x|0,m[D>>2]=d,m[k>>2]=g,m[p>>2]=0,x=0):(d=T,g=0),(d|0)<0&&(x=x-d|0,m[p>>2]=x,g=g-d|0,m[k>>2]=g,m[D>>2]=0,d=0),C=x-g|0,T=d-g|0,(g|0)<0?(m[p>>2]=C,m[D>>2]=T,m[k>>2]=0,d=T,T=C,g=0):T=x,x=(d|0)<(T|0)?d:T,x=(g|0)<(x|0)?g:x,(x|0)<=0?(D=0,D|0):(m[p>>2]=T-x,m[D>>2]=d-x,m[k>>2]=g-x,D=0,D|0)}function Xx(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;k=p+8|0,g=m[k>>2]|0,d=(m[p>>2]|0)-g|0,D=p+4|0,g=(m[D>>2]|0)-g|0,x=kf(+((d*3|0)-g|0)/7)|0,m[p>>2]=x,d=kf(+((g<<1)+d|0)/7)|0,m[D>>2]=d,m[k>>2]=0,g=d-x|0,(x|0)<0?(C=0-x|0,m[D>>2]=g,m[k>>2]=C,m[p>>2]=0,d=g,x=0,g=C):g=0,(d|0)<0&&(x=x-d|0,m[p>>2]=x,g=g-d|0,m[k>>2]=g,m[D>>2]=0,d=0),C=x-g|0,T=d-g|0,(g|0)<0?(m[p>>2]=C,m[D>>2]=T,m[k>>2]=0,d=T,T=C,g=0):T=x,x=(d|0)<(T|0)?d:T,x=(g|0)<(x|0)?g:x,!((x|0)<=0)&&(m[p>>2]=T-x,m[D>>2]=d-x,m[k>>2]=g-x)}function oA(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;k=p+8|0,g=m[k>>2]|0,d=(m[p>>2]|0)-g|0,D=p+4|0,g=(m[D>>2]|0)-g|0,x=kf(+((d<<1)+g|0)/7)|0,m[p>>2]=x,d=kf(+((g*3|0)-d|0)/7)|0,m[D>>2]=d,m[k>>2]=0,g=d-x|0,(x|0)<0?(C=0-x|0,m[D>>2]=g,m[k>>2]=C,m[p>>2]=0,d=g,x=0,g=C):g=0,(d|0)<0&&(x=x-d|0,m[p>>2]=x,g=g-d|0,m[k>>2]=g,m[D>>2]=0,d=0),C=x-g|0,T=d-g|0,(g|0)<0?(m[p>>2]=C,m[D>>2]=T,m[k>>2]=0,d=T,T=C,g=0):T=x,x=(d|0)<(T|0)?d:T,x=(g|0)<(x|0)?g:x,!((x|0)<=0)&&(m[p>>2]=T-x,m[D>>2]=d-x,m[k>>2]=g-x)}function Fd(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;d=m[p>>2]|0,k=p+4|0,g=m[k>>2]|0,D=p+8|0,x=m[D>>2]|0,T=g+(d*3|0)|0,m[p>>2]=T,g=x+(g*3|0)|0,m[k>>2]=g,d=(x*3|0)+d|0,m[D>>2]=d,x=g-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=x,m[D>>2]=d,m[p>>2]=0,g=x,x=0):x=T,(g|0)<0&&(x=x-g|0,m[p>>2]=x,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=x-d|0,T=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=T,m[D>>2]=0,x=C,d=0):T=g,g=(T|0)<(x|0)?T:x,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=x-g,m[k>>2]=T-g,m[D>>2]=d-g)}function Eu(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;T=m[p>>2]|0,k=p+4|0,d=m[k>>2]|0,D=p+8|0,g=m[D>>2]|0,x=(d*3|0)+T|0,T=g+(T*3|0)|0,m[p>>2]=T,m[k>>2]=x,d=(g*3|0)+d|0,m[D>>2]=d,g=x-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=g,m[D>>2]=d,m[p>>2]=0,T=0):g=x,(g|0)<0&&(T=T-g|0,m[p>>2]=T,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=T-d|0,x=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=x,m[D>>2]=0,T=C,d=0):x=g,g=(x|0)<(T|0)?x:T,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=T-g,m[k>>2]=x-g,m[D>>2]=d-g)}function cm(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0;(d+-1|0)>>>0>=6||(T=(m[15440+(d*12|0)>>2]|0)+(m[p>>2]|0)|0,m[p>>2]=T,D=p+4|0,x=(m[15440+(d*12|0)+4>>2]|0)+(m[D>>2]|0)|0,m[D>>2]=x,k=p+8|0,d=(m[15440+(d*12|0)+8>>2]|0)+(m[k>>2]|0)|0,m[k>>2]=d,g=x-T|0,(T|0)<0?(d=d-T|0,m[D>>2]=g,m[k>>2]=d,m[p>>2]=0,x=0):(g=x,x=T),(g|0)<0&&(x=x-g|0,m[p>>2]=x,d=d-g|0,m[k>>2]=d,m[D>>2]=0,g=0),C=x-d|0,T=g-d|0,(d|0)<0?(m[p>>2]=C,m[D>>2]=T,m[k>>2]=0,x=C,d=0):T=g,g=(T|0)<(x|0)?T:x,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=x-g,m[D>>2]=T-g,m[k>>2]=d-g))}function E_(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;T=m[p>>2]|0,k=p+4|0,d=m[k>>2]|0,D=p+8|0,g=m[D>>2]|0,x=d+T|0,T=g+T|0,m[p>>2]=T,m[k>>2]=x,d=g+d|0,m[D>>2]=d,g=x-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=g,m[D>>2]=d,m[p>>2]=0,x=0):(g=x,x=T),(g|0)<0&&(x=x-g|0,m[p>>2]=x,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=x-d|0,T=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=T,m[D>>2]=0,x=C,d=0):T=g,g=(T|0)<(x|0)?T:x,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=x-g,m[k>>2]=T-g,m[D>>2]=d-g)}function Ef(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;d=m[p>>2]|0,k=p+4|0,x=m[k>>2]|0,D=p+8|0,g=m[D>>2]|0,T=x+d|0,m[p>>2]=T,x=g+x|0,m[k>>2]=x,d=g+d|0,m[D>>2]=d,g=x-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=g,m[D>>2]=d,m[p>>2]=0,x=0):(g=x,x=T),(g|0)<0&&(x=x-g|0,m[p>>2]=x,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=x-d|0,T=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=T,m[D>>2]=0,x=C,d=0):T=g,g=(T|0)<(x|0)?T:x,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=x-g,m[k>>2]=T-g,m[D>>2]=d-g)}function Vc(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 Zl(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 aA(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;d=m[p>>2]|0,k=p+4|0,g=m[k>>2]|0,D=p+8|0,x=m[D>>2]|0,T=g+(d<<1)|0,m[p>>2]=T,g=x+(g<<1)|0,m[k>>2]=g,d=(x<<1)+d|0,m[D>>2]=d,x=g-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=x,m[D>>2]=d,m[p>>2]=0,g=x,x=0):x=T,(g|0)<0&&(x=x-g|0,m[p>>2]=x,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=x-d|0,T=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=T,m[D>>2]=0,x=C,d=0):T=g,g=(T|0)<(x|0)?T:x,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=x-g,m[k>>2]=T-g,m[D>>2]=d-g)}function ko(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;T=m[p>>2]|0,k=p+4|0,d=m[k>>2]|0,D=p+8|0,g=m[D>>2]|0,x=(d<<1)+T|0,T=g+(T<<1)|0,m[p>>2]=T,m[k>>2]=x,d=(g<<1)+d|0,m[D>>2]=d,g=x-T|0,(T|0)<0?(d=d-T|0,m[k>>2]=g,m[D>>2]=d,m[p>>2]=0,T=0):g=x,(g|0)<0&&(T=T-g|0,m[p>>2]=T,d=d-g|0,m[D>>2]=d,m[k>>2]=0,g=0),C=T-d|0,x=g-d|0,(d|0)<0?(m[p>>2]=C,m[k>>2]=x,m[D>>2]=0,T=C,d=0):x=g,g=(x|0)<(T|0)?x:T,g=(d|0)<(g|0)?d:g,!((g|0)<=0)&&(m[p>>2]=T-g,m[k>>2]=x-g,m[D>>2]=d-g)}function Yl(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0;return k=(m[p>>2]|0)-(m[d>>2]|0)|0,D=(k|0)<0,x=(m[p+4>>2]|0)-(m[d+4>>2]|0)-(D?k:0)|0,C=(x|0)<0,T=(D?0-k|0:0)+(m[p+8>>2]|0)-(m[d+8>>2]|0)+(C?0-x|0:0)|0,p=(T|0)<0,d=p?0:T,g=(C?0:x)-(p?T:0)|0,T=(D?0:k)-(C?x:0)-(p?T:0)|0,p=(g|0)<(T|0)?g:T,p=(d|0)<(p|0)?d:p,x=(p|0)>0,d=d-(x?p:0)|0,g=g-(x?p:0)|0,p=T-(x?p:0)|0,p=(p|0)>-1?p:0-p|0,g=(g|0)>-1?g:0-g|0,d=(d|0)>-1?d:0-d|0,d=(g|0)>(d|0)?g:d,((p|0)>(d|0)?p:d)|0}function Nd(p,d){p=p|0,d=d|0;var g=0;g=m[p+8>>2]|0,m[d>>2]=(m[p>>2]|0)-g,m[d+4>>2]=(m[p+4>>2]|0)-g}function um(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0;x=m[p>>2]|0,m[d>>2]=x,T=m[p+4>>2]|0,k=d+4|0,m[k>>2]=T,D=d+8|0,m[D>>2]=0,g=(T|0)<(x|0),p=g?x:T,g=g?T:x;do if((g|0)<0){if((p|0)>0){if((p|-2147483648|0)<(g|0)&((g|0)!=-2147483648&(2147483647-p|0)>=(g|0)))break;return p=1,p|0}if((g|0)==-2147483648|(-2147483648-p|0)>(g|0))return d=1,d|0;if((p|0)>-1){if((p|-2147483648|0)<(g|0))break;return p=1,p|0}else{if((p^-2147483648|0)<(g|0))p=1;else break;return p|0}}while(!1);return p=T-x|0,(x|0)<0?(g=0-x|0,m[k>>2]=p,m[D>>2]=g,m[d>>2]=0,x=0):(p=T,g=0),(p|0)<0&&(x=x-p|0,m[d>>2]=x,g=g-p|0,m[D>>2]=g,m[k>>2]=0,p=0),C=x-g|0,T=p-g|0,(g|0)<0?(m[d>>2]=C,m[k>>2]=T,m[D>>2]=0,p=T,T=C,g=0):T=x,x=(p|0)<(T|0)?p:T,x=(g|0)<(x|0)?g:x,(x|0)<=0?(d=0,d|0):(m[d>>2]=T-x,m[k>>2]=p-x,m[D>>2]=g-x,d=0,d|0)}function Mf(p){p=p|0;var d=0,g=0,x=0,T=0;d=p+8|0,T=m[d>>2]|0,g=T-(m[p>>2]|0)|0,m[p>>2]=g,x=p+4|0,p=(m[x>>2]|0)-T|0,m[x>>2]=p,m[d>>2]=0-(p+g)}function hm(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;g=m[p>>2]|0,d=0-g|0,m[p>>2]=d,k=p+8|0,m[k>>2]=0,D=p+4|0,x=m[D>>2]|0,T=x+g|0,(g|0)>0?(m[D>>2]=T,m[k>>2]=g,m[p>>2]=0,d=0,x=T):g=0,(x|0)<0?(C=d-x|0,m[p>>2]=C,g=g-x|0,m[k>>2]=g,m[D>>2]=0,T=C-g|0,d=0-g|0,(g|0)<0?(m[p>>2]=T,m[D>>2]=d,m[k>>2]=0,x=d,g=0):(x=0,T=C)):T=d,d=(x|0)<(T|0)?x:T,d=(g|0)<(d|0)?g:d,!((d|0)<=0)&&(m[p>>2]=T-d,m[D>>2]=x-d,m[k>>2]=g-d)}function M_(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0;if(de=he,he=he+64|0,ie=de,D=de+56|0,!(!0&(d&2013265920|0)==134217728&(!0&(x&2013265920|0)==134217728)))return T=5,he=de,T|0;if((p|0)==(g|0)&(d|0)==(x|0))return m[T>>2]=0,T=0,he=de,T|0;if(k=wt(p|0,d|0,52)|0,ye()|0,k=k&15,G=wt(g|0,x|0,52)|0,ye()|0,(k|0)!=(G&15|0))return T=12,he=de,T|0;if(C=k+-1|0,k>>>0>1){_n(p,d,C,ie)|0,_n(g,x,C,D)|0,G=ie,j=m[G>>2]|0,G=m[G+4>>2]|0;e:do if((j|0)==(m[D>>2]|0)&&(G|0)==(m[D+4>>2]|0)){k=(k^15)*3|0,C=wt(p|0,d|0,k|0)|0,ye()|0,C=C&7,k=wt(g|0,x|0,k|0)|0,ye()|0,k=k&7;do if((C|0)==0|(k|0)==0)m[T>>2]=1,C=0;else if((C|0)==7)C=5;else{if((C|0)==1|(k|0)==1&&Gi(j,G)|0){C=5;break}if((m[15536+(C<<2)>>2]|0)!=(k|0)&&(m[15568+(C<<2)>>2]|0)!=(k|0))break e;m[T>>2]=1,C=0}while(!1);return T=C,he=de,T|0}while(!1)}C=ie,k=C+56|0;do m[C>>2]=0,C=C+4|0;while((C|0)<(k|0));return Od(p,d,1,ie)|0,d=ie,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0))&&(d=ie+8|0,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0)))&&(d=ie+16|0,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0)))&&(d=ie+24|0,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0)))&&(d=ie+32|0,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0)))&&(d=ie+40|0,!((m[d>>2]|0)==(g|0)&&(m[d+4>>2]|0)==(x|0)))?(C=ie+48|0,C=((m[C>>2]|0)==(g|0)?(m[C+4>>2]|0)==(x|0):0)&1):C=1,m[T>>2]=C,T=0,he=de,T|0}function da(p,d,g,x,T){return p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,g=rA(p,d,g,x)|0,(g|0)==7?(T=11,T|0):(x=Vt(g|0,0,56)|0,d=d&-2130706433|(ye()|0)|268435456,m[T>>2]=p|x,m[T+4>>2]=d,T=0,T|0)}function gn(p,d,g){return p=p|0,d=d|0,g=g|0,!0&(d&2013265920|0)==268435456?(m[g>>2]=p,m[g+4>>2]=d&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function lA(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;return T=he,he=he+16|0,x=T,m[x>>2]=0,!0&(d&2013265920|0)==268435456?(C=wt(p|0,d|0,56)|0,ye()|0,x=ps(p,d&-2130706433|134217728,C&7,x,g)|0,he=T,x|0):(x=6,he=T,x|0)}function fm(p,d){p=p|0,d=d|0;var g=0;switch(g=wt(p|0,d|0,56)|0,ye()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=d&-2130706433|134217728,!(!0&(d&2013265920|0)==268435456)||!0&(d&117440512|0)==16777216&(Gi(p,g)|0)!=0?(g=0,g|0):(g=wn(p,g)|0,g|0)}function P_(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;return T=he,he=he+16|0,x=T,!0&(d&2013265920|0)==268435456?(C=d&-2130706433|134217728,k=g,m[k>>2]=p,m[k+4>>2]=C,m[x>>2]=0,d=wt(p|0,d|0,56)|0,ye()|0,x=ps(p,C,d&7,x,g+8|0)|0,he=T,x|0):(x=6,he=T,x|0)}function C_(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0;return T=(Gi(p,d)|0)==0,d=d&-2130706433,x=g,m[x>>2]=T?p:0,m[x+4>>2]=T?d|285212672:0,x=g+8|0,m[x>>2]=p,m[x+4>>2]=d|301989888,x=g+16|0,m[x>>2]=p,m[x+4>>2]=d|318767104,x=g+24|0,m[x>>2]=p,m[x+4>>2]=d|335544320,x=g+32|0,m[x>>2]=p,m[x+4>>2]=d|352321536,g=g+40|0,m[g>>2]=p,m[g+4>>2]=d|369098752,0}function zd(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;return k=he,he=he+16|0,T=k,C=d&-2130706433|134217728,!0&(d&2013265920|0)==268435456?(x=wt(p|0,d|0,56)|0,ye()|0,x=Wc(p,C,x&7)|0,(x|0)==-1?(m[g>>2]=0,C=6,he=k,C|0):(U(p,C,T)|0&&Er(23313,22484,282,22499),d=wt(p|0,d|0,52)|0,ye()|0,d=d&15,Gi(p,C)|0?wh(T,d,x,2,g):Ud(T,d,x,2,g),C=0,he=k,C|0)):(C=6,he=k,C|0)}function Qx(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0;x=he,he=he+16|0,T=x,Lo(p,d,g,T),Uc(T,g+4|0),he=x}function Lo(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0;if(D=he,he=he+16|0,j=D,cA(p,g,j),C=+Jp(+(1-+ue[j>>3]*.5)),C<1e-16){m[x>>2]=0,m[x+4>>2]=0,m[x+8>>2]=0,m[x+12>>2]=0,he=D;return}if(j=m[g>>2]|0,T=+ue[15920+(j*24|0)>>3],T=+Me(T-+Me(+vt(15600+(j<<4)|0,p))),P(d)|0?k=+Me(T+-.3334731722518321):k=T,T=+wu(+C)/.381966011250105,(d|0)>0){p=0;do T=T*2.6457513110645907,p=p+1|0;while((p|0)!=(d|0))}C=+Ri(+k)*T,ue[x>>3]=C,k=+ki(+k)*T,ue[x+8>>3]=k,he=D}function cA(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;if(C=he,he=he+32|0,T=C,_m(p,T),m[d>>2]=0,ue[g>>3]=5,x=+Ki(16400,T),x<+ue[g>>3]&&(m[d>>2]=0,ue[g>>3]=x),x=+Ki(16424,T),x<+ue[g>>3]&&(m[d>>2]=1,ue[g>>3]=x),x=+Ki(16448,T),x<+ue[g>>3]&&(m[d>>2]=2,ue[g>>3]=x),x=+Ki(16472,T),x<+ue[g>>3]&&(m[d>>2]=3,ue[g>>3]=x),x=+Ki(16496,T),x<+ue[g>>3]&&(m[d>>2]=4,ue[g>>3]=x),x=+Ki(16520,T),x<+ue[g>>3]&&(m[d>>2]=5,ue[g>>3]=x),x=+Ki(16544,T),x<+ue[g>>3]&&(m[d>>2]=6,ue[g>>3]=x),x=+Ki(16568,T),x<+ue[g>>3]&&(m[d>>2]=7,ue[g>>3]=x),x=+Ki(16592,T),x<+ue[g>>3]&&(m[d>>2]=8,ue[g>>3]=x),x=+Ki(16616,T),x<+ue[g>>3]&&(m[d>>2]=9,ue[g>>3]=x),x=+Ki(16640,T),x<+ue[g>>3]&&(m[d>>2]=10,ue[g>>3]=x),x=+Ki(16664,T),x<+ue[g>>3]&&(m[d>>2]=11,ue[g>>3]=x),x=+Ki(16688,T),x<+ue[g>>3]&&(m[d>>2]=12,ue[g>>3]=x),x=+Ki(16712,T),x<+ue[g>>3]&&(m[d>>2]=13,ue[g>>3]=x),x=+Ki(16736,T),x<+ue[g>>3]&&(m[d>>2]=14,ue[g>>3]=x),x=+Ki(16760,T),x<+ue[g>>3]&&(m[d>>2]=15,ue[g>>3]=x),x=+Ki(16784,T),x<+ue[g>>3]&&(m[d>>2]=16,ue[g>>3]=x),x=+Ki(16808,T),x<+ue[g>>3]&&(m[d>>2]=17,ue[g>>3]=x),x=+Ki(16832,T),x<+ue[g>>3]&&(m[d>>2]=18,ue[g>>3]=x),x=+Ki(16856,T),!(x<+ue[g>>3])){he=C;return}m[d>>2]=19,ue[g>>3]=x,he=C}function tr(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0;if(C=+Mh(p),C<1e-16){d=15600+(d<<4)|0,m[T>>2]=m[d>>2],m[T+4>>2]=m[d+4>>2],m[T+8>>2]=m[d+8>>2],m[T+12>>2]=m[d+12>>2];return}if(k=+qo(+ +ue[p+8>>3],+ +ue[p>>3]),(g|0)>0){p=0;do C=C/2.6457513110645907,p=p+1|0;while((p|0)!=(g|0))}x?(C=C/3,g=(P(g)|0)==0,C=+vf(+((g?C:C/2.6457513110645907)*.381966011250105))):(C=+vf(+(C*.381966011250105)),P(g)|0&&(k=+Me(k+.3334731722518321))),gt(15600+(d<<4)|0,+Me(+ue[15920+(d*24|0)>>3]-k),C,T)}function yr(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0;x=he,he=he+16|0,T=x,Gl(p+4|0,T),tr(T,m[p>>2]|0,d,0,g),he=x}function wh(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0,Wi=0,Oi=0,xi=0,ai=0,or=0,Qr=0,tn=0,Nr=0;if(Qr=he,he=he+272|0,C=Qr+256|0,rt=Qr+240|0,xi=Qr,ai=Qr+224|0,or=Qr+208|0,nt=Qr+176|0,Xe=Qr+160|0,Zt=Qr+192|0,nr=Qr+144|0,Ut=Qr+128|0,Yt=Qr+112|0,Wi=Qr+96|0,Oi=Qr+80|0,m[C>>2]=d,m[rt>>2]=m[p>>2],m[rt+4>>2]=m[p+4>>2],m[rt+8>>2]=m[p+8>>2],m[rt+12>>2]=m[p+12>>2],uA(rt,C,xi),m[T>>2]=0,rt=x+g+((x|0)==5&1)|0,(rt|0)<=(g|0)){he=Qr;return}j=m[C>>2]|0,G=ai+4|0,ie=nt+4|0,de=g+5|0,Le=16880+(j<<2)|0,Fe=16960+(j<<2)|0,Ie=Ut+8|0,Ye=Yt+8|0,ut=Wi+8|0,lt=or+4|0,D=g;e:for(;;){k=xi+(((D|0)%5|0)<<4)|0,m[or>>2]=m[k>>2],m[or+4>>2]=m[k+4>>2],m[or+8>>2]=m[k+8>>2],m[or+12>>2]=m[k+12>>2];do;while((Mu(or,j,0,1)|0)==2);if((D|0)>(g|0)&(P(d)|0)!=0){if(m[nt>>2]=m[or>>2],m[nt+4>>2]=m[or+4>>2],m[nt+8>>2]=m[or+8>>2],m[nt+12>>2]=m[or+12>>2],Gl(G,Xe),x=m[nt>>2]|0,C=m[17040+(x*80|0)+(m[ai>>2]<<2)>>2]|0,m[nt>>2]=m[18640+(x*80|0)+(C*20|0)>>2],k=m[18640+(x*80|0)+(C*20|0)+16>>2]|0,(k|0)>0){p=0;do E_(ie),p=p+1|0;while((p|0)<(k|0))}switch(k=18640+(x*80|0)+(C*20|0)+4|0,m[Zt>>2]=m[k>>2],m[Zt+4>>2]=m[k+4>>2],m[Zt+8>>2]=m[k+8>>2],om(Zt,(m[Le>>2]|0)*3|0),zn(ie,Zt,ie),Rt(ie),Gl(ie,nr),tn=+(m[Fe>>2]|0),ue[Ut>>3]=tn*3,ue[Ie>>3]=0,Nr=tn*-1.5,ue[Yt>>3]=Nr,ue[Ye>>3]=tn*2.598076211353316,ue[Wi>>3]=Nr,ue[ut>>3]=tn*-2.598076211353316,m[17040+((m[nt>>2]|0)*80|0)+(m[or>>2]<<2)>>2]|0){case 1:{p=Yt,x=Ut;break}case 3:{p=Wi,x=Yt;break}case 2:{p=Ut,x=Wi;break}default:{p=12;break e}}Al(Xe,nr,x,p,Oi),tr(Oi,m[nt>>2]|0,j,1,T+8+(m[T>>2]<<4)|0),m[T>>2]=(m[T>>2]|0)+1}if((D|0)<(de|0)&&(Gl(lt,nt),tr(nt,m[or>>2]|0,j,1,T+8+(m[T>>2]<<4)|0),m[T>>2]=(m[T>>2]|0)+1),m[ai>>2]=m[or>>2],m[ai+4>>2]=m[or+4>>2],m[ai+8>>2]=m[or+8>>2],m[ai+12>>2]=m[or+12>>2],D=D+1|0,(D|0)>=(rt|0)){p=3;break}}if((p|0)==3){he=Qr;return}else(p|0)==12&&Er(22522,22569,571,22579)}function uA(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0;j=he,he=he+128|0,x=j+64|0,T=j,C=x,k=20240,D=C+60|0;do m[C>>2]=m[k>>2],C=C+4|0,k=k+4|0;while((C|0)<(D|0));C=T,k=20304,D=C+60|0;do m[C>>2]=m[k>>2],C=C+4|0,k=k+4|0;while((C|0)<(D|0));D=(P(m[d>>2]|0)|0)==0,x=D?x:T,T=p+4|0,aA(T),ko(T),P(m[d>>2]|0)|0&&(Eu(T),m[d>>2]=(m[d>>2]|0)+1),m[g>>2]=m[p>>2],d=g+4|0,zn(T,x,d),Rt(d),m[g+16>>2]=m[p>>2],d=g+20|0,zn(T,x+12|0,d),Rt(d),m[g+32>>2]=m[p>>2],d=g+36|0,zn(T,x+24|0,d),Rt(d),m[g+48>>2]=m[p>>2],d=g+52|0,zn(T,x+36|0,d),Rt(d),m[g+64>>2]=m[p>>2],g=g+68|0,zn(T,x+48|0,g),Rt(g),he=j}function Mu(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0;if(Ie=he,he=he+32|0,Le=Ie+12|0,D=Ie,Fe=p+4|0,de=m[16960+(d<<2)>>2]|0,ie=(x|0)!=0,de=ie?de*3|0:de,T=m[Fe>>2]|0,G=p+8|0,k=m[G>>2]|0,ie){if(C=p+12|0,x=m[C>>2]|0,T=k+T+x|0,(T|0)==(de|0))return Fe=1,he=Ie,Fe|0;j=C}else j=p+12|0,x=m[j>>2]|0,T=k+T+x|0;if((T|0)<=(de|0))return Fe=0,he=Ie,Fe|0;do if((x|0)>0){if(x=m[p>>2]|0,(k|0)>0){C=18640+(x*80|0)+60|0,x=p;break}x=18640+(x*80|0)+40|0,g?(Tf(Le,de,0,0),Tu(Fe,Le,D),Ef(D),zn(D,Le,Fe),C=x,x=p):(C=x,x=p)}else C=18640+((m[p>>2]|0)*80|0)+20|0,x=p;while(!1);if(m[x>>2]=m[C>>2],T=C+16|0,(m[T>>2]|0)>0){x=0;do E_(Fe),x=x+1|0;while((x|0)<(m[T>>2]|0))}return p=C+4|0,m[Le>>2]=m[p>>2],m[Le+4>>2]=m[p+4>>2],m[Le+8>>2]=m[p+8>>2],d=m[16880+(d<<2)>>2]|0,om(Le,ie?d*3|0:d),zn(Fe,Le,Fe),Rt(Fe),ie?x=((m[G>>2]|0)+(m[Fe>>2]|0)+(m[j>>2]|0)|0)==(de|0)?1:2:x=2,Fe=x,he=Ie,Fe|0}function Xn(p,d){p=p|0,d=d|0;var g=0;do g=Mu(p,d,0,1)|0;while((g|0)==2);return g|0}function Ud(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0,Wi=0,Oi=0,xi=0;if(Wi=he,he=he+240|0,C=Wi+224|0,Zt=Wi+208|0,nr=Wi,Ut=Wi+192|0,Yt=Wi+176|0,ut=Wi+160|0,lt=Wi+144|0,rt=Wi+128|0,nt=Wi+112|0,Xe=Wi+96|0,m[C>>2]=d,m[Zt>>2]=m[p>>2],m[Zt+4>>2]=m[p+4>>2],m[Zt+8>>2]=m[p+8>>2],m[Zt+12>>2]=m[p+12>>2],pa(Zt,C,nr),m[T>>2]=0,Ye=x+g+((x|0)==6&1)|0,(Ye|0)<=(g|0)){he=Wi;return}j=m[C>>2]|0,G=g+6|0,ie=16960+(j<<2)|0,de=lt+8|0,Le=rt+8|0,Fe=nt+8|0,Ie=Ut+4|0,k=0,D=g,x=-1;e:for(;;){if(C=(D|0)%6|0,p=nr+(C<<4)|0,m[Ut>>2]=m[p>>2],m[Ut+4>>2]=m[p+4>>2],m[Ut+8>>2]=m[p+8>>2],m[Ut+12>>2]=m[p+12>>2],p=k,k=Mu(Ut,j,0,1)|0,(D|0)>(g|0)&(P(d)|0)!=0&&(p|0)!=1&&(m[Ut>>2]|0)!=(x|0)){switch(Gl(nr+(((C+5|0)%6|0)<<4)+4|0,Yt),Gl(nr+(C<<4)+4|0,ut),Oi=+(m[ie>>2]|0),ue[lt>>3]=Oi*3,ue[de>>3]=0,xi=Oi*-1.5,ue[rt>>3]=xi,ue[Le>>3]=Oi*2.598076211353316,ue[nt>>3]=xi,ue[Fe>>3]=Oi*-2.598076211353316,C=m[Zt>>2]|0,m[17040+(C*80|0)+(((x|0)==(C|0)?m[Ut>>2]|0:x)<<2)>>2]|0){case 1:{p=rt,x=lt;break}case 3:{p=nt,x=rt;break}case 2:{p=lt,x=nt;break}default:{p=8;break e}}Al(Yt,ut,x,p,Xe),!(ma(Yt,Xe)|0)&&!(ma(ut,Xe)|0)&&(tr(Xe,m[Zt>>2]|0,j,1,T+8+(m[T>>2]<<4)|0),m[T>>2]=(m[T>>2]|0)+1)}if((D|0)<(G|0)&&(Gl(Ie,Yt),tr(Yt,m[Ut>>2]|0,j,1,T+8+(m[T>>2]<<4)|0),m[T>>2]=(m[T>>2]|0)+1),D=D+1|0,(D|0)>=(Ye|0)){p=3;break}else x=m[Ut>>2]|0}if((p|0)==3){he=Wi;return}else(p|0)==8&&Er(22606,22569,736,22651)}function pa(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0;j=he,he=he+160|0,x=j+80|0,T=j,C=x,k=20368,D=C+72|0;do m[C>>2]=m[k>>2],C=C+4|0,k=k+4|0;while((C|0)<(D|0));C=T,k=20448,D=C+72|0;do m[C>>2]=m[k>>2],C=C+4|0,k=k+4|0;while((C|0)<(D|0));D=(P(m[d>>2]|0)|0)==0,x=D?x:T,T=p+4|0,aA(T),ko(T),P(m[d>>2]|0)|0&&(Eu(T),m[d>>2]=(m[d>>2]|0)+1),m[g>>2]=m[p>>2],d=g+4|0,zn(T,x,d),Rt(d),m[g+16>>2]=m[p>>2],d=g+20|0,zn(T,x+12|0,d),Rt(d),m[g+32>>2]=m[p>>2],d=g+36|0,zn(T,x+24|0,d),Rt(d),m[g+48>>2]=m[p>>2],d=g+52|0,zn(T,x+36|0,d),Rt(d),m[g+64>>2]=m[p>>2],d=g+68|0,zn(T,x+48|0,d),Rt(d),m[g+80>>2]=m[p>>2],g=g+84|0,zn(T,x+60|0,g),Rt(g),he=j}function I_(p,d){return p=p|0,d=d|0,d=wt(p|0,d|0,52)|0,ye()|0,d&15|0}function Pu(p,d){return p=p|0,d=d|0,d=wt(p|0,d|0,45)|0,ye()|0,d&127|0}function wn(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0;if(!(!0&(d&-16777216|0)==134217728)||(k=wt(p|0,d|0,45)|0,ye()|0,k=k&127,k>>>0>121))return d=0,d|0;g=wt(p|0,d|0,52)|0,ye()|0,g=g&15;do if(g|0){for(T=1,x=0;;){if(C=wt(p|0,d|0,(15-T|0)*3|0)|0,ye()|0,C=C&7,(C|0)!=0&(x^1))if((C|0)==1&(qi(k)|0)!=0){D=0,x=13;break}else x=1;if((C|0)==7){D=0,x=13;break}if(T>>>0>>0)T=T+1|0;else{x=9;break}}if((x|0)==9){if((g|0)==15)D=1;else break;return D|0}else if((x|0)==13)return D|0}while(!1);for(;;){if(D=wt(p|0,d|0,(14-g|0)*3|0)|0,ye()|0,!((D&7|0)==7&!0)){D=0,x=13;break}if(g>>>0<14)g=g+1|0;else{D=1,x=13;break}}return(x|0)==13?D|0:0}function _n(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0;if(C=wt(p|0,d|0,52)|0,ye()|0,C=C&15,g>>>0>15)return x=4,x|0;if((C|0)<(g|0))return x=12,x|0;if((C|0)==(g|0))return m[x>>2]=p,m[x+4>>2]=d,x=0,x|0;if(T=Vt(g|0,0,52)|0,T=T|p,p=ye()|0|d&-15728641,(C|0)>(g|0))do d=Vt(7,0,(14-g|0)*3|0)|0,g=g+1|0,T=d|T,p=ye()|0|p;while((g|0)<(C|0));return m[x>>2]=T,m[x+4>>2]=p,x=0,x|0}function jc(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0;if(C=wt(p|0,d|0,52)|0,ye()|0,C=C&15,!((g|0)<16&(C|0)<=(g|0)))return x=4,x|0;T=g-C|0,g=wt(p|0,d|0,45)|0,ye()|0;e:do if(!(qi(g&127)|0))g=jn(7,0,T,((T|0)<0)<<31>>31)|0,T=ye()|0;else{t:do if(C|0){for(g=1;k=Vt(7,0,(15-g|0)*3|0)|0,!!((k&p|0)==0&((ye()|0)&d|0)==0);)if(g>>>0>>0)g=g+1|0;else break t;g=jn(7,0,T,((T|0)<0)<<31>>31)|0,T=ye()|0;break e}while(!1);g=jn(7,0,T,((T|0)<0)<<31>>31)|0,g=Do(g|0,ye()|0,5,0)|0,g=ni(g|0,ye()|0,-5,-1)|0,g=Ru(g|0,ye()|0,6,0)|0,g=ni(g|0,ye()|0,1,0)|0,T=ye()|0}while(!1);return k=x,m[k>>2]=g,m[k+4>>2]=T,k=0,k|0}function Gi(p,d){p=p|0,d=d|0;var g=0,x=0,T=0;if(T=wt(p|0,d|0,45)|0,ye()|0,!(qi(T&127)|0))return T=0,T|0;T=wt(p|0,d|0,52)|0,ye()|0,T=T&15;e:do if(!T)g=0;else for(x=1;;){if(g=wt(p|0,d|0,(15-x|0)*3|0)|0,ye()|0,g=g&7,g|0)break e;if(x>>>0>>0)x=x+1|0;else{g=0;break}}while(!1);return T=(g|0)==0&1,T|0}function Vd(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0;if(k=he,he=he+16|0,C=k,ze(C,p,d,g),d=C,p=m[d>>2]|0,d=m[d+4>>2]|0,(p|0)==0&(d|0)==0)return he=k,0;T=0,g=0;do D=x+(T<<3)|0,m[D>>2]=p,m[D+4>>2]=d,T=ni(T|0,g|0,1,0)|0,g=ye()|0,Qe(C),D=C,p=m[D>>2]|0,d=m[D+4>>2]|0;while(!((p|0)==0&(d|0)==0));return he=k,0}function Sh(p,d,g,x){return p=p|0,d=d|0,g=g|0,x=x|0,(x|0)<(g|0)?(g=d,x=p,ii(g|0),x|0):(g=Vt(-1,-1,((x-g|0)*3|0)+3|0)|0,x=Vt(~g|0,~(ye()|0)|0,(15-x|0)*3|0)|0,g=~(ye()|0)&d,x=~x&p,ii(g|0),x|0)}function dm(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0;return T=wt(p|0,d|0,52)|0,ye()|0,T=T&15,(g|0)<16&(T|0)<=(g|0)?((T|0)<(g|0)&&(T=Vt(-1,-1,((g+-1-T|0)*3|0)+3|0)|0,T=Vt(~T|0,~(ye()|0)|0,(15-g|0)*3|0)|0,d=~(ye()|0)&d,p=~T&p),T=Vt(g|0,0,52)|0,g=d&-15728641|(ye()|0),m[x>>2]=p|T,m[x+4>>2]=g,x=0,x|0):(x=4,x|0)}function pm(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0;if((g|0)==0&(x|0)==0)return Ut=0,Ut|0;if(T=p,C=m[T>>2]|0,T=m[T+4>>2]|0,!0&(T&15728640|0)==0){if(!((x|0)>0|(x|0)==0&g>>>0>0)||(Ut=d,m[Ut>>2]=C,m[Ut+4>>2]=T,(g|0)==1&(x|0)==0))return Ut=0,Ut|0;T=1;do Zt=p+(T<<3)|0,nr=m[Zt+4>>2]|0,Ut=d+(T<<3)|0,m[Ut>>2]=m[Zt>>2],m[Ut+4>>2]=nr,T=T+1|0;while(0<(x|0)|(x|0)==0&T>>>0>>0);return T=0,T|0}if(Xe=g<<3,nr=Ql(Xe)|0,!nr)return Ut=13,Ut|0;if(O_(nr|0,p|0,Xe|0)|0,Zt=Hc(g,8)|0,!Zt)return Wr(nr),Ut=13,Ut|0;e:do if(g|0){t:for(;;){T=nr,lt=m[T>>2]|0,T=m[T+4>>2]|0,rt=wt(lt|0,T|0,52)|0,ye()|0,rt=rt&15,nt=rt+-1|0,ut=(g|0)>0;r:do if((rt|0)!=0&ut){if(Fe=((g|0)<0)<<31>>31,Ie=Vt(nt|0,0,52)|0,Ye=ye()|0,nt>>>0>15){if(!((lt|0)==0&(T|0)==0)){Ut=17;break t}for(C=0;;){if(C=C+1|0,(C|0)>=(g|0))break r;if(x=nr+(C<<3)|0,Ye=m[x>>2]|0,x=m[x+4>>2]|0,!((Ye|0)==0&(x|0)==0)){T=x,Ut=17;break t}}}for(C=0,p=lt,x=T;;){if(!((p|0)==0&(x|0)==0)){if(!(!0&(x&117440512|0)==0)){Ut=22;break t}if(D=wt(p|0,x|0,52)|0,ye()|0,D=D&15,(D|0)<(nt|0)){T=12,Ut=28;break t}if((D|0)!=(nt|0)&&(p=p|Ie,x=x&-15728641|Ye,D>>>0>=rt>>>0)){k=nt;do Le=Vt(7,0,(14-k|0)*3|0)|0,k=k+1|0,p=Le|p,x=ye()|0|x;while(k>>>0>>0)}if(k=gs(p|0,x|0,g|0,Fe|0)|0,ye()|0,G=Zt+(k<<3)|0,D=G,j=m[D>>2]|0,D=m[D+4>>2]|0,(j|0)==0&(D|0)==0)k=G;else for(Le=0;;){if((Le|0)>(g|0)){Ut=32;break t}if((j|0)==(p|0)&(D&-117440513|0)==(x|0)){ie=wt(j|0,D|0,56)|0,ye()|0,ie=ie&7,de=ie+1|0,Yt=wt(j|0,D|0,45)|0,ye()|0;i:do if(!(qi(Yt&127)|0))D=7;else{if(j=wt(j|0,D|0,52)|0,ye()|0,j=j&15,!j){D=6;break}for(D=1;;){if(Yt=Vt(7,0,(15-D|0)*3|0)|0,!((Yt&p|0)==0&((ye()|0)&x|0)==0)){D=7;break i}if(D>>>0>>0)D=D+1|0;else{D=6;break}}}while(!1);if((ie+2|0)>>>0>D>>>0){Ut=42;break t}Yt=Vt(de|0,0,56)|0,x=ye()|0|x&-117440513,de=G,m[de>>2]=0,m[de+4>>2]=0,p=Yt|p}else k=(k+1|0)%(g|0)|0;if(G=Zt+(k<<3)|0,D=G,j=m[D>>2]|0,D=m[D+4>>2]|0,(j|0)==0&(D|0)==0){k=G;break}else Le=Le+1|0}Yt=k,m[Yt>>2]=p,m[Yt+4>>2]=x}if(C=C+1|0,(C|0)>=(g|0))break r;x=nr+(C<<3)|0,p=m[x>>2]|0,x=m[x+4>>2]|0}}while(!1);if((g+5|0)>>>0<11){Ut=85;break}if(Ye=Hc((g|0)/6|0,8)|0,!Ye){Ut=49;break}r:do if(ut){Le=0,de=0;do{if(D=Zt+(Le<<3)|0,x=D,C=m[x>>2]|0,x=m[x+4>>2]|0,!((C|0)==0&(x|0)==0)){j=wt(C|0,x|0,56)|0,ye()|0,j=j&7,p=j+1|0,G=x&-117440513,Yt=wt(C|0,x|0,45)|0,ye()|0;i:do if(qi(Yt&127)|0){if(ie=wt(C|0,x|0,52)|0,ye()|0,ie=ie&15,ie|0)for(k=1;;){if(Yt=Vt(7,0,(15-k|0)*3|0)|0,!((C&Yt|0)==0&(G&(ye()|0)|0)==0))break i;if(k>>>0>>0)k=k+1|0;else break}x=Vt(p|0,0,56)|0,C=x|C,x=ye()|0|G,p=D,m[p>>2]=C,m[p+4>>2]=x,p=j+2|0}while(!1);(p|0)==7&&(Yt=Ye+(de<<3)|0,m[Yt>>2]=C,m[Yt+4>>2]=x&-117440513,de=de+1|0)}Le=Le+1|0}while((Le|0)!=(g|0));if(ut){if(Le=((g|0)<0)<<31>>31,Fe=Vt(nt|0,0,52)|0,Ie=ye()|0,nt>>>0>15){if(!((lt|0)==0&(T|0)==0)){T=4,Ut=84;break t}for(T=0;;){if(T=T+1|0,(T|0)>=(g|0)){C=0,T=de;break r}if(Yt=nr+(T<<3)|0,!((m[Yt>>2]|0)==0&(m[Yt+4>>2]|0)==0)){T=4,Ut=84;break t}}}for(ie=0,C=0,G=lt;;){do if(!((G|0)==0&(T|0)==0)){if(D=wt(G|0,T|0,52)|0,ye()|0,D=D&15,(D|0)<(nt|0)){T=12,Ut=84;break t}do if((D|0)==(nt|0))x=G,D=T;else{if(x=G|Fe,p=T&-15728641|Ie,D>>>0>>0){D=p;break}k=nt;do Yt=Vt(7,0,(14-k|0)*3|0)|0,k=k+1|0,x=Yt|x,p=ye()|0|p;while(k>>>0>>0);D=p}while(!1);for(k=gs(x|0,D|0,g|0,Le|0)|0,ye()|0,p=0;;){if((p|0)>(g|0)){Ut=77;break t}if(Yt=Zt+(k<<3)|0,j=m[Yt+4>>2]|0,(j&-117440513|0)==(D|0)&&(m[Yt>>2]|0)==(x|0)){Ut=79;break}if(k=(k+1|0)%(g|0)|0,Yt=Zt+(k<<3)|0,(m[Yt>>2]|0)==(x|0)&&(m[Yt+4>>2]|0)==(D|0))break;p=p+1|0}if((Ut|0)==79&&(Ut=0,!0&(j&117440512|0)==100663296))break;Yt=d+(C<<3)|0,m[Yt>>2]=G,m[Yt+4>>2]=T,C=C+1|0}while(!1);if(T=ie+1|0,(T|0)>=(g|0)){T=de;break r}Yt=nr+(T<<3)|0,ie=T,G=m[Yt>>2]|0,T=m[Yt+4>>2]|0}}else C=0,T=de}else C=0,T=0;while(!1);if(Lf(Zt|0,0,Xe|0)|0,O_(nr|0,Ye|0,T<<3|0)|0,Wr(Ye),T)d=d+(C<<3)|0,g=T;else break e}if((Ut|0)==17)!0&(T&117440512|0)==0?(T=4,Ut=28):Ut=22;else if((Ut|0)==32)Er(23313,22674,362,22684);else{if((Ut|0)==42)return Wr(nr),Wr(Zt),Yt=10,Yt|0;if((Ut|0)==49)return Wr(nr),Wr(Zt),Yt=13,Yt|0;if((Ut|0)==77)Er(23313,22674,462,22684);else{if((Ut|0)==84)return Wr(Ye),Wr(nr),Wr(Zt),Yt=T,Yt|0;if((Ut|0)==85){O_(d|0,nr|0,g<<3|0)|0;break}}}if((Ut|0)==22)return Wr(nr),Wr(Zt),Yt=5,Yt|0;if((Ut|0)==28)return Wr(nr),Wr(Zt),Yt=T,Yt|0}while(!1);return Wr(nr),Wr(Zt),Yt=0,Yt|0}function Pf(p,d,g,x,T,C,k){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,C=C|0,k=k|0;var D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0;if(Ye=he,he=he+16|0,Ie=Ye,!((g|0)>0|(g|0)==0&d>>>0>0))return Ie=0,he=Ye,Ie|0;if((k|0)>=16)return Ie=12,he=Ye,Ie|0;Le=0,Fe=0,de=0,D=0;e:for(;;){if(G=p+(Le<<3)|0,j=m[G>>2]|0,G=m[G+4>>2]|0,ie=wt(j|0,G|0,52)|0,ye()|0,(ie&15|0)>(k|0)){D=12,j=11;break}if(ze(Ie,j,G,k),ie=Ie,G=m[ie>>2]|0,ie=m[ie+4>>2]|0,(G|0)==0&(ie|0)==0)j=de;else{j=de;do{if(!((D|0)<(C|0)|(D|0)==(C|0)&j>>>0>>0)){j=10;break e}de=x+(j<<3)|0,m[de>>2]=G,m[de+4>>2]=ie,j=ni(j|0,D|0,1,0)|0,D=ye()|0,Qe(Ie),de=Ie,G=m[de>>2]|0,ie=m[de+4>>2]|0}while(!((G|0)==0&(ie|0)==0))}if(Le=ni(Le|0,Fe|0,1,0)|0,Fe=ye()|0,(Fe|0)<(g|0)|(Fe|0)==(g|0)&Le>>>0>>0)de=j;else{D=0,j=11;break}}return(j|0)==10?(Ie=14,he=Ye,Ie|0):(j|0)==11?(he=Ye,D|0):0}function Am(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0;Le=he,he=he+16|0,de=Le;e:do if((g|0)>0|(g|0)==0&d>>>0>0){for(G=0,k=0,C=0,ie=0;;){if(j=p+(G<<3)|0,D=m[j>>2]|0,j=m[j+4>>2]|0,!((D|0)==0&(j|0)==0)&&(j=(jc(D,j,x,de)|0)==0,D=de,k=ni(m[D>>2]|0,m[D+4>>2]|0,k|0,C|0)|0,C=ye()|0,!j)){C=12;break}if(G=ni(G|0,ie|0,1,0)|0,ie=ye()|0,!((ie|0)<(g|0)|(ie|0)==(g|0)&G>>>0>>0))break e}return he=Le,C|0}else k=0,C=0;while(!1);return m[T>>2]=k,m[T+4>>2]=C,T=0,he=Le,T|0}function mm(p,d){return p=p|0,d=d|0,d=wt(p|0,d|0,52)|0,ye()|0,d&1|0}function jr(p,d){p=p|0,d=d|0;var g=0,x=0,T=0;if(T=wt(p|0,d|0,52)|0,ye()|0,T=T&15,!T)return T=0,T|0;for(x=1;;){if(g=wt(p|0,d|0,(15-x|0)*3|0)|0,ye()|0,g=g&7,g|0){x=5;break}if(x>>>0>>0)x=x+1|0;else{g=0,x=5;break}}return(x|0)==5?g|0:0}function E(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0;if(j=wt(p|0,d|0,52)|0,ye()|0,j=j&15,!j)return D=d,j=p,ii(D|0),j|0;for(D=1,g=0;;){C=(15-D|0)*3|0,x=Vt(7,0,C|0)|0,T=ye()|0,k=wt(p|0,d|0,C|0)|0,ye()|0,C=Vt(Vc(k&7)|0,0,C|0)|0,k=ye()|0,p=C|p&~x,d=k|d&~T;e:do if(!g)if((C&x|0)==0&(k&T|0)==0)g=0;else if(x=wt(p|0,d|0,52)|0,ye()|0,x=x&15,!x)g=1;else{g=1;t:for(;;){switch(k=wt(p|0,d|0,(15-g|0)*3|0)|0,ye()|0,k&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0>>0)g=g+1|0;else{g=1;break e}}for(g=1;;)if(k=(15-g|0)*3|0,T=wt(p|0,d|0,k|0)|0,ye()|0,C=Vt(7,0,k|0)|0,d=d&~(ye()|0),k=Vt(Vc(T&7)|0,0,k|0)|0,p=p&~C|k,d=d|(ye()|0),g>>>0>>0)g=g+1|0;else{g=1;break}}while(!1);if(D>>>0>>0)D=D+1|0;else break}return ii(d|0),p|0}function l(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0;if(x=wt(p|0,d|0,52)|0,ye()|0,x=x&15,!x)return g=d,x=p,ii(g|0),x|0;for(g=1;C=(15-g|0)*3|0,k=wt(p|0,d|0,C|0)|0,ye()|0,T=Vt(7,0,C|0)|0,d=d&~(ye()|0),C=Vt(Vc(k&7)|0,0,C|0)|0,p=C|p&~T,d=ye()|0|d,g>>>0>>0;)g=g+1|0;return ii(d|0),p|0}function A(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0;if(j=wt(p|0,d|0,52)|0,ye()|0,j=j&15,!j)return D=d,j=p,ii(D|0),j|0;for(D=1,g=0;;){C=(15-D|0)*3|0,x=Vt(7,0,C|0)|0,T=ye()|0,k=wt(p|0,d|0,C|0)|0,ye()|0,C=Vt(Zl(k&7)|0,0,C|0)|0,k=ye()|0,p=C|p&~x,d=k|d&~T;e:do if(!g)if((C&x|0)==0&(k&T|0)==0)g=0;else if(x=wt(p|0,d|0,52)|0,ye()|0,x=x&15,!x)g=1;else{g=1;t:for(;;){switch(k=wt(p|0,d|0,(15-g|0)*3|0)|0,ye()|0,k&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0>>0)g=g+1|0;else{g=1;break e}}for(g=1;;)if(T=(15-g|0)*3|0,C=Vt(7,0,T|0)|0,k=d&~(ye()|0),d=wt(p|0,d|0,T|0)|0,ye()|0,d=Vt(Zl(d&7)|0,0,T|0)|0,p=p&~C|d,d=k|(ye()|0),g>>>0>>0)g=g+1|0;else{g=1;break}}while(!1);if(D>>>0>>0)D=D+1|0;else break}return ii(d|0),p|0}function v(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0;if(x=wt(p|0,d|0,52)|0,ye()|0,x=x&15,!x)return g=d,x=p,ii(g|0),x|0;for(g=1;k=(15-g|0)*3|0,C=Vt(7,0,k|0)|0,T=d&~(ye()|0),d=wt(p|0,d|0,k|0)|0,ye()|0,d=Vt(Zl(d&7)|0,0,k|0)|0,p=d|p&~C,d=ye()|0|T,g>>>0>>0;)g=g+1|0;return ii(d|0),p|0}function S(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(j=he,he=he+64|0,D=j+40|0,x=j+24|0,T=j+12|0,C=j,Vt(d|0,0,52)|0,g=ye()|0|134225919,!d)return(m[p+4>>2]|0)>2||(m[p+8>>2]|0)>2||(m[p+12>>2]|0)>2?(k=0,D=0,ii(k|0),he=j,D|0):(Vt(nm(p)|0,0,45)|0,k=ye()|0|g,D=-1,ii(k|0),he=j,D|0);if(m[D>>2]=m[p>>2],m[D+4>>2]=m[p+4>>2],m[D+8>>2]=m[p+8>>2],m[D+12>>2]=m[p+12>>2],k=D+4|0,(d|0)>0)for(p=-1;m[x>>2]=m[k>>2],m[x+4>>2]=m[k+4>>2],m[x+8>>2]=m[k+8>>2],d&1?(Xx(k),m[T>>2]=m[k>>2],m[T+4>>2]=m[k+4>>2],m[T+8>>2]=m[k+8>>2],Fd(T)):(oA(k),m[T>>2]=m[k>>2],m[T+4>>2]=m[k+4>>2],m[T+8>>2]=m[k+8>>2],Eu(T)),Tu(x,T,C),Rt(C),ie=(15-d|0)*3|0,G=Vt(7,0,ie|0)|0,g=g&~(ye()|0),ie=Vt(Nt(C)|0,0,ie|0)|0,p=ie|p&~G,g=ye()|0|g,(d|0)>1;)d=d+-1|0;else p=-1;e:do if((m[k>>2]|0)<=2&&(m[D+8>>2]|0)<=2&&(m[D+12>>2]|0)<=2){if(x=nm(D)|0,d=Vt(x|0,0,45)|0,d=d|p,p=ye()|0|g&-1040385,C=w_(D)|0,!(qi(x)|0)){if((C|0)<=0)break;for(T=0;;){if(x=wt(d|0,p|0,52)|0,ye()|0,x=x&15,x)for(g=1;ie=(15-g|0)*3|0,D=wt(d|0,p|0,ie|0)|0,ye()|0,G=Vt(7,0,ie|0)|0,p=p&~(ye()|0),ie=Vt(Vc(D&7)|0,0,ie|0)|0,d=d&~G|ie,p=p|(ye()|0),g>>>0>>0;)g=g+1|0;if(T=T+1|0,(T|0)==(C|0))break e}}T=wt(d|0,p|0,52)|0,ye()|0,T=T&15;t:do if(T){g=1;r:for(;;){switch(ie=wt(d|0,p|0,(15-g|0)*3|0)|0,ye()|0,ie&7){case 1:break r;case 0:break;default:break t}if(g>>>0>>0)g=g+1|0;else break t}if(fa(x,m[D>>2]|0)|0)for(g=1;D=(15-g|0)*3|0,G=Vt(7,0,D|0)|0,ie=p&~(ye()|0),p=wt(d|0,p|0,D|0)|0,ye()|0,p=Vt(Zl(p&7)|0,0,D|0)|0,d=d&~G|p,p=ie|(ye()|0),g>>>0>>0;)g=g+1|0;else for(g=1;ie=(15-g|0)*3|0,D=wt(d|0,p|0,ie|0)|0,ye()|0,G=Vt(7,0,ie|0)|0,p=p&~(ye()|0),ie=Vt(Vc(D&7)|0,0,ie|0)|0,d=d&~G|ie,p=p|(ye()|0),g>>>0>>0;)g=g+1|0}while(!1);if((C|0)>0){g=0;do d=E(d,p)|0,p=ye()|0,g=g+1|0;while((g|0)!=(C|0))}}else d=0,p=0;while(!1);return G=p,ie=d,ii(G|0),he=j,ie|0}function P(p){return p=p|0,(p|0)%2|0|0}function B(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0;return T=he,he=he+16|0,x=T,d>>>0>15?(x=4,he=T,x|0):(m[p+4>>2]&2146435072|0)==2146435072||(m[p+8+4>>2]&2146435072|0)==2146435072?(x=3,he=T,x|0):(Qx(p,d,x),d=S(x,d)|0,x=ye()|0,m[g>>2]=d,m[g+4>>2]=x,(d|0)==0&(x|0)==0&&Er(23313,22674,786,22697),x=0,he=T,x|0)}function F(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;if(T=g+4|0,C=wt(p|0,d|0,52)|0,ye()|0,C=C&15,k=wt(p|0,d|0,45)|0,ye()|0,x=(C|0)==0,qi(k&127)|0){if(x)return k=1,k|0;x=1}else{if(x)return k=0,k|0;!(m[T>>2]|0)&&!(m[g+8>>2]|0)?x=(m[g+12>>2]|0)!=0&1:x=1}for(g=1;g&1?Fd(T):Eu(T),k=wt(p|0,d|0,(15-g|0)*3|0)|0,ye()|0,cm(T,k&7),g>>>0>>0;)g=g+1|0;return x|0}function U(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(ie=he,he=he+16|0,j=ie,G=wt(p|0,d|0,45)|0,ye()|0,G=G&127,G>>>0>121)return m[g>>2]=0,m[g+4>>2]=0,m[g+8>>2]=0,m[g+12>>2]=0,G=5,he=ie,G|0;e:do if(qi(G)|0&&(C=wt(p|0,d|0,52)|0,ye()|0,C=C&15,(C|0)!=0)){x=1;t:for(;;){switch(D=wt(p|0,d|0,(15-x|0)*3|0)|0,ye()|0,D&7){case 5:break t;case 0:break;default:{x=d;break e}}if(x>>>0>>0)x=x+1|0;else{x=d;break e}}for(T=1,x=d;d=(15-T|0)*3|0,k=Vt(7,0,d|0)|0,D=x&~(ye()|0),x=wt(p|0,x|0,d|0)|0,ye()|0,x=Vt(Zl(x&7)|0,0,d|0)|0,p=p&~k|x,x=D|(ye()|0),T>>>0>>0;)T=T+1|0}else x=d;while(!1);if(D=7696+(G*28|0)|0,m[g>>2]=m[D>>2],m[g+4>>2]=m[D+4>>2],m[g+8>>2]=m[D+8>>2],m[g+12>>2]=m[D+12>>2],!(F(p,x,g)|0))return G=0,he=ie,G|0;if(k=g+4|0,m[j>>2]=m[k>>2],m[j+4>>2]=m[k+4>>2],m[j+8>>2]=m[k+8>>2],C=wt(p|0,x|0,52)|0,ye()|0,D=C&15,C&1?(Eu(k),C=D+1|0):C=D,!(qi(G)|0))x=0;else{e:do if(!D)x=0;else for(d=1;;){if(T=wt(p|0,x|0,(15-d|0)*3|0)|0,ye()|0,T=T&7,T|0){x=T;break e}if(d>>>0>>0)d=d+1|0;else{x=0;break}}while(!1);x=(x|0)==4&1}if(!(Mu(g,C,x,0)|0))(C|0)!=(D|0)&&(m[k>>2]=m[j>>2],m[k+4>>2]=m[j+4>>2],m[k+8>>2]=m[j+8>>2]);else{if(qi(G)|0)do;while(Mu(g,C,0,0)|0);(C|0)!=(D|0)&&oA(k)}return G=0,he=ie,G|0}function H(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;return C=he,he=he+16|0,x=C,T=U(p,d,x)|0,T|0?(he=C,T|0):(T=wt(p|0,d|0,52)|0,ye()|0,yr(x,T&15,g),T=0,he=C,T|0)}function Y(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0;if(k=he,he=he+16|0,C=k,x=U(p,d,C)|0,x|0)return C=x,he=k,C|0;x=wt(p|0,d|0,45)|0,ye()|0,x=(qi(x&127)|0)==0,T=wt(p|0,d|0,52)|0,ye()|0,T=T&15;e:do if(!x){if(T|0)for(x=1;;){if(D=Vt(7,0,(15-x|0)*3|0)|0,!((D&p|0)==0&((ye()|0)&d|0)==0))break e;if(x>>>0>>0)x=x+1|0;else break}return wh(C,T,0,5,g),D=0,he=k,D|0}while(!1);return Ud(C,T,0,6,g),D=0,he=k,D|0}function X(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;if(T=wt(p|0,d|0,45)|0,ye()|0,!(qi(T&127)|0))return T=2,m[g>>2]=T,0;if(T=wt(p|0,d|0,52)|0,ye()|0,T=T&15,!T)return T=5,m[g>>2]=T,0;for(x=1;;){if(C=Vt(7,0,(15-x|0)*3|0)|0,!((C&p|0)==0&((ye()|0)&d|0)==0)){x=2,p=6;break}if(x>>>0>>0)x=x+1|0;else{x=5,p=6;break}}return(p|0)==6&&(m[g>>2]=x),0}function se(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0;de=he,he=he+128|0,G=de+112|0,C=de+96|0,ie=de,T=wt(p|0,d|0,52)|0,ye()|0,D=T&15,m[G>>2]=D,k=wt(p|0,d|0,45)|0,ye()|0,k=k&127;e:do if(qi(k)|0){if(D|0)for(x=1;;){if(j=Vt(7,0,(15-x|0)*3|0)|0,!((j&p|0)==0&((ye()|0)&d|0)==0)){T=0;break e}if(x>>>0>>0)x=x+1|0;else break}if(T&1)T=1;else return j=Vt(D+1|0,0,52)|0,ie=ye()|0|d&-15728641,G=Vt(7,0,(14-D|0)*3|0)|0,ie=se((j|p)&~G,ie&~(ye()|0),g)|0,he=de,ie|0}else T=0;while(!1);if(x=U(p,d,C)|0,!x){T?(uA(C,G,ie),j=5):(pa(C,G,ie),j=6);e:do if(qi(k)|0)if(!D)p=5;else for(x=1;;){if(k=Vt(7,0,(15-x|0)*3|0)|0,!((k&p|0)==0&((ye()|0)&d|0)==0)){p=2;break e}if(x>>>0>>0)x=x+1|0;else{p=5;break}}else p=2;while(!1);Lf(g|0,-1,p<<2|0)|0;e:do if(T)for(C=0;;){if(k=ie+(C<<4)|0,Xn(k,m[G>>2]|0)|0,k=m[k>>2]|0,D=m[g>>2]|0,(D|0)==-1|(D|0)==(k|0))x=g;else{T=0;do{if(T=T+1|0,T>>>0>=p>>>0){x=1;break e}x=g+(T<<2)|0,D=m[x>>2]|0}while(!((D|0)==-1|(D|0)==(k|0)))}if(m[x>>2]=k,C=C+1|0,C>>>0>=j>>>0){x=0;break}}else for(C=0;;){if(k=ie+(C<<4)|0,Mu(k,m[G>>2]|0,0,1)|0,k=m[k>>2]|0,D=m[g>>2]|0,(D|0)==-1|(D|0)==(k|0))x=g;else{T=0;do{if(T=T+1|0,T>>>0>=p>>>0){x=1;break e}x=g+(T<<2)|0,D=m[x>>2]|0}while(!((D|0)==-1|(D|0)==(k|0)))}if(m[x>>2]=k,C=C+1|0,C>>>0>=j>>>0){x=0;break}}while(!1)}return ie=x,he=de,ie|0}function ge(){return 12}function me(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0;if(p>>>0>15)return D=4,D|0;if(Vt(p|0,0,52)|0,D=ye()|0|134225919,!p){g=0,x=0;do qi(x)|0&&(Vt(x|0,0,45)|0,k=D|(ye()|0),p=d+(g<<3)|0,m[p>>2]=-1,m[p+4>>2]=k,g=g+1|0),x=x+1|0;while((x|0)!=122);return g=0,g|0}g=0,k=0;do{if(qi(k)|0){for(Vt(k|0,0,45)|0,x=1,T=-1,C=D|(ye()|0);j=Vt(7,0,(15-x|0)*3|0)|0,T=T&~j,C=C&~(ye()|0),(x|0)!=(p|0);)x=x+1|0;j=d+(g<<3)|0,m[j>>2]=T,m[j+4>>2]=C,g=g+1|0}k=k+1|0}while((k|0)!=122);return g=0,g|0}function we(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0;if(rt=he,he=he+16|0,ut=rt,lt=wt(p|0,d|0,52)|0,ye()|0,lt=lt&15,g>>>0>15)return lt=4,he=rt,lt|0;if((lt|0)<(g|0))return lt=12,he=rt,lt|0;if((lt|0)!=(g|0))if(C=Vt(g|0,0,52)|0,C=C|p,D=ye()|0|d&-15728641,(lt|0)>(g|0)){j=g;do Ye=Vt(7,0,(14-j|0)*3|0)|0,j=j+1|0,C=Ye|C,D=ye()|0|D;while((j|0)<(lt|0));Ye=C}else Ye=C;else Ye=p,D=d;Ie=wt(Ye|0,D|0,45)|0,ye()|0;e:do if(qi(Ie&127)|0){if(j=wt(Ye|0,D|0,52)|0,ye()|0,j=j&15,j|0)for(C=1;;){if(Ie=Vt(7,0,(15-C|0)*3|0)|0,!((Ie&Ye|0)==0&((ye()|0)&D|0)==0)){G=33;break e}if(C>>>0>>0)C=C+1|0;else break}if(Ie=x,m[Ie>>2]=0,m[Ie+4>>2]=0,(lt|0)>(g|0)){for(Ie=d&-15728641,Fe=lt;;){if(Le=Fe,Fe=Fe+-1|0,Fe>>>0>15|(lt|0)<(Fe|0)){G=19;break}if((lt|0)!=(Fe|0))if(C=Vt(Fe|0,0,52)|0,C=C|p,j=ye()|0|Ie,(lt|0)<(Le|0))de=C;else{G=Fe;do de=Vt(7,0,(14-G|0)*3|0)|0,G=G+1|0,C=de|C,j=ye()|0|j;while((G|0)<(lt|0));de=C}else de=p,j=d;if(ie=wt(de|0,j|0,45)|0,ye()|0,!(qi(ie&127)|0))C=0;else{ie=wt(de|0,j|0,52)|0,ye()|0,ie=ie&15;t:do if(!ie)C=0;else for(G=1;;){if(C=wt(de|0,j|0,(15-G|0)*3|0)|0,ye()|0,C=C&7,C|0)break t;if(G>>>0>>0)G=G+1|0;else{C=0;break}}while(!1);C=(C|0)==0&1}if(j=wt(p|0,d|0,(15-Le|0)*3|0)|0,ye()|0,j=j&7,(j|0)==7){T=5,G=42;break}if(C=(C|0)!=0,(j|0)==1&C){T=5,G=42;break}if(de=j+(((j|0)!=0&C)<<31>>31)|0,de|0&&(G=lt-Le|0,G=jn(7,0,G,((G|0)<0)<<31>>31)|0,ie=ye()|0,C?(C=Do(G|0,ie|0,5,0)|0,C=ni(C|0,ye()|0,-5,-1)|0,C=Ru(C|0,ye()|0,6,0)|0,C=ni(C|0,ye()|0,1,0)|0,j=ye()|0):(C=G,j=ie),Le=de+-1|0,Le=Do(G|0,ie|0,Le|0,((Le|0)<0)<<31>>31|0)|0,Le=ni(C|0,j|0,Le|0,ye()|0)|0,de=ye()|0,ie=x,ie=ni(Le|0,de|0,m[ie>>2]|0,m[ie+4>>2]|0)|0,de=ye()|0,Le=x,m[Le>>2]=ie,m[Le+4>>2]=de),(Fe|0)<=(g|0)){G=37;break}}if((G|0)==19)Er(23313,22674,1099,22710);else if((G|0)==37){k=x,T=m[k+4>>2]|0,k=m[k>>2]|0;break}else if((G|0)==42)return he=rt,T|0}else T=0,k=0}else G=33;while(!1);e:do if((G|0)==33)if(Ie=x,m[Ie>>2]=0,m[Ie+4>>2]=0,(lt|0)>(g|0)){for(C=lt;;){if(T=wt(p|0,d|0,(15-C|0)*3|0)|0,ye()|0,T=T&7,(T|0)==7){T=5;break}if(k=lt-C|0,k=jn(7,0,k,((k|0)<0)<<31>>31)|0,T=Do(k|0,ye()|0,T|0,0)|0,k=ye()|0,Ie=x,k=ni(m[Ie>>2]|0,m[Ie+4>>2]|0,T|0,k|0)|0,T=ye()|0,Ie=x,m[Ie>>2]=k,m[Ie+4>>2]=T,C=C+-1|0,(C|0)<=(g|0))break e}return he=rt,T|0}else T=0,k=0;while(!1);return jc(Ye,D,lt,ut)|0&&Er(23313,22674,1063,22725),lt=ut,ut=m[lt+4>>2]|0,((T|0)>-1|(T|0)==-1&k>>>0>4294967295)&((ut|0)>(T|0)|((ut|0)==(T|0)?(m[lt>>2]|0)>>>0>k>>>0:0))?(lt=0,he=rt,lt|0):(Er(23313,22674,1139,22710),0)}function Ae(p,d,g,x,T,C){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,C=C|0;var k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0;if(de=he,he=he+16|0,k=de,T>>>0>15)return C=4,he=de,C|0;if(D=wt(g|0,x|0,52)|0,ye()|0,D=D&15,(D|0)>(T|0))return C=12,he=de,C|0;if(jc(g,x,T,k)|0&&Er(23313,22674,1063,22725),ie=k,G=m[ie+4>>2]|0,!(((d|0)>-1|(d|0)==-1&p>>>0>4294967295)&((G|0)>(d|0)|((G|0)==(d|0)?(m[ie>>2]|0)>>>0>p>>>0:0))))return C=2,he=de,C|0;ie=T-D|0,T=Vt(T|0,0,52)|0,j=ye()|0|x&-15728641,G=C,m[G>>2]=T|g,m[G+4>>2]=j,G=wt(g|0,x|0,45)|0,ye()|0;e:do if(qi(G&127)|0){if(D|0)for(k=1;;){if(G=Vt(7,0,(15-k|0)*3|0)|0,!((G&g|0)==0&((ye()|0)&x|0)==0))break e;if(k>>>0>>0)k=k+1|0;else break}if((ie|0)<1)return C=0,he=de,C|0;for(G=D^15,x=-1,j=1,k=1;;){D=ie-j|0,D=jn(7,0,D,((D|0)<0)<<31>>31)|0,g=ye()|0;do if(k)if(k=Do(D|0,g|0,5,0)|0,k=ni(k|0,ye()|0,-5,-1)|0,k=Ru(k|0,ye()|0,6,0)|0,T=ye()|0,(d|0)>(T|0)|(d|0)==(T|0)&p>>>0>k>>>0){d=ni(p|0,d|0,-1,-1)|0,d=Qo(d|0,ye()|0,k|0,T|0)|0,k=ye()|0,Le=C,Ie=m[Le>>2]|0,Le=m[Le+4>>2]|0,Ye=(G+x|0)*3|0,Fe=Vt(7,0,Ye|0)|0,Le=Le&~(ye()|0),x=Ru(d|0,k|0,D|0,g|0)|0,p=ye()|0,T=ni(x|0,p|0,2,0)|0,Ye=Vt(T|0,ye()|0,Ye|0)|0,Le=ye()|0|Le,T=C,m[T>>2]=Ye|Ie&~Fe,m[T+4>>2]=Le,p=Do(x|0,p|0,D|0,g|0)|0,p=Qo(d|0,k|0,p|0,ye()|0)|0,k=0,d=ye()|0;break}else{Ye=C,Fe=m[Ye>>2]|0,Ye=m[Ye+4>>2]|0,Ie=Vt(7,0,(G+x|0)*3|0)|0,Ye=Ye&~(ye()|0),k=C,m[k>>2]=Fe&~Ie,m[k+4>>2]=Ye,k=1;break}else Fe=C,T=m[Fe>>2]|0,Fe=m[Fe+4>>2]|0,x=(G+x|0)*3|0,Le=Vt(7,0,x|0)|0,Fe=Fe&~(ye()|0),Ye=Ru(p|0,d|0,D|0,g|0)|0,k=ye()|0,x=Vt(Ye|0,k|0,x|0)|0,Fe=ye()|0|Fe,Ie=C,m[Ie>>2]=x|T&~Le,m[Ie+4>>2]=Fe,k=Do(Ye|0,k|0,D|0,g|0)|0,p=Qo(p|0,d|0,k|0,ye()|0)|0,k=0,d=ye()|0;while(!1);if((ie|0)>(j|0))x=~j,j=j+1|0;else{d=0;break}}return he=de,d|0}while(!1);if((ie|0)<1)return Ye=0,he=de,Ye|0;for(T=D^15,k=1;;)if(Ie=ie-k|0,Ie=jn(7,0,Ie,((Ie|0)<0)<<31>>31)|0,Ye=ye()|0,j=C,g=m[j>>2]|0,j=m[j+4>>2]|0,D=(T-k|0)*3|0,x=Vt(7,0,D|0)|0,j=j&~(ye()|0),Le=Ru(p|0,d|0,Ie|0,Ye|0)|0,Fe=ye()|0,D=Vt(Le|0,Fe|0,D|0)|0,j=ye()|0|j,G=C,m[G>>2]=D|g&~x,m[G+4>>2]=j,Ye=Do(Le|0,Fe|0,Ie|0,Ye|0)|0,p=Qo(p|0,d|0,Ye|0,ye()|0)|0,d=ye()|0,(ie|0)<=(k|0)){d=0;break}else k=k+1|0;return he=de,d|0}function ze(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0;T=wt(d|0,g|0,52)|0,ye()|0,T=T&15,(d|0)==0&(g|0)==0|((x|0)>15|(T|0)>(x|0))?(x=-1,T=-1,d=0,g=0):(C=Sh(d,g,T+1|0,x)|0,g=(ye()|0)&-15728641,d=Vt(x|0,0,52)|0,d=C|d,g=g|(ye()|0),C=(Gi(d,g)|0)==0,x=C?-1:x),C=p,m[C>>2]=d,m[C+4>>2]=g,m[p+8>>2]=T,m[p+12>>2]=x}function Qe(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0;if(g=p,d=m[g>>2]|0,g=m[g+4>>2]|0,!((d|0)==0&(g|0)==0)&&(x=wt(d|0,g|0,52)|0,ye()|0,x=x&15,D=Vt(1,0,(x^15)*3|0)|0,d=ni(D|0,ye()|0,d|0,g|0)|0,g=ye()|0,D=p,m[D>>2]=d,m[D+4>>2]=g,D=p+8|0,k=m[D>>2]|0,!((x|0)<(k|0)))){for(j=p+12|0,C=x;;){if((C|0)==(k|0)){x=5;break}if(G=(C|0)==(m[j>>2]|0),T=(15-C|0)*3|0,x=wt(d|0,g|0,T|0)|0,ye()|0,x=x&7,G&((x|0)==1&!0)){x=7;break}if(!((x|0)==7&!0)){x=10;break}if(G=Vt(1,0,T|0)|0,d=ni(d|0,g|0,G|0,ye()|0)|0,g=ye()|0,G=p,m[G>>2]=d,m[G+4>>2]=g,(C|0)>(k|0))C=C+-1|0;else{x=10;break}}if((x|0)==5){G=p,m[G>>2]=0,m[G+4>>2]=0,m[D>>2]=-1,m[j>>2]=-1;return}else if((x|0)==7){k=Vt(1,0,T|0)|0,k=ni(d|0,g|0,k|0,ye()|0)|0,D=ye()|0,G=p,m[G>>2]=k,m[G+4>>2]=D,m[j>>2]=C+-1;return}else if((x|0)==10)return}}function Me(p){p=+p;var d=0;return d=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?d+-6.283185307179586:d)}function Ve(p,d){return p=p|0,d=d|0,+Tr(+(+ue[p>>3]-+ue[d>>3]))<17453292519943298e-27?(d=+Tr(+(+ue[p+8>>3]-+ue[d+8>>3]))<17453292519943298e-27,d|0):(d=0,d|0)}function it(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;return T=+ue[d>>3],x=+ue[p>>3],C=+ki(+((T-x)*.5)),g=+ki(+((+ue[d+8>>3]-+ue[p+8>>3])*.5)),g=C*C+g*(+Ri(+T)*+Ri(+x)*g),+(+qo(+ +Fr(+g),+ +Fr(+(1-g)))*2)}function tt(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;return T=+ue[d>>3],x=+ue[p>>3],C=+ki(+((T-x)*.5)),g=+ki(+((+ue[d+8>>3]-+ue[p+8>>3])*.5)),g=C*C+g*(+Ri(+T)*+Ri(+x)*g),+(+qo(+ +Fr(+g),+ +Fr(+(1-g)))*2*6371.007180918475)}function dt(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;return T=+ue[d>>3],x=+ue[p>>3],C=+ki(+((T-x)*.5)),g=+ki(+((+ue[d+8>>3]-+ue[p+8>>3])*.5)),g=C*C+g*(+Ri(+T)*+Ri(+x)*g),+(+qo(+ +Fr(+g),+ +Fr(+(1-g)))*2*6371.007180918475*1e3)}function vt(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0;return C=+ue[d>>3],x=+Ri(+C),T=+ue[d+8>>3]-+ue[p+8>>3],k=x*+ki(+T),g=+ue[p>>3],+ +qo(+k,+(+ki(+C)*+Ri(+g)-+Ri(+T)*(x*+ki(+g))))}function gt(p,d,g,x){p=p|0,d=+d,g=+g,x=x|0;var T=0,C=0,k=0,D=0;if(g<1e-16){m[x>>2]=m[p>>2],m[x+4>>2]=m[p+4>>2],m[x+8>>2]=m[p+8>>2],m[x+12>>2]=m[p+12>>2];return}C=d<0?d+6.283185307179586:d,C=d>=6.283185307179586?C+-6.283185307179586:C;do if(C<1e-16)d=+ue[p>>3]+g,ue[x>>3]=d,T=x;else{if(T=+Tr(+(C+-3.141592653589793))<1e-16,d=+ue[p>>3],T){d=d-g,ue[x>>3]=d,T=x;break}if(k=+Ri(+g),g=+ki(+g),d=k*+ki(+d)+ +Ri(+C)*(g*+Ri(+d)),d=d>1?1:d,d=+rm(+(d<-1?-1:d)),ue[x>>3]=d,+Tr(+(d+-1.5707963267948966))<1e-16){ue[x>>3]=1.5707963267948966,ue[x+8>>3]=0;return}if(+Tr(+(d+1.5707963267948966))<1e-16){ue[x>>3]=-1.5707963267948966,ue[x+8>>3]=0;return}if(D=+Ri(+d),C=g*+ki(+C)/D,g=+ue[p>>3],d=(k-+ki(+d)*+ki(+g))/+Ri(+g)/D,k=C>1?1:C,d=d>1?1:d,d=+ue[p+8>>3]+ +qo(+(k<-1?-1:k),+(d<-1?-1:d)),d>3.141592653589793)do d=d+-6.283185307179586;while(d>3.141592653589793);if(d<-3.141592653589793)do d=d+6.283185307179586;while(d<-3.141592653589793);ue[x+8>>3]=d;return}while(!1);if(+Tr(+(d+-1.5707963267948966))<1e-16){ue[T>>3]=1.5707963267948966,ue[x+8>>3]=0;return}if(+Tr(+(d+1.5707963267948966))<1e-16){ue[T>>3]=-1.5707963267948966,ue[x+8>>3]=0;return}if(d=+ue[p+8>>3],d>3.141592653589793)do d=d+-6.283185307179586;while(d>3.141592653589793);if(d<-3.141592653589793)do d=d+6.283185307179586;while(d<-3.141592653589793);ue[x+8>>3]=d}function Mt(p,d){return p=p|0,d=d|0,p>>>0>15?(d=4,d|0):(ue[d>>3]=+ue[20528+(p<<3)>>3],d=0,d|0)}function rr(p,d){return p=p|0,d=d|0,p>>>0>15?(d=4,d|0):(ue[d>>3]=+ue[20656+(p<<3)>>3],d=0,d|0)}function ci(p,d){return p=p|0,d=d|0,p>>>0>15?(d=4,d|0):(ue[d>>3]=+ue[20784+(p<<3)>>3],d=0,d|0)}function Ft(p,d){return p=p|0,d=d|0,p>>>0>15?(d=4,d|0):(ue[d>>3]=+ue[20912+(p<<3)>>3],d=0,d|0)}function mr(p,d){p=p|0,d=d|0;var g=0;return p>>>0>15?(d=4,d|0):(g=jn(7,0,p,((p|0)<0)<<31>>31)|0,g=Do(g|0,ye()|0,120,0)|0,p=ye()|0,m[d>>2]=g|2,m[d+4>>2]=p,d=0,d|0)}function ir(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0;return Le=+ue[d>>3],ie=+ue[p>>3],j=+ki(+((Le-ie)*.5)),C=+ue[d+8>>3],G=+ue[p+8>>3],k=+ki(+((C-G)*.5)),D=+Ri(+ie),de=+Ri(+Le),k=j*j+k*(de*D*k),k=+qo(+ +Fr(+k),+ +Fr(+(1-k)))*2,j=+ue[g>>3],Le=+ki(+((j-Le)*.5)),x=+ue[g+8>>3],C=+ki(+((x-C)*.5)),T=+Ri(+j),C=Le*Le+C*(de*T*C),C=+qo(+ +Fr(+C),+ +Fr(+(1-C)))*2,j=+ki(+((ie-j)*.5)),x=+ki(+((G-x)*.5)),x=j*j+x*(D*T*x),x=+qo(+ +Fr(+x),+ +Fr(+(1-x)))*2,T=(k+C+x)*.5,+(+vf(+ +Fr(+(+wu(+(T*.5))*+wu(+((T-k)*.5))*+wu(+((T-C)*.5))*+wu(+((T-x)*.5)))))*4)}function zi(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0;if(D=he,he=he+192|0,C=D+168|0,k=D,T=H(p,d,C)|0,T|0)return g=T,he=D,g|0;if(Y(p,d,k)|0&&Er(23313,22742,386,22751),d=m[k>>2]|0,(d|0)>0){if(x=+ir(k+8|0,k+8+(((d|0)!=1&1)<<4)|0,C)+0,(d|0)!=1){p=1;do T=p,p=p+1|0,x=x+ +ir(k+8+(T<<4)|0,k+8+(((p|0)%(d|0)|0)<<4)|0,C);while((p|0)<(d|0))}}else x=0;return ue[g>>3]=x,g=0,he=D,g|0}function oi(p,d,g){return p=p|0,d=d|0,g=g|0,p=zi(p,d,g)|0,p|0||(ue[g>>3]=+ue[g>>3]*6371.007180918475*6371.007180918475),p|0}function Gr(p,d,g){return p=p|0,d=d|0,g=g|0,p=zi(p,d,g)|0,p|0||(ue[g>>3]=+ue[g>>3]*6371.007180918475*6371.007180918475*1e3*1e3),p|0}function ui(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(D=he,he=he+176|0,k=D,p=zd(p,d,k)|0,p|0)return k=p,he=D,k|0;if(ue[g>>3]=0,p=m[k>>2]|0,(p|0)<=1)return k=0,he=D,k|0;d=p+-1|0,p=0,x=+ue[k+8>>3],T=+ue[k+16>>3],C=0;do p=p+1|0,G=x,x=+ue[k+8+(p<<4)>>3],ie=+ki(+((x-G)*.5)),j=T,T=+ue[k+8+(p<<4)+8>>3],j=+ki(+((T-j)*.5)),j=ie*ie+j*(+Ri(+x)*+Ri(+G)*j),C=C+ +qo(+ +Fr(+j),+ +Fr(+(1-j)))*2;while((p|0)<(d|0));return ue[g>>3]=C,k=0,he=D,k|0}function Un(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(D=he,he=he+176|0,k=D,p=zd(p,d,k)|0,p|0)return k=p,C=+ue[g>>3],C=C*6371.007180918475,ue[g>>3]=C,he=D,k|0;if(ue[g>>3]=0,p=m[k>>2]|0,(p|0)<=1)return k=0,C=0,C=C*6371.007180918475,ue[g>>3]=C,he=D,k|0;d=p+-1|0,p=0,x=+ue[k+8>>3],T=+ue[k+16>>3],C=0;do p=p+1|0,G=x,x=+ue[k+8+(p<<4)>>3],ie=+ki(+((x-G)*.5)),j=T,T=+ue[k+8+(p<<4)+8>>3],j=+ki(+((T-j)*.5)),j=ie*ie+j*(+Ri(+G)*+Ri(+x)*j),C=C+ +qo(+ +Fr(+j),+ +Fr(+(1-j)))*2;while((p|0)!=(d|0));return ue[g>>3]=C,k=0,ie=C,ie=ie*6371.007180918475,ue[g>>3]=ie,he=D,k|0}function ln(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(D=he,he=he+176|0,k=D,p=zd(p,d,k)|0,p|0)return k=p,C=+ue[g>>3],C=C*6371.007180918475,C=C*1e3,ue[g>>3]=C,he=D,k|0;if(ue[g>>3]=0,p=m[k>>2]|0,(p|0)<=1)return k=0,C=0,C=C*6371.007180918475,C=C*1e3,ue[g>>3]=C,he=D,k|0;d=p+-1|0,p=0,x=+ue[k+8>>3],T=+ue[k+16>>3],C=0;do p=p+1|0,G=x,x=+ue[k+8+(p<<4)>>3],ie=+ki(+((x-G)*.5)),j=T,T=+ue[k+8+(p<<4)+8>>3],j=+ki(+((T-j)*.5)),j=ie*ie+j*(+Ri(+G)*+Ri(+x)*j),C=C+ +qo(+ +Fr(+j),+ +Fr(+(1-j)))*2;while((p|0)!=(d|0));return ue[g>>3]=C,k=0,ie=C,ie=ie*6371.007180918475,ie=ie*1e3,ue[g>>3]=ie,he=D,k|0}function Ys(p){p=p|0;var d=0,g=0,x=0;return d=Hc(1,12)|0,d||Er(22832,22787,49,22845),g=p+4|0,x=m[g>>2]|0,x|0?(x=x+8|0,m[x>>2]=d,m[g>>2]=d,d|0):(m[p>>2]|0&&Er(22862,22787,61,22885),x=p,m[x>>2]=d,m[g>>2]=d,d|0)}function As(p,d){p=p|0,d=d|0;var g=0,x=0;return x=Ql(24)|0,x||Er(22899,22787,78,22913),m[x>>2]=m[d>>2],m[x+4>>2]=m[d+4>>2],m[x+8>>2]=m[d+8>>2],m[x+12>>2]=m[d+12>>2],m[x+16>>2]=0,d=p+4|0,g=m[d>>2]|0,g|0?(m[g+16>>2]=x,m[d>>2]=x,x|0):(m[p>>2]|0&&Er(22928,22787,82,22913),m[p>>2]=x,m[d>>2]=x,x|0)}function Vn(p){p=p|0;var d=0,g=0,x=0,T=0;if(p)for(x=1;;){if(d=m[p>>2]|0,d|0)do{if(g=m[d>>2]|0,g|0)do T=g,g=m[g+16>>2]|0,Wr(T);while(g|0);T=d,d=m[d+8>>2]|0,Wr(T)}while(d|0);if(d=p,p=m[p+8>>2]|0,x||Wr(d),p)x=0;else break}}function Aa(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0,Wi=0,Oi=0,xi=0,ai=0,or=0,Qr=0,tn=0,Nr=0;if(T=p+8|0,m[T>>2]|0)return Nr=1,Nr|0;if(x=m[p>>2]|0,!x)return Nr=0,Nr|0;d=x,g=0;do g=g+1|0,d=m[d+8>>2]|0;while(d|0);if(g>>>0<2)return Nr=0,Nr|0;Qr=Ql(g<<2)|0,Qr||Er(22948,22787,317,22967),or=Ql(g<<5)|0,or||Er(22989,22787,321,22967),m[p>>2]=0,nr=p+4|0,m[nr>>2]=0,m[T>>2]=0,g=0,ai=0,Zt=0,de=0;e:for(;;){if(ie=m[x>>2]|0,ie){C=0,k=ie;do{if(j=+ue[k+8>>3],d=k,k=m[k+16>>2]|0,G=(k|0)==0,T=G?ie:k,D=+ue[T+8>>3],+Tr(+(j-D))>3.141592653589793){Nr=14;break}C=C+(D-j)*(+ue[d>>3]+ +ue[T>>3])}while(!G);if((Nr|0)==14){Nr=0,C=0,d=ie;do Xe=+ue[d+8>>3],xi=d+16|0,Oi=m[xi>>2]|0,Oi=Oi|0?Oi:ie,nt=+ue[Oi+8>>3],C=C+(+ue[d>>3]+ +ue[Oi>>3])*((nt<0?nt+6.283185307179586:nt)-(Xe<0?Xe+6.283185307179586:Xe)),d=m[(d|0?xi:x)>>2]|0;while(d|0)}C>0?(m[Qr+(ai<<2)>>2]=x,ai=ai+1|0,T=Zt,d=de):Nr=19}else Nr=19;if((Nr|0)==19){Nr=0;do if(g){if(d=g+8|0,m[d>>2]|0){Nr=21;break e}if(g=Hc(1,12)|0,!g){Nr=23;break e}m[d>>2]=g,T=g+4|0,k=g,d=de}else if(de){T=nr,k=de+8|0,d=x,g=p;break}else if(m[p>>2]|0){Nr=27;break e}else{T=nr,k=p,d=x,g=p;break}while(!1);if(m[k>>2]=x,m[T>>2]=x,k=or+(Zt<<5)|0,G=m[x>>2]|0,G){for(ie=or+(Zt<<5)+8|0,ue[ie>>3]=17976931348623157e292,de=or+(Zt<<5)+24|0,ue[de>>3]=17976931348623157e292,ue[k>>3]=-17976931348623157e292,Le=or+(Zt<<5)+16|0,ue[Le>>3]=-17976931348623157e292,lt=17976931348623157e292,rt=-17976931348623157e292,T=0,Fe=G,j=17976931348623157e292,Ye=17976931348623157e292,ut=-17976931348623157e292,D=-17976931348623157e292;C=+ue[Fe>>3],Xe=+ue[Fe+8>>3],Fe=m[Fe+16>>2]|0,Ie=(Fe|0)==0,nt=+ue[(Ie?G:Fe)+8>>3],C>3]=C,j=C),Xe>3]=Xe,Ye=Xe),C>ut?ue[k>>3]=C:C=ut,Xe>D&&(ue[Le>>3]=Xe,D=Xe),lt=Xe>0&Xert?Xe:rt,T=T|+Tr(+(Xe-nt))>3.141592653589793,!Ie;)ut=C;T&&(ue[Le>>3]=rt,ue[de>>3]=lt)}else m[k>>2]=0,m[k+4>>2]=0,m[k+8>>2]=0,m[k+12>>2]=0,m[k+16>>2]=0,m[k+20>>2]=0,m[k+24>>2]=0,m[k+28>>2]=0;T=Zt+1|0}if(xi=x+8|0,x=m[xi>>2]|0,m[xi>>2]=0,x)Zt=T,de=d;else{Nr=45;break}}if((Nr|0)==21)Er(22765,22787,35,22799);else if((Nr|0)==23)Er(22819,22787,37,22799);else if((Nr|0)==27)Er(22862,22787,61,22885);else if((Nr|0)==45){e:do if((ai|0)>0){for(xi=(T|0)==0,Wi=T<<2,Oi=(p|0)==0,Yt=0,d=0;;){if(Ut=m[Qr+(Yt<<2)>>2]|0,xi)Nr=73;else{if(Zt=Ql(Wi)|0,!Zt){Nr=50;break}if(nr=Ql(Wi)|0,!nr){Nr=52;break}t:do if(Oi)g=0;else{for(T=0,g=0,k=p;x=or+(T<<5)|0,cn(m[k>>2]|0,x,m[Ut>>2]|0)|0?(m[Zt+(g<<2)>>2]=k,m[nr+(g<<2)>>2]=x,Ie=g+1|0):Ie=g,k=m[k+8>>2]|0,k;)T=T+1|0,g=Ie;if((Ie|0)>0)if(x=m[Zt>>2]|0,(Ie|0)==1)g=x;else for(Le=0,Fe=-1,g=x,de=x;;){for(G=m[de>>2]|0,x=0,k=0;T=m[m[Zt+(k<<2)>>2]>>2]|0,(T|0)==(G|0)?ie=x:ie=x+((cn(T,m[nr+(k<<2)>>2]|0,m[G>>2]|0)|0)&1)|0,k=k+1|0,(k|0)!=(Ie|0);)x=ie;if(T=(ie|0)>(Fe|0),g=T?de:g,x=Le+1|0,(x|0)==(Ie|0))break t;Le=x,Fe=T?ie:Fe,de=m[Zt+(x<<2)>>2]|0}else g=0}while(!1);if(Wr(Zt),Wr(nr),g){if(T=g+4|0,x=m[T>>2]|0,x)g=x+8|0;else if(m[g>>2]|0){Nr=70;break}m[g>>2]=Ut,m[T>>2]=Ut}else Nr=73}if((Nr|0)==73){if(Nr=0,d=m[Ut>>2]|0,d|0)do nr=d,d=m[d+16>>2]|0,Wr(nr);while(d|0);Wr(Ut),d=1}if(Yt=Yt+1|0,(Yt|0)>=(ai|0)){tn=d;break e}}(Nr|0)==50?Er(23004,22787,249,23023):(Nr|0)==52?Er(23042,22787,252,23023):(Nr|0)==70&&Er(22862,22787,61,22885)}else tn=0;while(!1);return Wr(Qr),Wr(or),Nr=tn,Nr|0}return 0}function cn(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0;if(!(nA(d,g)|0)||(d=T_(d)|0,x=+ue[g>>3],T=+ue[g+8>>3],T=d&T<0?T+6.283185307179586:T,p=m[p>>2]|0,!p))return p=0,p|0;if(d){d=0,G=T,g=p;e:for(;;){for(;k=+ue[g>>3],T=+ue[g+8>>3],g=g+16|0,ie=m[g>>2]|0,ie=ie|0?ie:p,C=+ue[ie>>3],D=+ue[ie+8>>3],k>C?(j=k,k=D):(j=C,C=k,k=T,T=D),x=x==C|x==j?x+2220446049250313e-31:x,!!(xj);)if(g=m[g>>2]|0,!g){g=22;break e}if(D=k<0?k+6.283185307179586:k,k=T<0?T+6.283185307179586:T,G=D==G|k==G?G+-2220446049250313e-31:G,j=D+(k-D)*((x-C)/(j-C)),(j<0?j+6.283185307179586:j)>G&&(d=d^1),g=m[g>>2]|0,!g){g=22;break}}if((g|0)==22)return d|0}else{d=0,G=T,g=p;e:for(;;){for(;k=+ue[g>>3],T=+ue[g+8>>3],g=g+16|0,ie=m[g>>2]|0,ie=ie|0?ie:p,C=+ue[ie>>3],D=+ue[ie+8>>3],k>C?(j=k,k=D):(j=C,C=k,k=T,T=D),x=x==C|x==j?x+2220446049250313e-31:x,!!(xj);)if(g=m[g>>2]|0,!g){g=22;break e}if(G=k==G|T==G?G+-2220446049250313e-31:G,k+(T-k)*((x-C)/(j-C))>G&&(d=d^1),g=m[g>>2]|0,!g){g=22;break}}if((g|0)==22)return d|0}return 0}function ks(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0;if(rt=he,he=he+32|0,lt=rt+16|0,ut=rt,C=wt(p|0,d|0,52)|0,ye()|0,C=C&15,Fe=wt(g|0,x|0,52)|0,ye()|0,(C|0)!=(Fe&15|0))return lt=12,he=rt,lt|0;if(G=wt(p|0,d|0,45)|0,ye()|0,G=G&127,ie=wt(g|0,x|0,45)|0,ye()|0,ie=ie&127,G>>>0>121|ie>>>0>121)return lt=5,he=rt,lt|0;if(Fe=(G|0)!=(ie|0),Fe){if(D=Sf(G,ie)|0,(D|0)==7)return lt=1,he=rt,lt|0;j=Sf(ie,G)|0,(j|0)==7?Er(23066,23090,161,23100):(Ie=D,k=j)}else Ie=0,k=0;de=qi(G)|0,Le=qi(ie)|0,m[lt>>2]=0,m[lt+4>>2]=0,m[lt+8>>2]=0,m[lt+12>>2]=0;do if(Ie){if(ie=m[4272+(G*28|0)+(Ie<<2)>>2]|0,D=(ie|0)>0,Le)if(D){G=0,j=g,D=x;do j=A(j,D)|0,D=ye()|0,k=Zl(k)|0,(k|0)==1&&(k=Zl(1)|0),G=G+1|0;while((G|0)!=(ie|0));ie=k,G=j,j=D}else ie=k,G=g,j=x;else if(D){G=0,j=g,D=x;do j=v(j,D)|0,D=ye()|0,k=Zl(k)|0,G=G+1|0;while((G|0)!=(ie|0));ie=k,G=j,j=D}else ie=k,G=g,j=x;if(F(G,j,lt)|0,Fe||Er(23115,23090,191,23100),D=(de|0)!=0,k=(Le|0)!=0,D&k&&Er(23142,23090,192,23100),D){if(k=jr(p,d)|0,(k|0)==7){C=5;break}if(_r[21872+(k*7|0)+Ie>>0]|0){C=1;break}j=m[21040+(k*28|0)+(Ie<<2)>>2]|0,G=j}else if(k){if(k=jr(G,j)|0,(k|0)==7){C=5;break}if(_r[21872+(k*7|0)+ie>>0]|0){C=1;break}G=0,j=m[21040+(ie*28|0)+(k<<2)>>2]|0}else G=0,j=0;if((G|j|0)<0)C=5;else{if((j|0)>0){D=lt+4|0,k=0;do Ef(D),k=k+1|0;while((k|0)!=(j|0))}if(m[ut>>2]=0,m[ut+4>>2]=0,m[ut+8>>2]=0,cm(ut,Ie),C|0)for(;P(C)|0?Fd(ut):Eu(ut),(C|0)>1;)C=C+-1|0;if((G|0)>0){C=0;do Ef(ut),C=C+1|0;while((C|0)!=(G|0))}Ye=lt+4|0,zn(Ye,ut,Ye),Rt(Ye),Ye=51}}else if(F(g,x,lt)|0,(de|0)!=0&(Le|0)!=0)if((ie|0)!=(G|0)&&Er(23173,23090,261,23100),k=jr(p,d)|0,C=jr(g,x)|0,(k|0)==7|(C|0)==7)C=5;else if(_r[21872+(k*7|0)+C>>0]|0)C=1;else if(k=m[21040+(k*28|0)+(C<<2)>>2]|0,(k|0)>0){D=lt+4|0,C=0;do Ef(D),C=C+1|0;while((C|0)!=(k|0));Ye=51}else Ye=51;else Ye=51;while(!1);return(Ye|0)==51&&(C=lt+4|0,m[T>>2]=m[C>>2],m[T+4>>2]=m[C+4>>2],m[T+8>>2]=m[C+8>>2],C=0),lt=C,he=rt,lt|0}function pl(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0;if(Ye=he,he=he+48|0,G=Ye+36|0,k=Ye+24|0,D=Ye+12|0,j=Ye,T=wt(p|0,d|0,52)|0,ye()|0,T=T&15,Le=wt(p|0,d|0,45)|0,ye()|0,Le=Le&127,Le>>>0>121)return x=5,he=Ye,x|0;if(ie=qi(Le)|0,Vt(T|0,0,52)|0,ut=ye()|0|134225919,C=x,m[C>>2]=-1,m[C+4>>2]=ut,!T)return T=Nt(g)|0,(T|0)==7||(T=dl(Le,T)|0,(T|0)==127)?(ut=1,he=Ye,ut|0):(Fe=Vt(T|0,0,45)|0,Ie=ye()|0,Le=x,Ie=m[Le+4>>2]&-1040385|Ie,ut=x,m[ut>>2]=m[Le>>2]|Fe,m[ut+4>>2]=Ie,ut=0,he=Ye,ut|0);for(m[G>>2]=m[g>>2],m[G+4>>2]=m[g+4>>2],m[G+8>>2]=m[g+8>>2],g=T;;){if(C=g,g=g+-1|0,m[k>>2]=m[G>>2],m[k+4>>2]=m[G+4>>2],m[k+8>>2]=m[G+8>>2],P(C)|0){if(T=am(G)|0,T|0){g=13;break}m[D>>2]=m[G>>2],m[D+4>>2]=m[G+4>>2],m[D+8>>2]=m[G+8>>2],Fd(D)}else{if(T=lm(G)|0,T|0){g=13;break}m[D>>2]=m[G>>2],m[D+4>>2]=m[G+4>>2],m[D+8>>2]=m[G+8>>2],Eu(D)}if(Tu(k,D,j),Rt(j),T=x,rt=m[T>>2]|0,T=m[T+4>>2]|0,nt=(15-C|0)*3|0,lt=Vt(7,0,nt|0)|0,T=T&~(ye()|0),nt=Vt(Nt(j)|0,0,nt|0)|0,T=ye()|0|T,ut=x,m[ut>>2]=nt|rt&~lt,m[ut+4>>2]=T,(C|0)<=1){g=14;break}}e:do if((g|0)!=13&&(g|0)==14)if((m[G>>2]|0)<=1&&(m[G+4>>2]|0)<=1&&(m[G+8>>2]|0)<=1){g=Nt(G)|0,T=dl(Le,g)|0,(T|0)==127?j=0:j=qi(T)|0;t:do if(g){if(ie){if(T=jr(p,d)|0,(T|0)==7){T=5;break e}if(C=m[21248+(T*28|0)+(g<<2)>>2]|0,(C|0)>0){T=g,g=0;do T=Vc(T)|0,g=g+1|0;while((g|0)!=(C|0))}else T=g;if((T|0)==1){T=9;break e}g=dl(Le,T)|0,(g|0)==127&&Er(23200,23090,411,23230),qi(g)|0?Er(23245,23090,412,23230):(Ie=g,Fe=C,de=T)}else Ie=T,Fe=0,de=g;if(D=m[4272+(Le*28|0)+(de<<2)>>2]|0,(D|0)<=-1&&Er(23276,23090,419,23230),!j){if((Fe|0)<0){T=5;break e}if(Fe|0){C=x,T=0,g=m[C>>2]|0,C=m[C+4>>2]|0;do g=l(g,C)|0,C=ye()|0,nt=x,m[nt>>2]=g,m[nt+4>>2]=C,T=T+1|0;while((T|0)<(Fe|0))}if((D|0)<=0){T=Ie,g=58;break}for(C=x,T=0,g=m[C>>2]|0,C=m[C+4>>2]|0;;)if(g=l(g,C)|0,C=ye()|0,nt=x,m[nt>>2]=g,m[nt+4>>2]=C,T=T+1|0,(T|0)==(D|0)){T=Ie,g=58;break t}}if(k=Sf(Ie,Le)|0,(k|0)==7&&Er(23066,23090,428,23230),T=x,g=m[T>>2]|0,T=m[T+4>>2]|0,(D|0)>0){C=0;do g=l(g,T)|0,T=ye()|0,nt=x,m[nt>>2]=g,m[nt+4>>2]=T,C=C+1|0;while((C|0)!=(D|0))}if(T=jr(g,T)|0,(T|0)==7&&Er(23313,23090,440,23230),g=iA(Ie)|0,g=m[(g?21664:21456)+(k*28|0)+(T<<2)>>2]|0,(g|0)<0&&Er(23313,23090,454,23230),!g)T=Ie,g=58;else{k=x,T=0,C=m[k>>2]|0,k=m[k+4>>2]|0;do C=E(C,k)|0,k=ye()|0,nt=x,m[nt>>2]=C,m[nt+4>>2]=k,T=T+1|0;while((T|0)<(g|0));T=Ie,g=58}}else if((ie|0)!=0&(j|0)!=0){if(g=jr(p,d)|0,C=x,C=jr(m[C>>2]|0,m[C+4>>2]|0)|0,(g|0)==7|(C|0)==7){T=5;break e}if(C=m[21248+(g*28|0)+(C<<2)>>2]|0,(C|0)<0){T=5;break e}if(!C)g=59;else{D=x,g=0,k=m[D>>2]|0,D=m[D+4>>2]|0;do k=l(k,D)|0,D=ye()|0,nt=x,m[nt>>2]=k,m[nt+4>>2]=D,g=g+1|0;while((g|0)<(C|0));g=58}}else g=58;while(!1);if((g|0)==58&&j&&(g=59),(g|0)==59&&(nt=x,(jr(m[nt>>2]|0,m[nt+4>>2]|0)|0)==1)){T=9;break}nt=x,lt=m[nt>>2]|0,nt=m[nt+4>>2]&-1040385,rt=Vt(T|0,0,45)|0,nt=nt|(ye()|0),T=x,m[T>>2]=lt|rt,m[T+4>>2]=nt,T=0}else T=1;while(!1);return nt=T,he=Ye,nt|0}function Cu(p,d,g,x,T,C){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0,C=C|0;var k=0,D=0;return D=he,he=he+16|0,k=D,T?p=15:(p=ks(p,d,g,x,k)|0,p||(Nd(k,C),p=0)),he=D,p|0}function Th(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0;return k=he,he=he+16|0,C=k,x?g=15:(g=um(g,C)|0,g||(g=pl(p,d,C,T)|0)),he=k,g|0}function Cf(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0;return j=he,he=he+32|0,k=j+12|0,D=j,C=ks(p,d,p,d,k)|0,C|0?(D=C,he=j,D|0):(p=ks(p,d,g,x,D)|0,p|0?(D=p,he=j,D|0):(k=Yl(k,D)|0,D=T,m[D>>2]=k,m[D+4>>2]=((k|0)<0)<<31>>31,D=0,he=j,D|0))}function go(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0;return j=he,he=he+32|0,k=j+12|0,D=j,C=ks(p,d,p,d,k)|0,!C&&(C=ks(p,d,g,x,D)|0,!C)?(x=Yl(k,D)|0,x=ni(x|0,((x|0)<0)<<31>>31|0,1,0)|0,k=ye()|0,D=T,m[D>>2]=x,m[D+4>>2]=k,D=0,he=j,D|0):(D=C,he=j,D|0)}function Xs(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0,Yt=0;if(Ut=he,he=he+48|0,k=Ut+24|0,D=Ut+12|0,nr=Ut,C=ks(p,d,p,d,k)|0,!C&&(C=ks(p,d,g,x,D)|0,!C)){Xe=Yl(k,D)|0,Zt=((Xe|0)<0)<<31>>31,m[k>>2]=0,m[k+4>>2]=0,m[k+8>>2]=0,m[D>>2]=0,m[D+4>>2]=0,m[D+8>>2]=0,ks(p,d,p,d,k)|0&&Er(23313,23090,691,23299),ks(p,d,g,x,D)|0&&Er(23313,23090,696,23299),Mf(k),Mf(D),Xe?(de=m[k>>2]|0,Ie=+(Xe|0),lt=k+4|0,Le=m[lt>>2]|0,rt=k+8|0,Fe=m[rt>>2]|0,nt=k,x=de,C=Le,g=Fe,Ye=+((m[D>>2]|0)-de|0)/Ie,ut=+((m[D+4>>2]|0)-Le|0)/Ie,Ie=+((m[D+8>>2]|0)-Fe|0)/Ie):(C=k+4|0,g=k+8|0,lt=C,rt=g,nt=k,x=m[k>>2]|0,C=m[C>>2]|0,g=m[g>>2]|0,Ye=0,ut=0,Ie=0),m[nr>>2]=x,Fe=nr+4|0,m[Fe>>2]=C,Le=nr+8|0,m[Le>>2]=g;e:do if((Xe|0)<0)C=0;else for(ie=0,de=0,C=x;;){G=+(de>>>0)+4294967296*+(ie|0),Yt=Ye*G+ +(C|0),j=ut*G+ +(m[lt>>2]|0),G=Ie*G+ +(m[rt>>2]|0),g=~~+Wd(+Yt),k=~~+Wd(+j),C=~~+Wd(+G),Yt=+Tr(+(+(g|0)-Yt)),j=+Tr(+(+(k|0)-j)),G=+Tr(+(+(C|0)-G));do if(Yt>j&Yt>G)g=0-(k+C)|0,x=k;else if(D=0-g|0,j>G){x=D-C|0;break}else{x=k,C=D-k|0;break}while(!1);if(m[nr>>2]=g,m[Fe>>2]=x,m[Le>>2]=C,hm(nr),C=pl(p,d,nr,T+(de<<3)|0)|0,C|0)break e;if(!((ie|0)<(Zt|0)|(ie|0)==(Zt|0)&de>>>0>>0)){C=0;break e}C=ni(de|0,ie|0,1,0)|0,D=ye()|0,ie=D,de=C,C=m[nt>>2]|0}while(!1);return nr=C,he=Ut,nr|0}return nr=C,he=Ut,nr|0}function jn(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0;if((g|0)==0&(x|0)==0)return T=0,C=1,ii(T|0),C|0;C=p,T=d,p=1,d=0;do k=(g&1|0)==0&!0,p=Do((k?1:C)|0,(k?0:T)|0,p|0,d|0)|0,d=ye()|0,g=jd(g|0,x|0,1)|0,x=ye()|0,C=Do(C|0,T|0,C|0,T|0)|0,T=ye()|0;while(!((g|0)==0&(x|0)==0));return ii(d|0),p|0}function Iu(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0;if(!(nA(d,g)|0)||(d=T_(d)|0,x=+ue[g>>3],T=+ue[g+8>>3],T=d&T<0?T+6.283185307179586:T,Le=m[p>>2]|0,(Le|0)<=0))return Le=0,Le|0;if(de=m[p+4>>2]|0,d){d=0,ie=T,g=-1,p=0;e:for(;;){for(G=p;k=+ue[de+(G<<4)>>3],T=+ue[de+(G<<4)+8>>3],p=(g+2|0)%(Le|0)|0,C=+ue[de+(p<<4)>>3],D=+ue[de+(p<<4)+8>>3],k>C?(j=k,k=D):(j=C,C=k,k=T,T=D),x=x==C|x==j?x+2220446049250313e-31:x,!!(xj);)if(g=G+1|0,(g|0)>=(Le|0)){g=22;break e}else p=G,G=g,g=p;if(D=k<0?k+6.283185307179586:k,k=T<0?T+6.283185307179586:T,ie=D==ie|k==ie?ie+-2220446049250313e-31:ie,j=D+(k-D)*((x-C)/(j-C)),(j<0?j+6.283185307179586:j)>ie&&(d=d^1),p=G+1|0,(p|0)>=(Le|0)){g=22;break}else g=G}if((g|0)==22)return d|0}else{d=0,ie=T,g=-1,p=0;e:for(;;){for(G=p;k=+ue[de+(G<<4)>>3],T=+ue[de+(G<<4)+8>>3],p=(g+2|0)%(Le|0)|0,C=+ue[de+(p<<4)>>3],D=+ue[de+(p<<4)+8>>3],k>C?(j=k,k=D):(j=C,C=k,k=T,T=D),x=x==C|x==j?x+2220446049250313e-31:x,!!(xj);)if(g=G+1|0,(g|0)>=(Le|0)){g=22;break e}else p=G,G=g,g=p;if(ie=k==ie|T==ie?ie+-2220446049250313e-31:ie,k+(T-k)*((x-C)/(j-C))>ie&&(d=d^1),p=G+1|0,(p|0)>=(Le|0)){g=22;break}else g=G}if((g|0)==22)return d|0}return 0}function Dn(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0;if(Ie=m[p>>2]|0,!Ie){m[d>>2]=0,m[d+4>>2]=0,m[d+8>>2]=0,m[d+12>>2]=0,m[d+16>>2]=0,m[d+20>>2]=0,m[d+24>>2]=0,m[d+28>>2]=0;return}if(Ye=d+8|0,ue[Ye>>3]=17976931348623157e292,ut=d+24|0,ue[ut>>3]=17976931348623157e292,ue[d>>3]=-17976931348623157e292,lt=d+16|0,ue[lt>>3]=-17976931348623157e292,!((Ie|0)<=0)){for(Le=m[p+4>>2]|0,G=17976931348623157e292,ie=-17976931348623157e292,de=0,p=-1,C=17976931348623157e292,k=17976931348623157e292,j=-17976931348623157e292,x=-17976931348623157e292,Fe=0;g=+ue[Le+(Fe<<4)>>3],D=+ue[Le+(Fe<<4)+8>>3],p=p+2|0,T=+ue[Le+(((p|0)==(Ie|0)?0:p)<<4)+8>>3],g>3]=g,C=g),D>3]=D,k=D),g>j?ue[d>>3]=g:g=j,D>x&&(ue[lt>>3]=D,x=D),G=D>0&Die?D:ie,de=de|+Tr(+(D-T))>3.141592653589793,p=Fe+1|0,(p|0)!=(Ie|0);)rt=Fe,j=g,Fe=p,p=rt;de&&(ue[lt>>3]=ie,ue[ut>>3]=G)}}function ms(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0,nr=0,Ut=0;if(Ie=m[p>>2]|0,Ie){if(Ye=d+8|0,ue[Ye>>3]=17976931348623157e292,ut=d+24|0,ue[ut>>3]=17976931348623157e292,ue[d>>3]=-17976931348623157e292,lt=d+16|0,ue[lt>>3]=-17976931348623157e292,(Ie|0)>0){for(T=m[p+4>>2]|0,Le=17976931348623157e292,Fe=-17976931348623157e292,x=0,g=-1,j=17976931348623157e292,G=17976931348623157e292,de=-17976931348623157e292,k=-17976931348623157e292,rt=0;C=+ue[T+(rt<<4)>>3],ie=+ue[T+(rt<<4)+8>>3],nr=g+2|0,D=+ue[T+(((nr|0)==(Ie|0)?0:nr)<<4)+8>>3],C>3]=C,j=C),ie>3]=ie,G=ie),C>de?ue[d>>3]=C:C=de,ie>k&&(ue[lt>>3]=ie,k=ie),Le=ie>0&ieFe?ie:Fe,x=x|+Tr(+(ie-D))>3.141592653589793,g=rt+1|0,(g|0)!=(Ie|0);)nr=rt,de=C,rt=g,g=nr;x&&(ue[lt>>3]=Fe,ue[ut>>3]=Le)}}else m[d>>2]=0,m[d+4>>2]=0,m[d+8>>2]=0,m[d+12>>2]=0,m[d+16>>2]=0,m[d+20>>2]=0,m[d+24>>2]=0,m[d+28>>2]=0;if(nr=p+8|0,g=m[nr>>2]|0,!((g|0)<=0)){Zt=p+12|0,Xe=0;do if(T=m[Zt>>2]|0,x=Xe,Xe=Xe+1|0,ut=d+(Xe<<5)|0,lt=m[T+(x<<3)>>2]|0,lt){if(rt=d+(Xe<<5)+8|0,ue[rt>>3]=17976931348623157e292,p=d+(Xe<<5)+24|0,ue[p>>3]=17976931348623157e292,ue[ut>>3]=-17976931348623157e292,nt=d+(Xe<<5)+16|0,ue[nt>>3]=-17976931348623157e292,(lt|0)>0){for(Ie=m[T+(x<<3)+4>>2]|0,Le=17976931348623157e292,Fe=-17976931348623157e292,T=0,x=-1,Ye=0,j=17976931348623157e292,G=17976931348623157e292,ie=-17976931348623157e292,k=-17976931348623157e292;C=+ue[Ie+(Ye<<4)>>3],de=+ue[Ie+(Ye<<4)+8>>3],x=x+2|0,D=+ue[Ie+(((x|0)==(lt|0)?0:x)<<4)+8>>3],C>3]=C,j=C),de>3]=de,G=de),C>ie?ue[ut>>3]=C:C=ie,de>k&&(ue[nt>>3]=de,k=de),Le=de>0&deFe?de:Fe,T=T|+Tr(+(de-D))>3.141592653589793,x=Ye+1|0,(x|0)!=(lt|0);)Ut=Ye,Ye=x,ie=C,x=Ut;T&&(ue[nt>>3]=Fe,ue[p>>3]=Le)}}else m[ut>>2]=0,m[ut+4>>2]=0,m[ut+8>>2]=0,m[ut+12>>2]=0,m[ut+16>>2]=0,m[ut+20>>2]=0,m[ut+24>>2]=0,m[ut+28>>2]=0,g=m[nr>>2]|0;while((Xe|0)<(g|0))}}function Xo(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;if(!(Iu(p,d,g)|0))return T=0,T|0;if(T=p+8|0,(m[T>>2]|0)<=0)return T=1,T|0;for(x=p+12|0,p=0;;){if(C=p,p=p+1|0,Iu((m[x>>2]|0)+(C<<3)|0,d+(p<<5)|0,g)|0){p=0,x=6;break}if((p|0)>=(m[T>>2]|0)){p=1,x=6;break}}return(x|0)==6?p|0:0}function Wn(){return 8}function Eh(){return 16}function hA(){return 168}function R_(){return 8}function k_(){return 16}function Kx(){return 12}function gm(){return 8}function Xl(p){return p=p|0,+(+((m[p>>2]|0)>>>0)+4294967296*+(m[p+4>>2]|0))}function Mh(p){p=p|0;var d=0,g=0;return g=+ue[p>>3],d=+ue[p+8>>3],+ +Fr(+(g*g+d*d))}function Al(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0;G=+ue[p>>3],j=+ue[d>>3]-G,D=+ue[p+8>>3],k=+ue[d+8>>3]-D,de=+ue[g>>3],C=+ue[x>>3]-de,Le=+ue[g+8>>3],ie=+ue[x+8>>3]-Le,C=(C*(D-Le)-(G-de)*ie)/(j*ie-k*C),ue[T>>3]=G+j*C,ue[T+8>>3]=D+k*C}function ma(p,d){return p=p|0,d=d|0,+Tr(+(+ue[p>>3]-+ue[d>>3]))<11920928955078125e-23?(d=+Tr(+(+ue[p+8>>3]-+ue[d+8>>3]))<11920928955078125e-23,d|0):(d=0,d|0)}function Ki(p,d){p=p|0,d=d|0;var g=0,x=0,T=0;return T=+ue[p>>3]-+ue[d>>3],x=+ue[p+8>>3]-+ue[d+8>>3],g=+ue[p+16>>3]-+ue[d+16>>3],+(T*T+x*x+g*g)}function _m(p,d){p=p|0,d=d|0;var g=0,x=0,T=0;g=+ue[p>>3],x=+Ri(+g),g=+ki(+g),ue[d+16>>3]=g,g=+ue[p+8>>3],T=x*+Ri(+g),ue[d>>3]=T,g=x*+ki(+g),ue[d+8>>3]=g}function Wc(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;if(C=he,he=he+16|0,T=C,x=Gi(p,d)|0,(g+-1|0)>>>0>5||(x=(x|0)!=0,(g|0)==1&x))return T=-1,he=C,T|0;do if(ym(p,d,T)|0)x=-1;else if(x){x=((m[21936+(g<<2)>>2]|0)+5-(m[T>>2]|0)|0)%5|0;break}else{x=((m[21968+(g<<2)>>2]|0)+6-(m[T>>2]|0)|0)%6|0;break}while(!1);return T=x,he=C,T|0}function ym(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0,G=0;if(G=he,he=he+32|0,k=G+16|0,D=G,x=U(p,d,k)|0,x|0)return g=x,he=G,g|0;C=Pu(p,d)|0,j=jr(p,d)|0,Fc(C,D),x=S_(C,m[k>>2]|0)|0;e:do if(qi(C)|0){do switch(C|0){case 4:{p=0;break}case 14:{p=1;break}case 24:{p=2;break}case 38:{p=3;break}case 49:{p=4;break}case 58:{p=5;break}case 63:{p=6;break}case 72:{p=7;break}case 83:{p=8;break}case 97:{p=9;break}case 107:{p=10;break}case 117:{p=11;break}default:{x=1;break e}}while(!1);if(T=m[22e3+(p*24|0)+8>>2]|0,d=m[22e3+(p*24|0)+16>>2]|0,p=m[k>>2]|0,(p|0)!=(m[D>>2]|0)&&(D=iA(C)|0,p=m[k>>2]|0,D|(p|0)==(d|0)&&(x=(x+1|0)%6|0)),(j|0)==3&(p|0)==(d|0)){x=(x+5|0)%6|0,T=22;break}(j|0)==5&(p|0)==(T|0)&&(x=(x+1|0)%6|0),T=22}else T=22;while(!1);return(T|0)==22&&(m[g>>2]=x,x=0),g=x,he=G,g|0}function ml(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0;if(nt=he,he=he+32|0,rt=nt+24|0,ut=nt+20|0,Ie=nt+8|0,Fe=nt+16|0,Le=nt,j=(Gi(p,d)|0)==0,j=j?6:5,ie=wt(p|0,d|0,52)|0,ye()|0,ie=ie&15,j>>>0<=g>>>0)return x=2,he=nt,x|0;de=(ie|0)==0,!de&&(Ye=Vt(7,0,(ie^15)*3|0)|0,(Ye&p|0)==0&((ye()|0)&d|0)==0)?T=g:C=4;e:do if((C|0)==4){if(T=(Gi(p,d)|0)!=0,((T?4:5)|0)<(g|0)||ym(p,d,rt)|0||(C=(m[rt>>2]|0)+g|0,T?T=22288+(((C|0)%5|0)<<2)|0:T=22320+(((C|0)%6|0)<<2)|0,Ye=m[T>>2]|0,(Ye|0)==7))return x=1,he=nt,x|0;m[ut>>2]=0,T=ps(p,d,Ye,ut,Ie)|0;do if(!T){if(D=Ie,G=m[D>>2]|0,D=m[D+4>>2]|0,k=D>>>0>>0|(D|0)==(d|0)&G>>>0

>>0,C=k?G:p,k=k?D:d,!de&&(de=Vt(7,0,(ie^15)*3|0)|0,(G&de|0)==0&(D&(ye()|0)|0)==0))T=g;else{if(D=(g+-1+j|0)%(j|0)|0,T=Gi(p,d)|0,(D|0)<0&&Er(23313,23315,245,23324),j=(T|0)!=0,((j?4:5)|0)<(D|0)&&Er(23313,23315,245,23324),ym(p,d,rt)|0&&Er(23313,23315,245,23324),T=(m[rt>>2]|0)+D|0,j?T=22288+(((T|0)%5|0)<<2)|0:T=22320+(((T|0)%6|0)<<2)|0,D=m[T>>2]|0,(D|0)==7&&Er(23313,23315,245,23324),m[Fe>>2]=0,T=ps(p,d,D,Fe,Le)|0,T|0)break;G=Le,j=m[G>>2]|0,G=m[G+4>>2]|0;do if(G>>>0>>0|(G|0)==(k|0)&j>>>0>>0){if(Gi(j,G)|0?C=rA(j,G,p,d)|0:C=m[22384+((((m[Fe>>2]|0)+(m[22352+(D<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,T=Gi(j,G)|0,(C+-1|0)>>>0>5){T=-1,C=j,k=G;break}if(T=(T|0)!=0,(C|0)==1&T){T=-1,C=j,k=G;break}do if(ym(j,G,rt)|0)T=-1;else if(T){T=((m[21936+(C<<2)>>2]|0)+5-(m[rt>>2]|0)|0)%5|0;break}else{T=((m[21968+(C<<2)>>2]|0)+6-(m[rt>>2]|0)|0)%6|0;break}while(!1);C=j,k=G}else T=g;while(!1);D=Ie,G=m[D>>2]|0,D=m[D+4>>2]|0}if((C|0)==(G|0)&(k|0)==(D|0)){if(j=(Gi(G,D)|0)!=0,j?p=rA(G,D,p,d)|0:p=m[22384+((((m[ut>>2]|0)+(m[22352+(Ye<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,T=Gi(G,D)|0,(p+-1|0)>>>0<=5&&(lt=(T|0)!=0,!((p|0)==1<)))do if(ym(G,D,rt)|0)T=-1;else if(lt){T=((m[21936+(p<<2)>>2]|0)+5-(m[rt>>2]|0)|0)%5|0;break}else{T=((m[21968+(p<<2)>>2]|0)+6-(m[rt>>2]|0)|0)%6|0;break}while(!1);else T=-1;T=T+1|0,T=(T|0)==6|j&(T|0)==5?0:T}d=k,p=C;break e}while(!1);return x=T,he=nt,x|0}while(!1);return lt=Vt(T|0,0,56)|0,rt=ye()|0|d&-2130706433|536870912,m[x>>2]=lt|p,m[x+4>>2]=rt,x=0,he=nt,x|0}function ls(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;return C=(Gi(p,d)|0)==0,x=ml(p,d,0,g)|0,T=(x|0)==0,C?!T||(x=ml(p,d,1,g+8|0)|0,x|0)||(x=ml(p,d,2,g+16|0)|0,x|0)||(x=ml(p,d,3,g+24|0)|0,x|0)||(x=ml(p,d,4,g+32|0)|0,x)?(C=x,C|0):ml(p,d,5,g+40|0)|0:!T||(x=ml(p,d,1,g+8|0)|0,x|0)||(x=ml(p,d,2,g+16|0)|0,x|0)||(x=ml(p,d,3,g+24|0)|0,x|0)||(x=ml(p,d,4,g+32|0)|0,x|0)?(C=x,C|0):(C=g+40|0,m[C>>2]=0,m[C+4>>2]=0,C=0,C|0)}function Jx(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0,D=0,j=0;return j=he,he=he+192|0,T=j,C=j+168|0,k=wt(p|0,d|0,56)|0,ye()|0,k=k&7,D=d&-2130706433|134217728,x=U(p,D,C)|0,x|0?(D=x,he=j,D|0):(d=wt(p|0,d|0,52)|0,ye()|0,d=d&15,Gi(p,D)|0?wh(C,d,k,1,T):Ud(C,d,k,1,T),D=T+8|0,m[g>>2]=m[D>>2],m[g+4>>2]=m[D+4>>2],m[g+8>>2]=m[D+8>>2],m[g+12>>2]=m[D+12>>2],D=0,he=j,D|0)}function VT(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;return T=he,he=he+16|0,g=T,!(!0&(d&2013265920|0)==536870912)||(x=d&-2130706433|134217728,!(wn(p,x)|0))?(x=0,he=T,x|0):(C=wt(p|0,d|0,56)|0,ye()|0,C=(ml(p,x,C&7,g)|0)==0,x=g,x=C&((m[x>>2]|0)==(p|0)?(m[x+4>>2]|0)==(d|0):0)&1,he=T,x|0)}function If(p,d,g){p=p|0,d=d|0,g=g|0;var x=0;(d|0)>0?(x=Hc(d,4)|0,m[p>>2]=x,x||Er(23337,23360,40,23374)):m[p>>2]=0,m[p+4>>2]=d,m[p+8>>2]=0,m[p+12>>2]=g}function Rf(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0;T=p+4|0,C=p+12|0,k=p+8|0;e:for(;;){for(g=m[T>>2]|0,d=0;;){if((d|0)>=(g|0))break e;if(x=m[p>>2]|0,D=m[x+(d<<2)>>2]|0,!D)d=d+1|0;else break}d=x+(~~(+Tr(+(+Nn(10,+ +(15-(m[C>>2]|0)|0))*(+ue[D>>3]+ +ue[D+8>>3])))%+(g|0))>>>0<<2)|0,g=m[d>>2]|0;t:do if(g|0){if(x=D+32|0,(g|0)==(D|0))m[d>>2]=m[x>>2];else{if(g=g+32|0,d=m[g>>2]|0,!d)break;for(;(d|0)!=(D|0);)if(g=d+32|0,d=m[g>>2]|0,!d)break t;m[g>>2]=m[x>>2]}Wr(D),m[k>>2]=(m[k>>2]|0)+-1}while(!1)}Wr(m[p>>2]|0)}function xm(p){p=p|0;var d=0,g=0,x=0;for(x=m[p+4>>2]|0,g=0;;){if((g|0)>=(x|0)){d=0,g=4;break}if(d=m[(m[p>>2]|0)+(g<<2)>>2]|0,!d)g=g+1|0;else{g=4;break}}return(g|0)==4?d|0:0}function L_(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;if(g=~~(+Tr(+(+Nn(10,+ +(15-(m[p+12>>2]|0)|0))*(+ue[d>>3]+ +ue[d+8>>3])))%+(m[p+4>>2]|0))>>>0,g=(m[p>>2]|0)+(g<<2)|0,x=m[g>>2]|0,!x)return C=1,C|0;C=d+32|0;do if((x|0)!=(d|0)){if(g=m[x+32>>2]|0,!g)return C=1,C|0;for(T=g;;){if((T|0)==(d|0)){T=8;break}if(g=m[T+32>>2]|0,g)x=T,T=g;else{g=1,T=10;break}}if((T|0)==8){m[x+32>>2]=m[C>>2];break}else if((T|0)==10)return g|0}else m[g>>2]=m[C>>2];while(!1);return Wr(d),C=p+8|0,m[C>>2]=(m[C>>2]|0)+-1,C=0,C|0}function jT(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;C=Ql(40)|0,C||Er(23390,23360,98,23403),m[C>>2]=m[d>>2],m[C+4>>2]=m[d+4>>2],m[C+8>>2]=m[d+8>>2],m[C+12>>2]=m[d+12>>2],T=C+16|0,m[T>>2]=m[g>>2],m[T+4>>2]=m[g+4>>2],m[T+8>>2]=m[g+8>>2],m[T+12>>2]=m[g+12>>2],m[C+32>>2]=0,T=~~(+Tr(+(+Nn(10,+ +(15-(m[p+12>>2]|0)|0))*(+ue[d>>3]+ +ue[d+8>>3])))%+(m[p+4>>2]|0))>>>0,T=(m[p>>2]|0)+(T<<2)|0,x=m[T>>2]|0;do if(!x)m[T>>2]=C;else{for(;!(Ve(x,d)|0&&Ve(x+16|0,g)|0);)if(T=m[x+32>>2]|0,x=T|0?T:x,!(m[x+32>>2]|0)){k=10;break}if((k|0)==10){m[x+32>>2]=C;break}return Wr(C),k=x,k|0}while(!1);return k=p+8|0,m[k>>2]=(m[k>>2]|0)+1,k=C,k|0}function H4(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0;if(T=~~(+Tr(+(+Nn(10,+ +(15-(m[p+12>>2]|0)|0))*(+ue[d>>3]+ +ue[d+8>>3])))%+(m[p+4>>2]|0))>>>0,T=m[(m[p>>2]|0)+(T<<2)>>2]|0,!T)return g=0,g|0;if(!g){for(p=T;;){if(Ve(p,d)|0){x=10;break}if(p=m[p+32>>2]|0,!p){p=0,x=10;break}}if((x|0)==10)return p|0}for(p=T;;){if(Ve(p,d)|0&&Ve(p+16|0,g)|0){x=10;break}if(p=m[p+32>>2]|0,!p){p=0,x=10;break}}return(x|0)==10?p|0:0}function WT(p,d){p=p|0,d=d|0;var g=0;if(g=~~(+Tr(+(+Nn(10,+ +(15-(m[p+12>>2]|0)|0))*(+ue[d>>3]+ +ue[d+8>>3])))%+(m[p+4>>2]|0))>>>0,p=m[(m[p>>2]|0)+(g<<2)>>2]|0,!p)return g=0,g|0;for(;;){if(Ve(p,d)|0){d=5;break}if(p=m[p+32>>2]|0,!p){p=0,d=5;break}}return(d|0)==5?p|0:0}function $4(){return 23424}function ev(p){return p=+p,+ +rv(+p)}function kf(p){return p=+p,~~+ev(p)|0}function Ql(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0,Ye=0,ut=0,lt=0,rt=0,nt=0,Xe=0,Zt=0;Zt=he,he=he+16|0,Le=Zt;do if(p>>>0<245){if(G=p>>>0<11?16:p+11&-8,p=G>>>3,de=m[5857]|0,g=de>>>p,g&3|0)return d=(g&1^1)+p|0,p=23468+(d<<1<<2)|0,g=p+8|0,x=m[g>>2]|0,T=x+8|0,C=m[T>>2]|0,(C|0)==(p|0)?m[5857]=de&~(1<>2]=p,m[g>>2]=C),Xe=d<<3,m[x+4>>2]=Xe|3,Xe=x+Xe+4|0,m[Xe>>2]=m[Xe>>2]|1,Xe=T,he=Zt,Xe|0;if(ie=m[5859]|0,G>>>0>ie>>>0){if(g|0)return d=2<>>12&16,d=d>>>D,g=d>>>5&8,d=d>>>g,C=d>>>2&4,d=d>>>C,p=d>>>1&2,d=d>>>p,x=d>>>1&1,x=(g|D|C|p|x)+(d>>>x)|0,d=23468+(x<<1<<2)|0,p=d+8|0,C=m[p>>2]|0,D=C+8|0,g=m[D>>2]|0,(g|0)==(d|0)?(p=de&~(1<>2]=d,m[p>>2]=g,p=de),Xe=x<<3,k=Xe-G|0,m[C+4>>2]=G|3,T=C+G|0,m[T+4>>2]=k|1,m[C+Xe>>2]=k,ie|0&&(x=m[5862]|0,d=ie>>>3,g=23468+(d<<1<<2)|0,d=1<>2]|0):(m[5857]=p|d,d=g,p=g+8|0),m[p>>2]=x,m[d+12>>2]=x,m[x+8>>2]=d,m[x+12>>2]=g),m[5859]=k,m[5862]=T,Xe=D,he=Zt,Xe|0;if(C=m[5858]|0,C){for(g=(C&0-C)+-1|0,T=g>>>12&16,g=g>>>T,x=g>>>5&8,g=g>>>x,k=g>>>2&4,g=g>>>k,D=g>>>1&2,g=g>>>D,j=g>>>1&1,j=m[23732+((x|T|k|D|j)+(g>>>j)<<2)>>2]|0,g=j,D=j,j=(m[j+4>>2]&-8)-G|0;p=m[g+16>>2]|0,!(!p&&(p=m[g+20>>2]|0,!p));)k=(m[p+4>>2]&-8)-G|0,T=k>>>0>>0,g=p,D=T?p:D,j=T?k:j;if(k=D+G|0,k>>>0>D>>>0){T=m[D+24>>2]|0,d=m[D+12>>2]|0;do if((d|0)==(D|0)){if(p=D+20|0,d=m[p>>2]|0,!d&&(p=D+16|0,d=m[p>>2]|0,!d)){g=0;break}for(;;)if(x=d+20|0,g=m[x>>2]|0,g)d=g,p=x;else if(x=d+16|0,g=m[x>>2]|0,g)d=g,p=x;else break;m[p>>2]=0,g=d}else g=m[D+8>>2]|0,m[g+12>>2]=d,m[d+8>>2]=g,g=d;while(!1);do if(T|0){if(d=m[D+28>>2]|0,p=23732+(d<<2)|0,(D|0)==(m[p>>2]|0)){if(m[p>>2]=g,!g){m[5858]=C&~(1<>2]|0)==(D|0)?Xe:T+20|0)>>2]=g,!g)break;m[g+24>>2]=T,d=m[D+16>>2]|0,d|0&&(m[g+16>>2]=d,m[d+24>>2]=g),d=m[D+20>>2]|0,d|0&&(m[g+20>>2]=d,m[d+24>>2]=g)}while(!1);return j>>>0<16?(Xe=j+G|0,m[D+4>>2]=Xe|3,Xe=D+Xe+4|0,m[Xe>>2]=m[Xe>>2]|1):(m[D+4>>2]=G|3,m[k+4>>2]=j|1,m[k+j>>2]=j,ie|0&&(x=m[5862]|0,d=ie>>>3,g=23468+(d<<1<<2)|0,d=1<>2]|0):(m[5857]=d|de,d=g,p=g+8|0),m[p>>2]=x,m[d+12>>2]=x,m[x+8>>2]=d,m[x+12>>2]=g),m[5859]=j,m[5862]=k),Xe=D+8|0,he=Zt,Xe|0}else de=G}else de=G}else de=G}else if(p>>>0<=4294967231)if(p=p+11|0,G=p&-8,x=m[5858]|0,x){T=0-G|0,p=p>>>8,p?G>>>0>16777215?j=31:(de=(p+1048320|0)>>>16&8,Ye=p<>>16&4,Ye=Ye<>>16&2,j=14-(D|de|j)+(Ye<>>15)|0,j=G>>>(j+7|0)&1|j<<1):j=0,g=m[23732+(j<<2)>>2]|0;e:do if(!g)g=0,p=0,Ye=61;else for(p=0,D=G<<((j|0)==31?0:25-(j>>>1)|0),C=0;;){if(k=(m[g+4>>2]&-8)-G|0,k>>>0>>0)if(k)p=g,T=k;else{p=g,T=0,Ye=65;break e}if(Ye=m[g+20>>2]|0,g=m[g+16+(D>>>31<<2)>>2]|0,C=(Ye|0)==0|(Ye|0)==(g|0)?C:Ye,g)D=D<<1;else{g=C,Ye=61;break}}while(!1);if((Ye|0)==61){if((g|0)==0&(p|0)==0){if(p=2<>>12&16,de=de>>>k,C=de>>>5&8,de=de>>>C,D=de>>>2&4,de=de>>>D,j=de>>>1&2,de=de>>>j,g=de>>>1&1,p=0,g=m[23732+((C|k|D|j|g)+(de>>>g)<<2)>>2]|0}g?Ye=65:(D=p,k=T)}if((Ye|0)==65)for(C=g;;)if(de=(m[C+4>>2]&-8)-G|0,g=de>>>0>>0,T=g?de:T,p=g?C:p,g=m[C+16>>2]|0,g||(g=m[C+20>>2]|0),g)C=g;else{D=p,k=T;break}if(D|0&&k>>>0<((m[5859]|0)-G|0)>>>0&&(ie=D+G|0,ie>>>0>D>>>0)){C=m[D+24>>2]|0,d=m[D+12>>2]|0;do if((d|0)==(D|0)){if(p=D+20|0,d=m[p>>2]|0,!d&&(p=D+16|0,d=m[p>>2]|0,!d)){d=0;break}for(;;)if(T=d+20|0,g=m[T>>2]|0,g)d=g,p=T;else if(T=d+16|0,g=m[T>>2]|0,g)d=g,p=T;else break;m[p>>2]=0}else Xe=m[D+8>>2]|0,m[Xe+12>>2]=d,m[d+8>>2]=Xe;while(!1);do if(C){if(p=m[D+28>>2]|0,g=23732+(p<<2)|0,(D|0)==(m[g>>2]|0)){if(m[g>>2]=d,!d){x=x&~(1<>2]|0)==(D|0)?Xe:C+20|0)>>2]=d,!d)break;m[d+24>>2]=C,p=m[D+16>>2]|0,p|0&&(m[d+16>>2]=p,m[p+24>>2]=d),p=m[D+20>>2]|0,p&&(m[d+20>>2]=p,m[p+24>>2]=d)}while(!1);e:do if(k>>>0<16)Xe=k+G|0,m[D+4>>2]=Xe|3,Xe=D+Xe+4|0,m[Xe>>2]=m[Xe>>2]|1;else{if(m[D+4>>2]=G|3,m[ie+4>>2]=k|1,m[ie+k>>2]=k,d=k>>>3,k>>>0<256){g=23468+(d<<1<<2)|0,p=m[5857]|0,d=1<>2]|0):(m[5857]=p|d,d=g,p=g+8|0),m[p>>2]=ie,m[d+12>>2]=ie,m[ie+8>>2]=d,m[ie+12>>2]=g;break}if(d=k>>>8,d?k>>>0>16777215?g=31:(nt=(d+1048320|0)>>>16&8,Xe=d<>>16&4,Xe=Xe<>>16&2,g=14-(rt|nt|g)+(Xe<>>15)|0,g=k>>>(g+7|0)&1|g<<1):g=0,d=23732+(g<<2)|0,m[ie+28>>2]=g,p=ie+16|0,m[p+4>>2]=0,m[p>>2]=0,p=1<>2]=ie,m[ie+24>>2]=d,m[ie+12>>2]=ie,m[ie+8>>2]=ie;break}d=m[d>>2]|0;t:do if((m[d+4>>2]&-8|0)!=(k|0)){for(x=k<<((g|0)==31?0:25-(g>>>1)|0);g=d+16+(x>>>31<<2)|0,p=m[g>>2]|0,!!p;)if((m[p+4>>2]&-8|0)==(k|0)){d=p;break t}else x=x<<1,d=p;m[g>>2]=ie,m[ie+24>>2]=d,m[ie+12>>2]=ie,m[ie+8>>2]=ie;break e}while(!1);nt=d+8|0,Xe=m[nt>>2]|0,m[Xe+12>>2]=ie,m[nt>>2]=ie,m[ie+8>>2]=Xe,m[ie+12>>2]=d,m[ie+24>>2]=0}while(!1);return Xe=D+8|0,he=Zt,Xe|0}else de=G}else de=G;else de=-1;while(!1);if(g=m[5859]|0,g>>>0>=de>>>0)return d=g-de|0,p=m[5862]|0,d>>>0>15?(Xe=p+de|0,m[5862]=Xe,m[5859]=d,m[Xe+4>>2]=d|1,m[p+g>>2]=d,m[p+4>>2]=de|3):(m[5859]=0,m[5862]=0,m[p+4>>2]=g|3,Xe=p+g+4|0,m[Xe>>2]=m[Xe>>2]|1),Xe=p+8|0,he=Zt,Xe|0;if(k=m[5860]|0,k>>>0>de>>>0)return rt=k-de|0,m[5860]=rt,Xe=m[5863]|0,nt=Xe+de|0,m[5863]=nt,m[nt+4>>2]=rt|1,m[Xe+4>>2]=de|3,Xe=Xe+8|0,he=Zt,Xe|0;if(m[5975]|0?p=m[5977]|0:(m[5977]=4096,m[5976]=4096,m[5978]=-1,m[5979]=-1,m[5980]=0,m[5968]=0,m[5975]=Le&-16^1431655768,p=4096),D=de+48|0,j=de+47|0,C=p+j|0,T=0-p|0,G=C&T,G>>>0<=de>>>0||(p=m[5967]|0,p|0&&(ie=m[5965]|0,Le=ie+G|0,Le>>>0<=ie>>>0|Le>>>0>p>>>0)))return Xe=0,he=Zt,Xe|0;e:do if(m[5968]&4)d=0,Ye=143;else{g=m[5863]|0;t:do if(g){for(x=23876;Le=m[x>>2]|0,!(Le>>>0<=g>>>0&&(Le+(m[x+4>>2]|0)|0)>>>0>g>>>0);)if(p=m[x+8>>2]|0,p)x=p;else{Ye=128;break t}if(d=C-k&T,d>>>0<2147483647)if(p=Ph(d|0)|0,(p|0)==((m[x>>2]|0)+(m[x+4>>2]|0)|0)){if((p|0)!=-1){k=d,C=p,Ye=145;break e}}else x=p,Ye=136;else d=0}else Ye=128;while(!1);do if((Ye|0)==128)if(g=Ph(0)|0,(g|0)!=-1&&(d=g,Fe=m[5976]|0,Ie=Fe+-1|0,d=(Ie&d|0?(Ie+d&0-Fe)-d|0:0)+G|0,Fe=m[5965]|0,Ie=d+Fe|0,d>>>0>de>>>0&d>>>0<2147483647)){if(Le=m[5967]|0,Le|0&&Ie>>>0<=Fe>>>0|Ie>>>0>Le>>>0){d=0;break}if(p=Ph(d|0)|0,(p|0)==(g|0)){k=d,C=g,Ye=145;break e}else x=p,Ye=136}else d=0;while(!1);do if((Ye|0)==136){if(g=0-d|0,!(D>>>0>d>>>0&(d>>>0<2147483647&(x|0)!=-1)))if((x|0)==-1){d=0;break}else{k=d,C=x,Ye=145;break e}if(p=m[5977]|0,p=j-d+p&0-p,p>>>0>=2147483647){k=d,C=x,Ye=145;break e}if((Ph(p|0)|0)==-1){Ph(g|0)|0,d=0;break}else{k=p+d|0,C=x,Ye=145;break e}}while(!1);m[5968]=m[5968]|4,Ye=143}while(!1);if((Ye|0)==143&&G>>>0<2147483647&&(rt=Ph(G|0)|0,Ie=Ph(0)|0,ut=Ie-rt|0,lt=ut>>>0>(de+40|0)>>>0,!((rt|0)==-1|lt^1|rt>>>0>>0&((rt|0)!=-1&(Ie|0)!=-1)^1))&&(k=lt?ut:d,C=rt,Ye=145),(Ye|0)==145){d=(m[5965]|0)+k|0,m[5965]=d,d>>>0>(m[5966]|0)>>>0&&(m[5966]=d),j=m[5863]|0;e:do if(j){for(d=23876;;){if(p=m[d>>2]|0,g=m[d+4>>2]|0,(C|0)==(p+g|0)){Ye=154;break}if(x=m[d+8>>2]|0,x)d=x;else break}if((Ye|0)==154&&(nt=d+4|0,(m[d+12>>2]&8|0)==0)&&C>>>0>j>>>0&p>>>0<=j>>>0){m[nt>>2]=g+k,Xe=(m[5860]|0)+k|0,rt=j+8|0,rt=rt&7|0?0-rt&7:0,nt=j+rt|0,rt=Xe-rt|0,m[5863]=nt,m[5860]=rt,m[nt+4>>2]=rt|1,m[j+Xe+4>>2]=40,m[5864]=m[5979];break}for(C>>>0<(m[5861]|0)>>>0&&(m[5861]=C),g=C+k|0,d=23876;;){if((m[d>>2]|0)==(g|0)){Ye=162;break}if(p=m[d+8>>2]|0,p)d=p;else break}if((Ye|0)==162&&!(m[d+12>>2]&8|0)){m[d>>2]=C,ie=d+4|0,m[ie>>2]=(m[ie>>2]|0)+k,ie=C+8|0,ie=C+(ie&7|0?0-ie&7:0)|0,d=g+8|0,d=g+(d&7|0?0-d&7:0)|0,G=ie+de|0,D=d-ie-de|0,m[ie+4>>2]=de|3;t:do if((j|0)==(d|0))Xe=(m[5860]|0)+D|0,m[5860]=Xe,m[5863]=G,m[G+4>>2]=Xe|1;else{if((m[5862]|0)==(d|0)){Xe=(m[5859]|0)+D|0,m[5859]=Xe,m[5862]=G,m[G+4>>2]=Xe|1,m[G+Xe>>2]=Xe;break}if(p=m[d+4>>2]|0,(p&3|0)==1){k=p&-8,x=p>>>3;r:do if(p>>>0<256)if(p=m[d+8>>2]|0,g=m[d+12>>2]|0,(g|0)==(p|0)){m[5857]=m[5857]&~(1<>2]=g,m[g+8>>2]=p;break}else{C=m[d+24>>2]|0,p=m[d+12>>2]|0;do if((p|0)==(d|0)){if(g=d+16|0,x=g+4|0,p=m[x>>2]|0,p)g=x;else if(p=m[g>>2]|0,!p){p=0;break}for(;;)if(T=p+20|0,x=m[T>>2]|0,x)p=x,g=T;else if(T=p+16|0,x=m[T>>2]|0,x)p=x,g=T;else break;m[g>>2]=0}else Xe=m[d+8>>2]|0,m[Xe+12>>2]=p,m[p+8>>2]=Xe;while(!1);if(!C)break;g=m[d+28>>2]|0,x=23732+(g<<2)|0;do if((m[x>>2]|0)!=(d|0)){if(Xe=C+16|0,m[((m[Xe>>2]|0)==(d|0)?Xe:C+20|0)>>2]=p,!p)break r}else{if(m[x>>2]=p,p|0)break;m[5858]=m[5858]&~(1<>2]=C,g=d+16|0,x=m[g>>2]|0,x|0&&(m[p+16>>2]=x,m[x+24>>2]=p),g=m[g+4>>2]|0,!g)break;m[p+20>>2]=g,m[g+24>>2]=p}while(!1);d=d+k|0,T=k+D|0}else T=D;if(d=d+4|0,m[d>>2]=m[d>>2]&-2,m[G+4>>2]=T|1,m[G+T>>2]=T,d=T>>>3,T>>>0<256){g=23468+(d<<1<<2)|0,p=m[5857]|0,d=1<>2]|0):(m[5857]=p|d,d=g,p=g+8|0),m[p>>2]=G,m[d+12>>2]=G,m[G+8>>2]=d,m[G+12>>2]=g;break}d=T>>>8;do if(!d)x=0;else{if(T>>>0>16777215){x=31;break}nt=(d+1048320|0)>>>16&8,Xe=d<>>16&4,Xe=Xe<>>16&2,x=14-(rt|nt|x)+(Xe<>>15)|0,x=T>>>(x+7|0)&1|x<<1}while(!1);if(d=23732+(x<<2)|0,m[G+28>>2]=x,p=G+16|0,m[p+4>>2]=0,m[p>>2]=0,p=m[5858]|0,g=1<>2]=G,m[G+24>>2]=d,m[G+12>>2]=G,m[G+8>>2]=G;break}d=m[d>>2]|0;r:do if((m[d+4>>2]&-8|0)!=(T|0)){for(x=T<<((x|0)==31?0:25-(x>>>1)|0);g=d+16+(x>>>31<<2)|0,p=m[g>>2]|0,!!p;)if((m[p+4>>2]&-8|0)==(T|0)){d=p;break r}else x=x<<1,d=p;m[g>>2]=G,m[G+24>>2]=d,m[G+12>>2]=G,m[G+8>>2]=G;break t}while(!1);nt=d+8|0,Xe=m[nt>>2]|0,m[Xe+12>>2]=G,m[nt>>2]=G,m[G+8>>2]=Xe,m[G+12>>2]=d,m[G+24>>2]=0}while(!1);return Xe=ie+8|0,he=Zt,Xe|0}for(d=23876;p=m[d>>2]|0,!(p>>>0<=j>>>0&&(Xe=p+(m[d+4>>2]|0)|0,Xe>>>0>j>>>0));)d=m[d+8>>2]|0;T=Xe+-47|0,p=T+8|0,p=T+(p&7|0?0-p&7:0)|0,T=j+16|0,p=p>>>0>>0?j:p,d=p+8|0,g=k+-40|0,rt=C+8|0,rt=rt&7|0?0-rt&7:0,nt=C+rt|0,rt=g-rt|0,m[5863]=nt,m[5860]=rt,m[nt+4>>2]=rt|1,m[C+g+4>>2]=40,m[5864]=m[5979],g=p+4|0,m[g>>2]=27,m[d>>2]=m[5969],m[d+4>>2]=m[5970],m[d+8>>2]=m[5971],m[d+12>>2]=m[5972],m[5969]=C,m[5970]=k,m[5972]=0,m[5971]=d,d=p+24|0;do nt=d,d=d+4|0,m[d>>2]=7;while((nt+8|0)>>>0>>0);if((p|0)!=(j|0)){if(C=p-j|0,m[g>>2]=m[g>>2]&-2,m[j+4>>2]=C|1,m[p>>2]=C,d=C>>>3,C>>>0<256){g=23468+(d<<1<<2)|0,p=m[5857]|0,d=1<>2]|0):(m[5857]=p|d,d=g,p=g+8|0),m[p>>2]=j,m[d+12>>2]=j,m[j+8>>2]=d,m[j+12>>2]=g;break}if(d=C>>>8,d?C>>>0>16777215?x=31:(nt=(d+1048320|0)>>>16&8,Xe=d<>>16&4,Xe=Xe<>>16&2,x=14-(rt|nt|x)+(Xe<>>15)|0,x=C>>>(x+7|0)&1|x<<1):x=0,g=23732+(x<<2)|0,m[j+28>>2]=x,m[j+20>>2]=0,m[T>>2]=0,d=m[5858]|0,p=1<>2]=j,m[j+24>>2]=g,m[j+12>>2]=j,m[j+8>>2]=j;break}d=m[g>>2]|0;t:do if((m[d+4>>2]&-8|0)!=(C|0)){for(x=C<<((x|0)==31?0:25-(x>>>1)|0);g=d+16+(x>>>31<<2)|0,p=m[g>>2]|0,!!p;)if((m[p+4>>2]&-8|0)==(C|0)){d=p;break t}else x=x<<1,d=p;m[g>>2]=j,m[j+24>>2]=d,m[j+12>>2]=j,m[j+8>>2]=j;break e}while(!1);nt=d+8|0,Xe=m[nt>>2]|0,m[Xe+12>>2]=j,m[nt>>2]=j,m[j+8>>2]=Xe,m[j+12>>2]=d,m[j+24>>2]=0}}else Xe=m[5861]|0,(Xe|0)==0|C>>>0>>0&&(m[5861]=C),m[5969]=C,m[5970]=k,m[5972]=0,m[5866]=m[5975],m[5865]=-1,m[5870]=23468,m[5869]=23468,m[5872]=23476,m[5871]=23476,m[5874]=23484,m[5873]=23484,m[5876]=23492,m[5875]=23492,m[5878]=23500,m[5877]=23500,m[5880]=23508,m[5879]=23508,m[5882]=23516,m[5881]=23516,m[5884]=23524,m[5883]=23524,m[5886]=23532,m[5885]=23532,m[5888]=23540,m[5887]=23540,m[5890]=23548,m[5889]=23548,m[5892]=23556,m[5891]=23556,m[5894]=23564,m[5893]=23564,m[5896]=23572,m[5895]=23572,m[5898]=23580,m[5897]=23580,m[5900]=23588,m[5899]=23588,m[5902]=23596,m[5901]=23596,m[5904]=23604,m[5903]=23604,m[5906]=23612,m[5905]=23612,m[5908]=23620,m[5907]=23620,m[5910]=23628,m[5909]=23628,m[5912]=23636,m[5911]=23636,m[5914]=23644,m[5913]=23644,m[5916]=23652,m[5915]=23652,m[5918]=23660,m[5917]=23660,m[5920]=23668,m[5919]=23668,m[5922]=23676,m[5921]=23676,m[5924]=23684,m[5923]=23684,m[5926]=23692,m[5925]=23692,m[5928]=23700,m[5927]=23700,m[5930]=23708,m[5929]=23708,m[5932]=23716,m[5931]=23716,Xe=k+-40|0,rt=C+8|0,rt=rt&7|0?0-rt&7:0,nt=C+rt|0,rt=Xe-rt|0,m[5863]=nt,m[5860]=rt,m[nt+4>>2]=rt|1,m[C+Xe+4>>2]=40,m[5864]=m[5979];while(!1);if(d=m[5860]|0,d>>>0>de>>>0)return rt=d-de|0,m[5860]=rt,Xe=m[5863]|0,nt=Xe+de|0,m[5863]=nt,m[nt+4>>2]=rt|1,m[Xe+4>>2]=de|3,Xe=Xe+8|0,he=Zt,Xe|0}return Xe=$4()|0,m[Xe>>2]=12,Xe=0,he=Zt,Xe|0}function Wr(p){p=p|0;var d=0,g=0,x=0,T=0,C=0,k=0,D=0,j=0;if(p){g=p+-8|0,T=m[5861]|0,p=m[p+-4>>2]|0,d=p&-8,j=g+d|0;do if(p&1)D=g,k=g;else{if(x=m[g>>2]|0,!(p&3)||(k=g+(0-x)|0,C=x+d|0,k>>>0>>0))return;if((m[5862]|0)==(k|0)){if(p=j+4|0,d=m[p>>2]|0,(d&3|0)!=3){D=k,d=C;break}m[5859]=C,m[p>>2]=d&-2,m[k+4>>2]=C|1,m[k+C>>2]=C;return}if(g=x>>>3,x>>>0<256)if(p=m[k+8>>2]|0,d=m[k+12>>2]|0,(d|0)==(p|0)){m[5857]=m[5857]&~(1<>2]=d,m[d+8>>2]=p,D=k,d=C;break}T=m[k+24>>2]|0,p=m[k+12>>2]|0;do if((p|0)==(k|0)){if(d=k+16|0,g=d+4|0,p=m[g>>2]|0,p)d=g;else if(p=m[d>>2]|0,!p){p=0;break}for(;;)if(x=p+20|0,g=m[x>>2]|0,g)p=g,d=x;else if(x=p+16|0,g=m[x>>2]|0,g)p=g,d=x;else break;m[d>>2]=0}else D=m[k+8>>2]|0,m[D+12>>2]=p,m[p+8>>2]=D;while(!1);if(T){if(d=m[k+28>>2]|0,g=23732+(d<<2)|0,(m[g>>2]|0)==(k|0)){if(m[g>>2]=p,!p){m[5858]=m[5858]&~(1<>2]|0)==(k|0)?D:T+20|0)>>2]=p,!p){D=k,d=C;break}m[p+24>>2]=T,d=k+16|0,g=m[d>>2]|0,g|0&&(m[p+16>>2]=g,m[g+24>>2]=p),d=m[d+4>>2]|0,d?(m[p+20>>2]=d,m[d+24>>2]=p,D=k,d=C):(D=k,d=C)}else D=k,d=C}while(!1);if(!(k>>>0>=j>>>0)&&(p=j+4|0,x=m[p>>2]|0,!!(x&1))){if(x&2)m[p>>2]=x&-2,m[D+4>>2]=d|1,m[k+d>>2]=d,T=d;else{if((m[5863]|0)==(j|0)){if(j=(m[5860]|0)+d|0,m[5860]=j,m[5863]=D,m[D+4>>2]=j|1,(D|0)!=(m[5862]|0))return;m[5862]=0,m[5859]=0;return}if((m[5862]|0)==(j|0)){j=(m[5859]|0)+d|0,m[5859]=j,m[5862]=k,m[D+4>>2]=j|1,m[k+j>>2]=j;return}T=(x&-8)+d|0,g=x>>>3;do if(x>>>0<256)if(d=m[j+8>>2]|0,p=m[j+12>>2]|0,(p|0)==(d|0)){m[5857]=m[5857]&~(1<>2]=p,m[p+8>>2]=d;break}else{C=m[j+24>>2]|0,p=m[j+12>>2]|0;do if((p|0)==(j|0)){if(d=j+16|0,g=d+4|0,p=m[g>>2]|0,p)d=g;else if(p=m[d>>2]|0,!p){g=0;break}for(;;)if(x=p+20|0,g=m[x>>2]|0,g)p=g,d=x;else if(x=p+16|0,g=m[x>>2]|0,g)p=g,d=x;else break;m[d>>2]=0,g=p}else g=m[j+8>>2]|0,m[g+12>>2]=p,m[p+8>>2]=g,g=p;while(!1);if(C|0){if(p=m[j+28>>2]|0,d=23732+(p<<2)|0,(m[d>>2]|0)==(j|0)){if(m[d>>2]=g,!g){m[5858]=m[5858]&~(1<>2]|0)==(j|0)?x:C+20|0)>>2]=g,!g)break;m[g+24>>2]=C,p=j+16|0,d=m[p>>2]|0,d|0&&(m[g+16>>2]=d,m[d+24>>2]=g),p=m[p+4>>2]|0,p|0&&(m[g+20>>2]=p,m[p+24>>2]=g)}}while(!1);if(m[D+4>>2]=T|1,m[k+T>>2]=T,(D|0)==(m[5862]|0)){m[5859]=T;return}}if(p=T>>>3,T>>>0<256){g=23468+(p<<1<<2)|0,d=m[5857]|0,p=1<>2]|0):(m[5857]=d|p,p=g,d=g+8|0),m[d>>2]=D,m[p+12>>2]=D,m[D+8>>2]=p,m[D+12>>2]=g;return}p=T>>>8,p?T>>>0>16777215?x=31:(k=(p+1048320|0)>>>16&8,j=p<>>16&4,j=j<>>16&2,x=14-(C|k|x)+(j<>>15)|0,x=T>>>(x+7|0)&1|x<<1):x=0,p=23732+(x<<2)|0,m[D+28>>2]=x,m[D+20>>2]=0,m[D+16>>2]=0,d=m[5858]|0,g=1<>2]=D,m[D+24>>2]=p,m[D+12>>2]=D,m[D+8>>2]=D;else{p=m[p>>2]|0;t:do if((m[p+4>>2]&-8|0)!=(T|0)){for(x=T<<((x|0)==31?0:25-(x>>>1)|0);g=p+16+(x>>>31<<2)|0,d=m[g>>2]|0,!!d;)if((m[d+4>>2]&-8|0)==(T|0)){p=d;break t}else x=x<<1,p=d;m[g>>2]=D,m[D+24>>2]=p,m[D+12>>2]=D,m[D+8>>2]=D;break e}while(!1);k=p+8|0,j=m[k>>2]|0,m[j+12>>2]=D,m[k>>2]=D,m[D+8>>2]=j,m[D+12>>2]=p,m[D+24>>2]=0}while(!1);if(j=(m[5865]|0)+-1|0,m[5865]=j,!(j|0)){for(p=23884;p=m[p>>2]|0,p;)p=p+8|0;m[5865]=-1}}}}function Hc(p,d){p=p|0,d=d|0;var g=0;return p?(g=Go(d,p)|0,(d|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(d|0)?g:-1)):g=0,p=Ql(g)|0,!p||!(m[p+-4>>2]&3)||Lf(p|0,0,g|0)|0,p|0}function ni(p,d,g,x){return p=p|0,d=d|0,g=g|0,x=x|0,g=p+g>>>0,ii(d+x+(g>>>0

>>0|0)>>>0|0),g|0|0}function Qo(p,d,g,x){return p=p|0,d=d|0,g=g|0,x=x|0,x=d-x-(g>>>0>p>>>0|0)>>>0,ii(x|0),p-g>>>0|0|0}function fA(p){return p=p|0,(p?31-(Bc(p^p-1)|0)|0:32)|0}function dA(p,d,g,x,T){p=p|0,d=d|0,g=g|0,x=x|0,T=T|0;var C=0,k=0,D=0,j=0,G=0,ie=0,de=0,Le=0,Fe=0,Ie=0;if(ie=p,j=d,G=j,k=g,Le=x,D=Le,!G)return C=(T|0)!=0,D?C?(m[T>>2]=p|0,m[T+4>>2]=d&0,Le=0,T=0,ii(Le|0),T|0):(Le=0,T=0,ii(Le|0),T|0):(C&&(m[T>>2]=(ie>>>0)%(k>>>0),m[T+4>>2]=0),Le=0,T=(ie>>>0)/(k>>>0)>>>0,ii(Le|0),T|0);C=(D|0)==0;do if(k){if(!C){if(C=(Bc(D|0)|0)-(Bc(G|0)|0)|0,C>>>0<=31){de=C+1|0,D=31-C|0,d=C-31>>31,k=de,p=ie>>>(de>>>0)&d|G<>>(de>>>0)&d,C=0,D=ie<>2]=p|0,m[T+4>>2]=j|d&0,Le=0,T=0,ii(Le|0),T|0):(Le=0,T=0,ii(Le|0),T|0)}if(C=k-1|0,C&k|0){D=(Bc(k|0)|0)+33-(Bc(G|0)|0)|0,Ie=64-D|0,de=32-D|0,j=de>>31,Fe=D-32|0,d=Fe>>31,k=D,p=de-1>>31&G>>>(Fe>>>0)|(G<>>(D>>>0))&d,d=d&G>>>(D>>>0),C=ie<>>(Fe>>>0))&j|ie<>31;break}return T|0&&(m[T>>2]=C&ie,m[T+4>>2]=0),(k|0)==1?(Fe=j|d&0,Ie=p|0|0,ii(Fe|0),Ie|0):(Ie=fA(k|0)|0,Fe=G>>>(Ie>>>0)|0,Ie=G<<32-Ie|ie>>>(Ie>>>0)|0,ii(Fe|0),Ie|0)}else{if(C)return T|0&&(m[T>>2]=(G>>>0)%(k>>>0),m[T+4>>2]=0),Fe=0,Ie=(G>>>0)/(k>>>0)>>>0,ii(Fe|0),Ie|0;if(!ie)return T|0&&(m[T>>2]=0,m[T+4>>2]=(G>>>0)%(D>>>0)),Fe=0,Ie=(G>>>0)/(D>>>0)>>>0,ii(Fe|0),Ie|0;if(C=D-1|0,!(C&D))return T|0&&(m[T>>2]=p|0,m[T+4>>2]=C&G|d&0),Fe=0,Ie=G>>>((fA(D|0)|0)>>>0),ii(Fe|0),Ie|0;if(C=(Bc(D|0)|0)-(Bc(G|0)|0)|0,C>>>0<=30){d=C+1|0,D=31-C|0,k=d,p=G<>>(d>>>0),d=G>>>(d>>>0),C=0,D=ie<>2]=p|0,m[T+4>>2]=j|d&0,Fe=0,Ie=0,ii(Fe|0),Ie|0):(Fe=0,Ie=0,ii(Fe|0),Ie|0)}while(!1);if(!k)G=D,j=0,D=0;else{de=g|0|0,ie=Le|x&0,G=ni(de|0,ie|0,-1,-1)|0,g=ye()|0,j=D,D=0;do x=j,j=C>>>31|j<<1,C=D|C<<1,x=p<<1|x>>>31|0,Le=p>>>31|d<<1|0,Qo(G|0,g|0,x|0,Le|0)|0,Ie=ye()|0,Fe=Ie>>31|((Ie|0)<0?-1:0)<<1,D=Fe&1,p=Qo(x|0,Le|0,Fe&de|0,(((Ie|0)<0?-1:0)>>31|((Ie|0)<0?-1:0)<<1)&ie|0)|0,d=ye()|0,k=k-1|0;while(k|0);G=j,j=0}return k=0,T|0&&(m[T>>2]=p,m[T+4>>2]=d),Fe=(C|0)>>>31|(G|k)<<1|(k<<1|C>>>31)&0|j,Ie=(C<<1|0)&-2|D,ii(Fe|0),Ie|0}function Ru(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0;return G=d>>31|((d|0)<0?-1:0)<<1,j=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1,C=x>>31|((x|0)<0?-1:0)<<1,T=((x|0)<0?-1:0)>>31|((x|0)<0?-1:0)<<1,D=Qo(G^p|0,j^d|0,G|0,j|0)|0,k=ye()|0,p=C^G,d=T^j,Qo((dA(D,k,Qo(C^g|0,T^x|0,C|0,T|0)|0,ye()|0,0)|0)^p|0,(ye()|0)^d|0,p|0,d|0)|0}function HT(p,d){p=p|0,d=d|0;var g=0,x=0,T=0,C=0;return C=p&65535,T=d&65535,g=Go(T,C)|0,x=p>>>16,p=(g>>>16)+(Go(T,x)|0)|0,T=d>>>16,d=Go(T,C)|0,ii((p>>>16)+(Go(T,x)|0)+(((p&65535)+d|0)>>>16)|0),p+d<<16|g&65535|0|0}function Do(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0;return T=p,C=g,g=HT(T,C)|0,p=ye()|0,ii((Go(d,C)|0)+(Go(x,T)|0)+p|p&0|0),g|0|0|0}function D_(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0,k=0,D=0,j=0,G=0;return T=he,he=he+16|0,D=T|0,k=d>>31|((d|0)<0?-1:0)<<1,C=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1,G=x>>31|((x|0)<0?-1:0)<<1,j=((x|0)<0?-1:0)>>31|((x|0)<0?-1:0)<<1,p=Qo(k^p|0,C^d|0,k|0,C|0)|0,d=ye()|0,dA(p,d,Qo(G^g|0,j^x|0,G|0,j|0)|0,ye()|0,D)|0,x=Qo(m[D>>2]^k|0,m[D+4>>2]^C|0,k|0,C|0)|0,g=ye()|0,he=T,ii(g|0),x|0}function gs(p,d,g,x){p=p|0,d=d|0,g=g|0,x=x|0;var T=0,C=0;return C=he,he=he+16|0,T=C|0,dA(p,d,g,x,T)|0,he=C,ii(m[T+4>>2]|0),m[T>>2]|0|0}function jd(p,d,g){return p=p|0,d=d|0,g=g|0,(g|0)<32?(ii(d>>g|0),p>>>g|(d&(1<>g-32|0)}function wt(p,d,g){return p=p|0,d=d|0,g=g|0,(g|0)<32?(ii(d>>>g|0),p>>>g|(d&(1<>>g-32|0)}function Vt(p,d,g){return p=p|0,d=d|0,g=g|0,(g|0)<32?(ii(d<>>32-g|0),p<=0?+En(p+.5):+$l(p-.5)}function O_(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0;if((g|0)>=8192)return y_(p|0,d|0,g|0)|0,p|0;if(C=p|0,T=p+g|0,(p&3)==(d&3)){for(;p&3;){if(!g)return C|0;_r[p>>0]=_r[d>>0]|0,p=p+1|0,d=d+1|0,g=g-1|0}for(g=T&-4|0,x=g-64|0;(p|0)<=(x|0);)m[p>>2]=m[d>>2],m[p+4>>2]=m[d+4>>2],m[p+8>>2]=m[d+8>>2],m[p+12>>2]=m[d+12>>2],m[p+16>>2]=m[d+16>>2],m[p+20>>2]=m[d+20>>2],m[p+24>>2]=m[d+24>>2],m[p+28>>2]=m[d+28>>2],m[p+32>>2]=m[d+32>>2],m[p+36>>2]=m[d+36>>2],m[p+40>>2]=m[d+40>>2],m[p+44>>2]=m[d+44>>2],m[p+48>>2]=m[d+48>>2],m[p+52>>2]=m[d+52>>2],m[p+56>>2]=m[d+56>>2],m[p+60>>2]=m[d+60>>2],p=p+64|0,d=d+64|0;for(;(p|0)<(g|0);)m[p>>2]=m[d>>2],p=p+4|0,d=d+4|0}else for(g=T-4|0;(p|0)<(g|0);)_r[p>>0]=_r[d>>0]|0,_r[p+1>>0]=_r[d+1>>0]|0,_r[p+2>>0]=_r[d+2>>0]|0,_r[p+3>>0]=_r[d+3>>0]|0,p=p+4|0,d=d+4|0;for(;(p|0)<(T|0);)_r[p>>0]=_r[d>>0]|0,p=p+1|0,d=d+1|0;return C|0}function Lf(p,d,g){p=p|0,d=d|0,g=g|0;var x=0,T=0,C=0,k=0;if(C=p+g|0,d=d&255,(g|0)>=67){for(;p&3;)_r[p>>0]=d,p=p+1|0;for(x=C&-4|0,k=d|d<<8|d<<16|d<<24,T=x-64|0;(p|0)<=(T|0);)m[p>>2]=k,m[p+4>>2]=k,m[p+8>>2]=k,m[p+12>>2]=k,m[p+16>>2]=k,m[p+20>>2]=k,m[p+24>>2]=k,m[p+28>>2]=k,m[p+32>>2]=k,m[p+36>>2]=k,m[p+40>>2]=k,m[p+44>>2]=k,m[p+48>>2]=k,m[p+52>>2]=k,m[p+56>>2]=k,m[p+60>>2]=k,p=p+64|0;for(;(p|0)<(x|0);)m[p>>2]=k,p=p+4|0}for(;(p|0)<(C|0);)_r[p>>0]=d,p=p+1|0;return C-g|0}function rv(p){return p=+p,p>=0?+En(p+.5):+$l(p-.5)}function Ph(p){p=p|0;var d=0,g=0,x=0;return x=__()|0,g=m[Ir>>2]|0,d=g+p|0,(p|0)>0&(d|0)<(g|0)|(d|0)<0?(tA(d|0)|0,eA(12),-1):(d|0)>(x|0)&&!(Ld(d|0)|0)?(eA(12),-1):(m[Ir>>2]=d,g|0)}return{___divdi3:Ru,___muldi3:Do,___remdi3:D_,___uremdi3:gs,_areNeighborCells:M_,_bitshift64Ashr:jd,_bitshift64Lshr:wt,_bitshift64Shl:Vt,_calloc:Hc,_cellAreaKm2:oi,_cellAreaM2:Gr,_cellAreaRads2:zi,_cellToBoundary:Y,_cellToCenterChild:dm,_cellToChildPos:we,_cellToChildren:Vd,_cellToChildrenSize:jc,_cellToLatLng:H,_cellToLocalIj:Cu,_cellToParent:_n,_cellToVertex:ml,_cellToVertexes:ls,_cellsToDirectedEdge:da,_cellsToLinkedMultiPolygon:ha,_childPosToCell:Ae,_compactCells:pm,_destroyLinkedMultiPolygon:Vn,_directedEdgeToBoundary:zd,_directedEdgeToCells:P_,_edgeLengthKm:Un,_edgeLengthM:ln,_edgeLengthRads:ui,_emscripten_replace_memory:x_,_free:Wr,_getBaseCellNumber:Pu,_getDirectedEdgeDestination:lA,_getDirectedEdgeOrigin:gn,_getHexagonAreaAvgKm2:Mt,_getHexagonAreaAvgM2:rr,_getHexagonEdgeLengthAvgKm:ci,_getHexagonEdgeLengthAvgM:Ft,_getIcosahedronFaces:se,_getNumCells:mr,_getPentagons:me,_getRes0Cells:zc,_getResolution:I_,_greatCircleDistanceKm:tt,_greatCircleDistanceM:dt,_greatCircleDistanceRads:it,_gridDisk:Od,_gridDiskDistances:Su,_gridDistance:Cf,_gridPathCells:Xs,_gridPathCellsSize:go,_gridRingUnsafe:v_,_i64Add:ni,_i64Subtract:Qo,_isPentagon:Gi,_isResClassIII:mm,_isValidCell:wn,_isValidDirectedEdge:fm,_isValidVertex:VT,_latLngToCell:B,_llvm_maxnum_f64:pA,_llvm_minnum_f64:tv,_llvm_round_f64:Wd,_localIjToCell:Th,_malloc:Ql,_maxFaceCount:X,_maxGridDiskSize:Dd,_maxPolygonToCellsSize:b_,_memcpy:O_,_memset:Lf,_originToDirectedEdges:C_,_pentagonCount:ge,_polygonToCells:ql,_readInt64AsDoubleFromPointer:Xl,_res0CellCount:Nc,_round:rv,_sbrk:Ph,_sizeOfCellBoundary:hA,_sizeOfCoordIJ:gm,_sizeOfGeoLoop:R_,_sizeOfGeoPolygon:k_,_sizeOfH3Index:Wn,_sizeOfLatLng:Eh,_sizeOfLinkedGeoPolygon:Kx,_uncompactCells:Pf,_uncompactCellsSize:Am,_vertexToLatLng:Jx,establishStackSpace:bf,stackAlloc:Ln,stackRestore:Zo,stackSave:bh}}(Te,Ee,qt),Be=e.___divdi3=xe.___divdi3,Ce=e.___muldi3=xe.___muldi3,je=e.___remdi3=xe.___remdi3,ht=e.___uremdi3=xe.___uremdi3,ft=e._areNeighborCells=xe._areNeighborCells,pt=e._bitshift64Ashr=xe._bitshift64Ashr,ur=e._bitshift64Lshr=xe._bitshift64Lshr,Sr=e._bitshift64Shl=xe._bitshift64Shl,er=e._calloc=xe._calloc,hr=e._cellAreaKm2=xe._cellAreaKm2,Cr=e._cellAreaM2=xe._cellAreaM2,Ii=e._cellAreaRads2=xe._cellAreaRads2,ji=e._cellToBoundary=xe._cellToBoundary,pi=e._cellToCenterChild=xe._cellToCenterChild,Xr=e._cellToChildPos=xe._cellToChildPos,Zn=e._cellToChildren=xe._cellToChildren,Ni=e._cellToChildrenSize=xe._cellToChildrenSize,Tn=e._cellToLatLng=xe._cellToLatLng,ss=e._cellToLocalIj=xe._cellToLocalIj,ua=e._cellToParent=xe._cellToParent,W0=e._cellToVertex=xe._cellToVertex,Vl=e._cellToVertexes=xe._cellToVertexes,Cs=e._cellsToDirectedEdge=xe._cellsToDirectedEdge,_h=e._cellsToLinkedMultiPolygon=xe._cellsToLinkedMultiPolygon,_i=e._childPosToCell=xe._childPosToCell,Fa=e._compactCells=xe._compactCells,Dc=e._destroyLinkedMultiPolygon=xe._destroyLinkedMultiPolygon,An=e._directedEdgeToBoundary=xe._directedEdgeToBoundary,Fn=e._directedEdgeToCells=xe._directedEdgeToCells,H0=e._edgeLengthKm=xe._edgeLengthKm,$o=e._edgeLengthM=xe._edgeLengthM,Yn=e._edgeLengthRads=xe._edgeLengthRads,mo=e._emscripten_replace_memory=xe._emscripten_replace_memory,jl=e._free=xe._free,an=e._getBaseCellNumber=xe._getBaseCellNumber,Ti=e._getDirectedEdgeDestination=xe._getDirectedEdgeDestination,Wl=e._getDirectedEdgeOrigin=xe._getDirectedEdgeOrigin,mn=e._getHexagonAreaAvgKm2=xe._getHexagonAreaAvgKm2,bu=e._getHexagonAreaAvgM2=xe._getHexagonAreaAvgM2,os=e._getHexagonEdgeLengthAvgKm=xe._getHexagonEdgeLengthAvgKm,Zp=e._getHexagonEdgeLengthAvgM=xe._getHexagonEdgeLengthAvgM,Hl=e._getIcosahedronFaces=xe._getIcosahedronFaces,Ed=e._getNumCells=xe._getNumCells,Md=e._getPentagons=xe._getPentagons,Pd=e._getRes0Cells=xe._getRes0Cells,Cd=e._getResolution=xe._getResolution,le=e._greatCircleDistanceKm=xe._greatCircleDistanceKm,pe=e._greatCircleDistanceM=xe._greatCircleDistanceM,De=e._greatCircleDistanceRads=xe._greatCircleDistanceRads,st=e._gridDisk=xe._gridDisk,St=e._gridDiskDistances=xe._gridDiskDistances,Jt=e._gridDistance=xe._gridDistance,li=e._gridPathCells=xe._gridPathCells,as=e._gridPathCellsSize=xe._gridPathCellsSize,Is=e._gridRingUnsafe=xe._gridRingUnsafe,Zs=e._i64Add=xe._i64Add,Na=e._i64Subtract=xe._i64Subtract,$0=e._isPentagon=xe._isPentagon,Hx=e._isResClassIII=xe._isResClassIII,$x=e._isValidCell=xe._isValidCell,u_=e._isValidDirectedEdge=xe._isValidDirectedEdge,h_=e._isValidVertex=xe._isValidVertex,yf=e._latLngToCell=xe._latLngToCell,q0=e._llvm_maxnum_f64=xe._llvm_maxnum_f64,fl=e._llvm_minnum_f64=xe._llvm_minnum_f64,G0=e._llvm_round_f64=xe._llvm_round_f64,Z0=e._localIjToCell=xe._localIjToCell,Yp=e._malloc=xe._malloc,Y0=e._maxFaceCount=xe._maxFaceCount,Id=e._maxGridDiskSize=xe._maxGridDiskSize,yh=e._maxPolygonToCellsSize=xe._maxPolygonToCellsSize,yi=e._memcpy=xe._memcpy,X0=e._memset=xe._memset,za=e._originToDirectedEdges=xe._originToDirectedEdges,Ua=e._pentagonCount=xe._pentagonCount,f_=e._polygonToCells=xe._polygonToCells,Q0=e._readInt64AsDoubleFromPointer=xe._readInt64AsDoubleFromPointer,K0=e._res0CellCount=xe._res0CellCount,d_=e._round=xe._round,p_=e._sbrk=xe._sbrk,J0=e._sizeOfCellBoundary=xe._sizeOfCellBoundary,A_=e._sizeOfCoordIJ=xe._sizeOfCoordIJ,m_=e._sizeOfGeoLoop=xe._sizeOfGeoLoop,em=e._sizeOfGeoPolygon=xe._sizeOfGeoPolygon,qx=e._sizeOfH3Index=xe._sizeOfH3Index,Gx=e._sizeOfLatLng=xe._sizeOfLatLng,Rd=e._sizeOfLinkedGeoPolygon=xe._sizeOfLinkedGeoPolygon,FT=e._uncompactCells=xe._uncompactCells,NT=e._uncompactCellsSize=xe._uncompactCellsSize,zT=e._vertexToLatLng=xe._vertexToLatLng,UT=e.establishStackSpace=xe.establishStackSpace,g_=e.stackAlloc=xe.stackAlloc,Zx=e.stackRestore=xe.stackRestore,tm=e.stackSave=xe.stackSave;if(e.asm=xe,e.cwrap=oe,e.setValue=V,e.getValue=$,Io){Da(Io)||(Io=o(Io));{vu("memory initializer");var xf=function(Ke){Ke.byteLength&&(Ke=new Uint8Array(Ke)),ri.set(Ke,N),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,ul("memory initializer")},Xp=function(){c(Io,xf,function(){throw"could not load memory initializer "+Io})},Qp=fe(Io);if(Qp)xf(Qp.buffer);else if(e.memoryInitializerRequest){var xh=function(){var Ke=e.memoryInitializerRequest,mt=Ke.response;if(Ke.status!==200&&Ke.status!==0){var Ot=fe(e.memoryInitializerRequestURL);if(Ot)mt=Ot.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ke.status+", retrying "+Io),Xp();return}}xf(mt)};e.memoryInitializerRequest.response?setTimeout(xh,0):e.memoryInitializerRequest.addEventListener("load",xh)}else Xp()}}var kd;Ao=function Ke(){kd||Kp(),kd||(Ao=Ke)};function Kp(Ke){if(Ke=Ke||n,Si>0||(cl(),Si>0))return;function mt(){kd||(kd=!0,!Q&&(Co(),La(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),la()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),mt()},1)):mt()}e.run=Kp;function Oc(Ke){throw e.onAbort&&e.onAbort(Ke),Ke+="",f(Ke),y(Ke),Q=!0,"abort("+Ke+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Oc,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return Kp(),t}(typeof js=="object"?js:{}),mi="number",Yr=mi,oT=mi,ei=mi,ti=mi,ol=mi,pr=mi,Uwe=[["sizeOfH3Index",mi],["sizeOfLatLng",mi],["sizeOfCellBoundary",mi],["sizeOfGeoLoop",mi],["sizeOfGeoPolygon",mi],["sizeOfLinkedGeoPolygon",mi],["sizeOfCoordIJ",mi],["readInt64AsDoubleFromPointer",mi],["isValidCell",oT,[ei,ti]],["latLngToCell",Yr,[mi,mi,ol,pr]],["cellToLatLng",Yr,[ei,ti,pr]],["cellToBoundary",Yr,[ei,ti,pr]],["maxGridDiskSize",Yr,[mi,pr]],["gridDisk",Yr,[ei,ti,mi,pr]],["gridDiskDistances",Yr,[ei,ti,mi,pr,pr]],["gridRingUnsafe",Yr,[ei,ti,mi,pr]],["maxPolygonToCellsSize",Yr,[pr,ol,mi,pr]],["polygonToCells",Yr,[pr,ol,mi,pr]],["cellsToLinkedMultiPolygon",Yr,[pr,mi,pr]],["destroyLinkedMultiPolygon",null,[pr]],["compactCells",Yr,[pr,pr,mi,mi]],["uncompactCells",Yr,[pr,mi,mi,pr,mi,ol]],["uncompactCellsSize",Yr,[pr,mi,mi,ol,pr]],["isPentagon",oT,[ei,ti]],["isResClassIII",oT,[ei,ti]],["getBaseCellNumber",mi,[ei,ti]],["getResolution",mi,[ei,ti]],["maxFaceCount",Yr,[ei,ti,pr]],["getIcosahedronFaces",Yr,[ei,ti,pr]],["cellToParent",Yr,[ei,ti,ol,pr]],["cellToChildren",Yr,[ei,ti,ol,pr]],["cellToCenterChild",Yr,[ei,ti,ol,pr]],["cellToChildrenSize",Yr,[ei,ti,ol,pr]],["cellToChildPos",Yr,[ei,ti,ol,pr]],["childPosToCell",Yr,[mi,mi,ei,ti,ol,pr]],["areNeighborCells",Yr,[ei,ti,ei,ti,pr]],["cellsToDirectedEdge",Yr,[ei,ti,ei,ti,pr]],["getDirectedEdgeOrigin",Yr,[ei,ti,pr]],["getDirectedEdgeDestination",Yr,[ei,ti,pr]],["isValidDirectedEdge",oT,[ei,ti]],["directedEdgeToCells",Yr,[ei,ti,pr]],["originToDirectedEdges",Yr,[ei,ti,pr]],["directedEdgeToBoundary",Yr,[ei,ti,pr]],["gridDistance",Yr,[ei,ti,ei,ti,pr]],["gridPathCells",Yr,[ei,ti,ei,ti,pr]],["gridPathCellsSize",Yr,[ei,ti,ei,ti,pr]],["cellToLocalIj",Yr,[ei,ti,ei,ti,mi,pr]],["localIjToCell",Yr,[ei,ti,pr,mi,pr]],["getHexagonAreaAvgM2",Yr,[ol,pr]],["getHexagonAreaAvgKm2",Yr,[ol,pr]],["getHexagonEdgeLengthAvgM",Yr,[ol,pr]],["getHexagonEdgeLengthAvgKm",Yr,[ol,pr]],["greatCircleDistanceM",mi,[pr,pr]],["greatCircleDistanceKm",mi,[pr,pr]],["greatCircleDistanceRads",mi,[pr,pr]],["cellAreaM2",Yr,[ei,ti,pr]],["cellAreaKm2",Yr,[ei,ti,pr]],["cellAreaRads2",Yr,[ei,ti,pr]],["edgeLengthM",Yr,[ei,ti,pr]],["edgeLengthKm",Yr,[ei,ti,pr]],["edgeLengthRads",Yr,[ei,ti,pr]],["getNumCells",Yr,[ol,pr]],["getRes0Cells",Yr,[pr]],["res0CellCount",mi],["getPentagons",Yr,[mi,pr]],["pentagonCount",mi],["cellToVertex",Yr,[ei,ti,mi,pr]],["cellToVertexes",Yr,[ei,ti,pr]],["vertexToLatLng",Yr,[ei,ti,pr]],["isValidVertex",oT,[ei,ti]]],Vwe=0,jwe=1,Wwe=2,Hwe=3,dJ=4,$we=5,qwe=6,Gwe=7,Zwe=8,Ywe=9,Xwe=10,Qwe=11,Kwe=12,Jwe=13,e2e=14,t2e=15,Ra={};Ra[Vwe]="Success";Ra[jwe]="The operation failed but a more specific error is not available";Ra[Wwe]="Argument was outside of acceptable range";Ra[Hwe]="Latitude or longitude arguments were outside of acceptable range";Ra[dJ]="Resolution argument was outside of acceptable range";Ra[$we]="Cell argument was not valid";Ra[qwe]="Directed edge argument was not valid";Ra[Gwe]="Undirected edge argument was not valid";Ra[Zwe]="Vertex argument was not valid";Ra[Ywe]="Pentagon distortion was encountered";Ra[Xwe]="Duplicate input";Ra[Qwe]="Cell arguments were not neighbors";Ra[Kwe]="Cell arguments had incompatible resolutions";Ra[Jwe]="Memory allocation failed";Ra[e2e]="Bounds of provided memory were insufficient";Ra[t2e]="Mode or flags argument was not valid";var pJ=1e3,r2e=1001,AJ=1002,GI={};GI[pJ]="Unknown unit";GI[r2e]="Array length out of bounds";GI[AJ]="Got unexpected null value for H3 index";var i2e="Unknown error";function mJ(t,e,r){var i=r&&"value"in r,n=new Error((t[e]||i2e)+" (code: "+e+(i?", value: "+r.value:"")+")");return n.code=e,n}function gJ(t,e){var r=arguments.length===2?{value:e}:{};return mJ(Ra,t,r)}function _J(t,e){var r=arguments.length===2?{value:e}:{};return mJ(GI,t,r)}function Ex(t){if(t!==0)throw gJ(t)}var oa={};Uwe.forEach(function(e){oa[e[0]]=js.cwrap.apply(js,e)});var Tx=16;var n2e=4;var Kg=8,s2e=8,$8=oa.sizeOfH3Index(),yJ=oa.sizeOfLatLng(),o2e=oa.sizeOfCellBoundary(),eht=oa.sizeOfGeoPolygon(),tht=oa.sizeOfGeoLoop(),rht=oa.sizeOfLinkedGeoPolygon(),iht=oa.sizeOfCoordIJ(),hJ={m:"m",m2:"m2",km:"km",km2:"km2",rads:"rads",rads2:"rads2"};function a2e(t){if(typeof t!="number"||t<0||t>15||Math.floor(t)!==t)throw gJ(dJ,t);return t}function l2e(t){if(!t)throw _J(AJ);return t}var nht=Math.pow(2,32)-1;var c2e=/[^0-9a-fA-F]/;function Mx(t){if(Array.isArray(t)&&t.length===2&&Number.isInteger(t[0])&&Number.isInteger(t[1]))return t;if(typeof t!="string"||c2e.test(t))return[0,0];var e=parseInt(t.substring(0,t.length-8),Tx),r=parseInt(t.substring(t.length-8),Tx);return[r,e]}function fJ(t){if(t>=0)return t.toString(Tx);t=t&2147483647;var e=xJ(8,t.toString(Tx)),r=(parseInt(e[0],Tx)+8).toString(Tx);return e=r+e.substring(1),e}function u2e(t,e){return fJ(e)+xJ(8,fJ(t))}function xJ(t,e){for(var r=t-e.length,i="",n=0;n180?r[0]-=360:i<-180&&(r[0]+=360)}}function _2e(t,e,r){let[i,n]=aT(t),s=e.length;PJ(e,n);let o=e[0]===e[s-1]?s-1:s;for(let c=0;ct.hexagon},extruded:!0},Px=class t extends Xi{static{this.defaultProps=v2e}static{this.layerName="H3HexagonLayer"}static{this._checkH3Lib=()=>{}}initializeState(){t._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:e}){return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}updateState({props:e,changeFlags:r}){if(e.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let i=this._calculateH3DataProps();this.setState(i)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let e=-1,r=!1,i=!1,{iterable:n,objectInfo:s}=su(this.props.data);for(let o of n){s.index++;let c=this.props.getHexagon(o,s),f=wJ(c);if(e<0){if(e=f,!this.props.highPrecision)break}else if(e!==f){i=!0;break}if(bJ(c)){r=!0;break}}return{resolution:e,edgeLengthKM:e>=0?MJ(e,"km"):0,hasMultipleRes:i,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:e,hasPentagon:r,hasMultipleRes:i}=this.state,{viewport:n}=this.context;return!!n?.resolution||i||r||e>=0&&e<=5}return this.props.highPrecision}_updateVertices(e){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:i,centerHex:n}=this.state;if(r<0)return;let s=this.props.centerHexagon||SJ(e.latitude,e.longitude,r);if(n===s)return;if(n)try{if(EJ(n,s)*i{let N=e.projectFlat(L);return[(N[0]-b)/o[0],(N[1]-M)/o[1]]}),this.setState({centerHex:s,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:e,material:r,coverage:i,extruded:n,wireframe:s,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:y,lineWidthMinPixels:b,lineWidthMaxPixels:M,getFillColor:L,getElevation:N,getLineColor:V,getLineWidth:$,transitions:Q,updateTriggers:q}=this.props;return{elevationScale:e,extruded:n,coverage:i,wireframe:s,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:y,lineWidthMinPixels:b,lineWidthMaxPixels:M,material:r,getElevation:N,getFillColor:L,getLineColor:V,getLineWidth:$,transitions:Q,updateTriggers:{getFillColor:q.getFillColor,getElevation:q.getElevation,getLineColor:q.getLineColor,getLineWidth:q.getLineWidth}}}_renderPolygonLayer(){let{data:e,getHexagon:r,updateTriggers:i,coverage:n}=this.props,s=this.getSubLayerClass("hexagon-cell-hifi",kp),o=this._getForwardProps();return o.updateTriggers.getPolygon=x2e(i.getHexagon,n),new s(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(c,f)=>{let y=r(c,f);return IJ(q8(y,n))}})}_renderColumnLayer(){let{data:e,getHexagon:r,updateTriggers:i}=this.props,n=this.getSubLayerClass("hexagon-cell",Rp),s=this._getForwardProps();return s.updateTriggers.getPosition=i.getHexagon,new n(s,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:s.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:CJ.bind(null,r)})}};var{data:bht,getHexagon:wht,...b2e}=Px.defaultProps,w2e={_validate:!0},Sht={...b2e,...w2e};var RJ=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function kJ(t,e=!1,r=Float32Array){let i;if(Number.isFinite(t[0]))i=new r(t);else{i=new r(t.length*4);let n=0;for(let s=0;sc[0]),r=t.map(c=>c[1]),i=Math.min.apply(null,e),n=Math.max.apply(null,e),s=Math.min.apply(null,r),o=Math.max.apply(null,r);return[i,s,n,o]}function BJ(t,e){return e[0]>=t[0]&&e[2]<=t[2]&&e[1]>=t[1]&&e[3]<=t[3]}var DJ=new Float32Array(12);function G8(t,e=2){let r=0;for(let i of t)for(let n=0;n 0.) { +maxValue = colorDomain[1]; +minValue = colorDomain[0]; +} +vIntensityMax = intensity / maxValue; +vIntensityMin = intensity / minValue; +} +`;var UJ=`#version 300 es +#define SHADER_NAME triangle-layer-fragment-shader +precision highp float; +uniform float opacity; +uniform sampler2D weightsTexture; +uniform sampler2D colorTexture; +uniform float aggregationMode; +in vec2 vTexCoords; +in float vIntensityMin; +in float vIntensityMax; +out vec4 fragColor; +vec4 getLinearColor(float value) { +float factor = clamp(value * vIntensityMax, 0., 1.); +vec4 color = texture(colorTexture, vec2(factor, 0.5)); +color.a *= min(value * vIntensityMin, 1.0); +return color; +} +void main(void) { +vec4 weights = texture(weightsTexture, vTexCoords); +float weight = weights.r; +if (aggregationMode > 0.5) { +weight /= max(1.0, weights.a); +} +if (weight <= 0.) { +discard; +} +vec4 linearColor = getLinearColor(weight); +linearColor.a *= opacity; +fragColor = linearColor; +} +`;var cT=class extends In{static{this.layerName="TriangleLayer"}getShaders(){return{vs:zJ,fs:UJ,modules:[Bs]}}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){let{vertexCount:r,data:i,weightsTexture:n,maxTexture:s,colorTexture:o}=this.props;return new en(e,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:n,maxTexture:s,colorTexture:o},attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:r})}draw({uniforms:e}){let{model:r}=this.state,{intensity:i,threshold:n,aggregationMode:s,colorDomain:o}=this.props;r.setUniforms({...e,intensity:i,threshold:n,aggregationMode:s,colorDomain:o}),r.draw(this.context.renderPass)}};var Z8=`#version 300 es +in vec3 positions; +in vec3 positions64Low; +in float weights; +out vec4 weightsTexture; +uniform float radiusPixels; +uniform float textureWidth; +uniform vec4 commonBounds; +uniform float weightsScale; +void main() +{ +weightsTexture = vec4(weights * weightsScale, 0., 0., 1.); +float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x); +gl_PointSize = radiusTexels * 2.; +vec3 commonPosition = project_position(positions, positions64Low); +gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ; +gl_Position.xy = (gl_Position.xy * 2.) - (1.); +gl_Position.w = 1.0; +} +`;var Y8=`#version 300 es +in vec4 weightsTexture; +out vec4 fragColor; +float gaussianKDE(float u){ +return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666); +} +void main() +{ +float dist = length(gl_PointCoord - vec2(0.5, 0.5)); +if (dist > 0.5) { +discard; +} +fragColor = weightsTexture * gaussianKDE(2. * dist); +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`;var VJ=`#version 300 es +uniform sampler2D inTexture; +uniform float textureSize; +out vec4 outTexture; +void main() +{ +int yIndex = gl_VertexID / int(textureSize); +int xIndex = gl_VertexID - (yIndex * int(textureSize)); +vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize; +outTexture = texture(inTexture, uv); +gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +gl_PointSize = 1.0; +} +`;var jJ=`#version 300 es +in vec4 outTexture; +out vec4 fragColor; +void main() { +fragColor = outTexture; +fragColor.g = outTexture.r / max(1.0, outTexture.a); +} +`;var T2e=2,X8={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},WJ=[0,0],E2e={SUM:0,MEAN:1},M2e={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:RJ,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}},P2e=["float32-renderable-webgl","texture-blend-float-webgl"],C2e={data:{props:["radiusPixels"]}},Jg=class extends lT{static{this.layerName="HeatmapLayer"}static{this.defaultProps=M2e}initializeState(){super.initializeAggregationLayer(C2e),this.setState({colorDomain:WJ}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(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(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:s,colorDomain:o}=this.state,{updateTriggers:c,intensity:f,threshold:y,aggregation:b}=this.props,M=this.getSubLayerClass("triangle",cT);return new M(this.getSubLayerProps({id:"triangle-layer",updateTriggers:c}),{coordinateSystem:Kr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:s,aggregationMode:E2e[b]||0,weightsTexture:e,intensity:f,threshold:y,colorDomain:o})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:s,triPositionBuffer:o,triTexCoordBuffer:c,colorTexture:f,updateTimer:y}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),s?.destroy(),o?.destroy(),c?.destroy(),f?.destroy(),y&&clearTimeout(y)}_getAttributeManager(){return new rd(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...X8,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...X8,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=P2e.every(c=>e.features.has(c)),s=n?"rgba32float":"rgba8unorm",o=n?1:1/255;this.setState({textureSize:i,format:s,weightsScale:o}),n||dr.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new Gy(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,s=this.getShaders({vs:Z8,fs:Y8});this._createWeightsTransform(s);let o=this.getShaders({vs:VJ,fs:jJ}),c=new Gy(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...o,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:c,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:Z8,fs:Y8,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!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=OJ(i),s={visibleWorldBounds:n,viewportCorners:i},o=!1;if(e||!this.state.worldBounds||!BJ(this.state.worldBounds,n)){let c=this._worldToCommonBounds(n),f=this._commonToWorldBounds(c);this.props.coordinateSystem===Kr.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));let y=this._worldToCommonBounds(f);s.worldBounds=f,s.normalizedCommonBounds=y,o=!0}return this.setState(s),o}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:s}=this.context;e.write(G8(n,3));let o=n.map(c=>NJ(s.projectPosition(c),i));r.write(G8(o,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=kJ(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...X8,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:s,weightsScale:o}=this.state,c=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let f=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:$}=this.context,Q=$.distanceScales.metersPerUnit[2]*(f[2]-f[0])/s;this.state.colorDomain=r.map(q=>q*Q*o)}else this.state.colorDomain=r||WJ;let b=this.getAttributeManager().getAttributes(),M=this.getModuleSettings(),L=b.positions.buffer,N={radiusPixels:e,commonBounds:f,textureWidth:s,weightsScale:o},V=b.weights.buffer;c.model.setAttributes({positions:L,weights:V}),c.model.setVertexCount(this.getNumInstances()),c.model.setUniforms(N),c.model.updateModuleSettings(M),c.run({parameters:{viewport:[0,0,s,s]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(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(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,s,o,c]=e,{viewport:f}=this.context,{textureSize:y}=this.state,{coordinateSystem:b}=this.props,M=i&&(b===Kr.LNGLAT_OFFSETS||b===Kr.METER_OFFSETS),L=M?f.projectPosition(this.props.coordinateOrigin):[0,0],N=y*T2e/f.scale,V,$;return i&&!M?(V=this.projectPosition([n,s,0]),$=this.projectPosition([o,c,0])):(V=f.projectPosition([n,s,0]),$=f.projectPosition([o,c,0])),FJ([V[0]-L[0],V[1]-L[1],$[0]-L[0],$[1]-L[1]],N,N)}_commonToWorldBounds(e){let[r,i,n,s]=e,{viewport:o}=this.context,c=o.unprojectPosition([r,i]),f=o.unprojectPosition([n,s]);return c.slice(0,2).concat(f.slice(0,2))}};var{data:lft,getPosition:cft,...I2e}=Jg.defaultProps,HJ={_validate:!0},R2e={...I2e,...HJ},uT=class extends Xi{static defaultProps=R2e;static layerName="GeoArrowHeatmapLayer";renderLayers(){let{data:e}=this.props;if(this.props.getPosition!==void 0){let r=this.props.getPosition;if(r!==void 0&&Li.isPointVector(r))return this._renderLayersPoint(r);throw new Error("getPosition should pass in an arrow Vector of Point type")}else{let r=Ps(e,ts.POINT);if(r!==null)return this._renderLayersPoint(r)}throw new Error("getPosition not GeoArrow point")}_renderLayersPoint(e){let{data:r}=this.props;this.props._validate&&(Mr(Li.isPointVector(e)),uo(this.props,r));let[i,n]=co(this.props,["getPosition"]),s=Mo(r.data),o=[];for(let c=0;cr.text()),earcutWorkerPool:null}}async initEarcutPool(){if(this.state.earcutWorkerPool)return this.state.earcutWorkerPool;let e=await this.state.earcutWorkerRequest;if(!e||window?.location?.href.startsWith("file://"))return null;try{let r=rte(()=>ete(tte.fromText(e)),8);return this.state.earcutWorkerPool=r,this.state.earcutWorkerPool}catch{return null}}async finalizeState(e){await this.state?.earcutWorkerPool?.terminate(),console.log("terminated")}async updateData(){let{data:e}=this.props,r=await this._updateEarcut(e),i=Mo(e.data);this.setState({table:this.props.data,triangles:r,tableOffsets:i})}async _updateEarcut(e){let r=Ps(e,ts.POLYGON);if(r!==null)return this._earcutPolygonVector(r);let i=Ps(e,ts.MULTIPOLYGON);if(i!==null)return this._earcutMultiPolygonVector(i);let n=this.props.getPolygon;if(n!==void 0&&Li.isPolygonVector(n))return this._earcutPolygonVector(n);if(n!==void 0&&Li.isMultiPolygonVector(n))return this._earcutMultiPolygonVector(n);throw new Error("geometryColumn not Polygon or MultiPolygon")}async _earcutPolygonVector(e){let r=await this.initEarcutPool();if(!r)return this._earcutPolygonVectorMainThread(e);let i=new Array(e.data.length);console.time("earcut");for(let n=0;n{let y=await f(EF(o,c));i[n]=y})}return await r.completed(),console.timeEnd("earcut"),i}_earcutPolygonVectorMainThread(e){let r=new Array(e.data.length);for(let i=0;i{let b=await y(EF(c,f));i[n]=b})}return await r.completed(),console.timeEnd("earcut"),i}_earcutMultiPolygonVectorMainThread(e){let r=new Array(e.data.length);for(let i=0;iite(e))):t}function nte(t){if("data"in t)return new Pr(t.data.map(o=>nte(o)));let e=t.valueOffsets,r=Mi.getMultiPolygonChild(t),i=r.valueOffsets,n=Mi.getPolygonChild(r),s=new Int32Array(e.length);for(let o=0;o{this.table=cS(this.model.get(e))};this.model.on(`change:${e}`,r),this.callbacks.set(`change:${e}`,r)}},u4=class extends _f{static layerType="arc";greatCircle;numSegments;widthUnits;widthScale;widthMinPixels;widthMaxPixels;getSourcePosition;getTargetPosition;getSourceColor;getTargetColor;getWidth;getHeight;getTilt;constructor(e,r){super(e,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,...at(this.greatCircle)&&{greatCircle:this.greatCircle},...at(this.numSegments)&&{numSegments:this.numSegments},...at(this.widthUnits)&&{widthUnits:this.widthUnits},...at(this.widthScale)&&{widthScale:this.widthScale},...at(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...at(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...at(this.getSourceColor)&&{getSourceColor:this.getSourceColor},...at(this.getTargetColor)&&{getTargetColor:this.getTargetColor},...at(this.getWidth)&&{getWidth:this.getWidth},...at(this.getHeight)&&{getHeight:this.getHeight},...at(this.getTilt)&&{getTilt:this.getTilt}}}render(){return new eT({...this.baseLayerProps(),...this.layerProps()})}},h4=class extends Fg{static layerType="bitmap";image;bounds;desaturate;transparentColor;tintColor;constructor(e,r){super(e,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{...at(this.image)&&{image:this.image},...at(this.bounds)&&{bounds:this.bounds},...at(this.desaturate)&&{desaturate:this.desaturate},...at(this.transparentColor)&&{transparentColor:this.transparentColor},...at(this.tintColor)&&{tintColor:this.tintColor}}}render(){return new zg({...this.baseLayerProps(),...this.layerProps(),data:void 0,pickable:!1})}},f4=class extends Fg{static layerType="bitmap-tile";data;tileSize;zoomOffset;maxZoom;minZoom;extent;maxCacheSize;maxCacheByteSize;refinementStrategy;maxRequests;desaturate;transparentColor;tintColor;constructor(e,r){super(e,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{...at(this.desaturate)&&{desaturate:this.desaturate},...at(this.transparentColor)&&{transparentColor:this.transparentColor},...at(this.tintColor)&&{tintColor:this.tintColor}}}layerProps(){return{data:this.data,...at(this.tileSize)&&{tileSize:this.tileSize},...at(this.zoomOffset)&&{zoomOffset:this.zoomOffset},...at(this.maxZoom)&&{maxZoom:this.maxZoom},...at(this.minZoom)&&{minZoom:this.minZoom},...at(this.extent)&&{extent:this.extent},...at(this.maxCacheSize)&&{maxCacheSize:this.maxCacheSize},...at(this.maxCacheByteSize)&&{maxCacheByteSize:this.maxCacheByteSize},...at(this.refinementStrategy)&&{refinementStrategy:this.refinementStrategy},...at(this.maxRequests)&&{maxRequests:this.maxRequests}}}render(){return new Sx({...this.baseLayerProps(),...this.layerProps(),renderSubLayers:e=>{let[r,i]=e.tile.boundingBox;return new zg(e,{...this.bitmapLayerProps(),data:void 0,image:e.data,bounds:[r[0],r[1],i[0],i[1]]})}})}},d4=class extends _f{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(e,r){super(e,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,...at(this.diskResolution)&&{diskResolution:this.diskResolution},...at(this.radius)&&{radius:this.radius},...at(this.angle)&&{angle:this.angle},...at(this.vertices)&&this.vertices!==void 0&&{vertices:this.vertices},...at(this.offset)&&{offset:this.offset},...at(this.coverage)&&{coverage:this.coverage},...at(this.elevationScale)&&{elevationScale:this.elevationScale},...at(this.filled)&&{filled:this.filled},...at(this.stroked)&&{stroked:this.stroked},...at(this.extruded)&&{extruded:this.extruded},...at(this.wireframe)&&{wireframe:this.wireframe},...at(this.flatShading)&&{flatShading:this.flatShading},...at(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...at(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...at(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...at(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...at(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...at(this.material)&&{material:this.material},...at(this.getPosition)&&{getPosition:this.getPosition},...at(this.getFillColor)&&{getFillColor:this.getFillColor},...at(this.getLineColor)&&{getLineColor:this.getLineColor},...at(this.getElevation)&&{getElevation:this.getElevation},...at(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new tT({...this.baseLayerProps(),...this.layerProps()})}},p4=class extends _f{static layerType="heatmap";radiusPixels;colorRange;intensity;threshold;colorDomain;aggregation;weightsTextureSize;debounceTimeout;getPosition;getWeight;constructor(e,r){super(e,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,...at(this.radiusPixels)&&{radiusPixels:this.radiusPixels},...at(this.colorRange)&&{colorRange:this.colorRange},...at(this.intensity)&&{intensity:this.intensity},...at(this.threshold)&&{threshold:this.threshold},...at(this.colorDomain)&&{colorDomain:this.colorDomain},...at(this.aggregation)&&{aggregation:this.aggregation},...at(this.weightsTextureSize)&&{weightsTextureSize:this.weightsTextureSize},...at(this.debounceTimeout)&&{debounceTimeout:this.debounceTimeout},...at(this.getPosition)&&{getPosition:this.getPosition},...at(this.getWeight)&&{getWeight:this.getWeight}}}render(){return new uT({...this.baseLayerProps(),...this.layerProps()})}},CT=class extends _f{static layerType="path";widthUnits;widthScale;widthMinPixels;widthMaxPixels;jointRounded;capRounded;miterLimit;billboard;getColor;getWidth;constructor(e,r){super(e,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,...at(this.widthUnits)&&{widthUnits:this.widthUnits},...at(this.widthScale)&&{widthScale:this.widthScale},...at(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...at(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...at(this.jointRounded)&&{jointRounded:this.jointRounded},...at(this.capRounded)&&{capRounded:this.capRounded},...at(this.miterLimit)&&{miterLimit:this.miterLimit},...at(this.billboard)&&{billboard:this.billboard},...at(this.getColor)&&{getColor:this.getColor},...at(this.getWidth)&&{getWidth:this.getWidth}}}render(){return new e_({...this.baseLayerProps(),...this.layerProps()})}},A4=class extends _f{static layerType="point-cloud";sizeUnits;pointSize;getColor;getNormal;constructor(e,r){super(e,r),this.initRegularAttribute("size_units","sizeUnits"),this.initRegularAttribute("point_size","pointSize"),this.initVectorizedAccessor("get_color","getColor"),this.initVectorizedAccessor("get_normal","getNormal")}layerProps(){return{data:this.table,...at(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...at(this.pointSize)&&{pointSize:this.pointSize},...at(this.getColor)&&{getColor:this.getColor},...at(this.getNormal)&&{getNormal:this.getNormal}}}render(){return new hT({...this.baseLayerProps(),...this.layerProps()})}},m4=class extends _f{static layerType="polygon";stroked;filled;extruded;wireframe;elevationScale;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;lineJointRounded;lineMiterLimit;getFillColor;getLineColor;getLineWidth;getElevation;constructor(e,r){super(e,r),this.initRegularAttribute("stroked","stroked"),this.initRegularAttribute("filled","filled"),this.initRegularAttribute("extruded","extruded"),this.initRegularAttribute("wireframe","wireframe"),this.initRegularAttribute("elevation_scale","elevationScale"),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("line_joint_rounded","lineJointRounded"),this.initRegularAttribute("line_miter_limit","lineMiterLimit"),this.initVectorizedAccessor("get_fill_color","getFillColor"),this.initVectorizedAccessor("get_line_color","getLineColor"),this.initVectorizedAccessor("get_line_width","getLineWidth"),this.initVectorizedAccessor("get_elevation","getElevation")}layerProps(){return{data:this.table,...at(this.stroked)&&{stroked:this.stroked},...at(this.filled)&&{filled:this.filled},...at(this.extruded)&&{extruded:this.extruded},...at(this.wireframe)&&{wireframe:this.wireframe},...at(this.elevationScale)&&{elevationScale:this.elevationScale},...at(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...at(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...at(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...at(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...at(this.lineJointRounded)&&{lineJointRounded:this.lineJointRounded},...at(this.lineMiterLimit)&&{lineMiterLimit:this.lineMiterLimit},...at(this.getFillColor)&&{getFillColor:this.getFillColor},...at(this.getLineColor)&&{getLineColor:this.getLineColor},...at(this.getLineWidth)&&{getLineWidth:this.getLineWidth},...at(this.getElevation)&&{getElevation:this.getElevation}}}render(){return new ET({...this.baseLayerProps(),...this.layerProps()})}},IT=class extends _f{static layerType="scatterplot";radiusUnits;radiusScale;radiusMinPixels;radiusMaxPixels;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;stroked;filled;billboard;antialiasing;getRadius;getFillColor;getLineColor;getLineWidth;constructor(e,r){super(e,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,...at(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...at(this.radiusScale)&&{radiusScale:this.radiusScale},...at(this.radiusMinPixels)&&{radiusMinPixels:this.radiusMinPixels},...at(this.radiusMaxPixels)&&{radiusMaxPixels:this.radiusMaxPixels},...at(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...at(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...at(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...at(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...at(this.stroked)&&{stroked:this.stroked},...at(this.filled)&&{filled:this.filled},...at(this.billboard)&&{billboard:this.billboard},...at(this.antialiasing)&&{antialiasing:this.antialiasing},...at(this.getRadius)&&{getRadius:this.getRadius},...at(this.getFillColor)&&{getFillColor:this.getFillColor},...at(this.getLineColor)&&{getLineColor:this.getLineColor},...at(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new MT({...this.baseLayerProps(),...this.layerProps()})}},RT=class extends _f{static layerType="solid-polygon";filled;extruded;wireframe;elevationScale;getElevation;getFillColor;getLineColor;constructor(e,r){super(e,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,...at(this.filled)&&{filled:this.filled},...at(this.extruded)&&{extruded:this.extruded},...at(this.wireframe)&&{wireframe:this.wireframe},...at(this.elevationScale)&&{elevationScale:this.elevationScale},...at(this.getElevation)&&{getElevation:this.getElevation},...at(this.getFillColor)&&{getFillColor:this.getFillColor},...at(this.getLineColor)&&{getLineColor:this.getLineColor}}}render(){return new s_({...this.baseLayerProps(),...this.layerProps()})}},g4=class extends _f{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(e,r){super(e,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,...at(this.billboard)&&{billboard:this.billboard},...at(this.sizeScale)&&{sizeScale:this.sizeScale},...at(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...at(this.sizeMinPixels)&&{sizeMinPixels:this.sizeMinPixels},...at(this.sizeMaxPixels)&&{sizeMaxPixels:this.sizeMaxPixels},...at(this.backgroundPadding)&&{backgroundPadding:this.backgroundPadding},...at(this.characterSet)&&{characterSet:this.characterSet},...at(this.fontFamily)&&{fontFamily:this.fontFamily},...at(this.fontWeight)&&{fontWeight:this.fontWeight},...at(this.lineHeight)&&{lineHeight:this.lineHeight},...at(this.outlineWidth)&&{outlineWidth:this.outlineWidth},...at(this.outlineColor)&&{outlineColor:this.outlineColor},...at(this.fontSettings)&&{fontSettings:this.fontSettings},...at(this.wordBreak)&&{wordBreak:this.wordBreak},...at(this.maxWidth)&&{maxWidth:this.maxWidth},...at(this.getBackgroundColor)&&{getBackgroundColor:this.getBackgroundColor},...at(this.getBorderColor)&&{getBorderColor:this.getBorderColor},...at(this.getBorderWidth)&&{getBorderWidth:this.getBorderWidth},...at(this.getPosition)&&{getPosition:this.getPosition},...at(this.getColor)&&{getColor:this.getColor},...at(this.getSize)&&{getSize:this.getSize},...at(this.getAngle)&&{getAngle:this.getAngle},...at(this.getTextAnchor)&&{getTextAnchor:this.getTextAnchor},...at(this.getAlignmentBaseline)&&{getAlignmentBaseline:this.getAlignmentBaseline},...at(this.getPixelOffset)&&{getPixelOffset:this.getPixelOffset}}}render(){return new PT({...this.baseLayerProps(),...this.layerProps()})}};async function CF(t,e){let r=t.get("_layer_type"),i;switch(r){case u4.layerType:i=new u4(t,e);break;case h4.layerType:i=new h4(t,e);break;case f4.layerType:i=new f4(t,e);break;case d4.layerType:i=new d4(t,e);break;case p4.layerType:i=new p4(t,e);break;case CT.layerType:i=new CT(t,e);break;case A4.layerType:i=new A4(t,e);break;case m4.layerType:i=new m4(t,e);break;case IT.layerType:i=new IT(t,e);break;case RT.layerType:i=new RT(t,e);break;case g4.layerType:i=new g4(t,e);break;default:throw new Error(`no layer supported for ${r}`)}return await i.loadSubModels(),i}var _4=Symbol.for("rowIndex");function I3e(t){return` + + ${Object.keys(t).map(e=>{let r=t[e];return` + + + `}).join("")} + +
${e}${r}
`}function ote({object:t}){if(t){if(t[_4]===null||t[_4]===void 0||t[_4]&&t[_4]<0)return null;let e=t.toJSON();return!e||(delete e.geometry,Object.keys(e).length===0)?null:{className:"lonboard-tooltip",html:I3e(e),style:{backgroundColor:"#fff",boxShadow:"0 0 15px rgba(0, 0, 0, 0.1)",color:"#000",padding:"6px"}}}return null}var y4,R3e=new Uint8Array(16);function IF(){if(!y4&&(y4=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!y4))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return y4(R3e)}var ka=[];for(let t=0;t<256;++t)ka.push((t+256).toString(16).slice(1));function ate(t,e=0){return ka[t[e+0]]+ka[t[e+1]]+ka[t[e+2]]+ka[t[e+3]]+"-"+ka[t[e+4]]+ka[t[e+5]]+"-"+ka[t[e+6]]+ka[t[e+7]]+"-"+ka[t[e+8]]+ka[t[e+9]]+"-"+ka[t[e+10]]+ka[t[e+11]]+ka[t[e+12]]+ka[t[e+13]]+ka[t[e+14]]+ka[t[e+15]]}var k3e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),RF={randomUUID:k3e};function L3e(t,e,r){if(RF.randomUUID&&!e&&!t)return RF.randomUUID();t=t||{};let i=t.random||(t.rng||IF)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){r=r||0;for(let n=0;n<16;++n)e[r+n]=i[n];return e}return ate(i)}var kF=L3e;function lte(t,e){let{longitude:r,latitude:i,zoom:n,pitch:s,bearing:o,transitionDuration:c,curve:f,speed:y,screenSpeed:b}=t,M=new sd({...at(f)&&{curve:f},...at(y)&&{speed:y},...at(b)&&{screenSpeed:b}});e({longitude:r,latitude:i,zoom:n,pitch:s,bearing:o,transitionDuration:c,transitionInterpolator:M})}var x4=Ei(Zi(),1);var D3e=iY(t=>{let e=t.get("view_state");"transitionInterpolator"in e&&(console.debug("Deleting transitionInterpolator!"),delete e.transitionInterpolator,t.set("view_state",e)),t.save_changes()},300);function cte(t){let e=lb(),[r,i]=x4.useState(e.get(t));return x4.useEffect(()=>{let n=()=>{i(e.get(t))};return e.on(`change:${t}`,n),()=>e.off(`change:${t}`,n)},[e,t]),[r,n=>{e.set(t,n),D3e(e)}]}var T4,rs,pte,O3e,o_,ute,Ate,LF,FF,DF,OF,B3e,kT={},mte=[],F3e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,NF=Array.isArray;function V0(t,e){for(var r in e)t[r]=e[r];return t}function gte(t){var e=t.parentNode;e&&e.removeChild(t)}function N3e(t,e,r){var i,n,s,o={};for(s in e)s=="key"?i=e[s]:s=="ref"?n=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?T4.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return b4(t,o,i,n,null)}function b4(t,e,r,i,n){var s={type:t,props:e,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++pte,__i:-1,__u:0};return n==null&&rs.vnode!=null&&rs.vnode(s),s}function zx(t){return t.children}function w4(t,e){this.props=t,this.context=e}function a_(t,e){if(e==null)return t.__?a_(t.__,t.__i+1):null;for(var r;ee&&o_.sort(LF));S4.__r=0}function yte(t,e,r,i,n,s,o,c,f,y,b){var M,L,N,V,$,Q=i&&i.__k||mte,q=e.length;for(r.__d=f,z3e(r,e,Q),f=r.__d,M=0;M0?b4(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=t,n.__b=t.__b+1,c=U3e(n,r,o,b),n.__i=c,s=null,c!==-1&&(b--,(s=r[c])&&(s.__u|=131072)),s==null||s.__v===null?(c==-1&&M--,typeof n.type!="function"&&(n.__u|=65536)):c!==o&&(c===o+1?M++:c>o?b>f-o?M+=c-o:M--:c(f!=null&&!(131072&f.__u)?1:0))for(;o>=0||c=0){if((f=e[o])&&!(131072&f.__u)&&n==f.key&&s===f.type)return o;o--}if(c{let{className:e,label:r,onClick:i}=t;return Hs("div",{className:"deck-widget-button",children:Hs("button",{className:`deck-widget-icon-button ${e}`,type:"button",onClick:i,title:r,children:Hs("div",{className:"deck-widget-icon"})})})},wte=t=>{let{children:e,orientation:r}=t;return Hs("div",{className:`deck-widget-button-group ${r}`,children:e})},VF=t=>{let{className:e,label:r,onClick:i}=t;return Hs("button",{className:`deck-widget-icon-button ${e}`,type:"button",onClick:i,title:r,children:Hs("div",{className:"deck-widget-icon"})})};var LT=class{constructor(e){this.id="fullscreen",this.placement="top-left",this.fullscreen=!1,this.id=e.id||"fullscreen",this.placement=e.placement||"top-left",e.enterLabel=e.enterLabel||"Enter Fullscreen",e.exitLabel=e.exitLabel||"Exit Fullscreen",e.style=e.style||{},this.props=e}onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");return n.classList.add("deck-widget","deck-widget-fullscreen"),i&&n.classList.add(i),r&&Object.entries(r).map(([s,o])=>n.style.setProperty(s,o)),this.deck=e,this.element=n,this.update(),document.addEventListener("fullscreenchange",this.onFullscreenChange.bind(this)),n}onRemove(){this.deck=void 0,this.element=void 0,document.removeEventListener("fullscreenchange",this.onFullscreenChange.bind(this))}update(){let{enterLabel:e,exitLabel:r}=this.props,i=this.element;if(!i)return;let n=Hs(bte,{onClick:this.handleClick.bind(this),label:this.fullscreen?r:e,className:this.fullscreen?"deck-widget-fullscreen-exit":"deck-widget-fullscreen-enter"});Ux(n,i)}setProps(e){let r=this.props,i=this.element;i&&(r.className!==e.className&&(r.className&&i.classList.remove(r.className),e.className&&i.classList.add(e.className)),qn(r.style,e.style,1)||(r.style&&Object.entries(r.style).map(([n])=>i.style.removeProperty(n)),e.style&&Object.entries(e.style).map(([n,s])=>i.style.setProperty(n,s)))),Object.assign(this.props,e)}getContainer(){return this.props.container||this.deck?.getCanvas()?.parentElement}onFullscreenChange(){let e=this.fullscreen,r=document.fullscreenElement===this.getContainer();e!==r&&(this.fullscreen=!this.fullscreen),this.update()}async handleClick(){this.fullscreen?await this.exitFullscreen():await this.requestFullscreen(),this.update()}async requestFullscreen(){let e=this.getContainer();e?.requestFullscreen?await e.requestFullscreen({navigationUI:"hide"}):this.togglePseudoFullscreen()}async exitFullscreen(){document.exitFullscreen?await document.exitFullscreen():this.togglePseudoFullscreen()}togglePseudoFullscreen(){this.getContainer()?.classList.toggle("deck-pseudo-fullscreen")}};var l_=class{constructor(e){this.id="compass",this.placement="top-left",this.viewId=null,this.id=e.id||"compass",this.viewId=e.viewId||null,this.placement=e.placement||"top-left",e.transitionDuration=e.transitionDuration||200,e.label=e.label||"Compass",e.style=e.style||{},this.props=e}setProps(e){Object.assign(this.props,e)}onViewportChange(e){this.viewport=e,this.update()}onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");return n.classList.add("deck-widget","deck-widget-compass"),i&&n.classList.add(i),r&&Object.entries(r).map(([s,o])=>n.style.setProperty(s,o)),this.deck=e,this.element=n,this.update(),n}getRotation(){return this.viewport instanceof el?[-this.viewport.bearing,this.viewport.pitch]:this.viewport instanceof l0?[0,Math.max(-80,Math.min(80,this.viewport.latitude))]:[0,0]}update(){let[e,r]=this.getRotation(),i=this.element;if(!i)return;let n=Hs("div",{className:"deck-widget-button",style:{perspective:100},children:Hs("button",{type:"button",onClick:()=>this.handleCompassReset(),label:this.props.label,style:{transform:`rotateX(${r}deg)`},children:Hs("svg",{fill:"none",width:"100%",height:"100%",viewBox:"0 0 26 26",children:Hs("g",{transform:`rotate(${e},13,13)`,children:[Hs("path",{d:"M10 13.0001L12.9999 5L15.9997 13.0001H10Z",fill:"var(--icon-compass-north-color, #F05C44)"}),Hs("path",{d:"M16.0002 12.9999L13.0004 21L10.0005 12.9999H16.0002Z",fill:"var(--icon-compass-south-color, #C2C2CC)"})]})})})});Ux(n,i)}onRemove(){this.deck=void 0,this.element=void 0}handleCompassReset(){let e=this.viewId||"default-view";if(this.viewport instanceof el){let r={...this.viewport,bearing:0,...this.getRotation()[0]===0?{pitch:0}:{},transitionDuration:this.props.transitionDuration,transitionInterpolator:new sd};this.deck._onViewStateChange({viewId:e,viewState:r,interactionState:{}})}}};var DT=class{constructor(e){this.id="zoom",this.placement="top-left",this.orientation="vertical",this.viewId=null,this.id=e.id||"zoom",this.viewId=e.viewId||null,this.placement=e.placement||"top-left",this.orientation=e.orientation||"vertical",e.transitionDuration=e.transitionDuration||200,e.zoomInLabel=e.zoomInLabel||"Zoom In",e.zoomOutLabel=e.zoomOutLabel||"Zoom Out",e.style=e.style||{},this.props=e}onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");n.classList.add("deck-widget","deck-widget-zoom"),i&&n.classList.add(i),r&&Object.entries(r).map(([o,c])=>n.style.setProperty(o,c));let s=Hs(wte,{orientation:this.orientation,children:[Hs(VF,{onClick:()=>this.handleZoomIn(),label:this.props.zoomInLabel,className:"deck-widget-zoom-in"}),Hs(VF,{onClick:()=>this.handleZoomOut(),label:this.props.zoomOutLabel,className:"deck-widget-zoom-out"})]});return Ux(s,n),this.deck=e,this.element=n,n}onRemove(){this.deck=void 0,this.element=void 0}setProps(e){Object.assign(this.props,e)}onViewportChange(e){this.viewport=e}handleZoom(e){let r=this.viewId||"default-view",i={...this.viewport,zoom:e,transitionDuration:this.props.transitionDuration,transitionInterpolator:new sd};this.deck._onViewStateChange({viewId:r,viewState:i,interactionState:{}})}handleZoomIn(){this.viewport&&this.handleZoom(this.viewport.zoom+1)}handleZoomOut(){this.viewport&&this.handleZoom(this.viewport.zoom-1)}};var c_={"--button-background":"#fff","--button-stroke":"rgba(255, 255, 255, 0.3)","--button-inner-stroke":"unset","--button-shadow":"0px 0px 8px 0px rgba(0, 0, 0, 0.25)","--button-backdrop-filter":"unset","--button-icon-idle":"rgba(97, 97, 102, 1)","--button-icon-hover":"rgba(24, 24, 26, 1)","--icon-compass-north-color":"#F05C44","--icon-compass-south-color":"#C2C2CC"};var Po=Ei(Zi(),1),D4=Ei(qk(),1);function Ste(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;let r=document.implementation.createHTMLDocument(),i=r.createElement("base"),n=r.createElement("a");return r.head.appendChild(i),r.body.appendChild(n),e&&(i.href=e),n.href=t,n.href}var Tte=(()=>{let t=0,e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function xu(t){let e=[];for(let r=0,i=t.length;ryu||t.height>yu)&&(t.width>yu&&t.height>yu?t.width>t.height?(t.height*=yu/t.width,t.width=yu):(t.width*=yu/t.height,t.height=yu):t.width>yu?(t.height*=yu/t.width,t.width=yu):(t.width*=yu/t.height,t.height=yu))}function Vx(t){return new Promise((e,r)=>{let i=new Image;i.decode=()=>e(i),i.onload=()=>e(i),i.onerror=r,i.crossOrigin="anonymous",i.decoding="async",i.src=t})}async function q3e(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Pte(t,e,r){let i="http://www.w3.org/2000/svg",n=document.createElementNS(i,"svg"),s=document.createElementNS(i,"foreignObject");return n.setAttribute("width",`${e}`),n.setAttribute("height",`${r}`),n.setAttribute("viewBox",`0 0 ${e} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),n.appendChild(s),s.appendChild(t),q3e(n)}var al=(t,e)=>{if(t instanceof e)return!0;let r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||al(r,e)};function G3e(t){let e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Z3e(t){return xu(t).map(e=>{let r=t.getPropertyValue(e),i=t.getPropertyPriority(e);return`${e}: ${r}${i?" !important":""};`}).join(" ")}function Y3e(t,e,r){let i=`.${t}:${e}`,n=r.cssText?G3e(r):Z3e(r);return document.createTextNode(`${i}{${n}}`)}function Cte(t,e,r){let i=window.getComputedStyle(t,r),n=i.getPropertyValue("content");if(n===""||n==="none")return;let s=Tte();try{e.className=`${e.className} ${s}`}catch{return}let o=document.createElement("style");o.appendChild(Y3e(s,r,i)),e.appendChild(o)}function Ite(t,e){Cte(t,e,":before"),Cte(t,e,":after")}var Rte="application/font-woff",kte="image/jpeg",X3e={woff:Rte,woff2:Rte,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:kte,jpeg:kte,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Q3e(t){let e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function jx(t){let e=Q3e(t).toLowerCase();return X3e[e]||""}function K3e(t){return t.split(/,/)[1]}function OT(t){return t.search(/^(data:)/)!==-1}function HF(t,e){return`data:${e};base64,${t}`}async function $F(t,e,r){let i=await fetch(t,e);if(i.status===404)throw new Error(`Resource "${i.url}" not found`);let n=await i.blob();return new Promise((s,o)=>{let c=new FileReader;c.onerror=o,c.onloadend=()=>{try{s(r({res:i,result:c.result}))}catch(f){o(f)}},c.readAsDataURL(n)})}var WF={};function J3e(t,e,r){let i=t.replace(/\?.*/,"");return r&&(i=t),/ttf|otf|eot|woff2?/i.test(i)&&(i=i.replace(/.*\//,"")),e?`[${e}]${i}`:i}async function Wx(t,e,r){let i=J3e(t,e,r.includeQueryParams);if(WF[i]!=null)return WF[i];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let n;try{let s=await $F(t,r.fetchRequestInit,({res:o,result:c})=>(e||(e=o.headers.get("Content-Type")||""),K3e(c)));n=HF(s,e)}catch(s){n=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;s&&(o=typeof s=="string"?s:s.message),o&&console.warn(o)}return WF[i]=n,n}async function eEe(t){let e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):Vx(e)}async function tEe(t,e){if(t.currentSrc){let s=document.createElement("canvas"),o=s.getContext("2d");s.width=t.clientWidth,s.height=t.clientHeight,o?.drawImage(t,0,0,s.width,s.height);let c=s.toDataURL();return Vx(c)}let r=t.poster,i=jx(r),n=await Wx(r,i,e);return Vx(n)}async function rEe(t){var e;try{if(!((e=t?.contentDocument)===null||e===void 0)&&e.body)return await BT(t.contentDocument.body,{},!0)}catch{}return t.cloneNode(!1)}async function iEe(t,e){return al(t,HTMLCanvasElement)?eEe(t):al(t,HTMLVideoElement)?tEe(t,e):al(t,HTMLIFrameElement)?rEe(t):t.cloneNode(!1)}var nEe=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT";async function sEe(t,e,r){var i,n;let s=[];return nEe(t)&&t.assignedNodes?s=xu(t.assignedNodes()):al(t,HTMLIFrameElement)&&(!((i=t.contentDocument)===null||i===void 0)&&i.body)?s=xu(t.contentDocument.body.childNodes):s=xu(((n=t.shadowRoot)!==null&&n!==void 0?n:t).childNodes),s.length===0||al(t,HTMLVideoElement)||await s.reduce((o,c)=>o.then(()=>BT(c,r)).then(f=>{f&&e.appendChild(f)}),Promise.resolve()),e}function oEe(t,e){let r=e.style;if(!r)return;let i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):xu(i).forEach(n=>{let s=i.getPropertyValue(n);n==="font-size"&&s.endsWith("px")&&(s=`${Math.floor(parseFloat(s.substring(0,s.length-2)))-.1}px`),al(t,HTMLIFrameElement)&&n==="display"&&s==="inline"&&(s="block"),n==="d"&&e.getAttribute("d")&&(s=`path(${e.getAttribute("d")})`),r.setProperty(n,s,i.getPropertyPriority(n))})}function aEe(t,e){al(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),al(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function lEe(t,e){if(al(t,HTMLSelectElement)){let r=e,i=Array.from(r.children).find(n=>t.value===n.getAttribute("value"));i&&i.setAttribute("selected","")}}function cEe(t,e){return al(e,Element)&&(oEe(t,e),Ite(t,e),aEe(t,e),lEe(t,e)),e}async function uEe(t,e){let r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;let i={};for(let s=0;siEe(i,e)).then(i=>sEe(t,i,e)).then(i=>cEe(t,i)).then(i=>uEe(i,e))}var Lte=/url\((['"]?)([^'"]+?)\1\)/g,hEe=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,fEe=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function dEe(t){let e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function pEe(t){let e=[];return t.replace(Lte,(r,i,n)=>(e.push(n),r)),e.filter(r=>!OT(r))}async function AEe(t,e,r,i,n){try{let s=r?Ste(e,r):e,o=jx(e),c;if(n){let f=await n(s);c=HF(f,o)}else c=await Wx(s,o,i);return t.replace(dEe(e),`$1${c}$3`)}catch{}return t}function mEe(t,{preferredFontFormat:e}){return e?t.replace(fEe,r=>{for(;;){let[i,,n]=hEe.exec(r)||[];if(!n)return"";if(n===e)return`src: ${i};`}}):t}function qF(t){return t.search(Lte)!==-1}async function M4(t,e,r){if(!qF(t))return t;let i=mEe(t,r);return pEe(i).reduce((s,o)=>s.then(c=>AEe(c,o,e,r)),Promise.resolve(i))}async function P4(t,e,r){var i;let n=(i=e.style)===null||i===void 0?void 0:i.getPropertyValue(t);if(n){let s=await M4(n,null,r);return e.style.setProperty(t,s,e.style.getPropertyPriority(t)),!0}return!1}async function gEe(t,e){await P4("background",t,e)||await P4("background-image",t,e),await P4("mask",t,e)||await P4("mask-image",t,e)}async function _Ee(t,e){let r=al(t,HTMLImageElement);if(!(r&&!OT(t.src))&&!(al(t,SVGImageElement)&&!OT(t.href.baseVal)))return;let i=r?t.src:t.href.baseVal,n=await Wx(i,jx(i),e);await new Promise((s,o)=>{t.onload=s,t.onerror=o;let c=t;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(t.srcset="",t.src=n):t.href.baseVal=n})}async function yEe(t,e){let i=xu(t.childNodes).map(n=>GF(n,e));await Promise.all(i).then(()=>t)}async function GF(t,e){al(t,Element)&&(await gEe(t,e),await _Ee(t,e),await yEe(t,e))}function Dte(t,e){let{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);let i=e.style;return i!=null&&Object.keys(i).forEach(n=>{r[n]=i[n]}),t}var Ote={};async function Bte(t){let e=Ote[t];if(e!=null)return e;let i=await(await fetch(t)).text();return e={url:t,cssText:i},Ote[t]=e,e}async function Fte(t,e){let r=t.cssText,i=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let c=o.replace(i,"$1");return c.startsWith("https://")||(c=new URL(c,t.url).href),$F(c,e.fetchRequestInit,({result:f})=>(r=r.replace(o,`url(${f})`),[o,f]))});return Promise.all(s).then(()=>r)}function Nte(t){if(t==null)return[];let e=[],r=/(\/\*[\s\S]*?\*\/)/gi,i=t.replace(r,""),n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let f=n.exec(i);if(f===null)break;e.push(f[0])}i=i.replace(n,"");let s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"gi");for(;;){let f=s.exec(i);if(f===null){if(f=c.exec(i),f===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;e.push(f[0])}return e}async function xEe(t,e){let r=[],i=[];return t.forEach(n=>{if("cssRules"in n)try{xu(n.cssRules||[]).forEach((s,o)=>{if(s.type===CSSRule.IMPORT_RULE){let c=o+1,f=s.href,y=Bte(f).then(b=>Fte(b,e)).then(b=>Nte(b).forEach(M=>{try{n.insertRule(M,M.startsWith("@import")?c+=1:n.cssRules.length)}catch(L){console.error("Error inserting rule from remote css",{rule:M,error:L})}})).catch(b=>{console.error("Error loading remote css",b.toString())});i.push(y)}})}catch(s){let o=t.find(c=>c.href==null)||document.styleSheets[0];n.href!=null&&i.push(Bte(n.href).then(c=>Fte(c,e)).then(c=>Nte(c).forEach(f=>{o.insertRule(f,n.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(i).then(()=>(t.forEach(n=>{if("cssRules"in n)try{xu(n.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${n.href}`,s)}}),r))}function vEe(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>qF(e.style.getPropertyValue("src")))}async function bEe(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");let r=xu(t.ownerDocument.styleSheets),i=await xEe(r,e);return vEe(i)}async function zte(t,e){let r=await bEe(t,e);return(await Promise.all(r.map(n=>{let s=n.parentStyleSheet?n.parentStyleSheet.href:null;return M4(n.cssText,s,e)}))).join(` +`)}async function Ute(t,e){let r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await zte(t,e);if(r){let i=document.createElement("style"),n=document.createTextNode(r);i.appendChild(n),t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i)}}async function wEe(t,e={}){let{width:r,height:i}=jF(t,e),n=await BT(t,e,!0);return await Ute(n,e),await GF(n,e),Dte(n,e),await Pte(n,r,i)}async function SEe(t,e={}){let{width:r,height:i}=jF(t,e),n=await wEe(t,e),s=await Vx(n),o=document.createElement("canvas"),c=o.getContext("2d"),f=e.pixelRatio||Ete(),y=e.canvasWidth||r,b=e.canvasHeight||i;return o.width=y*f,o.height=b*f,e.skipAutoScale||Mte(o),o.style.width=`${y}`,o.style.height=`${b}`,e.backgroundColor&&(c.fillStyle=e.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(s,0,0,o.width,o.height),o}async function Vte(t,e={}){return(await SEe(t,e)).toDataURL()}var C4=class{id="title";props;placement="top-right";deck;element;className="deck-widget-title";constructor(e){this.id=e.id||"title",this.placement=e.placement||"top-right",e.title=e.title,e.style=e.style||{},this.className=e.className||"deck-widget-title",this.props=e}setProps(e){Object.assign(this.props,e)}onAdd({deck:e}){let r=document.createElement("div");r.classList.add("deck-widget"),this.className&&r.classList.add(this.className);let i=document.createElement("div");i.innerText=this.props.title;let{style:n}=this.props;return n&&Object.entries(n).map(([s,o])=>{r.style.setProperty(s,o)}),r.appendChild(i),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}},I4=class{id="legend";props;placement="bottom-right";deck;element;className="deck-widget-legend";constructor(e){this.id=e.id||"legend",this.placement=e.placement||"bottom-right",e.title=e.title||"Legend",e.legend=e.legend,e.style=e.style||{},this.className=e.className||"deck-widget-legend",this.props=e}setProps(e){Object.assign(this.props,e)}onAdd({deck:e}){let r=document.createElement("div");r.classList.add("deck-widget"),this.className&&r.classList.add(this.className);let i=document.createElement("div");i.innerText=this.props.title,i.classList.add("legend-title");let n=document.createElement("div");n.classList.add("legend-scale");let s=document.createElement("ul");s.classList.add("legend-labels"),this.props.legend.forEach((c,f)=>{let y=document.createElement("li"),b=document.createElement("span");b.style.setProperty("background",c),y.innerText=f,y.appendChild(b),s.appendChild(y)}),n.appendChild(s);let{style:o}=this.props;return o&&Object.entries(o).map(([c,f])=>{r.style.setProperty(c,f)}),r.appendChild(i),r.appendChild(n),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}},R4=class extends l_{root;onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");return n.classList.add("deck-widget","deck-widget-north-arrow"),i&&n.classList.add(i),r&&Object.entries(r).map(([s,o])=>n.style.setProperty(s,o)),this.deck=e,this.element=n,this.root=(0,D4.createRoot)(n),this.update(),n}update(){let[e,r]=this.getRotation();if(!this.element)return;let n=Po.default.createElement("div",{style:{transform:`rotateX(${r}deg)`}},Po.default.createElement("svg",{transform:`rotate(${e})`,width:"100px",height:"100px",viewBox:"0 0 773 798"},Po.default.createElement("path",{transform:"translate(0 798) scale(1 -1)",d:"m674 403-161 48q-17 48-66 70l-46 166-46-167q-22-9-38-25t-29-45l-159-47 159-49q15-44 67-68l46-164 48 164q39 17 64 69zm-163 0q0-49-32-81-33-34-78-34-46 0-77 34-31 31-31 81 0 46 31 80t77 34q45 0 78-34 32-34 32-80zm-12 1q-5 7-7.5 17.5t-4 21.5-4.5 21-9 16q-7 6-17 9.5t-20.5 6-20 6-15.5 9.5v-107h98zm-98-108v108h-99l3-3 23-75q6-6 16.5-9.5t21-5.5 20-5.5 15.5-9.5zm-280 152h-26v-2q5 0 6-1 3-3 3-6 0-2-0.5-4t-1.5-7l-18-48-16 47q-3 9-3 12 0 7 7 7h2v2h-34v-2q2 0 3-1l3-3q2 0 2-2 2-1 4-5l5-15-12-42-17 50q-3 9-3 11 0 7 6 7h2v2h-33v-2q8 0 10-6 1-2 3-9l27-74h5l15 53 19-53h2l27 71q2 10 3 11 5 7 10 7v2zm325 350h-29v-3q7 0 10-4 1-1 1-11v-35l-42 53h-32v-3q7-2 12-6l2-3v-62q0-13-12-13v-2h29v2h-2q-4 0-7 2.5t-3 10.5v55l58-72h3v73q0 9 1 10.5t8 3.5l3 1v3zm207-395h-130q0 16-6 42zm-212-119-40-141v135q9 0 19 1t21 5zm-154 78-137 41h130q0-10 2-19.5t5-21.5zm114 168q-25 0-39-8l39 142v-134zm372-148h-3q-3-4-5-7.5t-4-5.5q-5-5-17-5h-19q-3 0-3 5v35h20q8 0 10-6 1-1 1-3 0-3 1-4h3v30h-3q-2-9-4-11t-8-2h-20v35h24q7 0 8-1 4-1 9-14h3l-1 20h-69v-2h3q7 0 8-4 2-2 2-9v-58q0-11-4-12-1-1-6-1h-3v-3h68zm-340-358q0 9-5.5 14.5t-20.5 14.5q-9 5-13 9l-5 5q-3 10-3 7 0 14 14 14 18 0 24-26h2v31h-2q-2-6-5-6-4 0-5 1-8 5-15 5-11 0-17.5-7t-6.5-17q0-13 9-19 6-4 16.5-10.5t12.5-8.5q8-7 8-13 0-14-18-14-13 0-18 5.5t-7 20.5h-2v-30h2q0 5 3 5l16-5h8q12 0 20 7t8 17z"})));this.root&&this.root.render(n)}},k4=class{root;id="scale";props;viewId=null;viewport;placement="bottom-left";deck;element;className="deck-widget-scale";constructor(e){this.id=e.id||"scale",this.placement=e.placement||"bottom-left",this.viewId=e.viewId||null,e.maxWidth=e.maxWidth||300,e.useImperial=e.useImperial||!1,e.style=e.style||{},this.className=e.className||"deck-widget-scale",this.props=e}setProps(e){Object.assign(this.props,e)}onViewportChange(e){this.viewport=e,this.update()}onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");return n.classList.add("deck-widget","deck-widget-scale"),i&&n.classList.add(i),r&&Object.entries(r).map(([s,o])=>n.style.setProperty(s,o)),this.deck=e,this.element=n,this.root=(0,D4.createRoot)(n),this.update(),n}update(){if(this.viewport instanceof el){let e=this.viewport.metersPerPixel*this.props.maxWidth,r,i,n;if(this.props.useImperial){let f=e*3.2808399;f>5280?(r=f/5280,i="mi"):(r=f,i="ft")}else r=e<1e3?e:e/1e3,i=e<1e3?"m":"km";n=this.roundNumber(r)/r,r=this.roundNumber(r);let s=`${Math.round(this.props.maxWidth*n*(4/3))}px`;if(!this.element)return;let c=Po.default.createElement("div",null,Po.default.createElement("svg",{id:"test",style:{width:s,height:"40px"}},Po.default.createElement("rect",{id:"border",style:{stroke:"#000",fill:"#FFF"},height:"40%",width:"75%",x:"5%",y:"2%"}),Po.default.createElement("rect",{id:"first_block",style:{fill:"#000"},height:"20%",width:"37.5%",x:"5%",y:"2%"}),Po.default.createElement("rect",{id:"second_block",style:{fill:"#000"},height:"20%",width:"37.5%",x:"42.5%",y:"22%"}),Po.default.createElement("text",{id:"zero","text-anchor":"middle","font-size":"20",x:"5%",y:"95%"},"0"),Po.default.createElement("text",{id:"half_scale","font-size":"20","text-anchor":"middle",x:"42.5%",y:"95%"},r/2),Po.default.createElement("text",{id:"scale","font-size":"20","text-anchor":"middle",x:"80%",y:"95%"},r),Po.default.createElement("text",{id:"unit","font-size":"20",x:"82%",y:"42%"},i)));this.root&&this.root.render(c)}}roundNumber(e){let r=Math.pow(10,`${Math.floor(e)}`.length-1),i=e/r;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,r*i}onRemove(){this.deck=void 0,this.element=void 0}},L4=class{root;id="save-image";props;placement="top-right";viewId=null;viewport;deck;element;constructor(e){this.id=e.id||"save-image",this.placement=e.placement||"top-right",e.label=e.label||"Save as Image",e.style=e.style||{},this.props=e}onAdd({deck:e}){let{style:r,className:i}=this.props,n=document.createElement("div");n.classList.add("deck-widget","deck-widget-save-image"),i&&n.classList.add(i),r&&Object.entries(r).map(([o,c])=>n.style.setProperty(o,c)),this.root=(0,D4.createRoot)(n);let s=Po.default.createElement("div",{className:"deck-widget-button"},Po.default.createElement("button",{className:`deck-widget-icon-button ${i}`,type:"button",onClick:this.handleClick.bind(this),title:this.props.label},Po.default.createElement("svg",{fill:"#000000",version:"1.1",width:"85%",height:"85%",viewBox:"0 0 492.676 492.676"},Po.default.createElement("g",null,Po.default.createElement("g",null,Po.default.createElement("path",{d:`M492.676,121.6H346.715l-23.494-74.789h-40.795H210.25h-40.794L145.961,121.6H0v324.266h492.676V121.6L492.676,121.6z + M246.338,415.533c-72.791,0-131.799-59.009-131.799-131.799c0-72.792,59.008-131.8,131.799-131.8s131.799,59.008,131.799,131.8 + C378.137,356.525,319.129,415.533,246.338,415.533z`}),Po.default.createElement("path",{d:`M246.338,199.006c-46.72,0-84.728,38.008-84.728,84.729c0,46.72,38.008,84.728,84.728,84.728 + c46.721,0,84.728-38.008,84.728-84.728C331.065,237.014,293.059,199.006,246.338,199.006z`}))))));return this.root&&this.root.render(s),this.deck=e,this.element=n,n}async handleClick(){if(this.deck){this.deck.redraw("true");let e=this.deck?.getCanvas()?.parentElement;e&&Vte(e).then(function(r){var i=new Image;i.src=r;let n=document.createElement("a");n.href=r,n.download="map.png",n.click()}).catch(function(r){console.error("Failed to export PNG",r)})}}onRemove(){this.deck=void 0,this.element=void 0}setProps(e){Object.assign(this.props,e)}};var Td=class extends Ip{placement="top-left";className=void 0;constructor(e,r){super(e,r),this.initRegularAttribute("placement","placement"),this.initRegularAttribute("class_name","className")}},O4=class extends Td{static widgetType="fullscreen";enterLabel="Enter Fullscreen";exitLabel="Exit Fullscreen";style={};constructor(e,r){super(e,r),this.initRegularAttribute("enter_label","enterLabel"),this.initRegularAttribute("exit_label","exitLabel"),this.initRegularAttribute("style","style"),this.initRegularAttribute("class_name","className")}render(){return new LT({id:"fullscreen-widget",placement:this.placement,enterLabel:this.enterLabel,exitLabel:this.exitLabel,style:{...c_,...this.style},className:this.className})}},B4=class extends Td{static widgetType="zoom";zoomInLabel="Zoom In";zoomOutLabel="Zoom Out";transitionDuration=200;style={};constructor(e,r){super(e,r),this.initRegularAttribute("zoom_in_label","zoomInLabel"),this.initRegularAttribute("zoom_out_label","zoomOutLabel"),this.initRegularAttribute("transition_duration","transitionDuration"),this.initRegularAttribute("style","style"),this.initRegularAttribute("class_name","className")}render(){return new DT({id:"zoom-widget",placement:this.placement,zoomInLabel:this.zoomInLabel,zoomOutLabel:this.zoomOutLabel,transitionDuration:this.transitionDuration,style:{...c_,...this.style},className:this.className})}},F4=class extends Td{static widgetType="compass";label="Compass";transitionDuration=200;style={};constructor(e,r){super(e,r),this.initRegularAttribute("label","label"),this.initRegularAttribute("transition_duration","transitionDuration"),this.initRegularAttribute("style","style"),this.initRegularAttribute("class_name","className")}render(){return new l_({id:"compass-widget",placement:this.placement,label:this.label,transitionDuration:this.transitionDuration,style:{...c_,...this.style},className:this.className})}},N4=class extends Td{static widgetType="north-arrow";label="North Arrow";transitionDuration=200;style={};constructor(e,r){super(e,r),this.initRegularAttribute("label","label"),this.initRegularAttribute("transition_duration","transitionDuration"),this.initRegularAttribute("style","style"),this.initRegularAttribute("class_name","className")}render(){return new R4({id:"north-arrow-widget",placement:this.placement,label:this.label,transitionDuration:this.transitionDuration,style:{...c_,...this.style},className:this.className})}},z4=class extends Td{static widgetType="title";title="";placement="top-right";style={};constructor(e,r){super(e,r),this.initRegularAttribute("title","title"),this.initRegularAttribute("placement","placement"),this.initRegularAttribute("style","style")}render(){return new C4({id:"title",title:this.title,placement:this.placement,style:{...c_,...this.style},className:this.className})}},U4=class extends Td{static widgetType="legend";title="Legend";labels=[];colors=[];placement="bottom-right";style={};constructor(e,r){super(e,r),this.initRegularAttribute("title","title"),this.initRegularAttribute("placement","placement"),this.initRegularAttribute("style","style"),this.initRegularAttribute("labels","labels"),this.initRegularAttribute("colors","colors")}render(){let e=new Map;for(let r in this.labels)e.set(this.labels[r],this.colors[r]);return new I4({id:"legend",title:this.title,legend:e,placement:this.placement,style:{...this.style},className:this.className})}},V4=class extends Td{static widgetType="scale";placement="bottom-left";style={};maxWidth=300;useImperial=!1;constructor(e,r){super(e,r),this.initRegularAttribute("placement","placement"),this.initRegularAttribute("style","style"),this.initRegularAttribute("max_width","maxWidth"),this.initRegularAttribute("use_imperial","useImperial")}render(){return new k4({id:"scale",placement:this.placement,style:{...this.style},maxWidth:this.maxWidth,useImperial:this.useImperial,className:this.className})}},j4=class extends Td{static widgetType="save-image";label="";placement="top-right";style={};constructor(e,r){super(e,r),this.initRegularAttribute("label","label"),this.initRegularAttribute("placement","placement"),this.initRegularAttribute("style","style")}render(){return new L4({id:"save-image",label:this.label,placement:this.placement,style:{...c_,...this.style},className:this.className})}};async function jte(t,e){let r=t.get("_widget_type"),i;switch(r){case O4.widgetType:i=new O4(t,e);break;case B4.widgetType:i=new B4(t,e);break;case F4.widgetType:i=new F4(t,e);break;case z4.widgetType:i=new z4(t,e);break;case N4.widgetType:i=new N4(t,e);break;case U4.widgetType:i=new U4(t,e);break;case V4.widgetType:i=new V4(t,e);break;case j4.widgetType:i=new j4(t,e);break;default:throw new Error(`no widget supported for ${r}`)}return i}await tY();var TEe={latitude:10,longitude:0,zoom:.5,bearing:0,pitch:0},EEe=new i0({repeat:!0}),MEe="https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json";async function PEe(t,e,r,i){let n={},s=()=>i(new Date);for(let o=0;oi(new Date);for(let o=0;o{switch(Re.type){case"fly-to":lte(Re,b);break;default:break}});let[M]=(0,j0.useState)(kF()),[L,N]=(0,j0.useState)({}),[V,$]=(0,j0.useState)({}),[Q]=Vh("layers"),[q]=Vh("deck_widgets"),[J,ee]=(0,j0.useState)(new Date);(0,j0.useEffect)(()=>{(async()=>{let Ze=await uS(t.widget_manager,Q),He=await PEe(Ze,Q,L,ee);N(He);let ot=await uS(t.widget_manager,q),et=await CEe(ot,q,V,ee);$(et)})().catch(console.error)},[Q]);let oe=[];for(let Re of Object.values(L))oe.push(Re.render());let ve=[];for(let Re of Object.values(V))ve.push(Re.render());return(0,j0.useEffect)(()=>{if(r)return;let Ze=document.getElementById(`map-${M}`)?.parentElement;if(Ze){let He=window.getComputedStyle(Ze);(!He.height||He.height==="0px")&&(Ze.style.height="100%",Ze.style.minHeight="500px")}},[]),W4.createElement("div",{id:`map-${M}`,style:{height:r||"100%",width:i||"100%"}},W4.createElement(k5,{initialViewState:["longitude","latitude","zoom"].every(Re=>Object.keys(y).includes(Re))?y:TEe,views:EEe,controller:f,layers:oe,widgets:ve,width:i,height:r,getTooltip:n&&ote,pickingRadius:s,useDevicePixels:at(o)?o:!0,_typedArrayManagerProps:{overAlloc:1,poolSize:0},parameters:c||{}},W4.createElement(sV,{mapStyle:e||MEe})))}var REe={render:H9(IEe)},Q0t=REe;export{Q0t as default}; +/*! Bundled license information: + +react/cjs/react.production.min.js: + (** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +scheduler/cjs/scheduler.production.min.js: + (** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +react-dom/cjs/react-dom.production.min.js: + (** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +hammerjs/hammer.js: + (*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license *) +*/ diff --git a/lonboard/types/map.py b/lonboard/types/map.py index a851339c..a2b8babf 100644 --- a/lonboard/types/map.py +++ b/lonboard/types/map.py @@ -1,7 +1,8 @@ import sys -from typing import Any, Dict, Union +from typing import Any, Dict, List, Union from lonboard.basemap import CartoBasemap +from lonboard._deck_widget import BaseDeckWidget if sys.version_info >= (3, 12): from typing import TypedDict @@ -13,6 +14,7 @@ class MapKwargs(TypedDict, total=False): _height: int basemap_style: Union[str, CartoBasemap] parameters: Dict[str, Any] + deck_widgets: List[BaseDeckWidget] picking_radius: int show_tooltip: bool use_device_pixels: Union[int, float, bool] diff --git a/package-lock.json b/package-lock.json index a916edcc..86c39b4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,14 @@ "@deck.gl/extensions": "^9.0.27", "@deck.gl/layers": "^9.0.27", "@deck.gl/react": "^9.0.27", + "@deck.gl/widgets": "^9.0.16", "@geoarrow/deck.gl-layers": "^0.3.0-beta.17", "@nextui-org/react": "^2.4.6", "@xstate/react": "^4.1.1", "apache-arrow": "^17.0.0", "esbuild-sass-plugin": "^3.3.1", "framer-motion": "^11.3.30", + "html-to-image": "^1.11.11", "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", "maplibre-gl": "^3.6.2", @@ -56,6 +58,26 @@ "vitest": "^2.0.5" } }, + "node_modules/@75lb/deep-merge": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.1.tgz", + "integrity": "sha512-xvgv6pkMGBA6GwdyJbNAnDmfAIR/DfWhrj9jgWh3TY7gRm3KO46x/GPjRg6wJ0nOepwqrNxFfojebh0Df4h4Tw==", + "dependencies": { + "lodash.assignwith": "^4.2.0", + "typical": "^7.1.1" + }, + "engines": { + "node": ">=12.17" + } + }, + "node_modules/@75lb/deep-merge/node_modules/typical": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz", + "integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==", + "engines": { + "node": ">=12.17" + } + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -1128,9 +1150,9 @@ } }, "node_modules/@deck.gl/aggregation-layers": { - "version": "9.0.27", - "resolved": "https://registry.npmjs.org/@deck.gl/aggregation-layers/-/aggregation-layers-9.0.27.tgz", - "integrity": "sha512-K4HI2taxPsBeAV95w/YdHhZ4jf2M5Tkkyv5e10nKVQBfdIrKNCBb8UQ8wEI2hw9UpVK3u/GsLrr+65RB4f7SWw==", + "version": "9.0.21", + "resolved": "https://registry.npmjs.org/@deck.gl/aggregation-layers/-/aggregation-layers-9.0.21.tgz", + "integrity": "sha512-vJzJhYjZD7Nk/d+aQ5rifv7fSeV7ThIgHVnpe3j9QAS8Yy5VfuHKcOqIMi0JlRNPdINqmXjokknRno5jrdBCJA==", "peer": true, "dependencies": { "@luma.gl/constants": "^9.0.15", @@ -1184,9 +1206,9 @@ } }, "node_modules/@deck.gl/geo-layers": { - "version": "9.0.27", - "resolved": "https://registry.npmjs.org/@deck.gl/geo-layers/-/geo-layers-9.0.27.tgz", - "integrity": "sha512-mIlAr6ff8gJTMfyEkmW6JnmuIcP6haUGKYjr5Gk1MP1zA1/cYktQLrZTK6jQhXq7xqSvHsDWkZdO97P639uSXw==", + "version": "9.0.21", + "resolved": "https://registry.npmjs.org/@deck.gl/geo-layers/-/geo-layers-9.0.21.tgz", + "integrity": "sha512-87s6rqOcsJALjSxfc+bH0GBqHbVshISu4Ii6CRHQpBl0Hply1ERONrUj0lIgU8d9sGt71Ide4cH3yHeFw+ynhQ==", "peer": true, "dependencies": { "@loaders.gl/3d-tiles": "^4.2.0", @@ -1245,9 +1267,9 @@ } }, "node_modules/@deck.gl/mesh-layers": { - "version": "9.0.27", - "resolved": "https://registry.npmjs.org/@deck.gl/mesh-layers/-/mesh-layers-9.0.27.tgz", - "integrity": "sha512-+MTKR6+OOl8xL48R/+Q2slJnAVxbfqz5wOH/9miIih96Znnr5BRctkOBdItnrDRqIiNE67f3lq4lzONedsvb3g==", + "version": "9.0.21", + "resolved": "https://registry.npmjs.org/@deck.gl/mesh-layers/-/mesh-layers-9.0.21.tgz", + "integrity": "sha512-ywTKEun/QA8p2ZhfBAKjD3DgjMzztEdWF/xOtEJfdPTG03v7WDfd8jFiLDCwVxGAuoxljRuNOX/B5z6HhizbNg==", "peer": true, "dependencies": { "@loaders.gl/gltf": "^4.2.0", @@ -1270,6 +1292,17 @@ "react-dom": ">=16.3.0" } }, + "node_modules/@deck.gl/widgets": { + "version": "9.0.27", + "resolved": "https://registry.npmjs.org/@deck.gl/widgets/-/widgets-9.0.27.tgz", + "integrity": "sha512-7CmoY8kRXxHH0W+B1I6d9klMYweymcFGnMBKc7ZPC20aUvjutcKSnz8o5BIlV5UZUKscD4PHQv1w+IPFhFrcZQ==", + "dependencies": { + "preact": "^10.17.0" + }, + "peerDependencies": { + "@deck.gl/core": "^9.0.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", @@ -1803,6 +1836,10 @@ "version": "0.3.0-beta.17", "resolved": "https://registry.npmjs.org/@geoarrow/deck.gl-layers/-/deck.gl-layers-0.3.0-beta.17.tgz", "integrity": "sha512-udBkxyImBn2D9WtufIbUBvZeEp/PRD+1DNzO3kiYVuqsbA59Y9CMVA0KHDR8yZH1ar47Riv382aA7N/mmkF3BA==", + "workspaces": [ + ".", + "examples/*" + ], "dependencies": { "@geoarrow/geoarrow-js": "^0.3.0", "threads": "^1.7.0" @@ -1997,9 +2034,9 @@ } }, "node_modules/@jupyter/ydoc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@jupyter/ydoc/-/ydoc-2.1.1.tgz", - "integrity": "sha512-NeEwqXQ2j1OyLq4uezeQmsMiI+Qo5k7dYIMqNByOM7dJp6sHeP0jQ96w7BEc9E4SmrxwcOT4cLvcJWJE8Xun4g==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@jupyter/ydoc/-/ydoc-1.1.1.tgz", + "integrity": "sha512-fXx9CbUwUlXBsJo83tBQL3T0MgWT4YYz2ozcSFj0ymZSohAnI1uo7N9CPpVe4/nmc9uG1lFdlXC4XQBevi2jSA==", "dependencies": { "@jupyterlab/nbformat": "^3.0.0 || ^4.0.0-alpha.21 || ^4.0.0", "@lumino/coreutils": "^1.11.0 || ^2.0.0", @@ -2010,9 +2047,9 @@ } }, "node_modules/@jupyterlab/coreutils": { - "version": "6.2.4", - "resolved": "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-6.2.4.tgz", - "integrity": "sha512-A3yHM3UgMYKKJU8JtcPEMGUWUHMlol3TFCdFQbeJnqj+uJmxV0ejkLvDlGk+mefjpcVm/z3cXaDrwoUVtY2FDw==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-6.0.9.tgz", + "integrity": "sha512-YN0HoAhaeD829DtrfPARsWdcakN3+ZqYXuO3imXUdz20lrw/O9ZcTD0X/0NZ8+uFa9bqoO4S1k/HLkNzaRqzLg==", "dependencies": { "@lumino/coreutils": "^2.1.2", "@lumino/disposable": "^2.1.2", @@ -2023,23 +2060,23 @@ } }, "node_modules/@jupyterlab/nbformat": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-4.2.4.tgz", - "integrity": "sha512-xR4qqvgjMSBeUQ7nUiRQAP6YDOZcqSHxNzIkds81dDL4wk5pj10oKpTg9lAqfwMImubjcGxTM4Msl8+N3cdpsw==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-4.0.9.tgz", + "integrity": "sha512-3uLgD8bK74Ng7ByL1qXXe2V+OktZ495PYvvmoj3c/FiihNLxnQ9ou7edUlOPYcQML5hu19oGX1AlJhSjGgvlzA==", "dependencies": { "@lumino/coreutils": "^2.1.2" } }, "node_modules/@jupyterlab/services": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/@jupyterlab/services/-/services-7.2.4.tgz", - "integrity": "sha512-9a9945owJsuAExroT/afecPSCLlQ/dhhQuttRBpycZFRBEGdSXcXY3/1q9rGUDb9wEk0A4ySk7LTZIWZTNP2rg==", - "dependencies": { - "@jupyter/ydoc": "^2.0.1", - "@jupyterlab/coreutils": "^6.2.4", - "@jupyterlab/nbformat": "^4.2.4", - "@jupyterlab/settingregistry": "^4.2.4", - "@jupyterlab/statedb": "^4.2.4", + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@jupyterlab/services/-/services-7.0.9.tgz", + "integrity": "sha512-nsW22kSymW6kBxb6YWf1rgY1TKBrSymsvYNF03D5xZ/5OJphrBDdCfGYqxknWHXqdK+yXwgSp+MyaVZ3VoywpQ==", + "dependencies": { + "@jupyter/ydoc": "^1.1.1", + "@jupyterlab/coreutils": "^6.0.9", + "@jupyterlab/nbformat": "^4.0.9", + "@jupyterlab/settingregistry": "^4.0.9", + "@jupyterlab/statedb": "^4.0.9", "@lumino/coreutils": "^2.1.2", "@lumino/disposable": "^2.1.2", "@lumino/polling": "^2.1.2", @@ -2049,17 +2086,17 @@ } }, "node_modules/@jupyterlab/settingregistry": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-4.2.4.tgz", - "integrity": "sha512-95eLd8uiufWE0pso/hlHKcF760NZKlQoubazG8uIphBuYCbSVhd621JoMViAIH6LqDwWi1LfdwYRMJp9hzTlfA==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-4.0.9.tgz", + "integrity": "sha512-ua9ZQxMzjgYRS1RnhNZ2MFvTD7JBDrlDu1vmB/pJ8ae0/eJoO+bUw2WdS5xyQKGQAjEDqjPZMW2a0raH2XgQSw==", "dependencies": { - "@jupyterlab/nbformat": "^4.2.4", - "@jupyterlab/statedb": "^4.2.4", - "@lumino/commands": "^2.3.0", + "@jupyterlab/nbformat": "^4.0.9", + "@jupyterlab/statedb": "^4.0.9", + "@lumino/commands": "^2.1.3", "@lumino/coreutils": "^2.1.2", "@lumino/disposable": "^2.1.2", "@lumino/signaling": "^2.1.2", - "@rjsf/utils": "^5.13.4", + "@rjsf/utils": "^5.1.0", "ajv": "^8.12.0", "json5": "^2.2.3" }, @@ -2068,11 +2105,11 @@ } }, "node_modules/@jupyterlab/statedb": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-4.2.4.tgz", - "integrity": "sha512-MzNCYEPZcQ55G4M9jExM0zOjC3Bldj63kVM5ontVUpykQgs+sbMjeGcHY7mcMi9gY6hiPPSSvpL3Rf0eZArqkQ==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-4.0.9.tgz", + "integrity": "sha512-8zrDKaeg8mwqol/Aicylmbnv5tEuLAeUC/h+g7rZQzVj9LcMCiF44sse9VOQYLvOhykzQHJ1E1Iodo5FLbDzng==", "dependencies": { - "@lumino/commands": "^2.3.0", + "@lumino/commands": "^2.1.3", "@lumino/coreutils": "^2.1.2", "@lumino/disposable": "^2.1.2", "@lumino/properties": "^2.0.1", @@ -2398,14 +2435,14 @@ } }, "node_modules/@luma.gl/constants": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/constants/-/constants-9.0.23.tgz", - "integrity": "sha512-s/ZhIyEQMisXYj8HCMywcSyem5b8XbVzGPeiftG0k52Nm8+I6Z7cSrF8B88B7GoHVJylwaKyPMXGSXy19STz4w==" + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/constants/-/constants-9.0.15.tgz", + "integrity": "sha512-gcvQmd5Nl0rnU/lXq2Rj214Mjc2XnyBJlfcQfRUGBngvcN4AtQvVtZVUveW6wCZA6JysB0ntvi4ovZm4GhJ/lw==" }, "node_modules/@luma.gl/core": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/core/-/core-9.0.23.tgz", - "integrity": "sha512-7ZU5lKaIfpkqIIL/fF4vLqfeAo1VyFCdHz9MdcKmKFKig7QE6B97BygiVUOwRgOCgrxIpdMZS16JeKIiZFVdwQ==", + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/core/-/core-9.0.15.tgz", + "integrity": "sha512-pogG6a91oM0ynSvBm0MsA7ABWu1QdqlaGyrb1mxvQrQA1NvgN/jflYlqBZ8YfckgJdJe7EZ4bNqnR5ABOu7wIA==", "dependencies": { "@math.gl/types": "^4.0.0", "@probe.gl/env": "^4.0.2", @@ -2415,11 +2452,11 @@ } }, "node_modules/@luma.gl/engine": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/engine/-/engine-9.0.23.tgz", - "integrity": "sha512-npv8VUlaWbJOPrAtBqJGqWqR0BZZvoVqB3vB90MPi6b0s4BaETP3x4QEthxqQb386+Z2HgjCbPcNRFnUdSErcg==", + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/engine/-/engine-9.0.15.tgz", + "integrity": "sha512-CTumSSnBoDbmLF4CvdDk3O8UKArv+cuWq6yiquuPNnJkpzPu1CCz8cIE21boHMNTkWzrxZNceS0RQwbATgQVRA==", "dependencies": { - "@luma.gl/shadertools": "9.0.23", + "@luma.gl/shadertools": "9.0.15", "@math.gl/core": "^4.0.0", "@probe.gl/log": "^4.0.2", "@probe.gl/stats": "^4.0.2" @@ -2429,13 +2466,13 @@ } }, "node_modules/@luma.gl/gltf": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/gltf/-/gltf-9.0.23.tgz", - "integrity": "sha512-FVYa/Umn68OJNLbX3NZT/t3LO4RDd0mdtxyJe9+59sGTEOIyU2scEhMj8mua8RnNnOcF2u4zr9eZ/AQFWGF7Xg==", + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/gltf/-/gltf-9.0.15.tgz", + "integrity": "sha512-gZsWzpYd+oj8W8Gsrr+Iq8Q05zSTyzbAHgmDvDFati4d7X++jnCUZL00KB4wwheQ755MXHU+//+10b5L1Nev1Q==", "peer": true, "dependencies": { "@loaders.gl/textures": "^4.2.0", - "@luma.gl/shadertools": "9.0.23", + "@luma.gl/shadertools": "9.0.15", "@math.gl/core": "^4.0.0" }, "peerDependencies": { @@ -2445,24 +2482,23 @@ } }, "node_modules/@luma.gl/shadertools": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/shadertools/-/shadertools-9.0.23.tgz", - "integrity": "sha512-qgSHxl+6nEEvAFSa09QiMesPVOxPdttH/UiTld++VkVHEQPE0tau4tBcBHbDCZNn9KeybA31TCkcbovH/zTcRQ==", + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/shadertools/-/shadertools-9.0.15.tgz", + "integrity": "sha512-U/W1Vh7HXlhw3T6edUMcLFPSO6OVlDZKPx8v6kSkJtjny37aFZaVeRupUgYfjsSxK1aEc5uTAN1w7+3lJMhUIg==", "dependencies": { "@math.gl/core": "^4.0.0", - "@math.gl/types": "^4.0.0", - "wgsl_reflect": "^1.0.1" + "@math.gl/types": "^4.0.0" }, "peerDependencies": { "@luma.gl/core": "^9.0.0" } }, "node_modules/@luma.gl/webgl": { - "version": "9.0.23", - "resolved": "https://registry.npmjs.org/@luma.gl/webgl/-/webgl-9.0.23.tgz", - "integrity": "sha512-ZicCtMbzOPq/1dEPF/0blZ6tVh14nBeZQ3LP2QUT76PjyM5rdwlLTVeAvgL235lla/fKcizMOqY0uT81h3Cbaw==", + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@luma.gl/webgl/-/webgl-9.0.15.tgz", + "integrity": "sha512-hAwer8bCe3S5fL8/1Z/gWp5dinVNOxC7oFZQ7uYVr/BhUu7NbUA6P9ueVJDANtE9wAh+tl/uN43mcH9aP7YMfQ==", "dependencies": { - "@luma.gl/constants": "9.0.23", + "@luma.gl/constants": "9.0.15", "@probe.gl/env": "^4.0.2" }, "peerDependencies": { @@ -2470,9 +2506,9 @@ } }, "node_modules/@lumino/algorithm": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/algorithm/-/algorithm-2.0.2.tgz", - "integrity": "sha512-cI8yJ2+QK1yM5ZRU3Kuaw9fJ/64JEDZEwWWp7+U0cd/mvcZ44BGdJJ29w+tIet1QXxPAvnsUleWyQ5qm4qUouA==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/algorithm/-/algorithm-2.0.1.tgz", + "integrity": "sha512-iA+uuvA7DeNFB0/cQpIWNgO1c6z4pOSigifjstLy+rxf1U5ZzxIq+xudnEuTbWgKSTviG02j4cKwCyx1PO6rzA==" }, "node_modules/@lumino/collections": { "version": "1.9.3", @@ -2488,53 +2524,50 @@ "integrity": "sha512-Z06lp/yuhz8CtIir3PNTGnuk7909eXt4ukJsCzChsGuot2l5Fbs96RJ/FOHgwCedaX74CtxPjXHXoszFbUA+4A==" }, "node_modules/@lumino/commands": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/@lumino/commands/-/commands-2.3.1.tgz", - "integrity": "sha512-DpX1kkE4PhILpvK1T4ZnaFb6UP4+YTkdZifvN3nbiomD64O2CTd+wcWIBpZMgy6MMgbVgrE8dzHxHk1EsKxNxw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@lumino/commands/-/commands-2.2.0.tgz", + "integrity": "sha512-xm+4rFithAd/DLZheQcS0GJaI3m0gVg07mCEZAWBLolN5e7w6XTr17VuD7J6KSjdBygMKZ3n8GlEkpcRNWEajA==", "dependencies": { - "@lumino/algorithm": "^2.0.2", - "@lumino/coreutils": "^2.2.0", - "@lumino/disposable": "^2.1.3", - "@lumino/domutils": "^2.0.2", - "@lumino/keyboard": "^2.0.2", - "@lumino/signaling": "^2.1.3", - "@lumino/virtualdom": "^2.0.2" + "@lumino/algorithm": "^2.0.1", + "@lumino/coreutils": "^2.1.2", + "@lumino/disposable": "^2.1.2", + "@lumino/domutils": "^2.0.1", + "@lumino/keyboard": "^2.0.1", + "@lumino/signaling": "^2.1.2", + "@lumino/virtualdom": "^2.0.1" } }, "node_modules/@lumino/coreutils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-2.2.0.tgz", - "integrity": "sha512-x5wnQ/GjWBayJ6vXVaUi6+Q6ETDdcUiH9eSfpRZFbgMQyyM6pi6baKqJBK2CHkCc/YbAEl6ipApTgm3KOJ/I3g==", - "dependencies": { - "@lumino/algorithm": "^2.0.2" - } + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-2.1.2.tgz", + "integrity": "sha512-vyz7WzchTO4HQ8iVAxvSUmb5o/8t3cz1vBo8V4ZIaPGada0Jx0xe3tKQ8bXp4pjHc+AEhMnkCnlUyVYMWbnj4A==" }, "node_modules/@lumino/disposable": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@lumino/disposable/-/disposable-2.1.3.tgz", - "integrity": "sha512-k5KXy/+T3UItiWHY4WwQawnsJnGo3aNtP5CTRKqo4+tbTNuhc3rTSvygJlNKIbEfIZXW2EWYnwfFDozkYx95eA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@lumino/disposable/-/disposable-2.1.2.tgz", + "integrity": "sha512-0qmB6zPt9+uj4SVMTfISn0wUOjYHahtKotwxDD5flfcscj2gsXaFCXO4Oqot1zcsZbg8uJmTUhEzAvFW0QhFNA==", "dependencies": { - "@lumino/signaling": "^2.1.3" + "@lumino/signaling": "^2.1.2" } }, "node_modules/@lumino/domutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/domutils/-/domutils-2.0.2.tgz", - "integrity": "sha512-2Kp6YHaMNI1rKB0PrALvOsZBHPy2EvVVAvJLWjlCm8MpWOVETjFp0MA9QpMubT9I76aKbaI5s1o1NJyZ8Y99pQ==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/domutils/-/domutils-2.0.1.tgz", + "integrity": "sha512-tbcfhsdKH04AMjSgYAYGD2xE80YcjrqKnfMTeU2NHt4J294Hzxs1GvEmSMk5qJ3Bbgwx6Z4BbQ7apnFg8Gc6cA==" }, "node_modules/@lumino/dragdrop": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@lumino/dragdrop/-/dragdrop-2.1.5.tgz", - "integrity": "sha512-zqwR4GakrQBKZOW6S5pj2nfrQDurOErAoe9x3HS3BKLa1AzWA+t9PD5NESOKd81NqXFHjiMirSyFkTUs6pw+uA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@lumino/dragdrop/-/dragdrop-2.1.4.tgz", + "integrity": "sha512-/ckaYPHIZC1Ff0pU2H3WDI/Xm7V3i0XnyYG4PeZvG1+ovc0I0zeZtlb6qZXne0Vi2r8L2a0624FjF2CwwgNSnA==", "dependencies": { - "@lumino/coreutils": "^2.2.0", - "@lumino/disposable": "^2.1.3" + "@lumino/coreutils": "^2.1.2", + "@lumino/disposable": "^2.1.2" } }, "node_modules/@lumino/keyboard": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/keyboard/-/keyboard-2.0.2.tgz", - "integrity": "sha512-icRUpvswDaFjqmAJNbQRb/aTu6Iugo6Y2oC08TiIwhQtLS9W+Ee9VofdqvbPSvCm6DkyP+DCWMuA3KXZ4V4g4g==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/keyboard/-/keyboard-2.0.1.tgz", + "integrity": "sha512-R2mrH9HCEcv/0MSAl7bEUbjCNOnhrg49nXZBEVckg//TEG+sdayCsyrbJNMPcZ07asIPKc6mq3v7DpAmDKqh+w==" }, "node_modules/@lumino/messaging": { "version": "1.10.3", @@ -2551,70 +2584,70 @@ "integrity": "sha512-Z06lp/yuhz8CtIir3PNTGnuk7909eXt4ukJsCzChsGuot2l5Fbs96RJ/FOHgwCedaX74CtxPjXHXoszFbUA+4A==" }, "node_modules/@lumino/polling": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@lumino/polling/-/polling-2.1.3.tgz", - "integrity": "sha512-WEZk96ddK6eHEhdDkFUAAA40EOLit86QVbqQqnbPmhdGwFogek26Kq9b1U273LJeirv95zXCATOJAkjRyb7D+w==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@lumino/polling/-/polling-2.1.2.tgz", + "integrity": "sha512-hv6MT7xuSrw2gW4VIoiz3L366ZdZz4oefht+7HIW/VUB6seSDp0kVyZ4P9P4I4s/LauuzPqru3eWr7QAsFZyGA==", "dependencies": { - "@lumino/coreutils": "^2.2.0", - "@lumino/disposable": "^2.1.3", - "@lumino/signaling": "^2.1.3" + "@lumino/coreutils": "^2.1.2", + "@lumino/disposable": "^2.1.2", + "@lumino/signaling": "^2.1.2" } }, "node_modules/@lumino/properties": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/properties/-/properties-2.0.2.tgz", - "integrity": "sha512-b312oA3Bh97WFK8efXejYmC3DVJmvzJk72LQB7H3fXhfqS5jUWvL7MSnNmgcQvGzl9fIhDWDWjhtSTi0KGYYBg==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/properties/-/properties-2.0.1.tgz", + "integrity": "sha512-RPtHrp8cQqMnTC915lOIdrmsbPDCC7PhPOZb2YY7/Jj6dEdwmGhoMthc2tBEYWoHP+tU/hVm8UR/mEQby22srQ==" }, "node_modules/@lumino/signaling": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@lumino/signaling/-/signaling-2.1.3.tgz", - "integrity": "sha512-9Wd4iMk8F1i6pYjy65bqKuPlzQMicyL9xy1/ccS20kovPcfD074waneL/7BVe+3M8i+fGa3x2qjbWrBzOdTdNw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@lumino/signaling/-/signaling-2.1.2.tgz", + "integrity": "sha512-KtwKxx+xXkLOX/BdSqtvnsqBTPKDIENFBKeYkMTxstQc3fHRmyTzmaVoeZES+pr1EUy3e8vM4pQFVQpb8VsDdA==", "dependencies": { - "@lumino/algorithm": "^2.0.2", - "@lumino/coreutils": "^2.2.0" + "@lumino/algorithm": "^2.0.1", + "@lumino/coreutils": "^2.1.2" } }, "node_modules/@lumino/virtualdom": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/virtualdom/-/virtualdom-2.0.2.tgz", - "integrity": "sha512-HYZThOtZSoknjdXA102xpy5CiXtTFCVz45EXdWeYLx3NhuEwuAIX93QBBIhupalmtFlRg1yhdDNV40HxJ4kcXg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/virtualdom/-/virtualdom-2.0.1.tgz", + "integrity": "sha512-WNM+uUZX7vORhlDRN9NmhEE04Tz1plDjtbwsX+i/51pQj2N2r7+gsVPY/gR4w+I5apmC3zG8/BojjJYIwi8ogA==", "dependencies": { - "@lumino/algorithm": "^2.0.2" + "@lumino/algorithm": "^2.0.1" } }, "node_modules/@lumino/widgets": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@lumino/widgets/-/widgets-2.5.0.tgz", - "integrity": "sha512-RSRpc6aIEiuw79jqWUHYWXLJ2GBy7vhwuqgo94UVzg6oeh3XBECX0OvXGjK2k7N2BhmRrIs9bXky7Dm861S6mQ==", - "dependencies": { - "@lumino/algorithm": "^2.0.2", - "@lumino/commands": "^2.3.1", - "@lumino/coreutils": "^2.2.0", - "@lumino/disposable": "^2.1.3", - "@lumino/domutils": "^2.0.2", - "@lumino/dragdrop": "^2.1.5", - "@lumino/keyboard": "^2.0.2", - "@lumino/messaging": "^2.0.2", - "@lumino/properties": "^2.0.2", - "@lumino/signaling": "^2.1.3", - "@lumino/virtualdom": "^2.0.2" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@lumino/widgets/-/widgets-2.3.1.tgz", + "integrity": "sha512-t3yKoXY4P1K1Tiv7ABZLKjwtn2gFIbaK0jnjFhoHNlzX5q43cm7FjtCFQWrvJbBN6Heq9qq00JPOWXeZ3IlQdg==", + "dependencies": { + "@lumino/algorithm": "^2.0.1", + "@lumino/commands": "^2.2.0", + "@lumino/coreutils": "^2.1.2", + "@lumino/disposable": "^2.1.2", + "@lumino/domutils": "^2.0.1", + "@lumino/dragdrop": "^2.1.4", + "@lumino/keyboard": "^2.0.1", + "@lumino/messaging": "^2.0.1", + "@lumino/properties": "^2.0.1", + "@lumino/signaling": "^2.1.2", + "@lumino/virtualdom": "^2.0.1" } }, "node_modules/@lumino/widgets/node_modules/@lumino/collections": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/collections/-/collections-2.0.2.tgz", - "integrity": "sha512-o0QmfV1D3WhAeA8GI1/YmEPaK89JtHVa764rQ5T0LdbDEwUtUDbjavHs1E/+y66tNTXz9RUJ4D2rcSb9tysYsg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/collections/-/collections-2.0.1.tgz", + "integrity": "sha512-8TbAU/48XVPKc/FOhGHLuugf2Gmx6vhVEx867KGG5fLwDOI8EW4gTno78yJUk8G0QpgNa+sdpB/LwbJFNIratg==", "dependencies": { - "@lumino/algorithm": "^2.0.2" + "@lumino/algorithm": "^2.0.1" } }, "node_modules/@lumino/widgets/node_modules/@lumino/messaging": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@lumino/messaging/-/messaging-2.0.2.tgz", - "integrity": "sha512-2sUF07cYA0f3mDil41Eh5sfBk0aGAH/mOh1I4+vyRUsKyBqp4WTUtpJFd8xVJGAntygxwnebIygkIaXXTIQvxA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@lumino/messaging/-/messaging-2.0.1.tgz", + "integrity": "sha512-Z1b9Sq7i2yw7BN/u9ezoBUMYK06CsQXO7BqpczSnEO0PfwFf9dWi7y9VcIySOBz9uogsT1uczZMIMtLefk+xPQ==", "dependencies": { - "@lumino/algorithm": "^2.0.2", - "@lumino/collections": "^2.0.2" + "@lumino/algorithm": "^2.0.1", + "@lumino/collections": "^2.0.1" } }, "node_modules/@mapbox/geojson-rewind": { @@ -5856,9 +5889,9 @@ } }, "node_modules/@rjsf/utils": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-5.20.0.tgz", - "integrity": "sha512-1hICYfz4DI+kgyITJgKcOAX2WoTMHLVwb199dz9ZnTH90YzbpbaQeXoEs06/i5vy0HNYLJ6uKd4Ety5eN4Uf+w==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-+K+WA/tGD8jSDRB6QzCvyCY0/rVZ+q/u0f07AGfx/h/ICVcJjOy5fWtUANQ0bBltLNPqjXqpFb3e3SxDXzSVaA==", "dependencies": { "json-schema-merge-allof": "^0.8.1", "jsonpointer": "^5.0.1", @@ -5873,32 +5906,6 @@ "react": "^16.14.0 || >=17" } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz", - "integrity": "sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz", - "integrity": "sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.20.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz", @@ -5912,175 +5919,6 @@ "darwin" ] }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz", - "integrity": "sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz", - "integrity": "sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz", - "integrity": "sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz", - "integrity": "sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz", - "integrity": "sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz", - "integrity": "sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz", - "integrity": "sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz", - "integrity": "sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz", - "integrity": "sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz", - "integrity": "sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz", - "integrity": "sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz", - "integrity": "sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz", - "integrity": "sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@statelyai/inspect": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@statelyai/inspect/-/inspect-0.4.0.tgz", @@ -6112,9 +5950,9 @@ } }, "node_modules/@swc/helpers": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.12.tgz", - "integrity": "sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==", + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.11.tgz", + "integrity": "sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A==", "dependencies": { "tslib": "^2.4.0" } @@ -6216,9 +6054,9 @@ "dev": true }, "node_modules/@types/geojson": { - "version": "7946.0.14", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", - "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" + "version": "7946.0.13", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.13.tgz", + "integrity": "sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==" }, "node_modules/@types/hammerjs": { "version": "2.0.45", @@ -6226,9 +6064,9 @@ "integrity": "sha512-qkcUlZmX6c4J8q45taBKTL3p+LbITgyx7qhlPYOdOHZB7B31K0mXbP5YA7i7SgDeEGuI9MnumiKPEMrxg8j3KQ==" }, "node_modules/@types/jquery": { - "version": "3.5.30", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.30.tgz", - "integrity": "sha512-nbWKkkyb919DOUxjmRVk8vwtDb0/k8FKncmUKFi+NY+QXqWltooxTrswvz4LspQwxvLdvzBN1TImr6cw3aQx2A==", + "version": "3.5.29", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.29.tgz", + "integrity": "sha512-oXQQC9X9MOPRrMhPHHOsXqeQDnWeCDT3PelUIg/Oy8FAbzSZtFHRjc7IpbfFVmpLtJ+UOoywpRsuO5Jxjybyeg==", "dependencies": { "@types/sizzle": "*" } @@ -6271,20 +6109,19 @@ } }, "node_modules/@types/mapbox-gl": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-3.4.0.tgz", - "integrity": "sha512-tbn++Mm94H1kE7W6FF0oVC9rMXHVzDDNUbS7KfBMRF8NV/8csFi+67ytKcZJ4LsrpsJ+8MC6Os6ZinEDCsrunw==", + "version": "2.7.19", + "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.7.19.tgz", + "integrity": "sha512-pkRdlhQJNbtwcKJSVC4uuOA6M3OlOObIMhNecqHB991oeaDF5XkjSIRaTE0lh5p4KClptSCxW6MBiREVRHrl2A==", "dependencies": { "@types/geojson": "*" } }, "node_modules/@types/node": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz", - "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==", - "peer": true, + "version": "20.14.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.14.tgz", + "integrity": "sha512-d64f00982fS9YoOgJkAMolK7MN8Iq3TDdVjchbYHdEmjth/DHowx82GnoA+tVUAN+7vxfYUgAzi+JXbKNd2SDQ==", "dependencies": { - "undici-types": "~6.13.0" + "undici-types": "~5.26.4" } }, "node_modules/@types/offscreencanvas": { @@ -6304,9 +6141,9 @@ "integrity": "sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA==" }, "node_modules/@types/prop-types": { - "version": "15.7.12", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", - "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" + "version": "15.7.11", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" }, "node_modules/@types/react": { "version": "18.3.4", @@ -6318,9 +6155,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.3.0", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", - "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", + "version": "18.2.17", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.17.tgz", + "integrity": "sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg==", "peer": true, "dependencies": { "@types/react": "*" @@ -6351,16 +6188,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.2.0.tgz", - "integrity": "sha512-02tJIs655em7fvt9gps/+4k4OsKULYGtLBPJfOsmOq1+3cdClYiF0+d6mHu6qDnTcg88wJBkcPLpQhq7FyDz0A==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.3.0.tgz", + "integrity": "sha512-FLAIn63G5KH+adZosDYiutqkOkYEx0nvcwNNfJAf+c7Ae/H35qWwTYvPZUKFj5AS+WfHG/WJJfWnDnyNUlp8UA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.2.0", - "@typescript-eslint/type-utils": "8.2.0", - "@typescript-eslint/utils": "8.2.0", - "@typescript-eslint/visitor-keys": "8.2.0", + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/type-utils": "8.3.0", + "@typescript-eslint/utils": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -6384,15 +6221,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.2.0.tgz", - "integrity": "sha512-j3Di+o0lHgPrb7FxL3fdEy6LJ/j2NE8u+AP/5cQ9SKb+JLH6V6UHDqJ+e0hXBkHP1wn1YDFjYCS9LBQsZDlDEg==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.3.0.tgz", + "integrity": "sha512-h53RhVyLu6AtpUzVCYLPhZGL5jzTD9fZL+SYf/+hYOx2bDkyQXztXSc4tbvKYHzfMXExMLiL9CWqJmVz6+78IQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.2.0", - "@typescript-eslint/types": "8.2.0", - "@typescript-eslint/typescript-estree": "8.2.0", - "@typescript-eslint/visitor-keys": "8.2.0", + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/typescript-estree": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "debug": "^4.3.4" }, "engines": { @@ -6412,13 +6249,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.2.0.tgz", - "integrity": "sha512-OFn80B38yD6WwpoHU2Tz/fTz7CgFqInllBoC3WP+/jLbTb4gGPTy9HBSTsbDWkMdN55XlVU0mMDYAtgvlUspGw==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.3.0.tgz", + "integrity": "sha512-mz2X8WcN2nVu5Hodku+IR8GgCOl4C0G/Z1ruaWN4dgec64kDBabuXyPAr+/RgJtumv8EEkqIzf3X2U5DUKB2eg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.2.0", - "@typescript-eslint/visitor-keys": "8.2.0" + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6429,13 +6266,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.2.0.tgz", - "integrity": "sha512-g1CfXGFMQdT5S+0PSO0fvGXUaiSkl73U1n9LTK5aRAFnPlJ8dLKkXr4AaLFvPedW8lVDoMgLLE3JN98ZZfsj0w==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.3.0.tgz", + "integrity": "sha512-wrV6qh//nLbfXZQoj32EXKmwHf4b7L+xXLrP3FZ0GOUU72gSvLjeWUl5J5Ue5IwRxIV1TfF73j/eaBapxx99Lg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.2.0", - "@typescript-eslint/utils": "8.2.0", + "@typescript-eslint/typescript-estree": "8.3.0", + "@typescript-eslint/utils": "8.3.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -6453,9 +6290,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.2.0.tgz", - "integrity": "sha512-6a9QSK396YqmiBKPkJtxsgZZZVjYQ6wQ/TlI0C65z7vInaETuC6HAHD98AGLC8DyIPqHytvNuS8bBVvNLKyqvQ==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.3.0.tgz", + "integrity": "sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6466,15 +6303,15 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.2.0.tgz", - "integrity": "sha512-kiG4EDUT4dImplOsbh47B1QnNmXSoUqOjWDvCJw/o8LgfD0yr7k2uy54D5Wm0j4t71Ge1NkynGhpWdS0dEIAUA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.3.0.tgz", + "integrity": "sha512-Mq7FTHl0R36EmWlCJWojIC1qn/ZWo2YiWYc1XVtasJ7FIgjo0MVv9rZWXEE7IK2CGrtwe1dVOxWwqXUdNgfRCA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.2.0", - "@typescript-eslint/visitor-keys": "8.2.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "debug": "^4.3.4", - "globby": "^11.1.0", + "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", @@ -6517,28 +6354,16 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/utils": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.2.0.tgz", - "integrity": "sha512-O46eaYKDlV3TvAVDNcoDzd5N550ckSe8G4phko++OCSC1dYIb9LTc3HDGYdWqWIAT5qDUKphO6sd9RrpIJJPfg==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.3.0.tgz", + "integrity": "sha512-F77WwqxIi/qGkIGOGXNBLV7nykwfjLsdauRB/DOFPdv6LTF3BHHkBpq81/b5iMPSF055oO2BiivDJV4ChvNtXA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.2.0", - "@typescript-eslint/types": "8.2.0", - "@typescript-eslint/typescript-estree": "8.2.0" + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/typescript-estree": "8.3.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -6552,12 +6377,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.2.0.tgz", - "integrity": "sha512-sbgsPMW9yLvS7IhCi8IpuK1oBmtbWUNP+hBdwl/I9nzqVsszGnNGti5r9dUtF5RLivHUFFIdRvLiTsPhzSyJ3Q==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.3.0.tgz", + "integrity": "sha512-RmZwrTbQ9QveF15m/Cl28n0LXD6ea2CjkhH5rQ55ewz3H24w+AMCJHPVYaZ8/0HoG8Z3cLLFFycRXxeO2tz9FA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.2.0", + "@typescript-eslint/types": "8.3.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -6679,6 +6504,12 @@ } } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -6701,14 +6532,14 @@ } }, "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", + "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" }, "funding": { "type": "github", @@ -6773,29 +6604,19 @@ "arrow2csv": "bin/arrow2csv.cjs" } }, - "node_modules/apache-arrow/node_modules/@types/node": { - "version": "20.14.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.15.tgz", - "integrity": "sha512-Fz1xDMCF/B00/tYSVMlmK7hVeLh7jE5f3B7X1/hmV0MJBwE27KlS7EvD/Yp+z1lm8mVhwV5w+n8jOZG8AfTlKw==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/apache-arrow/node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" }, "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "peer": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } }, "node_modules/arr-union": { "version": "3.1.0", @@ -6849,15 +6670,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/array.prototype.findlast": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", @@ -7056,14 +6868,11 @@ "peer": true }, "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/brace-expansion": { @@ -7206,9 +7015,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001651", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", - "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", + "version": "1.0.30001650", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001650.tgz", + "integrity": "sha512-fgEc7hP/LB7iicdXHUI9VsBsMZmUmlVJeQP2qqQW+3lkqVhbmjEU8zp+h5stWeilX+G7uXuIUIIlWlDw9jdt8g==", "dev": true, "funding": [ { @@ -7289,9 +7098,15 @@ } }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -7304,24 +7119,10 @@ "engines": { "node": ">= 8.10.0" }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, "optionalDependencies": { "fsevents": "~2.3.2" } }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/clsx": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", @@ -7387,13 +7188,13 @@ } }, "node_modules/command-line-usage": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.3.tgz", - "integrity": "sha512-PqMLy5+YGwhMh1wS04mVG44oqDsgyLRSKJBdOo1bnYhMKBW65gZF1dRp2OZRhiTjgUHljy99qkO7bsctLaw35Q==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.1.tgz", + "integrity": "sha512-NCyznE//MuTjwi3y84QVUGEOT+P5oto1e1Pk/jFPVdPPfsG03qpTIl3yw6etR+v73d0lXsoojRpvbru2sqePxQ==", "dependencies": { "array-back": "^6.2.2", "chalk-template": "^0.4.0", - "table-layout": "^4.1.0", + "table-layout": "^3.0.0", "typical": "^7.1.1" }, "engines": { @@ -7503,6 +7304,20 @@ "node": ">= 8" } }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/crypt": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", @@ -7614,9 +7429,9 @@ } }, "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "node_modules/d3-hexbin": { "version": "0.2.2", @@ -7770,18 +7585,6 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", @@ -7828,9 +7631,9 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, "node_modules/electron-to-chromium": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz", - "integrity": "sha512-jwXWsM5RPf6j9dPYzaorcBSUg6AiqocPEyMpkchkvntaH9HGfOOMZwxMJjDY/XEs3T5dM7uyH1VhRMkqUU9qVw==", + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.5.tgz", + "integrity": "sha512-QR7/A7ZkMS8tZuoftC/jfqNkZLQO779SSW3YuZHP4eXpj3EffGLFcB/Xu9AAZQzLccTiCV+EmUo3ha4mQ9wnlA==", "dev": true }, "node_modules/emoji-regex": { @@ -8189,6 +7992,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/eslint-scope": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", @@ -8233,6 +8045,18 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/eslint/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -8394,17 +8218,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -8423,15 +8236,10 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, - "node_modules/fast-uri": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" - }, "node_modules/fast-xml-parser": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", - "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.0.tgz", + "integrity": "sha512-kLY3jFlwIYwBNDojclKsNAC12sfD6NwW74QB2CoNGPvtVxjliYehVunB3HYyNi+n4Tt1dAcgwYvmKF/Z18flqg==", "funding": [ { "type": "github", @@ -8556,9 +8364,9 @@ } }, "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -8766,14 +8574,14 @@ } }, "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dependencies": { - "is-glob": "^4.0.3" + "is-glob": "^4.0.1" }, "engines": { - "node": ">=10.13.0" + "node": ">= 6" } }, "node_modules/glob/node_modules/brace-expansion": { @@ -8811,17 +8619,6 @@ "node": ">=6" } }, - "node_modules/global-prefix/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/globals": { "version": "15.9.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", @@ -8850,26 +8647,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -8986,6 +8763,11 @@ "node": ">= 0.4" } }, + "node_modules/html-to-image": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.11.tgz", + "integrity": "sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA==" + }, "node_modules/human-signals": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", @@ -9027,9 +8809,9 @@ ] }, "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -9662,6 +9444,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/js-yaml/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/json-bignum": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/json-bignum/-/json-bignum-0.0.3.tgz", @@ -9801,14 +9589,13 @@ } }, "node_modules/lib0": { - "version": "0.2.97", - "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.97.tgz", - "integrity": "sha512-Q4d1ekgvufi9FiHkkL46AhecfNjznSL9MRNoJRQ76gBHS9OqU2ArfQK0FvBpuxgWeJeNI0LVgAYMIpsGeX4gYg==", + "version": "0.2.88", + "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.88.tgz", + "integrity": "sha512-KyroiEvCeZcZEMx5Ys+b4u4eEBbA1ch7XUaBhYpwa/nPMrzTjUhI4RfcytmQfYoTBPcdyx+FX6WFNIoNuJzJfQ==", "dependencies": { "isomorphic.js": "^0.2.4" }, "bin": { - "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js", "0gentesthtml": "bin/gentesthtml.js", "0serve": "bin/0serve.js" }, @@ -9876,6 +9663,11 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, + "node_modules/lodash.assignwith": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz", + "integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g==" + }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -9951,11 +9743,6 @@ "get-func-name": "^2.0.1" } }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" - }, "node_modules/lz4js": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/lz4js/-/lz4js-0.2.0.tgz", @@ -10105,9 +9892,9 @@ } }, "node_modules/mjolnir.js": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/mjolnir.js/-/mjolnir.js-2.7.3.tgz", - "integrity": "sha512-Z5z/+FzZqOSO3juSVKV3zcm4R2eAlWwlKMcqHmyFEJAaLILNcDKnIbnb4/kbcGyIuhtdWrzu8WOIR7uM6I34aw==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/mjolnir.js/-/mjolnir.js-2.7.1.tgz", + "integrity": "sha512-72BeUWgTv2cj5aZQKpwL8caNUFhXZ9bDm1hxpNj70XJQ62IBnTZmtv/WPxJvtaVNhzNo+D2U8O6ryNI0zImYcw==", "dependencies": { "@types/hammerjs": "^2.0.41", "hammerjs": "^2.0.8" @@ -10203,18 +9990,6 @@ "node": ">=4" } }, - "node_modules/nodemon/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/nodemon/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -10227,6 +10002,21 @@ "node": ">=4" } }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -10245,9 +10035,9 @@ } }, "node_modules/npm-run-path": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", - "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz", + "integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==", "dev": true, "dependencies": { "path-key": "^4.0.0" @@ -10521,14 +10311,10 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" }, "node_modules/pathe": { "version": "1.1.2", @@ -10546,9 +10332,9 @@ } }, "node_modules/pbf": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.3.0.tgz", - "integrity": "sha512-XDF38WCH3z5OV/OVa8GKUNtLAyneuzbCisx7QUCF8Q6Nutx0WnJrQe5O+kOtBlLfRNUws98Y58Lblp+NJG5T4Q==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", "dependencies": { "ieee754": "^1.1.12", "resolve-protobuf-schema": "^2.1.0" @@ -11478,9 +11264,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", - "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz", + "integrity": "sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -11499,6 +11285,15 @@ "resolved": "https://registry.npmjs.org/potpack/-/potpack-2.0.0.tgz", "integrity": "sha512-Q+/tYsFU9r7xoOJ+y/ZTtdVQwTWfzjbiXBDMM/JKUux3+QPP02iUuIoeBQ+Ot6oEDlC+/PGjB/5A3K7KKb7hcw==" }, + "node_modules/preact": { + "version": "10.23.2", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.23.2.tgz", + "integrity": "sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -11530,9 +11325,9 @@ "peer": true }, "node_modules/proj4": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.12.0.tgz", - "integrity": "sha512-cQJxcVX7+fmAhOxoazKgk76GkGYQ5HcLod4rdy2MizhPvLdrZQJThxsHoz/TjjdxUvTm/rbozMgE0q9mdXKWIw==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.11.0.tgz", + "integrity": "sha512-SasuTkAx8HnWQHfIyhkdUNJorSJqINHAN3EyMWYiQRVorftz9DHz650YraFgczwgtHOxqnfuDxSNv3C8MUnHeg==", "dependencies": { "mgrs": "1.0.0", "wkt-parser": "^1.3.3" @@ -11570,7 +11365,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, "engines": { "node": ">=6" } @@ -11628,9 +11422,9 @@ } }, "node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==" + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/react-map-gl": { "version": "7.1.7", @@ -11794,9 +11588,9 @@ } }, "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" }, "node_modules/regexp.prototype.flags": { "version": "1.5.2", @@ -12055,82 +11849,6 @@ "sass-embedded-win32-x64": "1.77.8" } }, - "node_modules/sass-embedded-android-arm": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.77.8.tgz", - "integrity": "sha512-GpGL7xZ7V1XpFbnflib/NWbM0euRzineK0iwoo31/ntWKAXGj03iHhGzkSiOwWSFcXgsJJi3eRA5BTmBvK5Q+w==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-android-arm64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.77.8.tgz", - "integrity": "sha512-EmWHLbEx0Zo/f/lTFzMeH2Du+/I4RmSRlEnERSUKQWVp3aBSO04QDvdxfFezgQ+2Yt/ub9WMqBpma9P/8MPsLg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-android-ia32": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-android-ia32/-/sass-embedded-android-ia32-1.77.8.tgz", - "integrity": "sha512-+GjfJ3lDezPi4dUUyjQBxlNKXNa+XVWsExtGvVNkv1uKyaOxULJhubVo2G6QTJJU0esJdfeXf5Ca5/J0ph7+7w==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "android" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-android-x64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.77.8.tgz", - "integrity": "sha512-YZbFDzGe5NhaMCygShqkeCWtzjhkWxGVunc7ULR97wmxYPQLPeVyx7XFQZc84Aj0lKAJBJS4qRZeqphMqZEJsQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/sass-embedded-darwin-arm64": { "version": "1.77.8", "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.77.8.tgz", @@ -12150,222 +11868,6 @@ "node": ">=14.0.0" } }, - "node_modules/sass-embedded-darwin-x64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.77.8.tgz", - "integrity": "sha512-/VWZQtcWIOek60Zj6Sxk6HebXA1Qyyt3sD8o5qwbTgZnKitB1iEBuNunyGoAgMNeUz2PRd6rVki6hvbas9hQ6w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-arm": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.77.8.tgz", - "integrity": "sha512-2edZMB6jf0whx3T0zlgH+p131kOEmWp+I4wnKj7ZMUeokiY4Up05d10hSvb0Q63lOrSjFAWu6P5/pcYUUx8arQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-arm64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.77.8.tgz", - "integrity": "sha512-6iIOIZtBFa2YfMsHqOb3qake3C9d/zlKxjooKKnTSo+6g6z+CLTzMXe1bOfayb7yxeenElmFoK1k54kWD/40+g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-ia32": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-ia32/-/sass-embedded-linux-ia32-1.77.8.tgz", - "integrity": "sha512-63GsFFHWN5yRLTWiSef32TM/XmjhCBx1DFhoqxmj+Yc6L9Z1h0lDHjjwdG6Sp5XTz5EmsaFKjpDgnQTP9hJX3Q==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-musl-arm": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.77.8.tgz", - "integrity": "sha512-nFkhSl3uu9btubm+JBW7uRglNVJ8W8dGfzVqh3fyQJKS1oyBC3vT3VOtfbT9YivXk28wXscSHpqXZwY7bUuopA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-musl-arm64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.77.8.tgz", - "integrity": "sha512-j8cgQxNWecYK+aH8ESFsyam/Q6G+9gg8eJegiRVpA9x8yk3ykfHC7UdQWwUcF22ZcuY4zegrjJx8k+thsgsOVA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-musl-ia32": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-ia32/-/sass-embedded-linux-musl-ia32-1.77.8.tgz", - "integrity": "sha512-oWveMe+8TFlP8WBWPna/+Ec5TV0CE+PxEutyi0ltSruBds2zxRq9dPVOqrpPcDN9QUx50vNZC0Afgch0aQEd0g==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-musl-x64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.77.8.tgz", - "integrity": "sha512-2NtRpMXHeFo9kaYxuZ+Ewwo39CE7BTS2JDfXkTjZTZqd8H+8KC53eBh516YQnn2oiqxSiKxm7a6pxbxGZGwXOQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-linux-x64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.77.8.tgz", - "integrity": "sha512-ND5qZLWUCpOn7LJfOf0gLSZUWhNIysY+7NZK1Ctq+pM6tpJky3JM5I1jSMplNxv5H3o8p80n0gSm+fcjsEFfjQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-win32-arm64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.77.8.tgz", - "integrity": "sha512-7L8zT6xzEvTYj86MvUWnbkWYCNQP+74HvruLILmiPPE+TCgOjgdi750709BtppVJGGZSs40ZuN6mi/YQyGtwXg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass.bat" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-win32-ia32": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-ia32/-/sass-embedded-win32-ia32-1.77.8.tgz", - "integrity": "sha512-7Buh+4bP0WyYn6XPbthkIa3M2vtcR8QIsFVg3JElVlr+8Ng19jqe0t0SwggDgbMX6AdQZC+Wj4F1BprZSok42A==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass.bat" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/sass-embedded-win32-x64": { - "version": "1.77.8", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.77.8.tgz", - "integrity": "sha512-rZmLIx4/LLQm+4GW39sRJW0MIlDqmyV0fkRzTmhFP5i/wVC7cuj8TUubPHw18rv2rkHFfBZKZJTCkPjCS5Z+SA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "bin": { - "sass": "dart-sass/sass.bat" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/sass-embedded/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -12398,12 +11900,15 @@ } }, "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/set-function-length": { @@ -12532,27 +12037,6 @@ "node": ">=10" } }, - "node_modules/simple-update-notifier/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/snappyjs": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/snappyjs/-/snappyjs-0.6.1.tgz", @@ -12651,6 +12135,14 @@ "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", "dev": true }, + "node_modules/stream-read-all": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/stream-read-all/-/stream-read-all-3.0.1.tgz", + "integrity": "sha512-EWZT9XOceBPlVJRrYcykW8jyRSZYbkb/0ZK36uLEmoWVO5gxBOnntNTseNzfREsqxqdfEGQrD8SXQ3QWbBmq8A==", + "engines": { + "node": ">=10" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -12928,13 +12420,21 @@ } }, "node_modules/table-layout": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-4.1.1.tgz", - "integrity": "sha512-iK5/YhZxq5GO5z8wb0bY1317uDF3Zjpha0QFFLA8/trAoiLbQD0HUbMesEaxyzUgDxi2QlcbM8IvqOlEjgoXBA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-3.0.2.tgz", + "integrity": "sha512-rpyNZYRw+/C+dYkcQ3Pr+rLxW4CfHpXjPDnG7lYhdRoUcZTUt+KEsX+94RGp/aVp/MQU35JCITv2T/beY4m+hw==", "dependencies": { + "@75lb/deep-merge": "^1.1.1", "array-back": "^6.2.2", + "command-line-args": "^5.2.1", + "command-line-usage": "^7.0.0", + "stream-read-all": "^3.0.1", + "typical": "^7.1.1", "wordwrapjs": "^5.1.0" }, + "bin": { + "table-layout": "bin/cli.js" + }, "engines": { "node": ">=12.17" } @@ -12947,6 +12447,14 @@ "node": ">=12.17" } }, + "node_modules/table-layout/node_modules/typical": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz", + "integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==", + "engines": { + "node": ">=12.17" + } + }, "node_modules/tailwind-merge": { "version": "1.14.0", "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-1.14.0.tgz", @@ -13007,6 +12515,17 @@ "node": ">=14.0.0" } }, + "node_modules/tailwindcss/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -13026,15 +12545,6 @@ "texture-compressor": "bin/texture-compressor.js" } }, - "node_modules/texture-compressor/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "peer": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -13130,10 +12640,13 @@ } }, "node_modules/touch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, "bin": { "nodetouch": "bin/nodetouch.js" } @@ -13156,9 +12669,9 @@ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/type-check": { "version": "0.4.0", @@ -13259,14 +12772,14 @@ } }, "node_modules/typescript-eslint": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.2.0.tgz", - "integrity": "sha512-DmnqaPcML0xYwUzgNbM1XaKXpEb7BShYf2P1tkUmmcl8hyeG7Pj08Er7R9bNy6AufabywzJcOybQAtnD/c9DGw==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.3.0.tgz", + "integrity": "sha512-EvWjwWLwwKDIJuBjk2I6UkV8KEQcwZ0VM10nR1rIunRDIP67QJTZAHBXTX0HW/oI1H10YESF8yWie8fRQxjvFA==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.2.0", - "@typescript-eslint/parser": "8.2.0", - "@typescript-eslint/utils": "8.2.0" + "@typescript-eslint/eslint-plugin": "8.3.0", + "@typescript-eslint/parser": "8.3.0", + "@typescript-eslint/utils": "8.3.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -13324,15 +12837,14 @@ "dev": true }, "node_modules/underscore": { - "version": "1.13.7", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", - "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==" + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" }, "node_modules/undici-types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", - "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==", - "peer": true + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/union-value": { "version": "1.0.1", @@ -13382,7 +12894,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -13538,13 +13049,13 @@ "peer": true }, "node_modules/vite": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.0.tgz", - "integrity": "sha512-5xokfMX0PIiwCMCMb9ZJcMyh5wbBun0zUzKib+L65vAZ8GY9ePZMXxFrHbr/Kyll2+LSCY7xtERPpxkBDKngwg==", + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.5.tgz", + "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", "dev": true, "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.40", + "postcss": "^8.4.39", "rollup": "^4.13.0" }, "bin": { @@ -13564,7 +13075,6 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", - "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -13582,9 +13092,6 @@ "sass": { "optional": true }, - "sass-embedded": { - "optional": true - }, "stylus": { "optional": true }, @@ -14098,23 +13605,15 @@ "pbf": "^3.2.1" } }, - "node_modules/wgsl_reflect": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/wgsl_reflect/-/wgsl_reflect-1.0.8.tgz", - "integrity": "sha512-0kdpA5H3SF2CMeCBijYqQz+ZT+uW310nJORFX8QPFOvrkfSGNPHFDE7aGPCUnsuDi1kzpj+9SEFIhqjf9iHGSQ==" - }, "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dependencies": { "isexe": "^2.0.0" }, "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" + "which": "bin/which" } }, "node_modules/which-boxed-primitive": { @@ -14387,9 +13886,9 @@ } }, "node_modules/yjs": { - "version": "13.6.18", - "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.18.tgz", - "integrity": "sha512-GBTjO4QCmv2HFKFkYIJl7U77hIB1o22vSCSQD1Ge8ZxWbIbn8AltI4gyXbtL+g5/GJep67HCMq3Y5AmNwDSyEg==", + "version": "13.6.10", + "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.10.tgz", + "integrity": "sha512-1JcyQek1vaMyrDm7Fqfa+pvHg/DURSbVo4VmeN7wjnTKB/lZrfIPhdCj7d8sboK6zLfRBJXegTjc9JlaDd8/Zw==", "dependencies": { "lib0": "^0.2.86" }, @@ -14415,9 +13914,9 @@ } }, "node_modules/zstd-codec": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/zstd-codec/-/zstd-codec-0.1.5.tgz", - "integrity": "sha512-v3fyjpK8S/dpY/X5WxqTK3IoCnp/ZOLxn144GZVlNUjtwAchzrVo03h+oMATFhCIiJ5KTr4V3vDQQYz4RU684g==", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/zstd-codec/-/zstd-codec-0.1.4.tgz", + "integrity": "sha512-KYnWoFWgGtWyQEKNnUcb3u8ZtKO8dn5d8u+oGpxPlopqsPyv60U8suDyfk7Z7UtAO6Sk5i1aVcAs9RbaB1n36A==", "optional": true, "peer": true } diff --git a/package.json b/package.json index d0c6463c..c04a6f9f 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "framer-motion": "^11.3.30", "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", + "@deck.gl/widgets": "^9.0.16", + "html-to-image": "^1.11.11", "maplibre-gl": "^3.6.2", "memoize-one": "^6.0.0", "parquet-wasm": "0.6.1", diff --git a/src/index.tsx b/src/index.tsx index bb40d914..886785d5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,7 +4,13 @@ import { createRender, useModelState, useModel } from "@anywidget/react"; import type { Initialize, Render } from "@anywidget/types"; import Map from "react-map-gl/maplibre"; import DeckGL from "@deck.gl/react"; -import { MapViewState, PickingInfo, type Layer } from "@deck.gl/core"; +import { + MapView, + MapViewState, + PickingInfo, + Widget, + type Layer, +} from "@deck.gl/core"; import { BaseLayerModel, initializeLayer } from "./model/index.js"; import type { WidgetModel } from "@jupyter-widgets/base"; import { initParquetWasm } from "./parquet.js"; @@ -14,6 +20,12 @@ import { v4 as uuidv4 } from "uuid"; import { Message } from "./types.js"; import { flyTo } from "./actions/fly-to.js"; import { useViewStateDebounced } from "./state"; +import { + BaseDeckWidgetModel, + initializeWidget, +} from "./model/deck-widget-models.js"; +import "@deck.gl/widgets/stylesheet.css"; +import "./widget-style.css"; import { MachineContext, MachineProvider } from "./xstate"; import * as selectors from "./xstate/selectors"; @@ -34,6 +46,8 @@ const DEFAULT_INITIAL_VIEW_STATE = { pitch: 0, }; +const MAP_VIEW = new MapView({ repeat: true }); + const DEFAULT_MAP_STYLE = "https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json"; @@ -71,6 +85,44 @@ async function getChildModelState( return newSubModelState; } +async function getDeckWidgetModelState( + deckWidgetModels: WidgetModel[], + deckWidgetIds: string[], + previousSubModelState: Record, + setStateCounter: React.Dispatch>, +): Promise> { + const newDeckWidgetModelState: Record = {}; + const updateStateCallback = () => setStateCounter(new Date()); + + for (let i = 0; i < deckWidgetIds.length; i++) { + const deckWidgetId = deckWidgetIds[i]; + const deckWidgetModel = deckWidgetModels[i]; + + // If the layer existed previously, copy its model without constructing + // a new one + if (deckWidgetId in previousSubModelState) { + // pop from old state + newDeckWidgetModelState[deckWidgetId] = + previousSubModelState[deckWidgetId]; + delete previousSubModelState[deckWidgetId]; + continue; + } + + const deckWidget = await initializeWidget( + deckWidgetModel, + updateStateCallback, + ); + newDeckWidgetModelState[deckWidgetId] = deckWidget; + } + + // finalize models that were deleted + for (const previousDeckWidgetModel of Object.values(previousSubModelState)) { + previousDeckWidgetModel.finalize(); + } + + return newDeckWidgetModelState; +} + function App() { const actorRef = MachineContext.useActorRef(); const isDrawingBBoxSelection = MachineContext.useSelector( @@ -96,6 +148,7 @@ function App() { const [mapStyle] = useModelState("basemap_style"); const [mapHeight] = useModelState("_height"); + const [mapWidth] = useModelState("width"); const [showTooltip] = useModelState("show_tooltip"); const [pickingRadius] = useModelState("picking_radius"); const [useDevicePixels] = useModelState( @@ -103,6 +156,7 @@ function App() { ); const [parameters] = useModelState("parameters"); const [customAttribution] = useModelState("custom_attribution"); + const [controller] = useModelState("controller"); // initialViewState is the value of view_state on the Python side. This is // called `initial` here because it gets passed in to deck's @@ -134,6 +188,11 @@ function App() { >({}); const [childLayerIds] = useModelState("layers"); + const [deckWidgetState, setDeckWidgetState] = useState< + Record + >({}); + + const [deckWidgetIds] = useModelState("deck_widgets"); // Fake state just to get react to re-render when a model callback is called // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -155,6 +214,18 @@ function App() { ); setSubModelState(newSubModelState); + const deckWidgetModels = await loadChildModels( + model.widget_manager, + deckWidgetIds, + ); + const newDeckWidgetState = await getDeckWidgetModelState( + deckWidgetModels, + deckWidgetIds, + deckWidgetState, + setStateCounter, + ); + setDeckWidgetState(newDeckWidgetState); + if (!isDrawingBBoxSelection) { childModels.forEach((layer) => { layer.set("selected_bounds", bboxSelectBounds); @@ -174,6 +245,11 @@ function App() { layers.push(subModel.render()); } + const deckWidgets: Widget[] = []; + for (const deckWidget of Object.values(deckWidgetState)) { + deckWidgets.push(deckWidget.render()); + } + // This hook checks if the map container parent has a height set, which is // needed to make the map fill the parent container. useEffect(() => { @@ -228,7 +304,10 @@ function App() { ); return ( -
+
(isDrawingBBoxSelection ? "crosshair" : "grab")} + views={MAP_VIEW} + widgets={deckWidgets} + width={mapWidth || "100%"} + height={mapHeight || "100%"} pickingRadius={pickingRadius} onClick={onMapClickHandler} onHover={onMapHoverHandler} diff --git a/src/model/deck-widget-models.ts b/src/model/deck-widget-models.ts new file mode 100644 index 00000000..6269e404 --- /dev/null +++ b/src/model/deck-widget-models.ts @@ -0,0 +1,327 @@ +import type { WidgetModel } from "@jupyter-widgets/base"; +import { BaseModel } from "./base.js"; +import { Widget, WidgetPlacement } from "@deck.gl/core"; +import { CompassWidget, ZoomWidget, FullscreenWidget, LightTheme } from "@deck.gl/widgets"; +import { LegendWidget, NorthArrowWidget, TitleWidget, ScaleWidget, SaveImageWidget } from "./deck-widget.js"; + +export abstract class BaseDeckWidgetModel extends BaseModel { + + // protected props: Object = {}; + // protected viewId: string | null = null; + protected placement: WidgetPlacement = "top-left"; + protected className: string | undefined = undefined; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + // this.initRegularAttribute("props", "props"); + // this.initRegularAttribute("view_id", "viewId"); + this.initRegularAttribute("placement", "placement"); + this.initRegularAttribute("class_name", "className"); + } + + abstract render(): Widget; +} + +export class FullscreenWidgetModel extends BaseDeckWidgetModel { + static widgetType = "fullscreen"; + + protected enterLabel: string = "Enter Fullscreen"; + protected exitLabel: string = "Exit Fullscreen"; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("enter_label", "enterLabel"); + this.initRegularAttribute("exit_label", "exitLabel"); + this.initRegularAttribute("style", "style"); + this.initRegularAttribute("class_name", "className"); + } + + render(): FullscreenWidget { + return new FullscreenWidget({ + id: "fullscreen-widget", + placement: this.placement, + enterLabel: this.enterLabel, + exitLabel: this.exitLabel, + style: { + ...LightTheme as Partial, + ...this.style, + }, + className: this.className, + }) + } +} + +export class ZoomWidgetModel extends BaseDeckWidgetModel { + static widgetType = "zoom"; + + protected zoomInLabel: string = "Zoom In"; + protected zoomOutLabel: string = "Zoom Out"; + protected transitionDuration: number = 200; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("zoom_in_label", "zoomInLabel"); + this.initRegularAttribute("zoom_out_label", "zoomOutLabel"); + this.initRegularAttribute("transition_duration", "transitionDuration"); + this.initRegularAttribute("style", "style"); + this.initRegularAttribute("class_name", "className"); + } + + render(): ZoomWidget { + return new ZoomWidget({ + id: "zoom-widget", + placement: this.placement, + zoomInLabel: this.zoomInLabel, + zoomOutLabel: this.zoomOutLabel, + transitionDuration: this.transitionDuration, + style: { + ...LightTheme as Partial, + ...this.style, + }, + className: this.className, + }) + } +} + +export class CompassWidgetModel extends BaseDeckWidgetModel { + static widgetType = "compass"; + + protected label: string = "Compass"; + protected transitionDuration: number = 200; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("label", "label"); + this.initRegularAttribute("transition_duration", "transitionDuration"); + this.initRegularAttribute("style", "style"); + this.initRegularAttribute("class_name", "className"); + } + + render(): CompassWidget { + return new CompassWidget({ + id: "compass-widget", + placement: this.placement, + label: this.label, + transitionDuration: this.transitionDuration, + style: { + ...LightTheme as Partial, + ...this.style, + }, + className: this.className, + }) + } +} + +export class NorthArrowWidgetModel extends BaseDeckWidgetModel { + static widgetType = "north-arrow"; + + protected label: string = "North Arrow"; + protected transitionDuration: number = 200; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("label", "label"); + this.initRegularAttribute("transition_duration", "transitionDuration"); + this.initRegularAttribute("style", "style"); + this.initRegularAttribute("class_name", "className"); + } + + render(): NorthArrowWidget { + return new NorthArrowWidget({ + id: "north-arrow-widget", + placement: this.placement, + label: this.label, + transitionDuration: this.transitionDuration, + style: { + ...LightTheme as Partial, + ...this.style, + }, + className: this.className, + }) + } +} + +export class TitleWidgetModel extends BaseDeckWidgetModel{ + static widgetType = "title"; + + protected title: string = ""; + protected placement: WidgetPlacement = "top-right"; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("title", "title"); + this.initRegularAttribute("placement", "placement"); + this.initRegularAttribute("style", "style"); + } + + render() { + return new TitleWidget({ + id: "title", + title: this.title, + placement: this.placement, + style: { + ...LightTheme, + ...this.style, + }, + className: this.className, + }) + } +} + +export class LegendWidgetModel extends BaseDeckWidgetModel{ + static widgetType = "legend"; + + protected title: string = "Legend"; + protected labels: string[] = []; + protected colors: string[] = []; + protected placement: WidgetPlacement = "bottom-right"; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("title", "title"); + this.initRegularAttribute("placement", "placement"); + this.initRegularAttribute("style", "style"); + + this.initRegularAttribute("labels", "labels"); + this.initRegularAttribute("colors", "colors"); + } + + render() { + const legend = new Map() + for (const i in this.labels) { + legend.set(this.labels[i], this.colors[i]); + } + + return new LegendWidget({ + id: "legend", + title: this.title, + legend: legend, + placement: this.placement, + style: { + // ...LightTheme, + ...this.style, + }, + className: this.className, + }) + } +} + +export class ScaleWidgetModel extends BaseDeckWidgetModel{ + static widgetType = "scale"; + + protected placement: WidgetPlacement = "bottom-left"; + protected style: Partial = {}; + protected maxWidth: number = 300; + protected useImperial: boolean = false; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("placement", "placement"); + this.initRegularAttribute("style", "style"); + this.initRegularAttribute("max_width", "maxWidth"); + this.initRegularAttribute("use_imperial", "useImperial"); + } + + render() { + return new ScaleWidget({ + id: "scale", + placement: this.placement, + style: { + // ...LightTheme, + ...this.style, + }, + maxWidth: this.maxWidth, + useImperial: this.useImperial, + className: this.className, + }) + } +} + +export class SaveImageWidgetModel extends BaseDeckWidgetModel{ + static widgetType = "save-image"; + + protected label: string = ""; + protected placement: WidgetPlacement = "top-right"; + protected style: Partial = {}; + + constructor(model: WidgetModel, updateStateCallback: () => void) { + super(model, updateStateCallback); + + this.initRegularAttribute("label", "label"); + this.initRegularAttribute("placement", "placement"); + this.initRegularAttribute("style", "style"); + } + + render() { + return new SaveImageWidget({ + id: "save-image", + label: this.label, + placement: this.placement, + style: { + ...LightTheme, + ...this.style, + }, + className: this.className, + }) + } +} + + +export async function initializeWidget( + model: WidgetModel, + updateStateCallback: () => void, +): Promise { + const deckWidgetType = model.get("_widget_type"); + let deckWidgetModel: BaseDeckWidgetModel; + switch (deckWidgetType) { + case FullscreenWidgetModel.widgetType: + deckWidgetModel = new FullscreenWidgetModel(model, updateStateCallback); + break; + + case ZoomWidgetModel.widgetType: + deckWidgetModel = new ZoomWidgetModel(model, updateStateCallback); + break; + + case CompassWidgetModel.widgetType: + deckWidgetModel = new CompassWidgetModel(model, updateStateCallback); + break; + + case TitleWidgetModel.widgetType: + deckWidgetModel = new TitleWidgetModel(model, updateStateCallback); + break; + + case NorthArrowWidgetModel.widgetType: + deckWidgetModel = new NorthArrowWidgetModel(model, updateStateCallback); + break; + + case LegendWidgetModel.widgetType: + deckWidgetModel = new LegendWidgetModel(model, updateStateCallback); + break; + + case ScaleWidgetModel.widgetType: + deckWidgetModel = new ScaleWidgetModel(model, updateStateCallback); + break; + + case SaveImageWidgetModel.widgetType: + deckWidgetModel = new SaveImageWidgetModel(model, updateStateCallback); + break; + + default: + throw new Error(`no widget supported for ${deckWidgetType}`); + } + return deckWidgetModel; +} diff --git a/src/model/deck-widget.tsx b/src/model/deck-widget.tsx new file mode 100644 index 00000000..7858038e --- /dev/null +++ b/src/model/deck-widget.tsx @@ -0,0 +1,472 @@ +import { + Deck, + Viewport, + WebMercatorViewport, + Widget, + WidgetPlacement, +} from "@deck.gl/core"; +import { CompassWidget } from "@deck.gl/widgets"; +import React from "react"; +import { Root, createRoot } from "react-dom/client"; +import { toPng } from "html-to-image"; + +interface TitleWidgetProps { + id: string; + title: string; + + placement?: WidgetPlacement; + style?: Partial; + className?: string; +} + +export class TitleWidget implements Widget { + id = "title"; + props: TitleWidgetProps; + placement: WidgetPlacement = "top-right"; + deck?: Deck; + element?: HTMLDivElement; + className: string = "deck-widget-title"; + + constructor(props: TitleWidgetProps) { + this.id = props.id || "title"; + this.placement = props.placement || "top-right"; + props.style = props.style || {}; + this.className = props.className || "deck-widget-title"; + this.props = props; + } + + setProps(props: Partial) { + Object.assign(this.props, props); + } + + onAdd({ deck }: { deck: Deck }): HTMLDivElement { + const element = document.createElement("div"); + + element.classList.add("deck-widget"); + if (this.className) element.classList.add(this.className); + + const titleElement = document.createElement("div"); + titleElement.innerText = this.props.title; + + const { style } = this.props; + if (style) { + Object.entries(style).map(([key, value]) => { + element.style.setProperty(key, value as string); + }); + } + element.appendChild(titleElement); + + this.deck = deck; + this.element = element; + return element; + } + + onRemove() { + this.deck = undefined; + this.element = undefined; + } +} + +interface LegendWidgetProps { + id: string; + title: string; + legend: Map; + placement?: WidgetPlacement; + style?: Partial; + className?: string; +} + +export class LegendWidget implements Widget { + id = "legend"; + props: LegendWidgetProps; + placement: WidgetPlacement = "bottom-right"; + + deck?: Deck; + element?: HTMLDivElement; + className: string = "deck-widget-legend"; + + constructor(props: LegendWidgetProps) { + this.id = props.id || "legend"; + this.placement = props.placement || "bottom-right"; + props.title = props.title || "Legend"; + props.style = props.style || {}; + this.className = props.className || "deck-widget-legend"; + this.props = props; + } + + setProps(props: Partial) { + Object.assign(this.props, props); + } + + onAdd({ deck }: { deck: Deck }): HTMLDivElement { + const element = document.createElement("div"); + + element.classList.add("deck-widget"); + if (this.className) element.classList.add(this.className); + + const titleElement = document.createElement("div"); + titleElement.innerText = this.props.title; + titleElement.classList.add("legend-title"); + + const legendElement = document.createElement("div"); + legendElement.classList.add("legend-scale"); + + const ul = document.createElement("ul"); + ul.classList.add("legend-labels"); + + this.props.legend.forEach((color, label) => { + const li = document.createElement("li"); + const span = document.createElement("span"); + + span.style.setProperty("background", color); + li.innerText = label; + + li.appendChild(span); + ul.appendChild(li); + }); + + legendElement.appendChild(ul); + + const { style } = this.props; + if (style) { + Object.entries(style).map(([key, value]) => { + element.style.setProperty(key, value as string); + }); + } + element.appendChild(titleElement); + element.appendChild(legendElement); + + this.deck = deck; + this.element = element; + return element; + } + + onRemove() { + this.deck = undefined; + this.element = undefined; + } +} + +export class NorthArrowWidget extends CompassWidget { + root?: Root; + + onAdd({ deck }: { deck: Deck }): HTMLDivElement { + const { style, className } = this.props; + const element = document.createElement("div"); + element.classList.add("deck-widget", "deck-widget-north-arrow"); + if (className) element.classList.add(className); + if (style) { + Object.entries(style).map(([key, value]) => + element.style.setProperty(key, value as string), + ); + } + this.deck = deck; + this.element = element; + + this.root = createRoot(element); + + this.update(); + return element; + } + + update() { + const [rz, rx] = this.getRotation(); + const element = this.element; + if (!element) { + return; + } + const ui = ( +
+ + + +
+ ); + + if (this.root) this.root.render(ui); + } +} + +interface ScaleWidgetProps { + id: string; + maxWidth: number; + useImperial: boolean; + viewId?: string | null; + placement?: WidgetPlacement; + style?: Partial; + className?: string; +} +export class ScaleWidget implements Widget { + root?: Root; + + id = "scale"; + props: ScaleWidgetProps; + + viewId?: string | null = null; + viewport?: Viewport; + placement: WidgetPlacement = "bottom-left"; + deck?: Deck; + element?: HTMLDivElement; + className: string = "deck-widget-scale"; + + constructor(props: ScaleWidgetProps) { + this.id = props.id || "scale"; + this.placement = props.placement || "bottom-left"; + this.viewId = props.viewId || null; + props.maxWidth = props.maxWidth || 300; + props.useImperial = props.useImperial || false; + props.style = props.style || {}; + this.className = props.className || "deck-widget-scale"; + this.props = props; + } + + setProps(props: Partial) { + Object.assign(this.props, props); + } + + onViewportChange(viewport: Viewport) { + this.viewport = viewport; + this.update(); + } + + onAdd({ deck }: { deck: Deck }): HTMLDivElement { + const { style, className } = this.props; + const element = document.createElement("div"); + element.classList.add("deck-widget", "deck-widget-scale"); + if (className) element.classList.add(className); + if (style) { + Object.entries(style).map(([key, value]) => + element.style.setProperty(key, value as string), + ); + } + this.deck = deck; + this.element = element; + + this.root = createRoot(element); + + this.update(); + return element; + } + + update() { + if (this.viewport instanceof WebMercatorViewport) { + const meters = this.viewport.metersPerPixel * this.props.maxWidth; + let distance, label; + + if (this.props.useImperial) { + const feet = meters * 3.2808399; + if (feet > 5280) { + distance = feet / 5280; + label = "mi"; + } else { + distance = feet; + label = "ft"; + } + } else { + distance = meters < 1000 ? meters : meters / 1000; + label = meters < 1000 ? `m` : `km`; + } + + const ratio = this.roundNumber(distance) / distance; + distance = this.roundNumber(distance); + const width = `${Math.round(this.props.maxWidth * ratio * (4 / 3))}px`; + + const element = this.element; + if (!element) { + return; + } + const ui = ( +
+ + + + + + 0 + + + {distance / 2} + + + {distance} + + + {label} + + +
+ ); + + if (this.root) this.root.render(ui); + } + } + + roundNumber(number: number) { + const pow10 = Math.pow(10, `${Math.floor(number)}`.length - 1); + let d = number / pow10; + + d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1; + + return pow10 * d; + } + + onRemove() { + this.deck = undefined; + this.element = undefined; + } +} + +interface SaveImageWidgetProps { + id: string; + label?: string; + + placement?: WidgetPlacement; + style?: Partial; + className?: string; +} + +export class SaveImageWidget implements Widget { + root?: Root; + + id = "save-image"; + props: SaveImageWidgetProps; + placement: WidgetPlacement = "top-right"; + viewId?: string | null = null; + viewport?: Viewport; + deck?: Deck; + element?: HTMLDivElement; + + constructor(props: SaveImageWidgetProps) { + this.id = props.id || "save-image"; + this.placement = props.placement || "top-right"; + props.label = props.label || "Save as Image"; + props.style = props.style || {}; + this.props = props; + } + + onAdd({ deck }: { deck: Deck }): HTMLDivElement { + const { style, className } = this.props; + const element = document.createElement("div"); + element.classList.add("deck-widget", "deck-widget-save-image"); + if (className) element.classList.add(className); + if (style) { + Object.entries(style).map(([key, value]) => + element.style.setProperty(key, value as string), + ); + } + this.root = createRoot(element); + + const ui = ( +
+ +
+ ); + + if (this.root) this.root.render(ui); + + this.deck = deck; + this.element = element; + + return element; + } + + async handleClick() { + if (this.deck) { + this.deck.redraw("true"); + const deck_wrapper = this.deck?.getCanvas()?.parentElement; + + if (deck_wrapper) { + toPng(deck_wrapper) + .then(function (dataUrl) { + var img = new Image(); + img.src = dataUrl; + + const a = document.createElement("a"); + a.href = dataUrl; + a.download = "map.png"; + a.click(); + }) + .catch(function (error) { + console.error("Failed to export PNG", error); + }); + } + } + } + + onRemove() { + this.deck = undefined; + this.element = undefined; + } + + setProps(props: Partial) { + Object.assign(this.props, props); + } +} diff --git a/src/widget-style.css b/src/widget-style.css new file mode 100644 index 00000000..0c8e433f --- /dev/null +++ b/src/widget-style.css @@ -0,0 +1,67 @@ +.deck-widget.deck-widget-title { + font-size: 26px; + font-style: normal; + font-family: Helvetica; + color: rgb(0,0,0); + background-color: rgb(255, 255, 255); + outline-width: 0px; + outline-style: solid; + outline-color: rgb(0,0,0); + border-radius: 5px; + border-width: 1px; + border-style: solid; + border-color: rgb(0,0,0); + padding: 3px; + text-align: center; +} + +.deck-widget.deck-widget-legend { + background-color: rgb(255, 255, 255); + border-color: rgb(0,0,0); + border-style: solid; + border-radius: 5px; + border-width: 1px; + padding: 10px; + font-size:14px; +} + +.legend-title { + text-align: left; + margin-bottom: 5px; + font-weight: bold; + /* font-size: 90%; */ + font-family: "Helvetica"; + color: rgba(0, 0, 0, 1); + } + +.legend-scale ul{ + list-style: none; + margin: 0; + margin-bottom: 5px; + padding: 0; + color: rgba(0, 0, 0, 1); +} + +.deck-widget.deck-widget-legend.legend-scale ul { + margin: 0; + margin-bottom: 5px; + padding: 0; + float: left; + list-style: none; + } +.deck-widget.deck-widget-legend.legend-scale ul li { + font-size: 80%; + list-style: none; + margin-left: 0; + line-height: 18px; + margin-bottom: 2px; + } +.deck-widget.deck-widget-legend ul.legend-labels li span { + display: block; + float: left; + height: 16px; + width: 30px; + margin-right: 5px; + margin-left: 0; + border: 1px solid #999; + } \ No newline at end of file